diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-04-15 18:16:25 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-04-15 18:16:25 +0000 |
commit | 426bfa0c4555cc2b415f1a607252c373a69f3197 (patch) | |
tree | 23d5ae28c713f118b0b1000c7106816b3c05e5e8 /tools/libclang/CIndexCodeCompletion.cpp | |
parent | 258f1c35116abc057b5cd8139736bdb385cc29c1 (diff) | |
download | clang-426bfa0c4555cc2b415f1a607252c373a69f3197.tar.gz clang-426bfa0c4555cc2b415f1a607252c373a69f3197.tar.bz2 clang-426bfa0c4555cc2b415f1a607252c373a69f3197.tar.xz |
Honour -ivfsoverlay in ASTUnit to match clang
This allows code indexing, etc. to use the VFS in the same way as the
compiler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r-- | tools/libclang/CIndexCodeCompletion.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 591294599d..23fdf93b76 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -249,7 +249,7 @@ namespace { /// AllocatedCXCodeCompleteResults outlives the CXTranslationUnit, so we can /// not rely on the StringPool in the TU. struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { - AllocatedCXCodeCompleteResults(const FileSystemOptions& FileSystemOpts); + AllocatedCXCodeCompleteResults(IntrusiveRefCntPtr<FileManager> FileMgr); ~AllocatedCXCodeCompleteResults(); /// \brief Diagnostics produced while performing code completion. @@ -263,8 +263,6 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { /// \brief Language options used to adjust source locations. LangOptions LangOpts; - FileSystemOptions FileSystemOpts; - /// \brief File manager, used for diagnostics. IntrusiveRefCntPtr<FileManager> FileMgr; @@ -318,20 +316,15 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { static std::atomic<unsigned> CodeCompletionResultObjects; AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults( - const FileSystemOptions& FileSystemOpts) - : CXCodeCompleteResults(), - DiagOpts(new DiagnosticOptions), - Diag(new DiagnosticsEngine( - IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), - &*DiagOpts)), - FileSystemOpts(FileSystemOpts), - FileMgr(new FileManager(FileSystemOpts)), - SourceMgr(new SourceManager(*Diag, *FileMgr)), - CodeCompletionAllocator(new clang::GlobalCodeCompletionAllocator), - Contexts(CXCompletionContext_Unknown), - ContainerKind(CXCursor_InvalidCode), - ContainerIsIncomplete(1) -{ + IntrusiveRefCntPtr<FileManager> FileMgr) + : CXCodeCompleteResults(), + DiagOpts(new DiagnosticOptions), + Diag(new DiagnosticsEngine( + IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts)), + FileMgr(FileMgr), SourceMgr(new SourceManager(*Diag, *FileMgr)), + CodeCompletionAllocator(new clang::GlobalCodeCompletionAllocator), + Contexts(CXCompletionContext_Unknown), + ContainerKind(CXCursor_InvalidCode), ContainerIsIncomplete(1) { if (getenv("LIBCLANG_OBJTRACKING")) fprintf(stderr, "+++ %u completion results\n", ++CodeCompletionResultObjects); @@ -709,8 +702,8 @@ void clang_codeCompleteAt_Impl(void *UserData) { } // Parse the resulting source file to find code-completion results. - AllocatedCXCodeCompleteResults *Results = - new AllocatedCXCodeCompleteResults(AST->getFileSystemOpts()); + AllocatedCXCodeCompleteResults *Results = new AllocatedCXCodeCompleteResults( + &AST->getFileManager()); Results->Results = 0; Results->NumResults = 0; |