diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/Frontend')
20 files changed, 255 insertions, 152 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/ASTUnit.h b/contrib/llvm/tools/clang/include/clang/Frontend/ASTUnit.h index 5e409bd..02c57d7 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/ASTUnit.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/ASTUnit.h @@ -14,30 +14,30 @@ #ifndef LLVM_CLANG_FRONTEND_ASTUNIT_H #define LLVM_CLANG_FRONTEND_ASTUNIT_H -#include "clang/Serialization/ASTBitCodes.h" -#include "clang/Sema/Sema.h" -#include "clang/Sema/CodeCompleteConsumer.h" -#include "clang/Lex/ModuleLoader.h" -#include "clang/Lex/PreprocessingRecord.h" -#include "clang/Lex/HeaderSearchOptions.h" +#include "clang-c/Index.h" #include "clang/AST/ASTContext.h" -#include "clang/Basic/LangOptions.h" -#include "clang/Basic/SourceManager.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemOptions.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetOptions.h" -#include "clang-c/Index.h" +#include "clang/Lex/HeaderSearchOptions.h" +#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" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Path.h" +#include <cassert> #include <map> #include <string> -#include <vector> -#include <cassert> -#include <utility> #include <sys/types.h> +#include <utility> +#include <vector> namespace llvm { class MemoryBuffer; @@ -485,6 +485,9 @@ public: StringRef getMainFileName() const; + /// \brief If this ASTUnit came from an AST file, returns the filename for it. + StringRef getASTFileName() const; + typedef std::vector<Decl *>::iterator top_level_iterator; top_level_iterator top_level_begin() { @@ -830,12 +833,19 @@ public: /// \returns True if an error occurred, false otherwise. bool serialize(raw_ostream &OS); - virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path, - Module::NameVisibilityKind Visibility, - bool IsInclusionDirective) { + virtual ModuleLoadResult loadModule(SourceLocation ImportLoc, + ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective) { // ASTUnit doesn't know how to load modules (not that this matters). - return 0; + return ModuleLoadResult(); } + + virtual void makeModuleVisible(Module *Mod, + Module::NameVisibilityKind Visibility, + SourceLocation ImportLoc, + bool Complain) { } + }; } // namespace clang diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/ChainedIncludesSource.h b/contrib/llvm/tools/clang/include/clang/Frontend/ChainedIncludesSource.h index d7119e9..e14580e 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/ChainedIncludesSource.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/ChainedIncludesSource.h @@ -44,8 +44,8 @@ protected: virtual uint32_t GetNumExternalSelectors(); virtual Stmt *GetExternalDeclStmt(uint64_t Offset); virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset); - virtual DeclContextLookupResult - FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name); + virtual bool FindExternalVisibleDeclsByName(const DeclContext *DC, + DeclarationName Name); virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, bool (*isKindWeWant)(Decl::Kind), SmallVectorImpl<Decl*> &Result); diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def b/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def index 558e6f1..1c0b9fa 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def +++ b/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def @@ -30,6 +30,8 @@ CODEGENOPT(Name, Bits, Default) CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm. CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe. +CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files. +CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files. CODEGENOPT(CUDAIsDevice , 1, 0) ///< Set when compiling for CUDA device. CODEGENOPT(CXAAtExit , 1, 1) ///< Use __cxa_atexit for calling destructors. CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker @@ -40,6 +42,7 @@ CODEGENOPT(DisableLLVMOpts , 1, 0) ///< Don't run any optimizations, for use i ///< 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 @@ -49,6 +52,8 @@ CODEGENOPT(EmitDeclMetadata , 1, 0) ///< Emit special metadata indicating what CODEGENOPT(EmitGcovArcs , 1, 0) ///< Emit coverage data files, aka. GCDA. CODEGENOPT(EmitGcovNotes , 1, 0) ///< Emit coverage "notes" files, aka GCNO. CODEGENOPT(EmitOpenCLArgMetadata , 1, 0) ///< Emit OpenCL kernel arg metadata. +/// \brief FP_CONTRACT mode (on/off/fast). +ENUM_CODEGENOPT(FPContractMode, FPContractModeKind, 2, FPC_On) CODEGENOPT(ForbidGuardVariables , 1, 0) ///< Issue errors if C++ guard variables ///< are required. CODEGENOPT(FunctionSections , 1, 0) ///< Set when -ffunction-sections is enabled. @@ -65,6 +70,7 @@ CODEGENOPT(NoDwarf2CFIAsm , 1, 0) ///< Set when -fno-dwarf2-cfi-asm is enable CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is ///< enabled. CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled. +CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled. CODEGENOPT(NoGlobalMerge , 1, 0) ///< Set when -mno-global-merge is enabled. CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled. CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf. @@ -80,7 +86,14 @@ VALUE_CODEGENOPT(OptimizationLevel, 3, 0) ///< The -O[0-4] option specified. VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified. 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. CODEGENOPT(SaveTempLabels , 1, 0) ///< Save temporary labels. +CODEGENOPT(SanitizeAddressZeroBaseShadow , 1, 0) ///< Map shadow memory at zero + ///< offset in AddressSanitizer. +CODEGENOPT(SanitizeMemoryTrackOrigins, 1, 0) ///< Enable tracking origins in + ///< MemorySanitizer +CODEGENOPT(SanitizeUndefinedTrapOnError, 1, 0) ///< Set on + /// -fsanitize-undefined-trap-on-error CODEGENOPT(SimplifyLibCalls , 1, 1) ///< Set when -fbuiltin is enabled. CODEGENOPT(SoftFloat , 1, 0) ///< -soft-float. CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition. @@ -107,13 +120,12 @@ VALUE_CODEGENOPT(StackAlignment , 32, 0) ///< Overrides default stack CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information ///< in debug info. +CODEGENOPT(ModulesAutolink, 1, 0) ///< Whether to auto-link imported modules + /// The user specified number of registers to be used for integral arguments, /// or 0 if unspecified. VALUE_CODEGENOPT(NumRegisterParameters, 32, 0) -/// The run-time penalty for bounds checking, or 0 to disable. -VALUE_CODEGENOPT(BoundsChecking, 8, 0) - /// The lower bound for a buffer to be considered for stack protection. VALUE_CODEGENOPT(SSPBufferSize, 32, 0) @@ -126,6 +138,9 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining) /// The default TLS model to use. ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel) +CODEGENOPT(SanitizeRecover, 1, 1) ///< Attempt to recover from sanitizer checks + ///< by continuing execution when possible + #undef CODEGENOPT #undef ENUM_CODEGENOPT #undef VALUE_CODEGENOPT diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h b/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h index 3567187..d0bbf30 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h @@ -65,6 +65,12 @@ public: LocalExecTLSModel }; + enum FPContractModeKind { + FPC_Off, // Form fused FP ops only where result will not be affected. + FPC_On, // Form fused FP ops according to FP_CONTRACT rules. + FPC_Fast // Aggressively fuse FP ops (E.g. FMA). + }; + /// The code model to use (-mcmodel). std::string CodeModel; @@ -72,6 +78,9 @@ public: /// replaced. std::string CoverageFile; + /// The version string to put into coverage files. + char CoverageVersion[4]; + /// Enable additional debugging information. std::string DebugPass; @@ -96,9 +105,16 @@ public: /// file, for example with -save-temps. std::string MainFileName; + /// The name for the split debug info file that we'll break out. This is used + /// in the backend for setting the name in the skeleton cu. + std::string SplitDwarfFile; + /// The name of the relocation model to use. std::string RelocationModel; + /// Path to blacklist file for sanitizers. + std::string SanitizerBlacklistFile; + /// If not an empty string, trap intrinsics are lowered to calls to this /// function instead of to trap instructions. std::string TrapFuncName; @@ -121,6 +137,7 @@ public: #include "clang/Frontend/CodeGenOptions.def" RelocationModel = "pic"; + memcpy(CoverageVersion, "*204", 4); } }; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInstance.h b/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInstance.h index 2f3dc3f..0d67462 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInstance.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInstance.h @@ -10,15 +10,15 @@ #ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_ #define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_ -#include "clang/Frontend/CompilerInvocation.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" +#include "clang/Frontend/CompilerInvocation.h" #include "clang/Lex/ModuleLoader.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringRef.h" #include <cassert> #include <list> #include <string> @@ -94,7 +94,7 @@ class CompilerInstance : public ModuleLoader { /// \brief The semantic analysis object. OwningPtr<Sema> TheSema; - + /// \brief The frontend timer OwningPtr<llvm::Timer> FrontendTimer; @@ -111,8 +111,15 @@ class CompilerInstance : public ModuleLoader { /// \brief The result of the last module import. /// - Module *LastModuleImportResult; - + ModuleLoadResult LastModuleImportResult; + + /// \brief Whether we should (re)build the global module index once we + /// have finished with this translation unit. + bool BuildGlobalModuleIndex; + + /// \brief One or more modules failed to build. + bool ModuleBuildFailed; + /// \brief Holds information about the output file. /// /// If TempFilename is not empty we must rename it to Filename at the end. @@ -186,6 +193,15 @@ public: /// setInvocation - Replace the current invocation. void setInvocation(CompilerInvocation *Value); + /// \brief Indicates whether we should (re)build the global module index. + bool shouldBuildGlobalModuleIndex() const; + + /// \brief Set the flag indicating whether we should (re)build the global + /// module index. + void setBuildGlobalModuleIndex(bool Build) { + BuildGlobalModuleIndex = Build; + } + /// } /// @name Forwarding Methods /// { @@ -479,17 +495,12 @@ public: /// /// \param ShouldCloneClient If Client is non-NULL, specifies whether that /// client should be cloned. - void createDiagnostics(int Argc, const char* const *Argv, - DiagnosticConsumer *Client = 0, + void createDiagnostics(DiagnosticConsumer *Client = 0, bool ShouldOwnClient = true, bool ShouldCloneClient = true); /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter. /// - /// The \p Argc and \p Argv arguments are used only for logging purposes, - /// when the diagnostic options indicate that the compiler should output - /// logging information. - /// /// If no diagnostic client is provided, this creates a /// DiagnosticConsumer that is owned by the returned diagnostic /// object, if using directly the caller is responsible for @@ -507,8 +518,7 @@ public: /// /// \return The new object on success, or null on failure. static IntrusiveRefCntPtr<DiagnosticsEngine> - createDiagnostics(DiagnosticOptions *Opts, int Argc, - const char* const *Argv, + createDiagnostics(DiagnosticOptions *Opts, DiagnosticConsumer *Client = 0, bool ShouldOwnClient = true, bool ShouldCloneClient = true, @@ -542,7 +552,8 @@ public: bool DisablePCHValidation, bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, - void *DeserializationListener, bool Preamble); + void *DeserializationListener, bool Preamble, + bool UseGlobalModuleIndex); /// Create a code completion consumer using the invocation; note that this /// will cause the source manager to truncate the input source file at the @@ -645,9 +656,16 @@ public: /// } - virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path, - Module::NameVisibilityKind Visibility, - bool IsInclusionDirective); + virtual ModuleLoadResult loadModule(SourceLocation ImportLoc, + ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective); + + virtual void makeModuleVisible(Module *Mod, + Module::NameVisibilityKind Visibility, + SourceLocation ImportLoc, + bool Complain); + }; } // end namespace clang diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h b/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h index 1314956..fac05c5 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h @@ -10,22 +10,22 @@ #ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_ #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_ +#include "clang/Basic/DiagnosticOptions.h" +#include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/TargetOptions.h" -#include "clang/Basic/FileSystemOptions.h" -#include "clang/Basic/DiagnosticOptions.h" -#include "clang/Lex/HeaderSearchOptions.h" -#include "clang/Lex/PreprocessorOptions.h" -#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" -#include "clang/Frontend/MigratorOptions.h" #include "clang/Frontend/CodeGenOptions.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/Lex/HeaderSearchOptions.h" +#include "clang/Lex/PreprocessorOptions.h" +#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include <string> #include <vector> diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/DiagnosticRenderer.h b/contrib/llvm/tools/clang/include/clang/Frontend/DiagnosticRenderer.h index 086bb13..f3cd054 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/DiagnosticRenderer.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/DiagnosticRenderer.h @@ -19,6 +19,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/PointerUnion.h" namespace clang { @@ -31,7 +32,8 @@ typedef llvm::PointerUnion<const Diagnostic *, const StoredDiagnostic *> DiagOrStoredDiag; /// \brief Class to encapsulate the logic for formatting a diagnostic message. -/// Actual "printing" logic is implemented by subclasses. +/// +/// Actual "printing" logic is implemented by subclasses. /// /// This class provides an interface for building and emitting /// diagnostic, including all of the macro backtraces, caret diagnostics, FixIt @@ -55,7 +57,7 @@ protected: /// \brief The location of the last include whose stack was printed if known. /// - /// Same restriction as \see LastLoc essentially, but tracking include stack + /// Same restriction as LastLoc essentially, but tracking include stack /// root locations rather than diagnostic locations. SourceLocation LastIncludeLoc; @@ -92,7 +94,13 @@ protected: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM) = 0; - + virtual void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) = 0; + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) = 0; + virtual void beginDiagnostic(DiagOrStoredDiag D, DiagnosticsEngine::Level Level) {} virtual void endDiagnostic(DiagOrStoredDiag D, @@ -100,16 +108,23 @@ protected: private: - void emitIncludeStack(SourceLocation Loc, DiagnosticsEngine::Level Level, - const SourceManager &SM); + void emitIncludeStack(SourceLocation Loc, PresumedLoc PLoc, + DiagnosticsEngine::Level Level, const SourceManager &SM); void emitIncludeStackRecursively(SourceLocation Loc, const SourceManager &SM); - void emitMacroExpansionsAndCarets(SourceLocation Loc, - DiagnosticsEngine::Level Level, - SmallVectorImpl<CharSourceRange>& Ranges, - ArrayRef<FixItHint> Hints, - const SourceManager &SM, - unsigned &MacroDepth, - unsigned OnMacroInst = 0); + void emitImportStack(SourceLocation Loc, const SourceManager &SM); + void emitImportStackRecursively(SourceLocation Loc, StringRef ModuleName, + const SourceManager &SM); + void emitModuleBuildStack(const SourceManager &SM); + void emitCaret(SourceLocation Loc, DiagnosticsEngine::Level Level, + ArrayRef<CharSourceRange> Ranges, ArrayRef<FixItHint> Hints, + const SourceManager &SM); + void emitMacroExpansions(SourceLocation Loc, + DiagnosticsEngine::Level Level, + ArrayRef<CharSourceRange> Ranges, + ArrayRef<FixItHint> Hints, + const SourceManager &SM, + unsigned &MacroDepth, + unsigned OnMacroInst = 0); public: /// \brief Emit a diagnostic. /// @@ -149,7 +164,15 @@ public: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM); - + + virtual void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + virtual void emitNote(SourceLocation Loc, StringRef Message, const SourceManager *SM) = 0; }; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendAction.h b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendAction.h index 3283444..c67be92 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendAction.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendAction.h @@ -6,6 +6,14 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +/// +/// \file +/// \brief Defines the clang::FrontendAction interface and various convenience +/// abstract classes (clang::ASTFrontendAction, clang::PluginASTAction, +/// clang::PreprocessorFrontendAction, and clang::WrapperFrontendAction) +/// derived from it. +/// +//===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_FRONTEND_FRONTENDACTION_H #define LLVM_CLANG_FRONTEND_FRONTENDACTION_H @@ -13,8 +21,8 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" #include "clang/Frontend/FrontendOptions.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringRef.h" #include <string> #include <vector> @@ -24,8 +32,7 @@ class ASTMergeAction; class ASTUnit; class CompilerInstance; -/// FrontendAction - Abstract base class for actions which can be performed by -/// the frontend. +/// Abstract base class for actions which can be performed by the frontend. class FrontendAction { FrontendInputFile CurrentInput; OwningPtr<ASTUnit> CurrentASTUnit; @@ -41,20 +48,19 @@ protected: /// @name Implementation Action Interface /// @{ - /// CreateASTConsumer - Create the AST consumer object for this action, if - /// supported. + /// \brief Create the AST consumer object for this action, if supported. /// - /// This routine is called as part of \see BeginSourceAction(), which will + /// This routine is called as part of BeginSourceFile(), which will /// fail if the AST consumer cannot be created. This will not be called if the /// action has indicated that it only uses the preprocessor. /// - /// \param CI - The current compiler instance, provided as a convenience, \see + /// \param CI - The current compiler instance, provided as a convenience, see /// getCompilerInstance(). /// - /// \param InFile - The current input file, provided as a convenience, \see + /// \param InFile - The current input file, provided as a convenience, see /// getCurrentFile(). /// - /// \return The new AST consumer, or 0 on failure. + /// \return The new AST consumer, or null on failure. virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, StringRef InFile) = 0; @@ -62,29 +68,29 @@ protected: /// opportunity to modify the CompilerInvocation or do some other action /// before BeginSourceFileAction is called. /// - /// \return True on success; on failure \see BeginSourceFileAction() and - /// ExecutionAction() and EndSourceFileAction() will not be called. + /// \return True on success; on failure BeginSourceFileAction(), + /// ExecuteAction() and EndSourceFileAction() will not be called. virtual bool BeginInvocation(CompilerInstance &CI) { return true; } - /// BeginSourceFileAction - Callback at the start of processing a single - /// input. + /// \brief Callback at the start of processing a single input. /// - /// \return True on success; on failure \see ExecutionAction() and + /// \return True on success; on failure ExecutionAction() and /// EndSourceFileAction() will not be called. virtual bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) { return true; } - /// ExecuteAction - Callback to run the program action, using the initialized + /// \brief Callback to run the program action, using the initialized /// compiler instance. /// - /// This routine is guaranteed to only be called between \see - /// BeginSourceFileAction() and \see EndSourceFileAction(). + /// This is guaranteed to only be called between BeginSourceFileAction() + /// and EndSourceFileAction(). virtual void ExecuteAction() = 0; - /// EndSourceFileAction - Callback at the end of processing a single input; - /// this is guaranteed to only be called following a successful call to + /// \brief Callback at the end of processing a single input. + /// + /// This is guaranteed to only be called following a successful call to /// BeginSourceFileAction (and BeginSourceFile). virtual void EndSourceFileAction() {} @@ -142,34 +148,35 @@ public: /// @name Supported Modes /// @{ - /// usesPreprocessorOnly - Does this action only use the preprocessor? If so - /// no AST context will be created and this action will be invalid with AST - /// file inputs. + /// \brief Does this action only use the preprocessor? + /// + /// If so no AST context will be created and this action will be invalid + /// with AST file inputs. virtual bool usesPreprocessorOnly() const = 0; /// \brief For AST-based actions, the kind of translation unit we're handling. virtual TranslationUnitKind getTranslationUnitKind() { return TU_Complete; } - /// hasPCHSupport - Does this action support use with PCH? + /// \brief Does this action support use with PCH? virtual bool hasPCHSupport() const { return !usesPreprocessorOnly(); } - /// hasASTFileSupport - Does this action support use with AST files? + /// \brief Does this action support use with AST files? virtual bool hasASTFileSupport() const { return !usesPreprocessorOnly(); } - /// hasIRSupport - Does this action support use with IR files? + /// \brief Does this action support use with IR files? virtual bool hasIRSupport() const { return false; } - /// hasCodeCompletionSupport - Does this action support use with code - /// completion? + /// \brief Does this action support use with code completion? virtual bool hasCodeCompletionSupport() const { return false; } /// @} /// @name Public Action Interface /// @{ - /// BeginSourceFile - Prepare the action for processing the input file - /// \p Input; this is run after the options and frontend have been - /// initialized, but prior to executing any per-file processing. + /// \brief Prepare the action for processing the input file \p Input. + /// + /// This is run after the options and frontend have been initialized, + /// but prior to executing any per-file processing. /// /// \param CI - The compiler instance this action is being run from. The /// action may store and use this object up until the matching EndSourceFile @@ -180,29 +187,28 @@ public: /// several objects which would normally be owned by the /// CompilerInstance. When processing AST input files, these objects should /// generally not be initialized in the CompilerInstance -- they will - /// automatically be shared with the AST file in between \see - /// BeginSourceFile() and \see EndSourceFile(). + /// automatically be shared with the AST file in between + /// BeginSourceFile() and EndSourceFile(). /// /// \return True on success; on failure the compilation of this file should - /// be aborted and neither Execute nor EndSourceFile should be called. + /// be aborted and neither Execute() nor EndSourceFile() should be called. bool BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input); - /// Execute - Set the source managers main input file, and run the action. + /// \brief Set the source manager's main input file, and run the action. bool Execute(); - /// EndSourceFile - Perform any per-file post processing, deallocate per-file + /// \brief Perform any per-file post processing, deallocate per-file /// objects, and run statistics and output file cleanup code. void EndSourceFile(); /// @} }; -/// ASTFrontendAction - Abstract base class to use for AST consumer based -/// frontend actions. +/// \brief Abstract base class to use for AST consumer-based frontend actions. class ASTFrontendAction : public FrontendAction { protected: - /// ExecuteAction - Implement the ExecuteAction interface by running Sema on - /// the already initialized AST consumer. + /// \brief Implement the ExecuteAction interface by running Sema on + /// the already-initialized AST consumer. /// /// This will also take care of instantiating a code completion consumer if /// the user requested it and the action supports it. @@ -219,7 +225,7 @@ protected: StringRef InFile) = 0; public: - /// ParseArgs - Parse the given plugin command line arguments. + /// \brief Parse the given plugin command line arguments. /// /// \param CI - The compiler instance, for use in reporting diagnostics. /// \return True if the parsing succeeded; otherwise the plugin will be @@ -229,11 +235,10 @@ public: const std::vector<std::string> &arg) = 0; }; -/// PreprocessorFrontendAction - Abstract base class to use for preprocessor -/// based frontend actions. +/// \brief Abstract base class to use for preprocessor-based frontend actions. class PreprocessorFrontendAction : public FrontendAction { protected: - /// CreateASTConsumer - Provide a default implementation which returns aborts, + /// \brief Provide a default implementation which returns aborts; /// this method should never be called by FrontendAction clients. virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, StringRef InFile); @@ -242,11 +247,12 @@ public: virtual bool usesPreprocessorOnly() const { return true; } }; -/// WrapperFrontendAction - A frontend action which simply wraps some other -/// runtime specified frontend action. Deriving from this class allows an -/// action to inject custom logic around some existing action's behavior. It -/// implements every virtual method in the FrontendAction interface by -/// forwarding to the wrapped action. +/// \brief A frontend action which simply wraps some other runtime-specified +/// frontend action. +/// +/// Deriving from this class allows an action to inject custom logic around +/// some existing action's behavior. It implements every virtual method in +/// the FrontendAction interface by forwarding to the wrapped action. class WrapperFrontendAction : public FrontendAction { OwningPtr<FrontendAction> WrappedAction; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendActions.h b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendActions.h index 477ac45..1786190 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendActions.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendActions.h @@ -123,7 +123,7 @@ public: std::string &OutputFile, raw_ostream *&OS); }; - + class SyntaxOnlyAction : public ASTFrontendAction { protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, @@ -133,6 +133,21 @@ public: virtual bool hasCodeCompletionSupport() const { return true; } }; +/// \brief Dump information about the given module file, to be used for +/// basic debugging and discovery. +class DumpModuleInfoAction : public ASTFrontendAction { +protected: + virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile); + virtual void ExecuteAction(); + +public: + virtual bool hasPCHSupport() const { return false; } + virtual bool hasASTFileSupport() const { return true; } + virtual bool hasIRSupport() const { return false; } + virtual bool hasCodeCompletionSupport() const { return false; } +}; + /** * \brief Frontend action adaptor that merges ASTs together. * diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendOptions.h b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendOptions.h index db2f5a5..234e344 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/FrontendOptions.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/FrontendOptions.h @@ -43,6 +43,7 @@ namespace frontend { GeneratePCH, ///< Generate pre-compiled header. GeneratePTH, ///< Generate pre-tokenized header. InitOnly, ///< Only execute frontend initialization. + ModuleFileInfo, ///< Dump information about a module file. ParseSyntaxOnly, ///< Parse and perform semantic analysis. PluginAction, ///< Run a plugin action, \see ActionName. PrintDeclContext, ///< Print DeclContext and their Decls. @@ -137,6 +138,10 @@ public: /// speed up parsing in cases you do /// not need them (e.g. with code /// completion). + unsigned UseGlobalModuleIndex : 1; ///< Whether we can use the + ///< global module index if available. + unsigned GenerateGlobalModuleIndex : 1; ///< Whether we can generate the + ///< global module index if needed. CodeCompleteOptions CodeCompleteOpts; @@ -204,20 +209,16 @@ public: std::string OverrideRecordLayoutsFile; public: - FrontendOptions() { - DisableFree = 0; - ProgramAction = frontend::ParseSyntaxOnly; - ActionName = ""; - RelocatablePCH = 0; - ShowHelp = 0; - ShowStats = 0; - ShowTimers = 0; - ShowVersion = 0; - ARCMTAction = ARCMT_None; - ARCMTMigrateEmitARCErrors = 0; - SkipFunctionBodies = 0; - ObjCMTAction = ObjCMT_None; - } + FrontendOptions() : + DisableFree(false), RelocatablePCH(false), ShowHelp(false), + ShowStats(false), ShowTimers(false), ShowVersion(false), + FixWhatYouCan(false), FixOnlyWarnings(false), FixAndRecompile(false), + FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false), + SkipFunctionBodies(false), UseGlobalModuleIndex(true), + GenerateGlobalModuleIndex(true), + ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None), + ProgramAction(frontend::ParseSyntaxOnly) + {} /// getInputKindForExtension - Return the appropriate input kind for a file /// extension. For example, "c" would return IK_C. diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/LangStandard.h b/contrib/llvm/tools/clang/include/clang/Frontend/LangStandard.h index f07cb02..1124d53 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/LangStandard.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/LangStandard.h @@ -23,7 +23,7 @@ enum LangFeatures { C99 = (1 << 2), C11 = (1 << 3), CPlusPlus = (1 << 4), - CPlusPlus0x = (1 << 5), + CPlusPlus11 = (1 << 5), CPlusPlus1y = (1 << 6), Digraphs = (1 << 7), GNUMode = (1 << 8), @@ -69,8 +69,8 @@ public: /// isCPlusPlus - Language is a C++ variant. bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; } - /// isCPlusPlus0x - Language is a C++0x variant. - bool isCPlusPlus0x() const { return Flags & frontend::CPlusPlus0x; } + /// isCPlusPlus11 - Language is a C++0x variant. + bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; } /// isCPlusPlus1y - Language is a C++1y variant. bool isCPlusPlus1y() const { return Flags & frontend::CPlusPlus1y; } diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def b/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def index 10807b7..7b2516b 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def +++ b/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def @@ -96,23 +96,23 @@ LANGSTANDARD(gnucxx98, "gnu++98", LANGSTANDARD(cxx0x, "c++0x", "ISO C++ 2011 with amendments", - LineComment | CPlusPlus | CPlusPlus0x | Digraphs) + LineComment | CPlusPlus | CPlusPlus11 | Digraphs) LANGSTANDARD(cxx11, "c++11", "ISO C++ 2011 with amendments", - LineComment | CPlusPlus | CPlusPlus0x | Digraphs) + LineComment | CPlusPlus | CPlusPlus11 | Digraphs) LANGSTANDARD(gnucxx0x, "gnu++0x", "ISO C++ 2011 with amendments and GNU extensions", - LineComment | CPlusPlus | CPlusPlus0x | Digraphs | GNUMode) + LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode) LANGSTANDARD(gnucxx11, "gnu++11", "ISO C++ 2011 with amendments and GNU extensions", - LineComment | CPlusPlus | CPlusPlus0x | Digraphs | GNUMode) + LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode) LANGSTANDARD(cxx1y, "c++1y", "Working draft for ISO C++ 2014", - LineComment | CPlusPlus | CPlusPlus0x | CPlusPlus1y | Digraphs) + LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus1y | Digraphs) LANGSTANDARD(gnucxx1y, "gnu++1y", "Working draft for ISO C++ 2014 with GNU extensions", - LineComment | CPlusPlus | CPlusPlus0x | CPlusPlus1y | Digraphs | + LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus1y | Digraphs | GNUMode) // OpenCL diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/LayoutOverrideSource.h b/contrib/llvm/tools/clang/include/clang/Frontend/LayoutOverrideSource.h index 225efe6..ec34e14 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/LayoutOverrideSource.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/LayoutOverrideSource.h @@ -11,6 +11,7 @@ #define LLVM_CLANG_FRONTEND_LAYOUTOVERRIDESOURCE_H #include "clang/AST/ExternalASTSource.h" +#include "clang/Basic/LLVM.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" @@ -31,7 +32,7 @@ namespace clang { uint64_t Align; /// \brief The offsets of the fields, in source order. - llvm::SmallVector<uint64_t, 8> FieldOffsets; + SmallVector<uint64_t, 8> FieldOffsets; }; /// \brief The set of layouts that will be overridden. @@ -42,7 +43,7 @@ namespace clang { /// set of record types. /// /// The file is the result of passing -fdump-record-layouts to a file. - explicit LayoutOverrideSource(llvm::StringRef Filename); + explicit LayoutOverrideSource(StringRef Filename); /// \brief If this particular record type has an overridden layout, /// return that layout. diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/LogDiagnosticPrinter.h b/contrib/llvm/tools/clang/include/clang/Frontend/LogDiagnosticPrinter.h index f4fa876..0c700a7 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/LogDiagnosticPrinter.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/LogDiagnosticPrinter.h @@ -12,8 +12,8 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" namespace clang { class DiagnosticOptions; @@ -42,7 +42,7 @@ class LogDiagnosticPrinter : public DiagnosticConsumer { raw_ostream &OS; const LangOptions *LangOpts; - llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; SourceLocation LastWarningLoc; FullSourceLoc LastLoc; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/MultiplexConsumer.h b/contrib/llvm/tools/clang/include/clang/Frontend/MultiplexConsumer.h index 539f2c5..6ea7547 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/MultiplexConsumer.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/MultiplexConsumer.h @@ -17,7 +17,6 @@ #include "clang/Basic/LLVM.h" #include "clang/Sema/SemaConsumer.h" -#include "clang/Basic/LLVM.h" #include "llvm/ADT/OwningPtr.h" #include <vector> diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOutputOptions.h b/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOutputOptions.h index 9793aa6..e273dd6 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOutputOptions.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOutputOptions.h @@ -25,7 +25,7 @@ public: public: PreprocessorOutputOptions() { - ShowCPP = 1; + ShowCPP = 0; ShowComments = 0; ShowLineMarkers = 1; ShowMacroComments = 0; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h b/contrib/llvm/tools/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h index ab70afd..117771d 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h @@ -10,6 +10,7 @@ #ifndef LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_ #define LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_ +#include "clang/Basic/LLVM.h" #include "llvm/Bitcode/BitstreamWriter.h" namespace llvm { @@ -53,7 +54,7 @@ enum RecordIDs { /// This allows wrapper tools for Clang to get diagnostics from Clang /// (via libclang) without needing to parse Clang's command line output. /// -DiagnosticConsumer *create(llvm::raw_ostream *OS, +DiagnosticConsumer *create(raw_ostream *OS, DiagnosticOptions *diags); } // end serialized_diags namespace diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnostic.h b/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnostic.h index 51f841d..656aa57 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnostic.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnostic.h @@ -18,8 +18,6 @@ #include "clang/Frontend/DiagnosticRenderer.h" -struct SourceColumnMap; - namespace clang { /// \brief Class to encapsulate the logic for formatting and printing a textual @@ -103,6 +101,14 @@ protected: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM); + virtual void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + private: void emitSnippetAndCaret(SourceLocation Loc, DiagnosticsEngine::Level Level, SmallVectorImpl<CharSourceRange>& Ranges, @@ -111,16 +117,6 @@ private: void emitSnippet(StringRef SourceLine); - void highlightRange(const CharSourceRange &R, - unsigned LineNo, FileID FID, - const SourceColumnMap &map, - std::string &CaretLine, - const SourceManager &SM); - - std::string buildFixItInsertionLine(unsigned LineNo, - const SourceColumnMap &map, - ArrayRef<FixItHint> Hints, - const SourceManager &SM); void emitParseableFixits(ArrayRef<FixItHint> Hints, const SourceManager &SM); }; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnosticPrinter.h b/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnosticPrinter.h index 91ac3c8..470438e 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/TextDiagnosticPrinter.h @@ -17,8 +17,8 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LLVM.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/OwningPtr.h" namespace clang { class DiagnosticOptions; @@ -27,7 +27,7 @@ class TextDiagnostic; class TextDiagnosticPrinter : public DiagnosticConsumer { raw_ostream &OS; - llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; /// \brief Handle to the currently active text diagnostic emitter. OwningPtr<TextDiagnostic> TextDiag; diff --git a/contrib/llvm/tools/clang/include/clang/Frontend/Utils.h b/contrib/llvm/tools/clang/include/clang/Frontend/Utils.h index 6b1fc63..8830dce 100644 --- a/contrib/llvm/tools/clang/include/clang/Frontend/Utils.h +++ b/contrib/llvm/tools/clang/include/clang/Frontend/Utils.h @@ -60,7 +60,8 @@ void InitializePreprocessor(Preprocessor &PP, /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. void ProcessWarningOptions(DiagnosticsEngine &Diags, - const DiagnosticOptions &Opts); + const DiagnosticOptions &Opts, + bool ReportDiags = true); /// DoPrintPreprocessedInput - Implement -E mode. void DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream* OS, |