summaryrefslogtreecommitdiff
path: root/include/llvm/Support/Compiler.h
Commit message (Collapse)AuthorAge
* Add a LLVM_DUMP_METHOD macro.Nico Weber2014-01-03
| | | | | | | | | | | | | | | | The motivation is to mark dump methods as used in debug builds so that they can be called from lldb, but to not do so in release builds so that they can be dead-stripped. There's lots of potential follow-up work suggested in the thread "Should dump methods be LLVM_ATTRIBUTE_USED only in debug builds?" on cfe-dev, but everyone seems to agreen on this subset. Macro name chosen by fair coin toss. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198456 91177308-0d34-0410-b5e6-96231b3b80d8
* MSVC 2010 build fixAlp Toker2014-01-03
| | | | | | | | | | | | Back out the part of r198399 that enabled LLVM_FINAL/LLVM_OVERRIDE on VS 2010. DwarfUnit.h legitimately uses them on destructors which unfortunately triggers Compiler Error C3665 (override specifier not allowed on a destructor/finalizer) prior to MSVC 2012: virtual ~DwarfCompileUnit() LLVM_OVERRIDE; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198401 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable LLVM_FINAL, LLVM_OVERRIDE and LLVM_HAS_VARIADIC_TEMPLATES with more ↵Alp Toker2014-01-03
| | | | | | | | | | | | | | gcc and MSVC versions The 'sealed' definition of LLVM_FINAL can be dropped once VS 2010 is decommissioned. Some of this is speculative so will keep an eye on the waterfall -- ping me if you see failures. Incremental work towards C++11 migration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198399 91177308-0d34-0410-b5e6-96231b3b80d8
* Support LLVM_STATIC_ASSERT() in clang pre-C++11 modeAlp Toker2014-01-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198292 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence g++ 4.9 build issueAlp Toker2013-12-31
| | | | | | | | | lib/Support/ThreadLocal.cpp:53:15: error: typedef 'SIZE_TOO_BIG' locally defined but not used [-Werror=unused-local-typedefs] typedef int SIZE_TOO_BIG[sizeof(pthread_key_t) <= sizeof(data) ? 1 : -1]; Done the C++11 way, switching on and using LLVM_STATIC_ASSERT() instead of LLVM_ATTRIBUTE_UNUSED. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198255 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LLVM_MSC_PREREQ() compatible with all MSVC versionsAlp Toker2013-12-29
| | | | | | | | | The defined() preprocessor expansion wasn't working out on the lld builder. Also update the documentation to cover another Visual Studio release versioning convention. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198158 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parens fail in r198142Alp Toker2013-12-29
| | | | | | Probable cause of the lld build failure on VS 2012. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198154 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable deleted functions and explicit conversions in MSVC 2013Alp Toker2013-12-29
| | | | | | | Also prospectively enable static_assert as the documentation suggests it's been available since MSVC 2010. Let's see if the build servers agree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198142 91177308-0d34-0410-b5e6-96231b3b80d8
* Define LLVM_MSC_PREREQ() macro to simplify _MSC_VER checksAlp Toker2013-12-29
| | | | | | | | | Includes documentation mapping MSC version numbers to the more familiar Visual Studio releases. Cleanup only to simplify upcoming C++11 / MSVC 2013 changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198141 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the MSVC 2010 buildAlp Toker2013-12-25
| | | | | | C++11-style forward declared enums weren't supported until MSVC 2012. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197992 91177308-0d34-0410-b5e6-96231b3b80d8
* Define LLVM_HAS_STRONG_ENUMSAlp Toker2013-12-22
| | | | | | | This is needed to guard an upcoming feature in clang until the C++11 transition is complete, at which point it can be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197895 91177308-0d34-0410-b5e6-96231b3b80d8
* Compiler.h: Disable initializer list usage with clang-clReid Kleckner2013-12-05
| | | | | | | | | Most people are using MSVC 2012, which lacks the <initializer_list> header. MSVC 2013 shipped with that header, but it has not yet been tested. If clang works with the 2013 header, then we can enable this by checking the value of _MSC_VER. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196448 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't universally enable initialiser lists on GCC. Thanks for catching this ↵Pete Cooper2013-11-11
| | | | | | Chandler git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194365 91177308-0d34-0410-b5e6-96231b3b80d8
* Add LLVM_HAS_INITIALIZER_LISTS for upcoming C++11 support. Use it in ArrayRefPete Cooper2013-11-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194362 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly request unsigned enum types when desiredReid Kleckner2013-09-23
| | | | | | | | | | | | | | | | | | | | | The underlying type of all plain enums in MSVC is 'int', even if the enumerator contains large 32-bit unsigned values or values greater than UINT_MAX. The only way to get a large or unsigned enum type is to request it explicitly with the C++11 strong enum types feature. However, since LLVM isn't C++11 yet, I had to add a conditional LLVM_ENUM_INT_TYPE to Compiler.h to control its usage. The motivating true positive for this change is compiling PointerIntPair with MSVC for win64. The PointerIntMask value is supposed to be pointer sized value of all ones with some low zeros. Instead, it's truncated to 32-bits! We are only saved later because it is sign extended back in the AND with int64_t, and we happen to want all ones. This silences lots of -Wmicrosoft warnings during a clang self-host targeting Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191241 91177308-0d34-0410-b5e6-96231b3b80d8
* Add definition of __warn_unused_result__ attribute. It will be used in theJakub Staszak2013-08-19
| | | | | | | futher commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188689 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "Use Clang's __has_* macros in Compiler.h ..." with fixesReid Kleckner2013-07-08
| | | | | | | | | | | | | | | This reverts r185841 and relands r185831 without using __has_attribute(const). Clang prior to r161767 (between 3.1 and 3.2) does not accept __has_attribute(const) due to rdar://10253857. __const and __const__ are both keyword aliases of const, so they don't work either. I was able to repro the buildbot failure using clang 3.1 and this patch fixes it. Various important versions of XCode use clang 2.9-ish, so this workaround is necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185850 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert: "Use Clang's __has_* macros in Compiler.h to test for features"Quentin Colombet2013-07-08
| | | | | | | This reverts r185831 and 185833. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185841 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to fix Compiler.h for some self-hosting botsReid Kleckner2013-07-08
| | | | | | | I tested r185831 by self-hosting clang with a recent clang, and got no warnings. I haven't been able to reproduce the problem locally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185833 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Clang's __has_* macros in Compiler.h to test for featuresReid Kleckner2013-07-08
| | | | | | | | | | | | | | | | | | When targetting Windows, clang does not define __GNUC__, and as a result we don't use our attributes with it. This leads to warnings about unused functions that are already annotated with LLVM_ATTRIBUTE_UNUSED. Rather than testing for __clang__, we can use its __has_attribute and __has_builtin macros directlty. While I'm here, conditionally define and use __GNUC_PREREQ for gcc version checks. Spelling the check out with three comparisons is verbose and error prone. Reviewers: aaron.ballman Differential Revision: http://llvm-reviews.chandlerc.com/D1080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185831 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert ↵Argyrios Kyrtzidis2013-03-22
| | | | | | on compilers which support it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177699 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Optional<T>'s operator bool 'explicit' in C++11David Blaikie2013-02-21
| | | | | | | Provides a general way to add 'explicit' for conversion operators (a no-op when compiling as C++98). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175723 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix MSan annotations inclusion guard.Evgeniy Stepanov2013-02-13
| | | | | | | #cmakedefine does not behave the way I though it was. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175050 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][Compiler] Add LLVM_HAS_VARIADIC_TEMPLATES.Michael J. Spencer2013-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174913 91177308-0d34-0410-b5e6-96231b3b80d8
* More MSan/ASan annotations.Evgeniy Stepanov2013-02-04
| | | | | | | | | | | | | | | This change lets us bootstrap LLVM/Clang under ASan and MSan. It contains fixes for 2 issues: - X86JIT reads return address from stack, which MSan does not know is initialized. - bugpoint tests run binaries with RLIMIT_AS. This does not work with certain Sanitizers. We are no longer including config.h in Compiler.h with this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174306 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Add LLVM_IS_UNALIGNED_ACCESS_FAST.Michael J. Spencer2013-02-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174271 91177308-0d34-0410-b5e6-96231b3b80d8
* Annotate BumpPtrAllocator for MemorySanitizer.Evgeniy Stepanov2013-01-31
| | | | | | | | This change adds MemorySanitizer annotations to BumpPtrAllocator to improve report quality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174051 91177308-0d34-0410-b5e6-96231b3b80d8
* Support/Compiler.h: MSC1600, aka VS2010, is not C++11-ready.NAKAMURA Takumi2013-01-21
| | | | | | | LLVM_HAS_CXX11_TYPETRAITS -- std::is_constructible LLVM_HAS_CXX11_STDLIB -- std::unique_ptr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172997 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Port ErrorOr<T> from lld to C++03.Michael J. Spencer2013-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172991 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Update MSVC compiler support in Compiler.h.Michael J. Spencer2013-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172644 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Add LLVM_CONSTEXPR.Michael J. Spencer2013-01-15
| | | | | | Marks a decl as constexpr if the compiler supports it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172508 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new portability macro LLVM_FUNCTION_NAME, that expands to __func__, ifDmitri Gribenko2013-01-11
| | | | | | | supported. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172156 91177308-0d34-0410-b5e6-96231b3b80d8
* Compiler.h: Leave LLVM_BUILTIN_UNREACHABLE undefined if it is unavailable in ↵NAKAMURA Takumi2013-01-03
| | | | | | | | | | host compiler. Users of LLVM_BUILTIN_UNREACHABLE should be responsible in the case when LLVM_BUILTIN_UNREACHABLE is undefined. Actually, (0, (p)) in LLVM_ASSUME_ALIGNED(p, a) caused thousands of warnings on g++-4.4. It was a motivation in this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171455 91177308-0d34-0410-b5e6-96231b3b80d8
* Restrict __builtin_assume_aligned to gcc 4.7+Michael J. Spencer2013-01-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171408 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][Endian] Add support for specifying the alignment and native ↵Michael J. Spencer2013-01-02
| | | | | | | | | | | unaligned types. * Add support for specifying the alignment to use. * Add the concept of native endianness. Used for unaligned native types. The native alignment and read/write simplification is based on a patch by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171406 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.Chandler Carruth2012-11-30
| | | | | | | | | | | | | | Rationale: 1) This was the name in the comment block. ;] 2) It matches Clang's __has_feature naming convention. 3) It matches other compiler-feature-test conventions. Sorry for the noise. =] I've also switch the comment block to use a \brief tag and not duplicate the name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168996 91177308-0d34-0410-b5e6-96231b3b80d8
* Separate out the tests for whether the compiler suports R-valueChandler Carruth2012-11-30
| | | | | | | | | | | references from whether it supports an R-value reference *this. No version of GCC today supports the latter, which breaks GCC C++11 compiles of LLVM and Clang now. Also add doxygen comments clarifying what's going on here, and update the usage in Optional. I'll update the usages in Clang next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168993 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new C++11 compatibility macro, LLVM_LVALUE_FUNCTION.Jordan Rose2012-11-30
| | | | | | | | | | | | | | | | This expands to '&', and is intended to be used when an /optional/ rvalue override is available. Before: void foo() const { ... } After: void foo() const LLVM_LVALUE_FUNCTION { ... } void foo() && { ... } This is used to allow moving the contents of an Optional. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168963 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an extra slash so doxygen comments will be properly recognized.Craig Topper2012-11-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168554 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo. No functional change.Craig Topper2012-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164100 91177308-0d34-0410-b5e6-96231b3b80d8
* Add LLVM_OVERRIDE and LLVM_FINAL C++11 compatibility macros.Craig Topper2012-09-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164005 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure macros in the include subdirectory are not used without being defined.Bob Wilson2012-09-04
| | | | | | | | | | | | | | | | Rationale: For each preprocessor macro, either the definedness is what's meaningful, or the value is what's meaningful, or both. If definedness is meaningful, we should use #ifdef. If the value is meaningful, we should use and #ifdef interchangeably for the same macro, seems ugly to me, even if undefined macros are zero if used. This also has the benefit that including an LLVM header doesn't prevent you from compiling with -Wundef -Werror. Patch by John Garvin! <rdar://problem/12189979> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163148 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly cast an expression to bool before handing it off to __builtin_expect.Benjamin Kramer2012-08-29
| | | | | | Avoids surprises when someone uses LLVM_(UN)LIKELY with an integer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162877 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the BUILTIN_EXPECT macro with a less horrible ↵Benjamin Kramer2012-08-29
| | | | | | LLVM_LIKELY/LLVM_UNLIKELY interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162873 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide a portability macro for __builtin_trap.David Blaikie2012-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162300 91177308-0d34-0410-b5e6-96231b3b80d8
* Add LLVM_DELETED_FUNCTION compatibility macro.Michael J. Spencer2012-08-15
| | | | | | | | | | | | This should replace uses of: class A { A(const &A); // DO NOT IMPLEMENT public: ... }; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161975 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix few warnings.Galina Kistanova2012-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160576 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix trivial typo in llvm_move.John McCall2012-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156288 91177308-0d34-0410-b5e6-96231b3b80d8
* Update SmallVector to support move semantics if the host does.John McCall2012-05-02
| | | | | | | | | | | | | Note that support for rvalue references does not imply support for the full set of move-related STL operations. I've preserved support for an odd little thing in insert() where we're trying to support inserting a new element from an existing one. If we actually want to support that, there's a lot more we need to do: insert can call either grow or push_back, neither of which is safe against this particular use pattern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155979 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Drop verbose _ATTRIBUTE from LLVM_ATTRIBUTE_{READONLY,READNONE} macroDaniel Dunbar2012-03-09
| | | | | | names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152413 91177308-0d34-0410-b5e6-96231b3b80d8