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
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index d0c0ab8..d05b99a 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1474,7 +1474,11 @@
return;
}
- d->addAttr(::new (S.Context) GNUInlineAttr());
+ // FIXME: We only do this because of the hack in
+ // Sema::ActOnFunctionDeclarator, which needs to add the
+ // GNUInlineAttr early.
+ if (!d->hasAttr<GNUInlineAttr>())
+ d->addAttr(::new (S.Context) GNUInlineAttr());
}
static void HandleRegparmAttr(Decl *d, const AttributeList &Attr, Sema &S) {