diff options
author | DeLesley Hutchins <delesley@google.com> | 2012-11-02 21:44:32 +0000 |
---|---|---|
committer | DeLesley Hutchins <delesley@google.com> | 2012-11-02 21:44:32 +0000 |
commit | 161db02a747e0c8e717f542674c0581c03fc3c93 (patch) | |
tree | 7d65902754e88cf5e46f459027d301000705fc08 /lib/Parse/ParseDecl.cpp | |
parent | eacff03a37eaa984a2f72ae68281910fffea99b9 (diff) |
Thread safety analysis: Fixed ICE caused by double delete when late parsed
attributes are attached to function declarations nested inside a class method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 7b4fbfc287..d45f038f31 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -143,7 +143,7 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs, // Attributes in a class are parsed at the end of the class, along // with other late-parsed declarations. - if (!ClassStack.empty()) + if (!ClassStack.empty() && !LateAttrs->parseSoon()) getCurrentClass().LateParsedDeclarations.push_back(LA); // consume everything up to and including the matching right parens @@ -871,6 +871,8 @@ void Parser::ParseLexedAttributes(ParsingClass &Class) { /// \brief Parse all attributes in LAs, and attach them to Decl D. void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D, bool EnterScope, bool OnDefinition) { + assert(LAs.parseSoon() && + "Attribute list should be marked for immediate parsing."); for (unsigned i = 0, ni = LAs.size(); i < ni; ++i) { if (D) LAs[i]->addDecl(D); @@ -1413,7 +1415,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // Save late-parsed attributes for now; they need to be parsed in the // appropriate function scope after the function Decl has been constructed. - LateParsedAttrList LateParsedAttrs; + // These will be parsed in ParseFunctionDefinition or ParseLexedAttrList. + LateParsedAttrList LateParsedAttrs(true); if (D.isFunctionDeclarator()) MaybeParseGNUAttributes(D, &LateParsedAttrs); |