diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-05 22:21:46 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-05 22:21:46 +0000 |
commit | 07796e1c522921e2b396df36bf9c1f702ffb2fb5 (patch) | |
tree | 3f51a8b903fbb85a7f493bed22004986fd986f44 /lib/Frontend/ResolveLocation.cpp | |
parent | 49dd5851c463963a8a78f5222ea72cfaa6db1029 (diff) |
Avoid re-checking the parameters of a function, when trying to resolve a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ResolveLocation.cpp')
-rw-r--r-- | lib/Frontend/ResolveLocation.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Frontend/ResolveLocation.cpp b/lib/Frontend/ResolveLocation.cpp index 3dcd2143cb..5b8eed0c0e 100644 --- a/lib/Frontend/ResolveLocation.cpp +++ b/lib/Frontend/ResolveLocation.cpp @@ -203,13 +203,20 @@ void DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { // 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. |