]> granicus.if.org Git - clang/commitdiff
Make __has_feature(nullability) and __has_extension(nullability) always true.
authorDouglas Gregor <dgregor@apple.com>
Mon, 29 Jun 2015 18:11:42 +0000 (18:11 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 29 Jun 2015 18:11:42 +0000 (18:11 +0000)
These are _Underbar_capital-prefixed additions to the language that
shouldn't depend on language standard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240976 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/SemaCXX/nullability.cpp

index 3855c802aeb6f427d6d34978d1369f313ab8f19d..d52519e3313bf9b015db94082e1d2a0c4dd8e0aa 100644 (file)
@@ -1052,7 +1052,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
       .Case("address_sanitizer",
             LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
                                        SanitizerKind::KernelAddress))
-      .Case("assume_nonnull", LangOpts.ObjC1 || LangOpts.GNUMode)
+      .Case("assume_nonnull", true)
       .Case("attribute_analyzer_noreturn", true)
       .Case("attribute_availability", true)
       .Case("attribute_availability_with_message", true)
@@ -1077,7 +1077,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
       .Case("cxx_exceptions", LangOpts.CXXExceptions)
       .Case("cxx_rtti", LangOpts.RTTI)
       .Case("enumerator_attributes", true)
-      .Case("nullability", LangOpts.ObjC1 || LangOpts.GNUMode)
+      .Case("nullability", true)
       .Case("memory_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Memory))
       .Case("thread_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Thread))
       .Case("dataflow_sanitizer", LangOpts.Sanitize.has(SanitizerKind::DataFlow))
@@ -1226,8 +1226,6 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) {
   // Because we inherit the feature list from HasFeature, this string switch
   // must be less restrictive than HasFeature's.
   return llvm::StringSwitch<bool>(Extension)
-           .Case("assume_nonnull", true)
-           .Case("nullability", true)
            // C11 features supported by other languages as extensions.
            .Case("c_alignas", true)
            .Case("c_alignof", true)
index fa5d344a953e2d7fd5b5c372de20f84eebdb65bb..edce6b057bd3cf9b970e8fa200e93cd0e03f76e1 100644 (file)
@@ -1,5 +1,10 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-nullability-declspec %s -verify
 
+#if __has_feature(nullability)
+#else
+#  error nullability feature should be defined
+#endif
+
 typedef decltype(nullptr) nullptr_t;
 
 class X {