]> granicus.if.org Git - clang/commitdiff
Modify __has_attribute so that it only looks for GNU-style attributes. Removes the...
authorAaron Ballman <aaron@aaronballman.com>
Fri, 5 Dec 2014 15:24:55 +0000 (15:24 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 5 Dec 2014 15:24:55 +0000 (15:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223468 91177308-0d34-0410-b5e6-96231b3b80d8

docs/ReleaseNotes.rst
include/clang/Basic/Attributes.h
lib/Lex/PPMacroExpansion.cpp
test/Preprocessor/has_attribute.c
utils/TableGen/ClangAttrEmitter.cpp

index daab804b53ff831e2ae960461d5e1ee9c19516df..8c47d693ed3772772593f319376339b0d083d48a 100644 (file)
@@ -47,7 +47,11 @@ sections with improvements to Clang's support for those languages.
 Major New Features
 ------------------
 
-- A big one.
+- The __has_attribute built-in macro no longer queries for attributes across
+  multiple attribute syntaxes (GNU, C++11, __declspec, etc). Instead, it only
+  queries GNU-style attributes. With the addition of __has_cpp_attribute and
+  __has_declspec_attribute, this allows for more precise coverage of attribute
+  syntax querying.
 
 
 Improvements to Clang's diagnostics
index 982e12d9f24f2cf0aa9b27c9cc117441a2ed030d..10786006f85476cd998c4cef9d3e155a27bf68d7 100644 (file)
@@ -18,8 +18,6 @@ namespace clang {
 class IdentifierInfo;
 
 enum class AttrSyntax {
-  /// Is the attribute identifier generally known for any syntax?
-  Generic,
   /// Is the identifier known as a GNU-style attribute?
   GNU,
   /// Is the identifier known as a __declspec-style attribute?
index 26cf5439e7a8231796b917a291f8c427d132ea5b..b402a939c57d8faefe38afcdb589e434bd2adf08 100644 (file)
@@ -1425,7 +1425,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
       // Check for a builtin is trivial.
       Value = FeatureII->getBuiltinID() != 0;
     } else if (II == Ident__has_attribute)
-      Value = hasAttribute(AttrSyntax::Generic, nullptr, FeatureII,
+      Value = hasAttribute(AttrSyntax::GNU, nullptr, FeatureII,
                            getTargetInfo().getTriple(), getLangOpts());
     else if (II == Ident__has_cpp_attribute)
       Value = hasAttribute(AttrSyntax::CXX, ScopeII, FeatureII,
index 5fe060e68d3cd1fcf7c4defc98683429910d1483..0ef5b4857a388fd0f051e3a330ef79223b7c529c 100644 (file)
@@ -48,3 +48,8 @@ int has_no_volatile_attribute();
 #if !__has_attribute(dllexport)
   int does_not_have_dllexport();
 #endif
+
+// CHECK: does_not_have_uuid
+#if !__has_attribute(uuid)
+  int does_not_have_uuid
+#endif
index 7847b4f931a911e315dcb150f805ba23b4d59612..67f9452ba607a36dfea01e4de9649705e267c8ce 100644 (file)
@@ -1920,9 +1920,6 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
   }
 
   OS << "switch (Syntax) {\n";
-  OS << "case AttrSyntax::Generic:\n";
-  OS << "  return llvm::StringSwitch<int>(Name)\n";
-  GenerateHasAttrSpellingStringSwitch(Attrs, OS);
   OS << "case AttrSyntax::GNU:\n";
   OS << "  return llvm::StringSwitch<int>(Name)\n";
   GenerateHasAttrSpellingStringSwitch(GNU, OS, "GNU");