[cfe-commits] r159586 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/inline-functions.cpp
Eli Friedman
eli.friedman at gmail.com
Mon Jul 2 14:05:30 PDT 2012
Author: efriedma
Date: Mon Jul 2 16:05:30 2012
New Revision: 159586
URL: http://llvm.org/viewvc/llvm-project?rev=159586&view=rev
Log:
When we're looking for redeclarations which might provide a definition in CodeGen, make sure we examine all the redeclarations. PR13252.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCXX/inline-functions.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=159586&r1=159585&r2=159586&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jul 2 16:05:30 2012
@@ -1111,6 +1111,7 @@
} else if (getLangOpts().CPlusPlus && D.getDecl()) {
// Look for a declaration that's lexically in a record.
const FunctionDecl *FD = cast<FunctionDecl>(D.getDecl());
+ FD = FD->getMostRecentDecl();
do {
if (isa<CXXRecordDecl>(FD->getLexicalDeclContext())) {
if (FD->isImplicit() && !ForVTable) {
Modified: cfe/trunk/test/CodeGenCXX/inline-functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/inline-functions.cpp?rev=159586&r1=159585&r2=159586&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/inline-functions.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/inline-functions.cpp Mon Jul 2 16:05:30 2012
@@ -53,3 +53,17 @@
c.func();
}
}
+
+// PR13252
+namespace test2 {
+ struct A;
+ void f(const A& a);
+ struct A {
+ friend void f(const A& a) { }
+ };
+ void g() {
+ A a;
+ f(a);
+ }
+ // CHECK: define linkonce_odr void @_ZN5test21fERKNS_1AE
+}
More information about the cfe-commits
mailing list