diff options
| author | Sean Callanan <scallanan@apple.com> | 2015-04-07 17:02:02 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2015-04-07 17:02:02 +0000 |
| commit | 157f1af74328f3ae3e7af29fa80259ab15f20522 (patch) | |
| tree | 607df2f6589f86cd0a44a39cb81451865e1f6ab8 | |
| parent | d382ed25f65ccd282c83fde2160aae798acdedc6 (diff) | |
| download | bcm5719-llvm-157f1af74328f3ae3e7af29fa80259ab15f20522.tar.gz bcm5719-llvm-157f1af74328f3ae3e7af29fa80259ab15f20522.zip | |
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>
llvm-svn: 234330
| -rw-r--r-- | lldb/source/Expression/ClangModulesDeclVendor.cpp | 4 | ||||
| -rw-r--r-- | lldb/test/lang/objc/modules/TestObjCModules.py | 8 |
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"]) |

