mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 21:55:39 +08:00
Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.
llvm-svn: 127890
This commit is contained in:
@@ -881,7 +881,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
|
||||
// Configure the various subsystems.
|
||||
// FIXME: Should we retain the previous file manager?
|
||||
FileSystemOpts = Clang.getFileSystemOpts();
|
||||
FileMgr.reset(new FileManager(Clang.getFileSystemOpts()));
|
||||
FileMgr.reset(new FileManager(FileSystemOpts));
|
||||
SourceMgr.reset(new SourceManager(getDiagnostics(), *FileMgr));
|
||||
TheSema.reset();
|
||||
Ctx.reset();
|
||||
@@ -1537,7 +1537,8 @@ ASTUnit *ASTUnit::create(CompilerInvocation *CI,
|
||||
ConfigureDiags(Diags, 0, 0, *AST, /*CaptureDiagnostics=*/false);
|
||||
AST->Diagnostics = Diags;
|
||||
AST->Invocation.reset(CI);
|
||||
AST->FileMgr.reset(new FileManager(CI->getFileSystemOpts()));
|
||||
AST->FileSystemOpts = CI->getFileSystemOpts();
|
||||
AST->FileMgr.reset(new FileManager(AST->FileSystemOpts));
|
||||
AST->SourceMgr.reset(new SourceManager(*Diags, *AST->FileMgr));
|
||||
|
||||
return AST.take();
|
||||
@@ -1706,8 +1707,9 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
|
||||
AST.reset(new ASTUnit(false));
|
||||
ConfigureDiags(Diags, ArgBegin, ArgEnd, *AST, CaptureDiagnostics);
|
||||
AST->Diagnostics = Diags;
|
||||
|
||||
AST->FileMgr.reset(new FileManager(FileSystemOptions()));
|
||||
|
||||
AST->FileSystemOpts = CI->getFileSystemOpts();
|
||||
AST->FileMgr.reset(new FileManager(AST->FileSystemOpts));
|
||||
AST->OnlyLocalDecls = OnlyLocalDecls;
|
||||
AST->CaptureDiagnostics = CaptureDiagnostics;
|
||||
AST->CompleteTranslationUnit = CompleteTranslationUnit;
|
||||
|
||||
@@ -201,7 +201,7 @@ clang_getCompletionAvailability(CXCompletionString completion_string) {
|
||||
/// \brief The CXCodeCompleteResults structure we allocate internally;
|
||||
/// the client only sees the initial CXCodeCompleteResults structure.
|
||||
struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
|
||||
AllocatedCXCodeCompleteResults();
|
||||
AllocatedCXCodeCompleteResults(const FileSystemOptions& FileSystemOpts);
|
||||
~AllocatedCXCodeCompleteResults();
|
||||
|
||||
/// \brief Diagnostics produced while performing code completion.
|
||||
@@ -243,10 +243,12 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
|
||||
/// Used for debugging purposes only.
|
||||
static llvm::sys::cas_flag CodeCompletionResultObjects;
|
||||
|
||||
AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults()
|
||||
AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
|
||||
const FileSystemOptions& FileSystemOpts)
|
||||
: CXCodeCompleteResults(),
|
||||
Diag(new Diagnostic(
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
|
||||
FileSystemOpts(FileSystemOpts),
|
||||
FileMgr(FileSystemOpts),
|
||||
SourceMgr(*Diag, FileMgr) {
|
||||
if (getenv("LIBCLANG_OBJTRACKING")) {
|
||||
@@ -380,7 +382,8 @@ void clang_codeCompleteAt_Impl(void *UserData) {
|
||||
}
|
||||
|
||||
// Parse the resulting source file to find code-completion results.
|
||||
AllocatedCXCodeCompleteResults *Results = new AllocatedCXCodeCompleteResults;
|
||||
AllocatedCXCodeCompleteResults *Results =
|
||||
new AllocatedCXCodeCompleteResults(AST->getFileSystemOpts());
|
||||
Results->Results = 0;
|
||||
Results->NumResults = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user