[Lldb-commits] [lldb] r234330 - Fixed a problem where the second @import statement
Sean Callanan
scallanan at apple.com
Tue Apr 7 10:02:02 PDT 2015
Author: spyffe
Date: Tue Apr 7 12:02:02 2015
New Revision: 234330
URL: http://llvm.org/viewvc/llvm-project?rev=234330&view=rev
Log:
Fixed a problem where the second @import statement
in a session would be silently ignored by the compiler
because the compiler looked at its SourceLocation and
decided it had already handled it.
Also updated the relevant test case.
<rdar://problem/20315447>
Modified:
lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp
lldb/trunk/test/lang/objc/modules/TestObjCModules.py
Modified: lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp?rev=234330&r1=234329&r2=234330&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp Tue Apr 7 12:02:02 2015
@@ -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(st
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++)));
}
}
Modified: lldb/trunk/test/lang/objc/modules/TestObjCModules.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/modules/TestObjCModules.py?rev=234330&r1=234329&r2=234330&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/modules/TestObjCModules.py (original)
+++ lldb/trunk/test/lang/objc/modules/TestObjCModules.py Tue Apr 7 12:02:02 2015
@@ -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"])
More information about the lldb-commits
mailing list