Make __has_extension(assume_nonnull) always true.

llvm-svn: 240969
This commit is contained in:
Douglas Gregor 2015-06-29 17:25:49 +00:00
parent 51e3d7b2e0
commit cdfea9a7a7
2 changed files with 5 additions and 0 deletions

View 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)

View 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}}