diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index d9a3389c58f3a194feb2e062a95147f52376f014..74c0e2dc69d5b3a39438dd2ba4403f69af87a60e 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2712,7 +2712,7 @@ bool FunctionDecl::isMSExternInline() const { for (const FunctionDecl *FD = getMostRecentDecl(); FD; FD = FD->getPreviousDecl()) - if (FD->getStorageClass() == SC_Extern) + if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern) return true; return false; @@ -2724,7 +2724,7 @@ static bool redeclForcesDefMSVC(const FunctionDecl *Redecl) { for (const FunctionDecl *FD = Redecl->getPreviousDecl(); FD; FD = FD->getPreviousDecl()) - if (FD->getStorageClass() == SC_Extern) + if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern) return false; return true; diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c index a45bccc5132863726f87b676a108894f55cd05d1..16e95c03c875d7779b538b9555dd5c38b0824410 100644 --- a/test/CodeGen/inline.c +++ b/test/CodeGen/inline.c @@ -54,6 +54,7 @@ // RUN: echo "MS C Mode tests:" // RUN: %clang_cc1 %s -triple i386-unknown-unknown -O1 -disable-llvm-optzns -emit-llvm -o - -std=c99 -fms-compatibility | FileCheck %s --check-prefix=CHECK4 +// CHECK4-NOT: define weak_odr void @_Exit( // CHECK4-LABEL: define weak_odr i32 @ei() // CHECK4-LABEL: define i32 @bar() // CHECK4-NOT: unreferenced1 @@ -62,6 +63,9 @@ // CHECK4-LABEL: define linkonce_odr i32 @foo() // CHECK4-LABEL: define available_externally void @gnu_ei_inline() +__attribute__((noreturn)) void __cdecl _exit(int _Code); +__inline void __cdecl _Exit(int status) { _exit(status); } + extern __inline int ei() { return 123; } __inline int foo() {