[cfe-commits] r103741 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/PR6747.cpp

Douglas Gregor dgregor at apple.com
Thu May 13 14:36:57 PDT 2010


Author: dgregor
Date: Thu May 13 16:36:56 2010
New Revision: 103741

URL: http://llvm.org/viewvc/llvm-project?rev=103741&view=rev
Log:
Disable the available_externally optimization for inline virtual
methods for which the key function is guaranteed to be in another
translation unit. Unfortunately, this guarantee isn't the case when
dealing with shared libraries that fail to export these virtual method
definitions. 

I'm reopening PR6747 so we can consider this again at a later point in
time.


Removed:
    cfe/trunk/test/CodeGenCXX/PR6747.cpp
Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=103741&r1=103740&r2=103741&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu May 13 16:36:56 2010
@@ -316,17 +316,6 @@
                                        == TSK_ExplicitInstantiationDeclaration)
     return CodeGenModule::GVA_C99Inline;
 
-  // If this is a virtual method and its class has a key method in another
-  // translation unit, we know that this method will be present in that
-  // translation unit. In this translation unit we will use this method
-  // only for inlining and analysis. This is the semantics of c99 inline.
-  if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
-    const CXXRecordDecl *RD = MD->getParent();
-    if (MD->isVirtual() && !MD->isImplicit() &&
-        CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD))
-      return CodeGenModule::GVA_C99Inline;
-  }  
-
   return CodeGenModule::GVA_CXXInline;
 }
 

Removed: cfe/trunk/test/CodeGenCXX/PR6747.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR6747.cpp?rev=103740&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/PR6747.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/PR6747.cpp (removed)
@@ -1,11 +0,0 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-
-struct foo {
-  virtual void bar();
-// CHECK: define available_externally void @_ZN3foo3bazEv
-  virtual void baz() {}
-};
-void zed() {
-  foo b;
-  b.baz();
-}





More information about the cfe-commits mailing list