diff options
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 1 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/nullability-pragmas.mm | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index ea0af924736..3855c802aeb 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -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) diff --git a/clang/test/SemaObjCXX/nullability-pragmas.mm b/clang/test/SemaObjCXX/nullability-pragmas.mm index 2047fd9e0e7..dbf4f37f401 100644 --- a/clang/test/SemaObjCXX/nullability-pragmas.mm +++ b/clang/test/SemaObjCXX/nullability-pragmas.mm @@ -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}} |