summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-28 06:37:30 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-28 06:37:30 +0000
commit76fe50c654df0f35fd93335b93d9a101fd1b8dfd (patch)
tree9b2b533fe9d8f03ad47387c2454e47f4d2443861 /clang/lib/CodeGen/CodeGenModule.cpp
parent7e09994cb8ff541cf4fc78b4aea97e8ea8f6bfc1 (diff)
downloadbcm5719-llvm-76fe50c654df0f35fd93335b93d9a101fd1b8dfd.tar.gz
bcm5719-llvm-76fe50c654df0f35fd93335b93d9a101fd1b8dfd.zip
Improve compatibility with GCC regarding inline semantics in GNU89
mode and in the presence of __gnu_inline__ attributes. This should fix both PR3989 and PR4069. As part of this, we now keep track of all of the attributes attached to each declaration even after we've performed declaration merging. This fixes PR3264. llvm-svn: 70292
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 378223e3a71..4e58d093600 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -240,9 +240,17 @@ GetLinkageForFunction(const FunctionDecl *FD, const LangOptions &Features) {
// If the inline function explicitly has the GNU inline attribute on it, or if
// this is C89 mode, we use to GNU semantics.
- if (FD->hasAttr<GNUInlineAttr>() || (!Features.C99 && !Features.CPlusPlus)) {
+ if (!Features.C99 && !Features.CPlusPlus) {
// extern inline in GNU mode is like C99 inline.
- if (FD->isC99InlineDefinition())
+ if (FD->getStorageClass() == FunctionDecl::Extern)
+ return CodeGenModule::GVA_C99Inline;
+ // Normal inline is a strong symbol.
+ return CodeGenModule::GVA_StrongExternal;
+ } else if (FD->hasActiveGNUInlineAttribute()) {
+ // GCC in C99 mode seems to use a different decision-making
+ // process for extern inline, which factors in previous
+ // declarations.
+ if (FD->isExternGNUInline())
return CodeGenModule::GVA_C99Inline;
// Normal inline is a strong symbol.
return CodeGenModule::GVA_StrongExternal;
OpenPOWER on IntegriCloud