]> granicus.if.org Git - clang/commitdiff
Avoid re-checking the parameters of a function, when trying to resolve a location.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 5 Jul 2009 22:21:46 +0000 (22:21 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 5 Jul 2009 22:21:46 +0000 (22:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74799 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ResolveLocation.cpp

index 3dcd2143cbc97a0e4c809866463ec30c8b5204d5..5b8eed0c0ef833a9747952c9cd765bf740473c65 100644 (file)
@@ -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.