[Lldb-commits] [lldb] r241917 - Fixed a problem where variables in modules were not appropriately discovered by
Sean Callanan
scallanan at apple.com
Fri Jul 10 10:34:24 PDT 2015
Author: spyffe
Date: Fri Jul 10 12:34:23 2015
New Revision: 241917
URL: http://llvm.org/viewvc/llvm-project?rev=241917&view=rev
Log:
Fixed a problem where variables in modules were not appropriately discovered by
the expression parser.
<rdar://problem/21395220>
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/test/lang/c/modules/TestCModules.py
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=241917&r1=241916&r2=241917&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Jul 10 12:34:23 2015
@@ -1527,6 +1527,31 @@ ClangExpressionDeclMap::FindExternalVisi
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);
}
Modified: lldb/trunk/test/lang/c/modules/TestCModules.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/modules/TestCModules.py?rev=241917&r1=241916&r2=241917&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/modules/TestCModules.py (original)
+++ lldb/trunk/test/lang/c/modules/TestCModules.py Fri Jul 10 12:34:23 2015
@@ -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
More information about the lldb-commits
mailing list