From a3e2ff19e59c587ea14611eb64400c6d0ecabcee Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 20 Nov 2015 03:36:21 +0000 Subject: [libclang] Make sure to use the raw module format for libclang parsing. Fixes crash when passing '-gmodules' in the compiler options. rdar://23588717 llvm-svn: 253645 --- clang/lib/Frontend/ASTUnit.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/ASTUnit.cpp') diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 6b89447305f..0d5dd536589 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -1934,6 +1934,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( bool CacheCodeCompletionResults, bool IncludeBriefCommentsInCodeCompletion, bool AllowPCHWithCompilerErrors, bool SkipFunctionBodies, bool UserFilesAreVolatile, bool ForSerialization, + llvm::Optional ModuleFormat, std::unique_ptr *ErrAST) { assert(Diags.get() && "no DiagnosticsEngine was provided"); @@ -1967,6 +1968,9 @@ ASTUnit *ASTUnit::LoadFromCommandLine( CI->getFrontendOpts().SkipFunctionBodies = SkipFunctionBodies; + if (ModuleFormat) + CI->getHeaderSearchOpts().ModuleFormat = ModuleFormat.getValue(); + // Create the AST unit. std::unique_ptr AST; AST.reset(new ASTUnit(false)); -- cgit v1.2.3