Fix some mishandling of the attr(gnu_inline) mode when used with
extern. Previously we would warn about it and ignore the attribute.
This is incorrect, it should be handled as a c89 "extern inline"
function. Many thanks to Matthieu Castet for pointing this out and
beating me over the head until I got it.
PR3988: extern inline function are not externally visible
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69756 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c
index 4821988..eb8ee71 100644
--- a/test/CodeGen/inline.c
+++ b/test/CodeGen/inline.c
@@ -6,6 +6,7 @@
// RUN: grep "define void @unreferenced1()" %t &&
// RUN: not grep unreferenced2 %t &&
// RUN: grep "define void @gnu_inline()" %t &&
+// RUN: grep "define available_externally void @gnu_ei_inline()" %t &&
// RUN: echo "\nC99 tests:" &&
// RUN: clang %s -emit-llvm -S -o %t -std=c99 &&
@@ -15,6 +16,7 @@
// RUN: not grep unreferenced1 %t &&
// RUN: grep "define void @unreferenced2()" %t &&
// RUN: grep "define void @gnu_inline()" %t &&
+// RUN: grep "define available_externally void @gnu_ei_inline()" %t &&
// RUN: echo "\nC++ tests:" &&
// RUN: clang %s -emit-llvm -S -o %t -std=c++98 &&
@@ -22,7 +24,8 @@
// RUN: grep "define linkonce_odr i32 @_Z3foov()" %t &&
// RUN: grep "define i32 @_Z3barv()" %t &&
// RUN: not grep unreferenced %t &&
-// RUN: grep "define void @_Z10gnu_inlinev()" %t
+// RUN: grep "define void @_Z10gnu_inlinev()" %t &&
+// RUN: grep "define available_externally void @_Z13gnu_ei_inlinev()" %t
extern inline int ei() { return 123; }
@@ -37,3 +40,8 @@
extern inline void unreferenced2() {}
__inline __attribute((__gnu_inline__)) void gnu_inline() {}
+
+// PR3988
+extern inline __attribute__((gnu_inline)) void gnu_ei_inline() {}
+void (*P)() = gnu_ei_inline;
+
diff --git a/test/Sema/function.c b/test/Sema/function.c
index fa99830..77557c9 100644
--- a/test/Sema/function.c
+++ b/test/Sema/function.c
@@ -64,7 +64,7 @@
extern __inline
-__attribute__((__gnu_inline__)) // expected-warning{{'gnu_inline' attribute is overridden by 'extern inline', attribute ignored}} expected-warning{{extension used}}
+__attribute__((__gnu_inline__)) // expected-warning{{extension used}}
void gnu_inline1() {}
void