@@ -33,7 +33,8 @@ static int hasAttributeImpl(AttributeCommonInfo::Syntax Syntax, StringRef Name,
3333
3434int clang::hasAttribute (AttributeCommonInfo::Syntax Syntax,
3535 const IdentifierInfo *Scope, const IdentifierInfo *Attr,
36- const TargetInfo &Target, const LangOptions &LangOpts) {
36+ const TargetInfo &Target, const LangOptions &LangOpts,
37+ bool CheckPlugins) {
3738 StringRef Name = Attr->getName ();
3839 // Normalize the attribute name, __foo__ becomes foo.
3940 if (Name.size () >= 4 && Name.starts_with (" __" ) && Name.ends_with (" __" ))
@@ -61,14 +62,23 @@ int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
6162 if (res)
6263 return res;
6364
64- // Check if any plugin provides this attribute.
65- for (auto &Ptr : getAttributePluginInstances ())
66- if (Ptr->hasSpelling (Syntax, Name))
67- return 1 ;
65+ if (CheckPlugins) {
66+ // Check if any plugin provides this attribute.
67+ for (auto &Ptr : getAttributePluginInstances ())
68+ if (Ptr->hasSpelling (Syntax, Name))
69+ return 1 ;
70+ }
6871
6972 return 0 ;
7073}
7174
75+ int clang::hasAttribute (AttributeCommonInfo::Syntax Syntax,
76+ const IdentifierInfo *Scope, const IdentifierInfo *Attr,
77+ const TargetInfo &Target, const LangOptions &LangOpts) {
78+ return hasAttribute (Syntax, Scope, Attr, Target, LangOpts,
79+ /* CheckPlugins*/ true );
80+ }
81+
7282const char *attr::getSubjectMatchRuleSpelling (attr::SubjectMatchRule Rule) {
7383 switch (Rule) {
7484#define ATTR_MATCH_RULE (NAME, SPELLING, IsAbstract ) \
@@ -162,15 +172,6 @@ AttributeCommonInfo::getCXX11AttrArgsInfo(const IdentifierInfo *Name) {
162172#undef CXX11_ATTR_ARGS_INFO
163173}
164174
165- bool AttributeCommonInfo::hasCXX11Attr (const IdentifierInfo *Name,
166- const TargetInfo &Target,
167- const LangOptions &LangOpts) {
168- StringRef AttrName =
169- normalizeAttrName (Name, /* NormalizedScopeName*/ " " , Syntax::AS_CXX11);
170- return hasAttributeImpl (Syntax::AS_CXX11, AttrName, /* ScopeName*/ " " , Target,
171- LangOpts) > 0 ;
172- }
173-
174175std::string AttributeCommonInfo::getNormalizedFullName () const {
175176 return static_cast <std::string>(
176177 normalizeName (getAttrName (), getScopeName (), getSyntax ()));
0 commit comments