summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-05-07 23:58:18 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-05-07 23:58:18 +0000
commit3c9d9479b0b3dd28c17a682afd5bd219f0a6a5d1 (patch)
treeebe0898c9aa63bbfdde27c992e9afff77825d520 /clang/lib/Sema/SemaDeclAttr.cpp
parent9e8ae6c37fcfd5100c1b0837e2415bdd33a3a0ff (diff)
downloadbcm5719-llvm-3c9d9479b0b3dd28c17a682afd5bd219f0a6a5d1.tar.gz
bcm5719-llvm-3c9d9479b0b3dd28c17a682afd5bd219f0a6a5d1.zip
Process attributes in the order they appear in the source code. This make clang
match gcc behavior for two conflicting visibilities in the same decl. It also makes handling of dllimport/dllexport more natural. As a bonus we now warn on the dllimport in void __attribute__((dllimport)) foo13(); void __attribute__((dllexport)) foo13(); as does gcc. llvm-svn: 156343
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f2d1d19d22d..47acdf9456f 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3986,8 +3986,12 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
void Sema::ProcessDeclAttributeList(Scope *S, Decl *D,
const AttributeList *AttrList,
bool NonInheritable, bool Inheritable) {
+ SmallVector<const AttributeList*, 4> attrs;
for (const AttributeList* l = AttrList; l; l = l->getNext()) {
- ProcessDeclAttribute(*this, S, D, *l, NonInheritable, Inheritable);
+ attrs.push_back(l);
+ }
+ for (int i = attrs.size() - 1; i >= 0; --i) {
+ ProcessDeclAttribute(*this, S, D, *attrs[i], NonInheritable, Inheritable);
}
// GCC accepts
OpenPOWER on IntegriCloud