Enable the use of modules in the expression parser by default.

If your program refers to modules (as indicated in DWARF) we will now try to
load these modules and give you access to their types in expressions.  This used
to be gated by a setting ("settings set target.auto-import-clang-modules true")
but that setting defaulted to false.  Now it defaults to true -- but you can
disable it by toggling the setting to false.

llvm-svn: 257812
This commit is contained in:
Sean Callanan 2016-01-14 21:46:09 +00:00
parent 5337a3e965
commit b0300a4c30
3 changed files with 38 additions and 3 deletions

View File

@ -627,7 +627,9 @@ ClangModulesDeclVendor::Create(Target &target)
std::vector<std::string> compiler_invocation_arguments =
{
"clang",
"-fmodules",
"-fimplicit-module-maps",
"-fcxx-modules",
"-fsyntax-only",
"-femit-all-decls",

View File

@ -1091,9 +1091,42 @@ SymbolFileDWARF::ParseImportedModules (const lldb_private::SymbolContext &sc, st
if (ClangModulesDeclVendor::LanguageSupportsClangModules(sc.comp_unit->GetLanguage()))
{
UpdateExternalModuleListIfNeeded();
for (const auto &pair : m_external_type_modules)
if (sc.comp_unit)
{
imported_modules.push_back(pair.first);
DWARFCompileUnit *dwarf_cu = GetDWARFCompileUnit (sc.comp_unit);
const DWARFDIE die = dwarf_cu->GetCompileUnitDIEOnly();
if (die)
{
for (DWARFDIE child_die = die.GetFirstChild();
child_die;
child_die = child_die.GetSibling())
{
if (child_die.Tag() == DW_TAG_imported_declaration)
{
if (DWARFDIE module_die = child_die.GetReferencedDIE(DW_AT_import))
{
if (module_die.Tag() == DW_TAG_module)
{
if (const char *name = module_die.GetAttributeValueAsString(DW_AT_name, nullptr))
{
ConstString const_name(name);
imported_modules.push_back(const_name);
}
}
}
}
}
}
}
else
{
for (const auto &pair : m_external_type_modules)
{
imported_modules.push_back(pair.first);
}
}
}
}

View File

@ -3389,7 +3389,7 @@ g_properties[] =
{ "exec-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , nullptr, nullptr, "Executable search paths to use when locating executable files whose paths don't match the local file system." },
{ "debug-file-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , nullptr, nullptr, "List of directories to be searched when locating debug symbol files." },
{ "clang-module-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , nullptr, nullptr, "List of directories to be searched when locating modules for Clang." },
{ "auto-import-clang-modules" , OptionValue::eTypeBoolean , false, false , nullptr, nullptr, "Automatically load Clang modules referred to by the program." },
{ "auto-import-clang-modules" , OptionValue::eTypeBoolean , false, true , nullptr, nullptr, "Automatically load Clang modules referred to by the program." },
{ "max-children-count" , OptionValue::eTypeSInt64 , false, 256 , nullptr, nullptr, "Maximum number of children to expand in any level of depth." },
{ "max-string-summary-length" , OptionValue::eTypeSInt64 , false, 1024 , nullptr, nullptr, "Maximum number of characters to show when using %s in summary strings." },
{ "max-memory-read-size" , OptionValue::eTypeSInt64 , false, 1024 , nullptr, nullptr, "Maximum number of bytes that 'memory read' will fetch before --force must be specified." },