uweigand updated this revision to Diff 53553.
uweigand added a comment.
Add test case.
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)
- 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)
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)
- 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)
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits