[Lldb-commits] [PATCH] D14542: [lldb] Fix name lookup in ClangASTContext

Eugene Leviant via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 10 08:25:39 PST 2015


evgeny777 created this revision.
evgeny777 added a reviewer: clayborg.
evgeny777 added subscribers: lldb-commits, KLapshin.

The check for already searched namespaces has disappeared from DeclContextFindDeclByName() recently. This breaks variable evaluation in many cases, for example in this one   

```
namespace ns1 {
    int var = 100;
}

namespace ns2 {
    int var = 101;
}

int main(void) {
    {
        using namespace ns1;
        printf("var=%d\n", var); // evaluation fails - multiple candidates
    }

    {
        using namespace ns2;
        printf("var=%d\n", var); // evaluation fails - multiple candidates
    }
}
```

http://reviews.llvm.org/D14542

Files:
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9097,6 +9097,8 @@
 
             for (auto it = search_queue.find(decl_context); it != search_queue.end(); it++)
             {
+                if (searched.find(it->second) != searched.end())
+                    continue;
                 searched.insert(it->second);
                 symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14542.39813.patch
Type: text/x-patch
Size: 553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151110/45beb130/attachment.bin>


More information about the lldb-commits mailing list