[cfe-commits] r70436 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaCXX/constructor.cpp
Anders Carlsson
andersca at mac.com
Wed Apr 29 16:19:39 PDT 2009
Author: andersca
Date: Wed Apr 29 18:19:39 2009
New Revision: 70436
URL: http://llvm.org/viewvc/llvm-project?rev=70436&view=rev
Log:
Just because a declaration has the same name as its containing class doesn't mean that it's a constructor. Fixes rdar://problem/6815988.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/SemaCXX/constructor.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=70436&r1=70435&r2=70436&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Apr 29 18:19:39 2009
@@ -1982,16 +1982,7 @@
if (Tok.is(tok::identifier)) {
assert(Tok.getIdentifierInfo() && "Not an identifier?");
-
- // If this identifier is the name of the current class, it's a
- // constructor name.
- if (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());
+ D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
ConsumeToken();
goto PastIdentifier;
} else if (Tok.is(tok::annot_template_id)) {
@@ -2101,6 +2092,15 @@
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 {
Modified: cfe/trunk/test/SemaCXX/constructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constructor.cpp?rev=70436&r1=70435&r2=70436&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constructor.cpp (original)
+++ cfe/trunk/test/SemaCXX/constructor.cpp Wed Apr 29 18:19:39 2009
@@ -40,3 +40,8 @@
struct Length {
Length l() const { return *this; }
};
+
+// <rdar://problem/6815988>
+struct mmst_reg{
+ char mmst_reg[10];
+};
More information about the cfe-commits
mailing list