[cfe-commits] r74799 - /cfe/trunk/lib/Frontend/ResolveLocation.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Sun Jul 5 15:21:47 PDT 2009
Author: akirtzidis
Date: Sun Jul 5 17:21:46 2009
New Revision: 74799
URL: http://llvm.org/viewvc/llvm-project?rev=74799&view=rev
Log:
Avoid re-checking the parameters of a function, when trying to resolve a location.
Modified:
cfe/trunk/lib/Frontend/ResolveLocation.cpp
Modified: cfe/trunk/lib/Frontend/ResolveLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ResolveLocation.cpp?rev=74799&r1=74798&r2=74799&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ResolveLocation.cpp (original)
+++ cfe/trunk/lib/Frontend/ResolveLocation.cpp Sun Jul 5 17:21:46 2009
@@ -203,13 +203,20 @@
// Second, search through the declarations that are part of the function.
// If we find he location there, we won't have to search through its body.
+
DeclLocResolver DLR(Ctx, Loc);
- DLR.VisitDeclContext(D);
- if (DLR.FoundIt()) {
- llvm::tie(Dcl, Stm) = DLR.getResult();
- return;
+ for (DeclContext::decl_iterator
+ I = D->decls_begin(), E = D->decls_end(); I != E; ++I) {
+ if (isa<ParmVarDecl>(*I))
+ continue; // We already searched through the parameters.
+
+ DLR.Visit(*I);
+ if (DLR.FoundIt()) {
+ llvm::tie(Dcl, Stm) = DLR.getResult();
+ return;
+ }
}
-
+
// We didn't find a declaration that corresponds to the source location.
// Finally, search through the body of the function.
More information about the cfe-commits
mailing list