aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-07-02 21:05:30 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-07-02 21:05:30 +0000
commitb135f0f2d893121ed2cc46d4d6c5bd5ab87d872f (patch)
tree9efd45a8addf24674c9455014201b8a7efd5a3f6
parent24364151180895f90018b6e373e51c0082ecff35 (diff)
When we're looking for redeclarations which might provide a definition in CodeGen, make sure we examine all the redeclarations. PR13252.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159586 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CodeGenModule.cpp1
-rw-r--r--test/CodeGenCXX/inline-functions.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 25053b91a4..ef20cf4556 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1111,6 +1111,7 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName,
} 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) {
diff --git a/test/CodeGenCXX/inline-functions.cpp b/test/CodeGenCXX/inline-functions.cpp
index 69dfe0db98..8c011de28a 100644
--- a/test/CodeGenCXX/inline-functions.cpp
+++ b/test/CodeGenCXX/inline-functions.cpp
@@ -53,3 +53,17 @@ namespace test1 {
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
+}