diff options
author | Anders Carlsson <andersca@mac.com> | 2009-04-30 22:41:11 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-04-30 22:41:11 +0000 |
commit | 4649cac75c3cb80d543c6d90269388277228508d (patch) | |
tree | f648efff2dfb5d57851689ca0874a9813aa10843 /lib/Parse/ParseDecl.cpp | |
parent | e2f2c16047a0165cbfbdba84c74bd4fb814d7c3e (diff) |
Rework the way we handle constructor decls to be less hacky and fix PR3948 completely.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70516 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 59e9ed6acb..8b81c312d2 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1982,7 +1982,17 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (Tok.is(tok::identifier)) { assert(Tok.getIdentifierInfo() && "Not an identifier?"); - D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation()); + + // If this identifier is the name of the current class, it's a + // constructor name. + if (!D.getDeclSpec().hasTypeSpecifier() && + Actions.isCurrentClassName(*Tok.getIdentifierInfo(),CurScope)) { + D.setConstructor(Actions.getTypeName(*Tok.getIdentifierInfo(), + Tok.getLocation(), CurScope), + Tok.getLocation()); + // This is a normal identifier. + } else + D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation()); ConsumeToken(); goto PastIdentifier; } else if (Tok.is(tok::annot_template_id)) { @@ -2092,15 +2102,6 @@ void Parser::ParseDirectDeclarator(Declarator &D) { break; } ParseFunctionDeclarator(ConsumeParen(), D); - - // If this identifier is the name of the current class, it's a - // constructor name. - if (IdentifierInfo *II = D.getIdentifier()) { - if (Actions.isCurrentClassName(*II, CurScope)) - D.setConstructor(Actions.getTypeName(*II, D.getIdentifierLoc(), - CurScope), - D.getIdentifierLoc()); - } } else if (Tok.is(tok::l_square)) { ParseBracketDeclarator(D); } else { |