summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-23 18:22:55 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-23 18:22:55 +0000
commit89c8e000cf9905ae4b895d02963ef557d1e5eec9 (patch)
treebdc3996d90302847947834656bb134c307e1dfe7 /clang/lib/CodeGen/CodeGenModule.cpp
parenta6acb390e70453fd129cdaa19bdf8b0e206081f5 (diff)
downloadbcm5719-llvm-89c8e000cf9905ae4b895d02963ef557d1e5eec9.tar.gz
bcm5719-llvm-89c8e000cf9905ae4b895d02963ef557d1e5eec9.zip
Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and <rdar://problem/6818429>. llvm-svn: 69905
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index c07eac993be..378223e3a71 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud