[cfe-commits] r165720 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility-inlines-hidden.cpp

Rafael Espindola rafael.espindola at gmail.com
Thu Oct 11 09:32:26 PDT 2012


Author: rafael
Date: Thu Oct 11 11:32:25 2012
New Revision: 165720

URL: http://llvm.org/viewvc/llvm-project?rev=165720&view=rev
Log:
Handle gnu_inline in c++ in a gcc compatible way. Original patch by Tobias
Grosser.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=165720&r1=165719&r2=165720&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Oct 11 11:32:25 2012
@@ -193,7 +193,7 @@
   // anyway.
   return TSK != TSK_ExplicitInstantiationDeclaration &&
     TSK != TSK_ExplicitInstantiationDefinition &&
-    FD->hasBody(Def) && Def->isInlined();
+    FD->hasBody(Def) && Def->isInlined() && !Def->hasAttr<GNUInlineAttr>();
 }
 
 static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,

Modified: cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp?rev=165720&r1=165719&r2=165720&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp Thu Oct 11 11:32:25 2012
@@ -126,3 +126,12 @@
   // CHECK: define linkonce_odr hidden void @_ZN5test33fooEv
   // CHECK: define linkonce_odr hidden void @_ZN5test33zedIiEEvv
 }
+
+namespace test4 {
+  extern inline __attribute__ ((__gnu_inline__))
+  void foo() {}
+  void bar() {
+    foo();
+  }
+  // CHECK: define available_externally void @_ZN5test43fooE
+}





More information about the cfe-commits mailing list