[Lldb-commits] [PATCH] D20395: Remove m_decl_objects and look up variables for ComiplerDecls directly

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Wed May 18 16:05:57 PDT 2016

spyffe added a comment.

Added a few inline comments to make the patch's intent more understandable.

Comment at: include/lldb/Symbol/ClangASTContext.h:1221
@@ -1220,3 +1214,2 @@
     bool                                            m_can_evaluate_expressions;
-    std::map<void *, std::shared_ptr<void>>         m_decl_objects;
     // clang-format on
We remove this map and all accessors to it because its only purpose was the lookup that's been replaced.

Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1262
@@ -1261,2 +1261,3 @@
                 for (CompilerDecl decl : found_decls)
+                    for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi)
Here, we already have a list of variables in scope with the right name (returned from `GetInScopeVariableList()`).  So we just have to pick the one with the right `VarDecl`.

If there are any other variables that aren't in that list that we need to consider, this is something we need to know about.

Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:3610
@@ -3609,1 +3609,3 @@
+    if (DWARFDIE abstract_origin_die = die.GetReferencedDIE(DW_AT_abstract_origin))
The point of this code is to ensure that the variables are not duplicated.  There is only one `FunctionDecl`, so there needs to be only one `VarDecl`, the one for the abstract origin.  Otherwise the `FunctionDecl` contains multiple variables with the same name, messing up lookup.



More information about the lldb-commits mailing list