diff options
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 5 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 24 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 14 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendActions.h | 9 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 51 | ||||
-rw-r--r-- | include/clang/Frontend/LangStandard.h | 117 | ||||
-rw-r--r-- | include/clang/Frontend/LangStandards.def | 188 | ||||
-rw-r--r-- | include/clang/Frontend/Utils.h | 13 |
8 files changed, 58 insertions, 363 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 7fb1d2d93380..a36655150d4e 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -315,7 +315,7 @@ public: CodeCompletionTUInfo &getCodeCompletionTUInfo() { if (!CCTUInfo) - CCTUInfo = llvm::make_unique<CodeCompletionTUInfo>( + CCTUInfo = std::make_unique<CodeCompletionTUInfo>( std::make_shared<GlobalCodeCompletionAllocator>()); return *CCTUInfo; } @@ -390,7 +390,7 @@ private: /// just about any usage. /// Becomes a noop in release mode; only useful for debug mode checking. class ConcurrencyState { - void *Mutex; // a llvm::sys::MutexImpl in debug; + void *Mutex; // a std::recursive_mutex in debug; public: ConcurrencyState(); @@ -832,6 +832,7 @@ public: SkipFunctionBodiesScope::None, bool SingleFileParse = false, bool UserFilesAreVolatile = false, bool ForSerialization = false, + bool RetainExcludedConditionalBlocks = false, llvm::Optional<StringRef> ModuleFormat = llvm::None, std::unique_ptr<ASTUnit> *ErrAST = nullptr, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr); diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index eb49c53ff40b..d15bdc4665a3 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -155,6 +155,12 @@ class CompilerInstance : public ModuleLoader { /// One or more modules failed to build. bool ModuleBuildFailed = false; + /// The stream for verbose output if owned, otherwise nullptr. + std::unique_ptr<raw_ostream> OwnedVerboseOutputStream; + + /// The stream for verbose output. + raw_ostream *VerboseOutputStream = &llvm::errs(); + /// Holds information about the output file. /// /// If TempFilename is not empty we must rename it to Filename at the end. @@ -217,9 +223,6 @@ public: /// \param Act - The action to execute. /// \return - True on success. // - // FIXME: This function should take the stream to write any debugging / - // verbose output to as an argument. - // // FIXME: Eliminate the llvm_shutdown requirement, that should either be part // of the context or else not CompilerInstance specific. bool ExecuteAction(FrontendAction &Act); @@ -350,6 +353,21 @@ public: } /// } + /// @name VerboseOutputStream + /// } + + /// Replace the current stream for verbose output. + void setVerboseOutputStream(raw_ostream &Value); + + /// Replace the current stream for verbose output. + void setVerboseOutputStream(std::unique_ptr<raw_ostream> Value); + + /// Get the current stream for verbose output. + raw_ostream &getVerboseOutputStream() { + return *VerboseOutputStream; + } + + /// } /// @name Target Info /// { diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 413134be4cef..f3253d5b40e3 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -14,13 +14,14 @@ #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" +#include "clang/Basic/LangStandard.h" #include "clang/Frontend/DependencyOutputOptions.h" #include "clang/Frontend/FrontendOptions.h" -#include "clang/Frontend/LangStandard.h" #include "clang/Frontend/MigratorOptions.h" #include "clang/Frontend/PreprocessorOutputOptions.h" #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/ArrayRef.h" #include <memory> #include <string> @@ -147,13 +148,14 @@ public: /// Create a compiler invocation from a list of input options. /// \returns true on success. /// + /// \returns false if an error was encountered while parsing the arguments + /// and attempts to recover and continue parsing the rest of the arguments. + /// The recovery is best-effort and only guarantees that \p Res will end up in + /// one of the vaild-to-access (albeit arbitrary) states. + /// /// \param [out] Res - The resulting invocation. - /// \param ArgBegin - The first element in the argument vector. - /// \param ArgEnd - The last element in the argument vector. - /// \param Diags - The diagnostic engine to use for errors. static bool CreateFromArgs(CompilerInvocation &Res, - const char* const *ArgBegin, - const char* const *ArgEnd, + ArrayRef<const char *> CommandLineArgs, DiagnosticsEngine &Diags); /// Get the directory where the compiler headers diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index 6c7bc6046f33..89ac20075fa4 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -126,14 +126,7 @@ protected: bool hasASTFileSupport() const override { return false; } }; -// Support different interface stub formats this way: -class GenerateInterfaceYAMLExpV1Action : public GenerateInterfaceStubAction { -protected: - std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) override; -}; - -class GenerateInterfaceTBEExpV1Action : public GenerateInterfaceStubAction { +class GenerateInterfaceIfsExpV1Action : public GenerateInterfaceStubAction { protected: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override; diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index a0acb1f066f2..09d83adf579b 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -10,15 +10,16 @@ #define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H #include "clang/AST/ASTDumperUtils.h" +#include "clang/Basic/LangStandard.h" #include "clang/Frontend/CommandLineSourceLoc.h" -#include "clang/Serialization/ModuleFileExtension.h" #include "clang/Sema/CodeCompleteOptions.h" +#include "clang/Serialization/ModuleFileExtension.h" #include "llvm/ADT/StringRef.h" #include <cassert> #include <memory> #include <string> -#include <vector> #include <unordered_map> +#include <vector> namespace llvm { @@ -89,8 +90,7 @@ enum ActionKind { GeneratePCH, /// Generate Interface Stub Files. - GenerateInterfaceYAMLExpV1, - GenerateInterfaceTBEExpV1, + GenerateInterfaceIfsExpV1, /// Only execute frontend initialization. InitOnly, @@ -143,35 +143,11 @@ enum ActionKind { /// The kind of a file that we've been handed as an input. class InputKind { private: - unsigned Lang : 4; + Language Lang; unsigned Fmt : 3; unsigned Preprocessed : 1; public: - /// The language for the input, used to select and validate the language - /// standard and possible actions. - enum Language { - Unknown, - - /// Assembly: we accept this only so that we can preprocess it. - Asm, - - /// LLVM IR: we accept this so that we can run the optimizer on it, - /// and compile it to assembly or object code. - LLVM_IR, - - ///@{ Languages that the frontend can parse and compile. - C, - CXX, - ObjC, - ObjCXX, - OpenCL, - CUDA, - RenderScript, - HIP, - ///@} - }; - /// The input file format. enum Format { Source, @@ -179,7 +155,7 @@ public: Precompiled }; - constexpr InputKind(Language L = Unknown, Format F = Source, + constexpr InputKind(Language L = Language::Unknown, Format F = Source, bool PP = false) : Lang(L), Fmt(F), Preprocessed(PP) {} @@ -188,10 +164,12 @@ public: bool isPreprocessed() const { return Preprocessed; } /// Is the input kind fully-unknown? - bool isUnknown() const { return Lang == Unknown && Fmt == Source; } + bool isUnknown() const { return Lang == Language::Unknown && Fmt == Source; } /// Is the language of the input some dialect of Objective-C? - bool isObjectiveC() const { return Lang == ObjC || Lang == ObjCXX; } + bool isObjectiveC() const { + return Lang == Language::ObjC || Lang == Language::ObjCXX; + } InputKind getPreprocessed() const { return InputKind(getLanguage(), getFormat(), true); @@ -451,6 +429,9 @@ public: /// Filename to write statistics to. std::string StatsFile; + /// Minimum time granularity (in microseconds) traced by time profiler. + unsigned TimeTraceGranularity; + public: FrontendOptions() : DisableFree(false), RelocatablePCH(false), ShowHelp(false), @@ -461,12 +442,12 @@ public: UseGlobalModuleIndex(true), GenerateGlobalModuleIndex(true), ASTDumpDecls(false), ASTDumpLookups(false), BuildingImplicitModule(false), ModulesEmbedAllFiles(false), - IncludeTimestamps(true) {} + IncludeTimestamps(true), TimeTraceGranularity(500) {} /// getInputKindForExtension - Return the appropriate input kind for a file - /// extension. For example, "c" would return InputKind::C. + /// extension. For example, "c" would return Language::C. /// - /// \return The input kind for the extension, or InputKind::Unknown if the + /// \return The input kind for the extension, or Language::Unknown if the /// extension is not recognized. static InputKind getInputKindForExtension(StringRef Extension); }; diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h deleted file mode 100644 index 244f14c793de..000000000000 --- a/include/clang/Frontend/LangStandard.h +++ /dev/null @@ -1,117 +0,0 @@ -//===--- LangStandard.h -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H -#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H - -#include "clang/Basic/LLVM.h" -#include "clang/Frontend/FrontendOptions.h" -#include "llvm/ADT/StringRef.h" - -namespace clang { - -namespace frontend { - -enum LangFeatures { - LineComment = (1 << 0), - C99 = (1 << 1), - C11 = (1 << 2), - C17 = (1 << 3), - C2x = (1 << 4), - CPlusPlus = (1 << 5), - CPlusPlus11 = (1 << 6), - CPlusPlus14 = (1 << 7), - CPlusPlus17 = (1 << 8), - CPlusPlus2a = (1 << 9), - Digraphs = (1 << 10), - GNUMode = (1 << 11), - HexFloat = (1 << 12), - ImplicitInt = (1 << 13), - OpenCL = (1 << 14) -}; - -} - -/// LangStandard - Information about the properties of a particular language -/// standard. -struct LangStandard { - enum Kind { -#define LANGSTANDARD(id, name, lang, desc, features) \ - lang_##id, -#include "clang/Frontend/LangStandards.def" - lang_unspecified - }; - - const char *ShortName; - const char *Description; - unsigned Flags; - InputKind::Language Language; - -public: - /// getName - Get the name of this standard. - const char *getName() const { return ShortName; } - - /// getDescription - Get the description of this standard. - const char *getDescription() const { return Description; } - - /// Get the language that this standard describes. - InputKind::Language getLanguage() const { return Language; } - - /// Language supports '//' comments. - bool hasLineComments() const { return Flags & frontend::LineComment; } - - /// isC99 - Language is a superset of C99. - bool isC99() const { return Flags & frontend::C99; } - - /// isC11 - Language is a superset of C11. - bool isC11() const { return Flags & frontend::C11; } - - /// isC17 - Language is a superset of C17. - bool isC17() const { return Flags & frontend::C17; } - - /// isC2x - Language is a superset of C2x. - bool isC2x() const { return Flags & frontend::C2x; } - - /// isCPlusPlus - Language is a C++ variant. - bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; } - - /// isCPlusPlus11 - Language is a C++11 variant (or later). - bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; } - - /// isCPlusPlus14 - Language is a C++14 variant (or later). - bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; } - - /// isCPlusPlus17 - Language is a C++17 variant (or later). - bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; } - - /// isCPlusPlus2a - Language is a post-C++17 variant (or later). - bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; } - - - /// hasDigraphs - Language supports digraphs. - bool hasDigraphs() const { return Flags & frontend::Digraphs; } - - /// isGNUMode - Language includes GNU extensions. - bool isGNUMode() const { return Flags & frontend::GNUMode; } - - /// hasHexFloats - Language supports hexadecimal float constants. - bool hasHexFloats() const { return Flags & frontend::HexFloat; } - - /// hasImplicitInt - Language allows variables to be typed as int implicitly. - bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; } - - /// isOpenCL - Language is a OpenCL variant. - bool isOpenCL() const { return Flags & frontend::OpenCL; } - - static const LangStandard &getLangStandardForKind(Kind K); - static const LangStandard *getLangStandardForName(StringRef Name); -}; - -} // end namespace clang - -#endif diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def deleted file mode 100644 index 0964e9b90a03..000000000000 --- a/include/clang/Frontend/LangStandards.def +++ /dev/null @@ -1,188 +0,0 @@ -//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LANGSTANDARD -#error "LANGSTANDARD must be defined before including this file" -#endif - -/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES) -/// -/// \param IDENT - The name of the standard as a C++ identifier. -/// \param NAME - The name of the standard. -/// \param LANG - The InputKind::Language for which this is a standard. -/// \param DESC - A short description of the standard. -/// \param FEATURES - The standard features as flags, these are enums from the -/// clang::frontend namespace, which is assumed to be be available. - -/// LANGSTANDARD_ALIAS(IDENT, ALIAS) -/// \param IDENT - The name of the standard as a C++ identifier. -/// \param ALIAS - The alias of the standard. - -/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) -/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias. - -#ifndef LANGSTANDARD_ALIAS -#define LANGSTANDARD_ALIAS(IDENT, ALIAS) -#endif - -#ifndef LANGSTANDARD_ALIAS_DEPR -#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS) -#endif - -// C89-ish modes. -LANGSTANDARD(c89, "c89", - C, "ISO C 1990", - ImplicitInt) -LANGSTANDARD_ALIAS(c89, "c90") -LANGSTANDARD_ALIAS(c89, "iso9899:1990") - -LANGSTANDARD(c94, "iso9899:199409", - C, "ISO C 1990 with amendment 1", - Digraphs | ImplicitInt) - -LANGSTANDARD(gnu89, "gnu89", - C, "ISO C 1990 with GNU extensions", - LineComment | Digraphs | GNUMode | ImplicitInt) -LANGSTANDARD_ALIAS(gnu89, "gnu90") - -// C99-ish modes -LANGSTANDARD(c99, "c99", - C, "ISO C 1999", - LineComment | C99 | Digraphs | HexFloat) -LANGSTANDARD_ALIAS(c99, "iso9899:1999") -LANGSTANDARD_ALIAS_DEPR(c99, "c9x") -LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x") - -LANGSTANDARD(gnu99, "gnu99", - C, "ISO C 1999 with GNU extensions", - LineComment | C99 | Digraphs | GNUMode | HexFloat) -LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x") - -// C11 modes -LANGSTANDARD(c11, "c11", - C, "ISO C 2011", - LineComment | C99 | C11 | Digraphs | HexFloat) -LANGSTANDARD_ALIAS(c11, "iso9899:2011") -LANGSTANDARD_ALIAS_DEPR(c11, "c1x") -LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x") - -LANGSTANDARD(gnu11, "gnu11", - C, "ISO C 2011 with GNU extensions", - LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat) -LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x") - -// C17 modes -LANGSTANDARD(c17, "c17", - C, "ISO C 2017", - LineComment | C99 | C11 | C17 | Digraphs | HexFloat) -LANGSTANDARD_ALIAS(c17, "iso9899:2017") -LANGSTANDARD_ALIAS(c17, "c18") -LANGSTANDARD_ALIAS(c17, "iso9899:2018") -LANGSTANDARD(gnu17, "gnu17", - C, "ISO C 2017 with GNU extensions", - LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat) -LANGSTANDARD_ALIAS(gnu17, "gnu18") - -// C2x modes -LANGSTANDARD(c2x, "c2x", - C, "Working Draft for ISO C2x", - LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat) -LANGSTANDARD(gnu2x, "gnu2x", - C, "Working Draft for ISO C2x with GNU extensions", - LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat) - -// C++ modes -LANGSTANDARD(cxx98, "c++98", - CXX, "ISO C++ 1998 with amendments", - LineComment | CPlusPlus | Digraphs) -LANGSTANDARD_ALIAS(cxx98, "c++03") - -LANGSTANDARD(gnucxx98, "gnu++98", - CXX, "ISO C++ 1998 with amendments and GNU extensions", - LineComment | CPlusPlus | Digraphs | GNUMode) -LANGSTANDARD_ALIAS(gnucxx98, "gnu++03") - -LANGSTANDARD(cxx11, "c++11", - CXX, "ISO C++ 2011 with amendments", - LineComment | CPlusPlus | CPlusPlus11 | Digraphs) -LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x") - -LANGSTANDARD(gnucxx11, "gnu++11", CXX, - "ISO C++ 2011 with amendments and GNU extensions", - LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode) -LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x") - -LANGSTANDARD(cxx14, "c++14", - CXX, "ISO C++ 2014 with amendments", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs) -LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y") - -LANGSTANDARD(gnucxx14, "gnu++14", - CXX, "ISO C++ 2014 with amendments and GNU extensions", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs | - GNUMode) -LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y") - -LANGSTANDARD(cxx17, "c++17", - CXX, "ISO C++ 2017 with amendments", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | - Digraphs | HexFloat) -LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z") - -LANGSTANDARD(gnucxx17, "gnu++17", - CXX, "ISO C++ 2017 with amendments and GNU extensions", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | - Digraphs | HexFloat | GNUMode) -LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z") - -LANGSTANDARD(cxx2a, "c++2a", - CXX, "Working draft for ISO C++ 2020", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | - CPlusPlus2a | Digraphs | HexFloat) - -LANGSTANDARD(gnucxx2a, "gnu++2a", - CXX, "Working draft for ISO C++ 2020 with GNU extensions", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | - CPlusPlus2a | Digraphs | HexFloat | GNUMode) - -// OpenCL -LANGSTANDARD(opencl10, "cl1.0", - OpenCL, "OpenCL 1.0", - LineComment | C99 | Digraphs | HexFloat | OpenCL) -LANGSTANDARD_ALIAS_DEPR(opencl10, "cl") - -LANGSTANDARD(opencl11, "cl1.1", - OpenCL, "OpenCL 1.1", - LineComment | C99 | Digraphs | HexFloat | OpenCL) -LANGSTANDARD(opencl12, "cl1.2", - OpenCL, "OpenCL 1.2", - LineComment | C99 | Digraphs | HexFloat | OpenCL) -LANGSTANDARD(opencl20, "cl2.0", - OpenCL, "OpenCL 2.0", - LineComment | C99 | Digraphs | HexFloat | OpenCL) -LANGSTANDARD(openclcpp, "c++", - OpenCL, "C++ for OpenCL", - LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 | - Digraphs | HexFloat | OpenCL) - -LANGSTANDARD_ALIAS_DEPR(opencl10, "CL") -LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1") -LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2") -LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0") - -// CUDA -LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)", - LineComment | CPlusPlus | Digraphs) - -// HIP -LANGSTANDARD(hip, "hip", HIP, "HIP", - LineComment | CPlusPlus | Digraphs) - -#undef LANGSTANDARD -#undef LANGSTANDARD_ALIAS -#undef LANGSTANDARD_ALIAS_DEPR diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 74e563218c31..0f9b17ee5089 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -99,11 +99,11 @@ public: /// Return true if system files should be passed to sawDependency(). virtual bool needSystemDependencies() { return false; } - // implementation detail /// Add a dependency \p Filename if it has not been seen before and /// sawDependency() returns true. - void maybeAddDependency(StringRef Filename, bool FromModule, bool IsSystem, - bool IsModuleFile, bool IsMissing); + virtual void maybeAddDependency(StringRef Filename, bool FromModule, + bool IsSystem, bool IsModuleFile, + bool IsMissing); protected: /// Return true if the filename was added to the list of dependencies, false @@ -213,13 +213,18 @@ createChainedIncludesSource(CompilerInstance &CI, /// createInvocationFromCommandLine - Construct a compiler invocation object for /// a command line argument vector. /// +/// \param ShouldRecoverOnErrors - whether we should attempt to return a +/// non-null (and possibly incorrect) CompilerInvocation if any errors were +/// encountered. When this flag is false, always return null on errors. +/// /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. std::unique_ptr<CompilerInvocation> createInvocationFromCommandLine( ArrayRef<const char *> Args, IntrusiveRefCntPtr<DiagnosticsEngine> Diags = IntrusiveRefCntPtr<DiagnosticsEngine>(), - IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr); + IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr, + bool ShouldRecoverOnErrors = false); /// Return the value of the last argument as an integer, or a default. If Diags /// is non-null, emits an error if the argument is given, but non-integral. |