diff options
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/ASTConsumers.h | 9 | ||||
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 14 | ||||
-rw-r--r-- | include/clang/Frontend/CodeGenOptions.def | 14 | ||||
-rw-r--r-- | include/clang/Frontend/CodeGenOptions.h | 12 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 36 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 15 | ||||
-rw-r--r-- | include/clang/Frontend/DependencyOutputOptions.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 10 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendActions.h | 10 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendDiagnostic.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 33 | ||||
-rw-r--r-- | include/clang/Frontend/TextDiagnostic.h | 3 | ||||
-rw-r--r-- | include/clang/Frontend/Utils.h | 23 |
13 files changed, 132 insertions, 51 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index 3731478..366c499 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -16,9 +16,6 @@ #include "clang/Basic/LLVM.h" -namespace llvm { - namespace sys { class Path; } -} namespace clang { class ASTConsumer; @@ -37,16 +34,12 @@ ASTConsumer *CreateASTPrinter(raw_ostream *OS, StringRef FilterString); // AST dumper: dumps the raw AST in human-readable form to stderr; this is // intended for debugging. -ASTConsumer *CreateASTDumper(StringRef FilterString); +ASTConsumer *CreateASTDumper(StringRef FilterString, bool DumpLookups = false); // AST Decl node lister: prints qualified names of all filterable AST Decl // nodes. ASTConsumer *CreateASTDeclNodeLister(); -// AST XML-dumper: dumps out the AST to stderr in a very detailed XML -// format; this is intended for particularly intense debugging. -ASTConsumer *CreateASTDumperXML(raw_ostream &OS); - // Graphical AST viewer: for each function definition, creates a graph of // the AST and displays it with the graph viewer "dotty". Also outputs // function declarations to stderr. diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 02c57d7..43d77f0 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -25,7 +25,6 @@ #include "clang/Lex/ModuleLoader.h" #include "clang/Lex/PreprocessingRecord.h" #include "clang/Sema/CodeCompleteConsumer.h" -#include "clang/Sema/Sema.h" #include "clang/Serialization/ASTBitCodes.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/OwningPtr.h" @@ -44,6 +43,7 @@ namespace llvm { } namespace clang { +class Sema; class ASTContext; class ASTReader; class CodeCompleteConsumer; @@ -75,6 +75,7 @@ private: IntrusiveRefCntPtr<TargetOptions> TargetOpts; IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts; ASTReader *Reader; + bool HadModuleLoaderFatalFailure; struct ASTWriterData; OwningPtr<ASTWriterData> WriterData; @@ -456,7 +457,7 @@ public: void setASTContext(ASTContext *ctx) { Ctx = ctx; } void setPreprocessor(Preprocessor *pp); - bool hasSema() const { return TheSema; } + bool hasSema() const { return TheSema.isValid(); } Sema &getSema() const { assert(TheSema && "ASTUnit does not have a Sema object!"); return *TheSema; @@ -471,13 +472,14 @@ public: return OriginalSourceFile; } + ASTMutationListener *getASTMutationListener(); ASTDeserializationListener *getDeserializationListener(); /// \brief Add a temporary file that the ASTUnit depends on. /// /// This file will be erased when the ASTUnit is destroyed. - void addTemporaryFile(const llvm::sys::Path &TempFile); - + void addTemporaryFile(StringRef TempFile); + bool getOnlyLocalDecls() const { return OnlyLocalDecls; } bool getOwnsRemappedFileBuffers() const { return OwnsRemappedFileBuffers; } @@ -697,10 +699,10 @@ public: /// lifetime is expected to extend past that of the returned ASTUnit. /// /// \param Action - The ASTFrontendAction to invoke. Its ownership is not - /// transfered. + /// transferred. /// /// \param Unit - optionally an already created ASTUnit. Its ownership is not - /// transfered. + /// transferred. /// /// \param Persistent - if true the returned ASTUnit will be complete. /// false means the caller is only interested in getting info through the diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index f6e2472..78b825d 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -39,11 +39,12 @@ CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker ///< aliases to base ctors when possible. CODEGENOPT(DataSections , 1, 0) ///< Set when -fdata-sections is enabled. CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is enabled. +CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory. +CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing. CODEGENOPT(DisableLLVMOpts , 1, 0) ///< Don't run any optimizations, for use in ///< getting .bc files that correspond to the ///< internal state before optimizations are ///< done. -CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing. CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled. CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls. CODEGENOPT(EmitDeclMetadata , 1, 0) ///< Emit special metadata indicating what @@ -85,6 +86,10 @@ CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer ///< enabled. VALUE_CODEGENOPT(OptimizationLevel, 3, 0) ///< The -O[0-4] option specified. VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified. + + /// If -fpcc-struct-return or -freg-struct-return is specified. +ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Default) + CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions. CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled. CODEGENOPT(StructPathTBAA , 1, 0) ///< Whether or not to use struct-path TBAA. @@ -102,8 +107,12 @@ CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report is enabled. CODEGENOPT(UnitAtATime , 1, 1) ///< Unused. For mirroring GCC optimization ///< selection. CODEGENOPT(UnrollLoops , 1, 0) ///< Control whether loops are unrolled. +CODEGENOPT(RerollLoops , 1, 0) ///< Control whether loops are rerolled. CODEGENOPT(UnsafeFPMath , 1, 0) ///< Allow unsafe floating point optzns. CODEGENOPT(UnwindTables , 1, 0) ///< Emit unwind tables. +CODEGENOPT(VectorizeBB , 1, 0) ///< Run basic block vectorizer. +CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer. +CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer. /// Attempt to use register sized accesses to bit-fields in structures, when /// possible. @@ -131,6 +140,9 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0) /// The kind of generated debug info. ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 2, NoDebugInfo) +/// Dwarf version. +VALUE_CODEGENOPT(DwarfVersion, 3, 0) + /// The kind of inlining to perform. ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining) diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h index db6b418..86aabf7 100644 --- a/include/clang/Frontend/CodeGenOptions.h +++ b/include/clang/Frontend/CodeGenOptions.h @@ -71,6 +71,12 @@ public: FPC_Fast // Aggressively fuse FP ops (E.g. FMA). }; + enum StructReturnConventionKind { + SRCK_Default, // No special option was passed. + SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return). + SRCK_InRegs // Small structs in registers (-freg-struct-return). + }; + /// The code model to use (-mcmodel). std::string CodeModel; @@ -122,6 +128,12 @@ public: /// A list of command-line options to forward to the LLVM backend. std::vector<std::string> BackendOptions; + /// A list of dependent libraries. + std::vector<std::string> DependentLibraries; + + /// Name of the profile file to use with -fprofile-sample-use. + std::string SampleProfileFile; + public: // Define accessors/mutators for code generation options of enumeration type. #define CODEGENOPT(Name, Bits, Default) diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index dbd7606..5673c59 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -395,7 +395,7 @@ public: /// @name ASTConsumer /// { - bool hasASTConsumer() const { return Consumer != 0; } + bool hasASTConsumer() const { return Consumer.isValid(); } ASTConsumer &getASTConsumer() const { assert(Consumer && "Compiler instance has no AST consumer!"); @@ -413,7 +413,7 @@ public: /// } /// @name Semantic analysis /// { - bool hasSema() const { return TheSema != 0; } + bool hasSema() const { return TheSema.isValid(); } Sema &getSema() const { assert(TheSema && "Compiler instance has no Sema object!"); @@ -433,7 +433,9 @@ public: /// @name Code Completion /// { - bool hasCodeCompletionConsumer() const { return CompletionConsumer != 0; } + bool hasCodeCompletionConsumer() const { + return CompletionConsumer.isValid(); + } CodeCompleteConsumer &getCodeCompletionConsumer() const { assert(CompletionConsumer && @@ -455,7 +457,7 @@ public: /// @name Frontend timer /// { - bool hasFrontendTimer() const { return FrontendTimer != 0; } + bool hasFrontendTimer() const { return FrontendTimer.isValid(); } llvm::Timer &getFrontendTimer() const { assert(FrontendTimer && "Compiler instance has no frontend timer!"); @@ -589,10 +591,10 @@ public: /// \return - Null on error. llvm::raw_fd_ostream * createOutputFile(StringRef OutputPath, - bool Binary = true, bool RemoveFileOnSignal = true, - StringRef BaseInput = "", - StringRef Extension = "", - bool UseTemporary = false, + bool Binary, bool RemoveFileOnSignal, + StringRef BaseInput, + StringRef Extension, + bool UseTemporary, bool CreateMissingDirectories = false); /// Create a new output file, optionally deriving the output path name. @@ -622,13 +624,13 @@ public: /// will be stored here on success. static llvm::raw_fd_ostream * createOutputFile(StringRef OutputPath, std::string &Error, - bool Binary = true, bool RemoveFileOnSignal = true, - StringRef BaseInput = "", - StringRef Extension = "", - bool UseTemporary = false, - bool CreateMissingDirectories = false, - std::string *ResultPathName = 0, - std::string *TempPathName = 0); + bool Binary, bool RemoveFileOnSignal, + StringRef BaseInput, + StringRef Extension, + bool UseTemporary, + bool CreateMissingDirectories, + std::string *ResultPathName, + std::string *TempPathName); /// } /// @name Initialization Utility Methods @@ -662,6 +664,10 @@ public: SourceLocation ImportLoc, bool Complain); + bool hadModuleLoaderFatalFailure() const { + return ModuleLoader::HadFatalFailure; + } + }; } // end namespace clang diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index fac05c5..f64773c 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -29,15 +29,16 @@ #include <string> #include <vector> -namespace clang { +namespace llvm { +namespace opt { +class ArgList; +} +} +namespace clang { class CompilerInvocation; class DiagnosticsEngine; -namespace driver { -class ArgList; -} - /// \brief Fill out Opts based on the options given in Args. /// /// Args must have been created from the OptTable returned by @@ -45,9 +46,9 @@ class ArgList; /// /// When errors are encountered, return false and, if Diags is non-null, /// report the error(s). -bool ParseDiagnosticArgs(DiagnosticOptions &Opts, driver::ArgList &Args, +bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags = 0); - + class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> { protected: /// Options controlling the language variant. diff --git a/include/clang/Frontend/DependencyOutputOptions.h b/include/clang/Frontend/DependencyOutputOptions.h index 83976c3..fefb6f3 100644 --- a/include/clang/Frontend/DependencyOutputOptions.h +++ b/include/clang/Frontend/DependencyOutputOptions.h @@ -25,6 +25,7 @@ public: /// dependency, which can avoid some 'make' /// problems. unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list + unsigned PrintShowIncludes : 1; ///< Print cl.exe style /showIncludes info. /// The file to write dependency output to. std::string OutputFile; @@ -48,6 +49,7 @@ public: ShowHeaderIncludes = 0; UsePhonyTargets = 0; AddMissingHeaderDeps = 0; + PrintShowIncludes = 0; } }; diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index c67be92..a568ba0 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -94,6 +94,14 @@ protected: /// BeginSourceFileAction (and BeginSourceFile). virtual void EndSourceFileAction() {} + /// \brief Callback at the end of processing a single input, to determine + /// if the output files should be erased or not. + /// + /// By default it returns true if a compiler error occurred. + /// This is guaranteed to only be called following a successful call to + /// BeginSourceFileAction (and BeginSourceFile). + virtual bool shouldEraseOutputFiles(); + /// @} public: @@ -116,7 +124,7 @@ public: bool isCurrentFileAST() const { assert(!CurrentInput.isEmpty() && "No current file!"); - return CurrentASTUnit != 0; + return CurrentASTUnit.isValid(); } const FrontendInputFile &getCurrentInput() const { diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index 1786190..f3d1276 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -56,12 +56,6 @@ protected: StringRef InFile); }; -class ASTDumpXMLAction : public ASTFrontendAction { -protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); -}; - class ASTViewAction : public ASTFrontendAction { protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, @@ -99,6 +93,7 @@ public: class GenerateModuleAction : public ASTFrontendAction { clang::Module *Module; + bool IsSystem; protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, @@ -111,6 +106,9 @@ protected: virtual bool hasASTFileSupport() const { return false; } public: + explicit GenerateModuleAction(bool IsSystem = false) + : ASTFrontendAction(), IsSystem(IsSystem) { } + virtual bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename); /// \brief Compute the AST consumer arguments that will be used to diff --git a/include/clang/Frontend/FrontendDiagnostic.h b/include/clang/Frontend/FrontendDiagnostic.h index 0b05b74..312dbf1 100644 --- a/include/clang/Frontend/FrontendDiagnostic.h +++ b/include/clang/Frontend/FrontendDiagnostic.h @@ -16,7 +16,7 @@ namespace clang { namespace diag { enum { #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, + SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, #define FRONTENDSTART #include "clang/Basic/DiagnosticFrontendKinds.inc" #undef DIAG diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 234e344..4b321e8 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -26,7 +26,6 @@ namespace frontend { enum ActionKind { ASTDeclList, ///< Parse ASTs and list Decl nodes. ASTDump, ///< Parse ASTs and dump them. - ASTDumpXML, ///< Parse ASTs and dump them in XML. ASTPrint, ///< Parse ASTs and print them. ASTView, ///< Parse ASTs and view them in Graphviz. DumpRawTokens, ///< Dump out raw tokens. @@ -142,6 +141,8 @@ public: ///< global module index if available. unsigned GenerateGlobalModuleIndex : 1; ///< Whether we can generate the ///< global module index if needed. + unsigned ASTDumpLookups : 1; ///< Whether we include lookup table + ///< dumps in AST dumps. CodeCompleteOptions CodeCompleteOpts; @@ -157,9 +158,35 @@ public: /// \brief Enable migration to modern ObjC literals. ObjCMT_Literals = 0x1, /// \brief Enable migration to modern ObjC subscripting. - ObjCMT_Subscripting = 0x2 + ObjCMT_Subscripting = 0x2, + /// \brief Enable migration to modern ObjC readonly property. + ObjCMT_ReadonlyProperty = 0x4, + /// \brief Enable migration to modern ObjC readwrite property. + ObjCMT_ReadwriteProperty = 0x8, + /// \brief Enable migration to modern ObjC property. + ObjCMT_Property = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty), + /// \brief Enable annotation of ObjCMethods of all kinds. + ObjCMT_Annotation = 0x10, + /// \brief Enable migration of ObjC methods to 'instancetype'. + ObjCMT_Instancetype = 0x20, + /// \brief Enable migration to NS_ENUM/NS_OPTIONS macros. + ObjCMT_NsMacros = 0x40, + /// \brief Enable migration to add conforming protocols. + ObjCMT_ProtocolConformance = 0x80, + /// \brief prefer 'atomic' property over 'nonatomic'. + ObjCMT_AtomicProperty = 0x100, + /// \brief annotate property with NS_RETURNS_INNER_POINTER + ObjCMT_ReturnsInnerPointerProperty = 0x200, + /// \brief use NS_NONATOMIC_IOSONLY for property 'atomic' attribute + ObjCMT_NsAtomicIOSOnlyProperty = 0x400, + ObjCMT_MigrateDecls = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty | + ObjCMT_Annotation | ObjCMT_Instancetype | + ObjCMT_NsMacros | ObjCMT_ProtocolConformance | + ObjCMT_NsAtomicIOSOnlyProperty), + ObjCMT_MigrateAll = (ObjCMT_Literals | ObjCMT_Subscripting | ObjCMT_MigrateDecls) }; unsigned ObjCMTAction; + std::string ObjCMTWhiteListPath; std::string MTMigrateDir; std::string ARCMTMigrateReportOut; @@ -215,7 +242,7 @@ public: FixWhatYouCan(false), FixOnlyWarnings(false), FixAndRecompile(false), FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false), SkipFunctionBodies(false), UseGlobalModuleIndex(true), - GenerateGlobalModuleIndex(true), + GenerateGlobalModuleIndex(true), ASTDumpLookups(false), ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None), ProgramAction(frontend::ParseSyntaxOnly) {} diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index 656aa57..c8d01b0 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -51,7 +51,8 @@ public: /// TextDiagnostic logic requires. static void printDiagnosticLevel(raw_ostream &OS, DiagnosticsEngine::Level Level, - bool ShowColors); + bool ShowColors, + bool CLFallbackMode = false); /// \brief Pretty-print a diagnostic message to a raw_ostream. /// diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 8830dce..dff56c3 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -17,10 +17,15 @@ #include "clang/Basic/Diagnostic.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Option/OptSpecifier.h" namespace llvm { class raw_fd_ostream; class Triple; + +namespace opt { +class ArgList; +} } namespace clang { @@ -86,9 +91,11 @@ void AttachDependencyFileGen(Preprocessor &PP, /// the default behavior used by -H. /// \param OutputPath - If non-empty, a path to write the header include /// information to, instead of writing to stderr. +/// \param ShowDepth - Whether to indent to show the nesting of the includes. +/// \param MSStyle - Whether to print in cl.exe /showIncludes style. void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false, StringRef OutputPath = "", - bool ShowDepth = true); + bool ShowDepth = true, bool MSStyle = false); /// CacheTokens - Cache tokens for use with PCH. Note that this requires /// a seekable stream. @@ -104,6 +111,18 @@ createInvocationFromCommandLine(ArrayRef<const char *> Args, IntrusiveRefCntPtr<DiagnosticsEngine> Diags = IntrusiveRefCntPtr<DiagnosticsEngine>()); -} // end namespace clang +/// 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. +int getLastArgIntValue(const llvm::opt::ArgList &Args, + llvm::opt::OptSpecifier Id, int Default, + DiagnosticsEngine *Diags = 0); + +inline int getLastArgIntValue(const llvm::opt::ArgList &Args, + llvm::opt::OptSpecifier Id, int Default, + DiagnosticsEngine &Diags) { + return getLastArgIntValue(Args, Id, Default, &Diags); +} + +} // end namespace clang #endif |