[cfe-commits] r168519 - in /cfe/trunk/lib: AST/DeclBase.cpp Sema/SemaDecl.cpp
Rafael Espindola
rafael.espindola at gmail.com
Fri Nov 23 08:26:30 PST 2012
Author: rafael
Date: Fri Nov 23 10:26:30 2012
New Revision: 168519
URL: http://llvm.org/viewvc/llvm-project?rev=168519&view=rev
Log:
Merge used flags so that we don't have to iterate on isUsed. With this change
"clang -cc1 -fsyntax-only" on the preprocessed output of
#define M extern int a;
#define M2 M M
#define M4 M2 M2
#define M8 M4 M4
#define M16 M8 M8
#define M32 M16 M16
#define M64 M32 M32
#define M128 M64 M64
#define M256 M128 M128
#define M512 M256 M256
#define M1024 M512 M512
#define M2048 M1024 M1024
#define M4096 M2048 M2048
#define M8192 M4096 M4096
#define M16384 M8192 M8192
M16384
goes from 2.994s to 1.416s. GCC is at 0.022s, so we still have a long way to go.
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=168519&r1=168518&r2=168519&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri Nov 23 10:26:30 2012
@@ -260,14 +260,7 @@
// Check for used attribute.
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=168519&r1=168518&r2=168519&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Nov 23 10:26:30 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())
More information about the cfe-commits
mailing list