================
@@ -751,38 +753,56 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
if (LA.Decls.size() > 0) {
Decl *D = LA.Decls[0];
- NamedDecl *ND = dyn_cast<NamedDecl>(D);
- RecordDecl *RD = dyn_cast_or_null<RecordDecl>(D->getDeclContext());
- // Allow 'this' within late-parsed attributes.
- Sema::CXXThisScopeRAII ThisScope(Actions, RD, Qualifiers(),
- ND && ND->isCXXInstanceMember());
+ if (getLangOpts().CPlusPlus) {
+ NamedDecl *ND = dyn_cast<NamedDecl>(D);
+ RecordDecl *RD = dyn_cast_or_null<RecordDecl>(D->getDeclContext());
- if (LA.Decls.size() == 1) {
- // If the Decl is templatized, add template parameters to scope.
- ReenterTemplateScopeRAII InDeclScope(*this, D, EnterScope);
+ // Allow 'this' within late-parsed attributes.
+ Sema::CXXThisScopeRAII ThisScope(Actions, RD, Qualifiers(),
+ ND && ND->isCXXInstanceMember());
- // If the Decl is on a function, add function parameters to the scope.
+ if (LA.Decls.size() == 1) {
+ // If the Decl is templatized, add template parameters to scope.
+ ReenterTemplateScopeRAII InDeclScope(*this, D, EnterScope);
+
+ // If the Decl is on a function, add function parameters to the scope.
+ bool HasFunScope = EnterScope && D->isFunctionOrFunctionTemplate();
----------------
erichkeane wrote:
```suggestion
bool HasFuncScope = EnterScope && D->isFunctionOrFunctionTemplate();
```
https://github.com/llvm/llvm-project/pull/186033
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits