From 50b73317314e889cf39c7b1d6cbf419fa7502f22 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 14 Apr 2012 14:01:31 +0000 Subject: Vendor import of clang trunk r154661: http://llvm.org/svn/llvm-project/cfe/trunk@r154661 --- include/clang/Frontend/CompilerInvocation.h | 47 +++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'include/clang/Frontend/CompilerInvocation.h') diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 47c7031..0d2260a 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -14,6 +14,7 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Basic/FileSystemOptions.h" #include "clang/Frontend/AnalyzerOptions.h" +#include "clang/Frontend/MigratorOptions.h" #include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/DependencyOutputOptions.h" #include "clang/Frontend/DiagnosticOptions.h" @@ -30,18 +31,45 @@ namespace clang { +class CompilerInvocation; class DiagnosticsEngine; +namespace driver { +class ArgList; +} + +/// CompilerInvocation - Fill out Opts based on the options given in Args. +/// Args must have been created from the OptTable returned by +/// createCC1OptTable(). When errors are encountered, return false and, +/// if Diags is non-null, report the error(s). +bool ParseDiagnosticArgs(DiagnosticOptions &Opts, driver::ArgList &Args, + DiagnosticsEngine *Diags = 0); + +class CompilerInvocationBase : public RefCountedBase { +protected: + /// Options controlling the language variant. + IntrusiveRefCntPtr LangOpts; +public: + CompilerInvocationBase(); + + CompilerInvocationBase(const CompilerInvocationBase &X); + + LangOptions *getLangOpts() { return LangOpts.getPtr(); } + const LangOptions *getLangOpts() const { return LangOpts.getPtr(); } +}; + /// CompilerInvocation - Helper class for holding the data necessary to invoke /// the compiler. /// /// This class is designed to represent an abstract "invocation" of the /// compiler, including data such as the include paths, the code generation /// options, the warning flags, and so on. -class CompilerInvocation : public llvm::RefCountedBase { +class CompilerInvocation : public CompilerInvocationBase { /// Options controlling the static analyzer. AnalyzerOptions AnalyzerOpts; + MigratorOptions MigratorOpts; + /// Options controlling IRgen and the backend. CodeGenOptions CodeGenOpts; @@ -60,9 +88,6 @@ class CompilerInvocation : public llvm::RefCountedBase { /// Options controlling the #include directive. HeaderSearchOptions HeaderSearchOpts; - /// Options controlling the language variant. - LangOptions LangOpts; - /// Options controlling the preprocessor (aside from #include handling). PreprocessorOptions PreprocessorOpts; @@ -79,13 +104,13 @@ public: /// @{ /// CreateFromArgs - Create a compiler invocation from a list of input - /// options. + /// options. Returns true on success. /// /// \param Res [out] - 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 void CreateFromArgs(CompilerInvocation &Res, + static bool CreateFromArgs(CompilerInvocation &Res, const char* const *ArgBegin, const char* const *ArgEnd, DiagnosticsEngine &Diags); @@ -111,7 +136,7 @@ public: /// \param LangStd - The input language standard. void setLangDefaults(InputKind IK, LangStandard::Kind LangStd = LangStandard::lang_unspecified) { - setLangDefaults(LangOpts, IK, LangStd); + setLangDefaults(*getLangOpts(), IK, LangStd); } /// setLangDefaults - Set language defaults for the given input language and @@ -136,6 +161,11 @@ public: return AnalyzerOpts; } + MigratorOptions &getMigratorOpts() { return MigratorOpts; } + const MigratorOptions &getMigratorOpts() const { + return MigratorOpts; + } + CodeGenOptions &getCodeGenOpts() { return CodeGenOpts; } const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; @@ -166,9 +196,6 @@ public: return FrontendOpts; } - LangOptions &getLangOpts() { return LangOpts; } - const LangOptions &getLangOpts() const { return LangOpts; } - PreprocessorOptions &getPreprocessorOpts() { return PreprocessorOpts; } const PreprocessorOptions &getPreprocessorOpts() const { return PreprocessorOpts; -- cgit v1.1