summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp12
-rw-r--r--clang/test/CodeGen/inline2.c9
2 files changed, 15 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index addf8d09e41..92f49379f1b 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1177,12 +1177,14 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
if (!FD->doesDeclarationForceExternallyVisibleDefinition())
return;
- const FunctionDecl *InlineDefinition = 0;
- FD->getBody(InlineDefinition);
-
StringRef MangledName = getMangledName(GD);
- DeferredDecls.erase(MangledName);
- EmitGlobalDefinition(InlineDefinition);
+
+ // Compute the function info and LLVM type.
+ const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
+ llvm::Type *Ty = getTypes().GetFunctionType(FI);
+
+ GetOrCreateLLVMFunction(MangledName, Ty, GD, /*ForVTable=*/false,
+ /*DontDefer=*/false);
return;
}
} else {
diff --git a/clang/test/CodeGen/inline2.c b/clang/test/CodeGen/inline2.c
index 670ae201f9b..84cd4db0277 100644
--- a/clang/test/CodeGen/inline2.c
+++ b/clang/test/CodeGen/inline2.c
@@ -39,6 +39,9 @@ extern int f7(void) { return 0; }
// CHECK-GNU89-LABEL: define i32 @fA()
inline int fA(void) { return 0; }
+// CHECK-GNU89-LABEL: define i32 @fB()
+inline int fB() { return 0; }
+
// CHECK-GNU89-LABEL: define available_externally i32 @f4()
// CHECK-C99-LABEL: define i32 @f4()
int f4(void);
@@ -56,7 +59,11 @@ extern inline int f9(void) { return 0; }
// CHECK-C99-LABEL: define available_externally i32 @fA()
+// CHECK-C99-LABEL: define i32 @fB()
+
int test_all() {
return f0() + f1() + f2() + f3() + f4() + f5() + f6() + f7() + f8() + f9()
- + fA();
+ + fA() + fB();
}
+
+int fB(void);
OpenPOWER on IntegriCloud