[Lldb-commits] [PATCH] D22060: [expression evaluation] Prevent invalid function declarations ending up in clang AST

Luke Drummond via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 6 11:29:51 PDT 2016


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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22060.62920.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160706/7c938b64/attachment.bin>


More information about the lldb-commits mailing list