summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2015-07-10 17:34:23 +0000
committerSean Callanan <scallanan@apple.com>2015-07-10 17:34:23 +0000
commit9ff456c8a24681576db320aa4efdee4282dddb3c (patch)
tree9038c6ad2de925e95faecbe7f8e572f686607f16
parent03ce2a16bfb31df14ae3bfb6d288e785ffe13d35 (diff)
downloadbcm5719-llvm-9ff456c8a24681576db320aa4efdee4282dddb3c.tar.gz
bcm5719-llvm-9ff456c8a24681576db320aa4efdee4282dddb3c.zip
Fixed a problem where variables in modules were not appropriately discovered by
the expression parser. <rdar://problem/21395220> llvm-svn: 241917
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp25
-rw-r--r--lldb/test/lang/c/modules/TestCModules.py3
2 files changed, 28 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 1013bb54060..2c66a0aa427 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -1527,6 +1527,31 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
context.m_found.function_with_type_info = true;
context.m_found.function = true;
}
+ else if (llvm::isa<clang::VarDecl>(decl_from_modules))
+ {
+ if (log)
+ {
+ log->Printf(" CAS::FEVD[%u] Matching variable found for \"%s\" in the modules",
+ current_id,
+ name.GetCString());
+ }
+
+ clang::Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &decl_from_modules->getASTContext(), decl_from_modules);
+ clang::VarDecl *copied_var_decl = copied_decl ? dyn_cast_or_null<clang::VarDecl>(copied_decl) : nullptr;
+
+ if (!copied_var_decl)
+ {
+ if (log)
+ log->Printf(" CAS::FEVD[%u] - Couldn't export a variable declaration from the modules",
+ current_id);
+
+ break;
+ }
+
+ context.AddNamedDecl(copied_var_decl);
+
+ context.m_found.variable = true;
+ }
}
} while (0);
}
diff --git a/lldb/test/lang/c/modules/TestCModules.py b/lldb/test/lang/c/modules/TestCModules.py
index 340b229f3a9..4c22c195bcc 100644
--- a/lldb/test/lang/c/modules/TestCModules.py
+++ b/lldb/test/lang/c/modules/TestCModules.py
@@ -74,6 +74,9 @@ class CModulesTestCase(TestBase):
self.expect("expr MIN((uint64_t)2, (uint64_t)3)", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["uint64_t", "2"])
+
+ self.expect("expr stdin", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["(FILE *)", "0x"])
if __name__ == '__main__':
import atexit
OpenPOWER on IntegriCloud