[Lldb-commits] [PATCH] D18976: Handle lookup of names identifying both a variable and a type
Ulrich Weigand via lldb-commits
lldb-commits at lists.llvm.org
Wed May 18 07:17:02 PDT 2016
uweigand added a reviewer: jingham.
uweigand updated this revision to Diff 57617.
uweigand added a comment.
Ping? This fixes the last remaining test suite failure on s390x. I'd like to get a clean test suite ...
Patch updated to current sources.
Added jingham since you touched that code recently.
http://reviews.llvm.org/D18976
Files:
packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
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
@@ -866,8 +866,11 @@
current_id);
}
- if (!context.m_found.variable && !context.m_found.local_vars_nsp)
- ClangASTSource::FindExternalVisibleDecls(context);
+ // Always call into ClangASTSource::FindExternalVisibleDecls, even if we already found
+ // some decls above. It might be that Clang is looking for a type, but we have found
+ // a variable of the same name instead. Let ClangASTSource add the type to the result
+ // list as well; Clang will filter out the decl it is actually interested in.
+ ClangASTSource::FindExternalVisibleDecls(context);
}
void
Index: packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
===================================================================
--- packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
@@ -19,6 +19,10 @@
int C::a = 3333;
int a = 4444;
+// Verify that LLDB is able to parse "C::a" even when "C" exists both as a
+// type name and a variable name at the same time.
+int C = 5555;
+
int main() // break here
{
return 0;
Index: packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
===================================================================
--- packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
+++ packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
@@ -54,10 +54,12 @@
'B::a': 2222,
'C::a': 3333,
'::a': 4444,
- 'a': 4444
+ 'a': 4444,
+ '::C': 5555,
+ 'C': 5555
}
- self.assertTrue(global_variables.GetSize() == 4, "target variable returns all variables")
+ self.assertTrue(global_variables.GetSize() == 5, "target variable returns all variables")
for variable in global_variables:
name = variable.GetName()
self.assertTrue(name in global_variables_assert, "target variable returns wrong variable " + name)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18976.57617.patch
Type: text/x-patch
Size: 2272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160518/d9852a1f/attachment.bin>
More information about the lldb-commits
mailing list