diff options
author | DeLesley Hutchins <delesley@google.com> | 2012-02-16 16:50:43 +0000 |
---|---|---|
committer | DeLesley Hutchins <delesley@google.com> | 2012-02-16 16:50:43 +0000 |
commit | c24a2335677f3d1bd2cab1019ac445d650f52123 (patch) | |
tree | c7942b6cb2a46762429a0936e91be4bb8f207ded /lib/Parse/ParseTemplate.cpp | |
parent | 32addd519c6699000ff79c387a1c87f0ab7c3698 (diff) |
Allow thread safety attributes on function definitions.
For compatibility with gcc, clang will now parse gcc attributes on
function definitions, but issue a warning if the attribute is not a
thread safety attribute. Warning controlled by -Wgcc-compat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150698 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 1222fb08f5..a30ef96d63 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -241,6 +241,10 @@ Parser::ParseSingleDeclarationAfterTemplate( return 0; } + LateParsedAttrList LateParsedAttrs; + if (DeclaratorInfo.isFunctionDeclarator()) + MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs); + // If we have a declaration or declarator list, handle it. if (isDeclarationAfterDeclarator()) { // Parse this declaration. @@ -256,6 +260,8 @@ Parser::ParseSingleDeclarationAfterTemplate( // Eat the semi colon after the declaration. ExpectAndConsume(tok::semi, diag::err_expected_semi_declaration); + if (LateParsedAttrs.size() > 0) + ParseLexedAttributeList(LateParsedAttrs, ThisDecl, true, false); DeclaratorInfo.complete(ThisDecl); return ThisDecl; } @@ -270,7 +276,8 @@ Parser::ParseSingleDeclarationAfterTemplate( << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc()); DS.ClearStorageClassSpecs(); } - return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo); + return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo, + &LateParsedAttrs); } if (DeclaratorInfo.isFunctionDeclarator()) |