summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-04-01 16:23:44 +0000
committerReid Kleckner <reid@kleckner.net>2015-04-01 16:23:44 +0000
commit0a33e615f31ca2882893cf16f619e21632fbad66 (patch)
tree55a4b6073ca47a680457226a513fee3f092cfc0f /clang/test
parentba7c3ff32f7564b4503e5245a09052b4d0c23291 (diff)
downloadbcm5719-llvm-0a33e615f31ca2882893cf16f619e21632fbad66.tar.gz
bcm5719-llvm-0a33e615f31ca2882893cf16f619e21632fbad66.zip
Mark instantiated function decls as inline specified if any pattern is
A function template pattern can be declared without the 'inline' specifier and defined later with the 'inline' specifier. However, during instantiation, we were only looking at the canonical decl to see if we should mark the instantiated decl as inline specified. Since the instantiated decl actually represents many pattern declarations, put the inline specifier on the instantiation decl if any of the pattern decls have it. llvm-svn: 233817
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/inlinehint.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/inlinehint.cpp b/clang/test/CodeGenCXX/inlinehint.cpp
new file mode 100644
index 00000000000..57873b173da
--- /dev/null
+++ b/clang/test/CodeGenCXX/inlinehint.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple %s -emit-llvm -o - | FileCheck %s
+
+inline void InlineFunc() {}
+// CHECK: define linkonce_odr void @_Z10InlineFuncv() #[[INLINEHINTATTR:[0-9]+]] comdat {
+
+struct MyClass {
+ static void InlineStaticMethod();
+ void InlineInstanceMethod();
+};
+inline void MyClass::InlineStaticMethod() {}
+// CHECK: define linkonce_odr void @_ZN7MyClass18InlineStaticMethodEv() #[[INLINEHINTATTR]] comdat
+inline void MyClass::InlineInstanceMethod() {}
+// CHECK: define linkonce_odr void @_ZN7MyClass20InlineInstanceMethodEv(%struct.MyClass* %this) #[[INLINEHINTATTR]] comdat
+
+template <typename T>
+struct MyTemplate {
+ static void InlineStaticMethod();
+ void InlineInstanceMethod();
+};
+template <typename T> inline void MyTemplate<T>::InlineStaticMethod() {}
+// CHECK: define linkonce_odr void @_ZN10MyTemplateIiE18InlineStaticMethodEv() #[[INLINEHINTATTR]] comdat
+template <typename T> inline void MyTemplate<T>::InlineInstanceMethod() {}
+// CHECK: define linkonce_odr void @_ZN10MyTemplateIiE20InlineInstanceMethodEv(%struct.MyTemplate* %this) #[[INLINEHINTATTR]] comdat
+
+void UseThem() {
+ InlineFunc();
+ MyClass::InlineStaticMethod();
+ MyClass().InlineInstanceMethod();
+ MyTemplate<int>::InlineStaticMethod();
+ MyTemplate<int>().InlineInstanceMethod();
+}
+
+// CHECK: attributes #[[INLINEHINTATTR]] = { {{.*}}inlinehint{{.*}} }
OpenPOWER on IntegriCloud