ldrumm created this revision.
ldrumm added reviewers: spyffe, jingham.
ldrumm added a subscriber: lldb-commits.

Due to the way the lldb override for 
`clang::ExternalASTSource::FindExternalGlobalVisibleDeclsByName` callback was 
searching for functions, it was possible for invalid declarations to end up in 
the list of function declarations passed back to the clang AST, which 
subsequently caused clang to complain about ambiguous lookups. The logic used 
to prune duplicate function declarations based on lexical distance was ignoring 
the error status returned for invalid declarations which meant that they ended 
up in the list of resolved declarations passed back to clang.

http://reviews.llvm.org/D22060

Files:
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1430,7 +1430,14 @@
                                                                   &fdi.m_name,
                                                                   
&fdi.m_copied_type);
                         }
-                        fdi_cache.emplace_back(fdi);
+                        if (fdi.m_decl_lvl == LLDB_INVALID_DECL_LEVEL)
+                        {
+                            if (log)
+                                log->Printf("INVALID_DECL_LEVEL for function 
declaration '%s'",
+                                            fdi.m_name.GetCString());
+                        }
+                        else
+                            fdi_cache.emplace_back(fdi);
                     }
 
                     // Loop through the functions in our cache looking for 
matching types,


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1430,7 +1430,14 @@
                                                                   &fdi.m_name,
                                                                   &fdi.m_copied_type);
                         }
-                        fdi_cache.emplace_back(fdi);
+                        if (fdi.m_decl_lvl == LLDB_INVALID_DECL_LEVEL)
+                        {
+                            if (log)
+                                log->Printf("INVALID_DECL_LEVEL for function declaration '%s'",
+                                            fdi.m_name.GetCString());
+                        }
+                        else
+                            fdi_cache.emplace_back(fdi);
                     }
 
                     // Loop through the functions in our cache looking for matching types,
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to