//===--- CompilerInstance.cpp ---------------------------------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===//#include"clang/Frontend/CompilerInstance.h"#include"clang/AST/ASTConsumer.h"#include"clang/AST/ASTContext.h"#include"clang/AST/Decl.h"#include"clang/Basic/Diagnostic.h"#include"clang/Basic/FileManager.h"#include"clang/Basic/SourceManager.h"#include"clang/Basic/TargetInfo.h"#include"clang/Basic/Version.h"#include"clang/Frontend/ChainedDiagnosticConsumer.h"#include"clang/Frontend/FrontendAction.h"#include"clang/Frontend/FrontendActions.h"#include"clang/Frontend/FrontendDiagnostic.h"#include"clang/Frontend/LogDiagnosticPrinter.h"#include"clang/Frontend/SerializedDiagnosticPrinter.h"#include"clang/Frontend/TextDiagnosticPrinter.h"#include"clang/Frontend/Utils.h"#include"clang/Frontend/VerifyDiagnosticConsumer.h"#include"clang/Lex/HeaderSearch.h"#include"clang/Lex/PTHManager.h"#include"clang/Lex/Preprocessor.h"#include"clang/Sema/CodeCompleteConsumer.h"#include"clang/Sema/Sema.h"#include"clang/Serialization/ASTReader.h"#include"llvm/ADT/Statistic.h"#include"llvm/Config/config.h"#include"llvm/Support/CrashRecoveryContext.h"#include"llvm/Support/FileSystem.h"#include"llvm/Support/Host.h"#include"llvm/Support/LockFileManager.h"#include"llvm/Support/MemoryBuffer.h"#include"llvm/Support/Path.h"#include"llvm/Support/Program.h"#include"llvm/Support/Signals.h"#include"llvm/Support/Timer.h"#include"llvm/Support/raw_ostream.h"#include"llvm/Support/system_error.h"#include<sys/stat.h>#include<time.h>usingnamespaceclang;CompilerInstance::CompilerInstance():Invocation(newCompilerInvocation()),ModuleManager(0),BuildGlobalModuleIndex(false),ModuleBuildFailed(false){}CompilerInstance::~CompilerInstance(){assert(OutputFiles.empty()&&"Still output files in flight?");}voidCompilerInstance::setInvocation(CompilerInvocation*Value){Invocation=Value;}boolCompilerInstance::shouldBuildGlobalModuleIndex()const{return(BuildGlobalModuleIndex||(ModuleManager&&ModuleManager->isGlobalIndexUnavailable()&&getFrontendOpts(