OSDN Git Service

Enable constexpr on Visual Studio 2015, add support for two equivalent attributes
authorReid Kleckner <rnk@google.com>
Wed, 10 Feb 2016 19:07:47 +0000 (19:07 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 10 Feb 2016 19:07:47 +0000 (19:07 +0000)
commit88dea5d1ef555ce84f7f90258b9b5b8801205b42
tree4f520deca374f8f85a31e30a96496f84cbfe5482
parent5b0e331ef6585b8bdbb3963f47a2b1b623862c91
Enable constexpr on Visual Studio 2015, add support for two equivalent attributes

Patch by Alexander Riccio

This patch enables `constexpr` on Visual Studio 2015 by adding `||
LLVM_MSC_PREREQ(1900)` to the preprocessor `#if` statement. Since VS2013
doesn't support `constexpr`, that's purposely excluded. The
`LLVM_CONSTEXPR` macro is used in ~25 places.

I also added the MSVC/SAL equivalent of:

  - `__attribute__((__warn_unused_result__))` as an
    `LLVM_ATTRIBUTE_UNUSED_RESULT` definition

  - `__attribute__((returns_nonnull))` as an
    `LLVM_ATTRIBUTE_RETURNS_NONNULL` definition

...in case anybody ever decides to run `/analyze` on LLVM (probably
myself, if anybody)

Reviewers: rnk, aaron.ballman

Differential Revision: http://reviews.llvm.org/D16751

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260410 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Compiler.h