Index: lib/Parse/ParseDecl.cpp |
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp |
index 58593691148a47621c6ba913c189bea443daa2fe..f8408b8dc8b443335b4a86e8ca190ab1a6fd1aff 100644 |
--- a/lib/Parse/ParseDecl.cpp |
+++ b/lib/Parse/ParseDecl.cpp |
@@ -759,8 +759,18 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA) { |
ParsedAttributes Attrs(AttrFactory); |
SourceLocation endLoc; |
+ // For function attributes, enter the function scope |
+ bool IsFunScope = Actions.IsFunction(LA.D); |
+ ParseScope FnScope(this, Scope::FnScope | Scope::DeclScope, IsFunScope); |
+ if (IsFunScope) Actions.EnterFunctionContext(LA.D); |
+ |
ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc); |
+ if (IsFunScope) { |
+ Actions.ExitFunctionContext(); |
+ FnScope.Exit(); // Pop scope, and remove Decls from IdResolver |
+ } |
+ |
// Late parsed attributes must be attached to Decls by hand. If the |
// LA.D is not set, then this was not done properly. |
assert(LA.D && "No decl attached to late parsed attribute"); |