From: Argyrios Kyrtzidis Date: Mon, 21 Jan 2013 18:45:42 +0000 (+0000) Subject: [ASTUnit] Unlike LoadFromCommandLine, LoadFromCompilerInvocation causes a crash if... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb8fc58241e1781a77c958764e16a4c402e4d707;p=clang [ASTUnit] Unlike LoadFromCommandLine, LoadFromCompilerInvocation causes a crash if Precompilepreamble is set to true because there is no FileManager at that point. Patch by Hurcan Solter! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173071 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 9ab3a8faba..4feaad81e6 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -1912,6 +1912,8 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, AST->IncludeBriefCommentsInCodeCompletion = IncludeBriefCommentsInCodeCompletion; AST->Invocation = CI; + AST->FileSystemOpts = CI->getFileSystemOpts(); + AST->FileMgr = new FileManager(AST->FileSystemOpts); AST->UserFilesAreVolatile = UserFilesAreVolatile; // Recover resources if we crash before exiting this method.