diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-23 18:22:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-23 18:22:55 +0000 |
commit | b3efa98e320590e8be9d62818e89e599303e65b4 (patch) | |
tree | e1dfe49a1b96f17d9dc5815273bee027ed5d5343 /lib/CodeGen | |
parent | 87de6497f45243fbcef6dac5be6a641ca9331f61 (diff) |
Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and
<rdar://problem/6818429>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index c07eac993b..378223e3a7 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -242,7 +242,7 @@ GetLinkageForFunction(const FunctionDecl *FD, const LangOptions &Features) { // this is C89 mode, we use to GNU semantics. if (FD->hasAttr<GNUInlineAttr>() || (!Features.C99 && !Features.CPlusPlus)) { // extern inline in GNU mode is like C99 inline. - if (FD->getStorageClass() == FunctionDecl::Extern) + if (FD->isC99InlineDefinition()) return CodeGenModule::GVA_C99Inline; // Normal inline is a strong symbol. return CodeGenModule::GVA_StrongExternal; @@ -254,11 +254,10 @@ GetLinkageForFunction(const FunctionDecl *FD, const LangOptions &Features) { return CodeGenModule::GVA_CXXInline; assert(Features.C99 && "Must be in C99 mode if not in C89 or C++ mode"); - // extern inline in C99 is a strong definition. - if (FD->getStorageClass() == FunctionDecl::Extern) - return CodeGenModule::GVA_StrongExternal; - - return CodeGenModule::GVA_C99Inline; + if (FD->isC99InlineDefinition()) + return CodeGenModule::GVA_C99Inline; + + return CodeGenModule::GVA_StrongExternal; } /// SetFunctionDefinitionAttributes - Set attributes for a global. |