Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition.  Based on work by Anton Yartsev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149963 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c
index 6bc583d..2a01f25 100644
--- a/test/CodeGen/inline.c
+++ b/test/CodeGen/inline.c
@@ -13,8 +13,14 @@
 // RUN: grep "define available_externally i32 @test4" %t
 // RUN: grep "define available_externally i32 @test5" %t
 // RUN: grep "define i32 @test6" %t
+// RUN: grep "define void @test7" %t
+// RUN: grep "define i.. @strlcpy" %t
+// RUN: not grep test9 %t
+// RUN: grep "define void @testA" %t
+// RUN: grep "define void @testB" %t
+// RUN: grep "define void @testC" %t
 
-// RUN: echo "\nC99 tests:"
+// RUN: echo "C99 tests:"
 // RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu99
 // RUN: grep "define i32 @ei()" %t
 // RUN: grep "define available_externally i32 @foo()" %t
@@ -29,9 +35,14 @@
 // RUN: grep "define available_externally i32 @test4" %t
 // RUN: grep "define available_externally i32 @test5" %t
 // RUN: grep "define i32 @test6" %t
+// RUN: grep "define void @test7" %t
 // RUN: grep "define available_externally i.. @strlcpy" %t
+// RUN: grep "define void @test9" %t
+// RUN: grep "define void @testA" %t
+// RUN: grep "define void @testB" %t
+// RUN: grep "define void @testC" %t
 
-// RUN: echo "\nC++ tests:"
+// RUN: echo "C++ tests:"
 // RUN: %clang -x c++ %s -O1 -emit-llvm -S -o %t -std=c++98
 // RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t
 // RUN: grep "define linkonce_odr i32 @_Z3foov()" %t
@@ -102,3 +113,17 @@
 // PR11062; the fact that the function is named strlcpy matters here.
 inline __typeof(sizeof(int)) strlcpy(char *dest, const char *src, __typeof(sizeof(int)) size) { return 3; }
 void test8() { strlcpy(0,0,0); }
+
+// PR10657; the test crashed in C99 mode
+extern inline void test9() { }
+void test9();
+
+inline void testA() {}
+void testA();
+
+void testB();
+inline void testB() {}
+extern void testB();
+
+extern inline void testC() {}
+inline void testC();