[cfe-commits] r115387 - in /cfe/trunk: lib/AST/ASTImporter.cpp test/ASTMerge/Inputs/class1.cpp test/ASTMerge/Inputs/class2.cpp
Douglas Gregor
dgregor at apple.com
Fri Oct 1 16:55:07 PDT 2010
Author: dgregor
Date: Fri Oct 1 18:55:07 2010
New Revision: 115387
URL: http://llvm.org/viewvc/llvm-project?rev=115387&view=rev
Log:
Don't add an imported function into its lexical context until *after*
we've set all of its parameters. Fixes <rdar://problem/8499598>;
thanks to Sean for the diagnosis.
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/Inputs/class1.cpp
cfe/trunk/test/ASTMerge/Inputs/class2.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=115387&r1=115386&r2=115387&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Oct 1 18:55:07 2010
@@ -1966,7 +1966,6 @@
ToFunction->setAccess(D->getAccess());
ToFunction->setLexicalDeclContext(LexicalDC);
Importer.Imported(D, ToFunction);
- LexicalDC->addDecl(ToFunction);
// Set the parameters.
for (unsigned I = 0, N = Parameters.size(); I != N; ++I) {
@@ -1976,7 +1975,10 @@
ToFunction->setParams(Parameters.data(), Parameters.size());
// FIXME: Other bits to merge?
-
+
+ // Add this function to the lexical context.
+ LexicalDC->addDecl(ToFunction);
+
return ToFunction;
}
Modified: cfe/trunk/test/ASTMerge/Inputs/class1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/Inputs/class1.cpp?rev=115387&r1=115386&r2=115387&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/Inputs/class1.cpp (original)
+++ cfe/trunk/test/ASTMerge/Inputs/class1.cpp Fri Oct 1 18:55:07 2010
@@ -6,3 +6,10 @@
float y;
float foo();
};
+
+struct C {
+ C(int i = 10);
+ C(const C&);
+ C &operator=(C&);
+ ~C();
+};
Modified: cfe/trunk/test/ASTMerge/Inputs/class2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/Inputs/class2.cpp?rev=115387&r1=115386&r2=115387&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/Inputs/class2.cpp (original)
+++ cfe/trunk/test/ASTMerge/Inputs/class2.cpp Fri Oct 1 18:55:07 2010
@@ -6,3 +6,4 @@
int y;
int foo();
};
+
More information about the cfe-commits
mailing list