mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-20 23:30:54 +00:00
Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
llvm-svn: 223468
This commit is contained in:
parent
3c0f9b4a7d
commit
a6f759e423
@ -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
|
||||
|
@ -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?
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user