]> granicus.if.org Git - clang/commitdiff
Make __has_extension(assume_nonnull) always true.
authorDouglas Gregor <dgregor@apple.com>
Mon, 29 Jun 2015 17:25:49 +0000 (17:25 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 29 Jun 2015 17:25:49 +0000 (17:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240969 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/SemaObjCXX/nullability-pragmas.mm

index ea0af924736276035181ca38940eb9cbf6cf613e..3855c802aeb6f427d6d34978d1369f313ab8f19d 100644 (file)
@@ -1226,6 +1226,7 @@ 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)
index 2047fd9e0e719266cb4e79348ffa57918620a14a..dbf4f37f4019ccc25cd6169573a435ea564e6474 100644 (file)
@@ -7,6 +7,10 @@
 #  error assume_nonnull feature is not set
 #endif
 
+#if !__has_extension(assume_nonnull)
+#  error assume_nonnull extension is not set
+#endif
+
 void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) {
   f1(0); // okay: no nullability annotations
   f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}}