Author: dgregor Date: Mon Jun 29 13:11:42 2015 New Revision: 240976 URL: http://llvm.org/viewvc/llvm-project?rev=240976&view=rev Log: Make __has_feature(nullability) and __has_extension(nullability) always true.
These are _Underbar_capital-prefixed additions to the language that shouldn't depend on language standard. Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp cfe/trunk/test/SemaCXX/nullability.cpp Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=240976&r1=240975&r2=240976&view=diff ============================================================================== --- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original) +++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Mon Jun 29 13:11:42 2015 @@ -1052,7 +1052,7 @@ static bool HasFeature(const Preprocesso .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 Preprocesso .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 Preproces // 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) Modified: cfe/trunk/test/SemaCXX/nullability.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nullability.cpp?rev=240976&r1=240975&r2=240976&view=diff ============================================================================== --- cfe/trunk/test/SemaCXX/nullability.cpp (original) +++ cfe/trunk/test/SemaCXX/nullability.cpp Mon Jun 29 13:11:42 2015 @@ -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 { _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits