summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Expression/ClangModulesDeclVendor.cpp4
-rw-r--r--lldb/test/lang/objc/modules/TestObjCModules.py8
2 files changed, 9 insertions, 3 deletions
diff --git a/lldb/source/Expression/ClangModulesDeclVendor.cpp b/lldb/source/Expression/ClangModulesDeclVendor.cpp
index 1ac5cc9902d..65e886056cd 100644
--- a/lldb/source/Expression/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Expression/ClangModulesDeclVendor.cpp
@@ -80,6 +80,7 @@ namespace {
llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> m_compiler_invocation;
std::unique_ptr<clang::CompilerInstance> m_compiler_instance;
std::unique_ptr<clang::Parser> m_parser;
+ size_t m_source_location_index = 0; // used to give name components fake SourceLocations
};
}
@@ -177,13 +178,12 @@ ClangModulesDeclVendorImpl::AddModule(std::vector<llvm::StringRef> &path,
llvm::SmallVector<std::pair<clang::IdentifierInfo *, clang::SourceLocation>, 4> clang_path;
{
- size_t source_loc_counter = 0;
clang::SourceManager &source_manager = m_compiler_instance->getASTContext().getSourceManager();
for (llvm::StringRef &component : path)
{
clang_path.push_back(std::make_pair(&m_compiler_instance->getASTContext().Idents.get(component),
- source_manager.getLocForStartOfFile(source_manager.getMainFileID()).getLocWithOffset(source_loc_counter++)));
+ source_manager.getLocForStartOfFile(source_manager.getMainFileID()).getLocWithOffset(m_source_location_index++)));
}
}
diff --git a/lldb/test/lang/objc/modules/TestObjCModules.py b/lldb/test/lang/objc/modules/TestObjCModules.py
index b6628774088..0892b91db0f 100644
--- a/lldb/test/lang/objc/modules/TestObjCModules.py
+++ b/lldb/test/lang/objc/modules/TestObjCModules.py
@@ -67,9 +67,15 @@ class ObjCModulesTestCase(TestBase):
self.common_setup()
- self.expect("expr @import Foundation; 3", VARIABLES_DISPLAYED_CORRECTLY,
+ self.expect("expr @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["int", "3"])
+ self.expect("expr getpid()", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["pid_t"])
+
+ self.expect("expr @import Foundation; 4", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["int", "4"])
+
self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["NSUInteger", "5"])
OpenPOWER on IntegriCloud