[cfe-commits] r168564 - in /cfe/trunk/lib: AST/DeclBase.cpp Sema/SemaDecl.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sun Nov 25 06:07:59 PST 2012
Author: rafael
Date: Sun Nov 25 08:07:59 2012
New Revision: 168564
URL: http://llvm.org/viewvc/llvm-project?rev=168564&view=rev
Log:
Add r168519 back, but with a fix to also merge the used flag in variables.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=168564&r1=168563&r2=168564&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Sun Nov 25 08:07:59 2012
@@ -261,13 +261,6 @@
if (CheckUsedAttr && hasAttr<UsedAttr>())
return true;
- // Check redeclarations. We merge attributes, so we don't need to check
- // attributes in all redeclarations.
- for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
- if (I->Used)
- return true;
- }
-
return false;
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=168564&r1=168563&r2=168564&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Nov 25 08:07:59 2012
@@ -2388,6 +2388,10 @@
if (Old->isPure())
New->setPure();
+ // Merge "used" flag.
+ if (Old->isUsed(false))
+ New->setUsed();
+
// Merge attributes from the parameters. These can mismatch with K&R
// declarations.
if (New->getNumParams() == Old->getNumParams())
@@ -2613,6 +2617,10 @@
New->getDeclContext() == Old->getDeclContext())
New->setStorageClass(Old->getStorageClass());
+ // Merge "used" flag.
+ if (Old->isUsed(false))
+ New->setUsed();
+
// Keep a chain of previous declarations.
New->setPreviousDeclaration(Old);
More information about the cfe-commits
mailing list