]> granicus.if.org Git - clang/commitdiff
When we're looking for redeclarations which might provide a definition in CodeGen...
authorEli Friedman <eli.friedman@gmail.com>
Mon, 2 Jul 2012 21:05:30 +0000 (21:05 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 2 Jul 2012 21:05:30 +0000 (21:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159586 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/inline-functions.cpp

index 25053b91a4cd1fd8f27a53bcaacc19c6efc096ff..ef20cf45562c9b6788b52843568d66b22104128c 100644 (file)
@@ -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) {
index 69dfe0db98f0442d8b3cdbba55eb403d807e7c33..8c011de28a02328a29344670546d87a36a2c8a3f 100644 (file)
@@ -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
+}