diff options
Diffstat (limited to 'include/clang/Frontend')
25 files changed, 230 insertions, 1671 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index c45bd40..3c05834 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -14,8 +14,6 @@ #ifndef DRIVER_ASTCONSUMERS_H #define DRIVER_ASTCONSUMERS_H -#include <string> - namespace llvm { class raw_ostream; namespace sys { class Path; } @@ -36,12 +34,6 @@ class TargetOptions; // implementation is still incomplete. ASTConsumer *CreateASTPrinter(llvm::raw_ostream *OS); -// AST XML-printer: prints out the AST in a XML format -// The output is intended to be in a format such that -// clang or any other tool could re-parse the output back into the same AST, -// but the implementation is still incomplete. -ASTConsumer *CreateASTPrinterXML(llvm::raw_ostream *OS); - // AST dumper: dumps the raw AST in human-readable form to stderr; this is // intended for debugging. ASTConsumer *CreateASTDumper(); diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index e935633..57c59d9 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -71,12 +71,12 @@ public: private: llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics; - llvm::OwningPtr<FileManager> FileMgr; - llvm::OwningPtr<SourceManager> SourceMgr; + llvm::IntrusiveRefCntPtr<FileManager> FileMgr; + llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; llvm::OwningPtr<HeaderSearch> HeaderInfo; - llvm::OwningPtr<TargetInfo> Target; - llvm::OwningPtr<Preprocessor> PP; - llvm::OwningPtr<ASTContext> Ctx; + llvm::IntrusiveRefCntPtr<TargetInfo> Target; + llvm::IntrusiveRefCntPtr<Preprocessor> PP; + llvm::IntrusiveRefCntPtr<ASTContext> Ctx; FileSystemOptions FileSystemOpts; @@ -90,7 +90,7 @@ private: /// Optional owned invocation, just used to make the invocation used in /// LoadFromCommandLine available. - llvm::OwningPtr<CompilerInvocation> Invocation; + llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation; /// \brief The set of target features. /// @@ -115,6 +115,9 @@ private: /// \brief Whether we should time each operation. bool WantTiming; + + /// \brief Whether the ASTUnit should delete the remapped buffers. + bool OwnsRemappedFileBuffers; /// Track the top-level decls which appeared in an ASTUnit which was loaded /// from a source file. @@ -393,11 +396,11 @@ public: const SourceManager &getSourceManager() const { return *SourceMgr; } SourceManager &getSourceManager() { return *SourceMgr; } - const Preprocessor &getPreprocessor() const { return *PP.get(); } - Preprocessor &getPreprocessor() { return *PP.get(); } + const Preprocessor &getPreprocessor() const { return *PP; } + Preprocessor &getPreprocessor() { return *PP; } - const ASTContext &getASTContext() const { return *Ctx.get(); } - ASTContext &getASTContext() { return *Ctx.get(); } + const ASTContext &getASTContext() const { return *Ctx; } + ASTContext &getASTContext() { return *Ctx; } bool hasSema() const { return TheSema; } Sema &getSema() const { @@ -422,6 +425,9 @@ public: bool getOnlyLocalDecls() const { return OnlyLocalDecls; } + bool getOwnsRemappedFileBuffers() const { return OwnsRemappedFileBuffers; } + void setOwnsRemappedFileBuffers(bool val) { OwnsRemappedFileBuffers = val; } + /// \brief Retrieve the maximum PCH level of declarations that a /// traversal of the translation unit should consider. unsigned getMaxPCHLevel() const; @@ -529,10 +535,16 @@ public: /// that might still be used as a precompiled header or preamble. bool isCompleteTranslationUnit() const { return CompleteTranslationUnit; } + typedef llvm::PointerUnion<const char *, const llvm::MemoryBuffer *> + FilenameOrMemBuf; /// \brief A mapping from a file name to the memory buffer that stores the /// remapped contents of that file. - typedef std::pair<std::string, const llvm::MemoryBuffer *> RemappedFile; - + typedef std::pair<std::string, FilenameOrMemBuf> RemappedFile; + + /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation. + static ASTUnit *create(CompilerInvocation *CI, + llvm::IntrusiveRefCntPtr<Diagnostic> Diags); + /// \brief Create a ASTUnit from an AST file. /// /// \param Filename - The AST file to load. @@ -603,6 +615,7 @@ public: bool CaptureDiagnostics = false, RemappedFile *RemappedFiles = 0, unsigned NumRemappedFiles = 0, + bool RemappedFilesKeepOriginalName = true, bool PrecompilePreamble = false, bool CompleteTranslationUnit = true, bool CacheCodeCompletionResults = false, @@ -647,6 +660,11 @@ public: /// /// \returns True if an error occurred, false otherwise. bool Save(llvm::StringRef File); + + /// \brief Serialize this translation unit with the given output stream. + /// + /// \returns True if an error occurred, false otherwise. + bool serialize(llvm::raw_ostream &OS); }; } // namespace clang diff --git a/include/clang/Frontend/Analyses.def b/include/clang/Frontend/Analyses.def index 75b52a8..f055549 100644 --- a/include/clang/Frontend/Analyses.def +++ b/include/clang/Frontend/Analyses.def @@ -11,16 +11,6 @@ // //===----------------------------------------------------------------------===// -#ifndef ANALYSIS -#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) -#endif - -ANALYSIS(WarnUninitVals, "warn-uninit-values", - "Warn about uses of uninitialized variables", Code) - -ANALYSIS(ObjCMemChecker, "analyzer-check-objc-mem", - "Run the [Core] Foundation reference count checker", Code) - #ifndef ANALYSIS_STORE #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) #endif @@ -45,7 +35,6 @@ ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", cre ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", "Output analysis results using HTML wrapped with Plists", createPlistHTMLDiagnosticClient, true) ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results", createTextPathDiagnosticClient, true) -#undef ANALYSIS #undef ANALYSIS_STORE #undef ANALYSIS_CONSTRAINTS #undef ANALYSIS_DIAGNOSTICS diff --git a/include/clang/Frontend/AnalyzerOptions.h b/include/clang/Frontend/AnalyzerOptions.h index 64263c1..ea9f5e3 100644 --- a/include/clang/Frontend/AnalyzerOptions.h +++ b/include/clang/Frontend/AnalyzerOptions.h @@ -55,7 +55,6 @@ NUM_ANALYSIS_DIAG_CLIENTS class AnalyzerOptions { public: - std::vector<Analyses> AnalysisList; /// \brief Pair of checker name and enable/disable. std::vector<std::pair<std::string, bool> > CheckersControlList; AnalysisStores AnalysisStoreOpt; @@ -68,14 +67,11 @@ public: unsigned AnalyzeAll : 1; unsigned AnalyzerDisplayProgress : 1; unsigned AnalyzeNestedBlocks : 1; - unsigned AnalyzerStats : 1; unsigned EagerlyAssume : 1; - unsigned BufferOverflows : 1; unsigned PurgeDead : 1; unsigned TrimGraph : 1; unsigned VisualizeEGDot : 1; unsigned VisualizeEGUbi : 1; - unsigned EnableExperimentalChecks : 1; unsigned InlineCall : 1; unsigned UnoptimizedCFG : 1; unsigned CFGAddImplicitDtors : 1; @@ -91,14 +87,11 @@ public: AnalyzeAll = 0; AnalyzerDisplayProgress = 0; AnalyzeNestedBlocks = 0; - AnalyzerStats = 0; EagerlyAssume = 0; - BufferOverflows = 0; PurgeDead = 1; TrimGraph = 0; VisualizeEGDot = 0; VisualizeEGUbi = 0; - EnableExperimentalChecks = 0; InlineCall = 0; UnoptimizedCFG = 0; CFGAddImplicitDtors = 0; diff --git a/include/clang/Frontend/ChainedDiagnosticClient.h b/include/clang/Frontend/ChainedDiagnosticClient.h index 2d5e128..70f2190 100644 --- a/include/clang/Frontend/ChainedDiagnosticClient.h +++ b/include/clang/Frontend/ChainedDiagnosticClient.h @@ -48,6 +48,9 @@ public: virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info) { + // Default implementation (Warnings/errors count). + DiagnosticClient::HandleDiagnostic(DiagLevel, Info); + Primary->HandleDiagnostic(DiagLevel, Info); Secondary->HandleDiagnostic(DiagLevel, Info); } diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h index ee85b655..8bef6a3 100644 --- a/include/clang/Frontend/CodeGenOptions.h +++ b/include/clang/Frontend/CodeGenOptions.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H #include <string> +#include <vector> namespace clang { @@ -51,6 +52,10 @@ public: /// Decl* various IR entities came from. Only /// useful when running CodeGen as a /// subroutine. + unsigned EmitGcovArcs : 1; /// Emit coverage data files, aka. GCDA. + unsigned EmitGcovNotes : 1; /// Emit coverage "notes" files, aka GCNO. + unsigned ForbidGuardVariables : 1; /// Issue errors if C++ guard variables + /// are required unsigned FunctionSections : 1; /// Set when -ffunction-sections is enabled unsigned HiddenWeakTemplateVTables : 1; /// Emit weak vtables and RTTI for /// template classes with hidden visibility @@ -63,6 +68,7 @@ public: /// generated. unsigned MergeAllConstants : 1; /// Merge identical constants. unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled. + unsigned NoDwarf2CFIAsm : 1; /// Set when -fno-dwarf2-cfi-asm is enabled. unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled. unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not +-Inf. unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN. @@ -71,9 +77,10 @@ public: unsigned OmitLeafFramePointer : 1; /// Set when -momit-leaf-frame-pointer is /// enabled. unsigned OptimizationLevel : 3; /// The -O[0-4] option specified. - unsigned OptimizeSize : 1; /// If -Os is specified. + unsigned OptimizeSize : 2; /// If -Os (==1) or -Oz (==2) is specified. unsigned RelaxAll : 1; /// Relax all machine code instructions. unsigned RelaxedAliasing : 1; /// Set when -fno-strict-aliasing is enabled. + unsigned SaveTempLabels : 1; /// Save temporary labels. unsigned SimplifyLibCalls : 1; /// Set when -fbuiltin is enabled. unsigned SoftFloat : 1; /// -soft-float. unsigned TimePasses : 1; /// Set when -ftime-report is enabled. @@ -112,6 +119,9 @@ public: /// The name of the relocation model to use. std::string RelocationModel; + /// A list of command-line options to forward to the LLVM backend. + std::vector<std::string> BackendOptions; + /// The user specified number of registers to be used for integral arguments, /// or 0 if unspecified. unsigned NumRegisterParameters; @@ -128,6 +138,9 @@ public: DisableLLVMOpts = 0; DisableRedZone = 0; EmitDeclMetadata = 0; + EmitGcovArcs = 0; + EmitGcovNotes = 0; + ForbidGuardVariables = 0; FunctionSections = 0; HiddenWeakTemplateVTables = 0; HiddenWeakVTables = 0; @@ -136,6 +149,7 @@ public: LessPreciseFPMAD = 0; MergeAllConstants = 1; NoCommon = 0; + NoDwarf2CFIAsm = 0; NoImplicitFloat = 0; NoInfsFPMath = 0; NoNaNsFPMath = 0; @@ -147,6 +161,7 @@ public: OptimizeSize = 0; RelaxAll = 0; RelaxedAliasing = 0; + SaveTempLabels = 0; SimplifyLibCalls = 1; SoftFloat = 0; TimePasses = 0; diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 7ea79e5..004c889 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -59,25 +59,25 @@ class TargetInfo; /// and a long form that takes explicit instances of any required objects. class CompilerInstance { /// The options used in this compiler instance. - llvm::OwningPtr<CompilerInvocation> Invocation; + llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation; /// The diagnostics engine instance. llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics; /// The target being compiled for. - llvm::OwningPtr<TargetInfo> Target; + llvm::IntrusiveRefCntPtr<TargetInfo> Target; /// The file manager. - llvm::OwningPtr<FileManager> FileMgr; + llvm::IntrusiveRefCntPtr<FileManager> FileMgr; /// The source manager. - llvm::OwningPtr<SourceManager> SourceMgr; + llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; /// The preprocessor. - llvm::OwningPtr<Preprocessor> PP; + llvm::IntrusiveRefCntPtr<Preprocessor> PP; /// The AST context. - llvm::OwningPtr<ASTContext> Context; + llvm::IntrusiveRefCntPtr<ASTContext> Context; /// The AST consumer. llvm::OwningPtr<ASTConsumer> Consumer; @@ -161,10 +161,7 @@ public: return *Invocation; } - CompilerInvocation *takeInvocation() { return Invocation.take(); } - - /// setInvocation - Replace the current invocation; the compiler instance - /// takes ownership of \arg Value. + /// setInvocation - Replace the current invocation. void setInvocation(CompilerInvocation *Value); /// } @@ -251,13 +248,13 @@ public: bool hasDiagnostics() const { return Diagnostics != 0; } + /// Get the current diagnostics engine. Diagnostic &getDiagnostics() const { assert(Diagnostics && "Compiler instance has no diagnostics!"); return *Diagnostics; } - /// setDiagnostics - Replace the current diagnostics engine; the compiler - /// instance takes ownership of \arg Value. + /// setDiagnostics - Replace the current diagnostics engine. void setDiagnostics(Diagnostic *Value); DiagnosticClient &getDiagnosticClient() const { @@ -277,12 +274,7 @@ public: return *Target; } - /// takeTarget - Remove the current diagnostics engine and give ownership - /// to the caller. - TargetInfo *takeTarget() { return Target.take(); } - - /// setTarget - Replace the current diagnostics engine; the compiler - /// instance takes ownership of \arg Value. + /// Replace the current diagnostics engine. void setTarget(TargetInfo *Value); /// } @@ -291,17 +283,17 @@ public: bool hasFileManager() const { return FileMgr != 0; } + /// Return the current file manager to the caller. FileManager &getFileManager() const { assert(FileMgr && "Compiler instance has no file manager!"); return *FileMgr; } + + void resetAndLeakFileManager() { + FileMgr.resetWithoutRelease(); + } - /// takeFileManager - Remove the current file manager and give ownership to - /// the caller. - FileManager *takeFileManager() { return FileMgr.take(); } - - /// setFileManager - Replace the current file manager; the compiler instance - /// takes ownership of \arg Value. + /// setFileManager - Replace the current file manager. void setFileManager(FileManager *Value); /// } @@ -310,17 +302,17 @@ public: bool hasSourceManager() const { return SourceMgr != 0; } + /// Return the current source manager. SourceManager &getSourceManager() const { assert(SourceMgr && "Compiler instance has no source manager!"); return *SourceMgr; } + + void resetAndLeakSourceManager() { + SourceMgr.resetWithoutRelease(); + } - /// takeSourceManager - Remove the current source manager and give ownership - /// to the caller. - SourceManager *takeSourceManager() { return SourceMgr.take(); } - - /// setSourceManager - Replace the current source manager; the compiler - /// instance takes ownership of \arg Value. + /// setSourceManager - Replace the current source manager. void setSourceManager(SourceManager *Value); /// } @@ -329,17 +321,17 @@ public: bool hasPreprocessor() const { return PP != 0; } + /// Return the current preprocessor. Preprocessor &getPreprocessor() const { assert(PP && "Compiler instance has no preprocessor!"); return *PP; } - /// takePreprocessor - Remove the current preprocessor and give ownership to - /// the caller. - Preprocessor *takePreprocessor() { return PP.take(); } + void resetAndLeakPreprocessor() { + PP.resetWithoutRelease(); + } - /// setPreprocessor - Replace the current preprocessor; the compiler instance - /// takes ownership of \arg Value. + /// Replace the current preprocessor. void setPreprocessor(Preprocessor *Value); /// } @@ -352,13 +344,12 @@ public: assert(Context && "Compiler instance has no AST context!"); return *Context; } + + void resetAndLeakASTContext() { + Context.resetWithoutRelease(); + } - /// takeASTContext - Remove the current AST context and give ownership to the - /// caller. - ASTContext *takeASTContext() { return Context.take(); } - - /// setASTContext - Replace the current AST context; the compiler instance - /// takes ownership of \arg Value. + /// setASTContext - Replace the current AST context. void setASTContext(ASTContext *Value); /// \brief Replace the current Sema; the compiler instance takes ownership @@ -479,11 +470,15 @@ public: /// attached to (and, then, owned by) the returned Diagnostic /// object. /// + /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be + /// used by some diagnostics printers (for logging purposes only). + /// /// \return The new object on success, or null on failure. static llvm::IntrusiveRefCntPtr<Diagnostic> createDiagnostics(const DiagnosticOptions &Opts, int Argc, const char* const *Argv, - DiagnosticClient *Client = 0); + DiagnosticClient *Client = 0, + const CodeGenOptions *CodeGenOpts = 0); /// Create the file manager and replace any existing one with it. void createFileManager(); diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index e0329db..e18f3fe 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -22,6 +22,7 @@ #include "clang/Frontend/LangStandard.h" #include "clang/Frontend/PreprocessorOptions.h" #include "clang/Frontend/PreprocessorOutputOptions.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringMap.h" #include <string> @@ -41,7 +42,7 @@ class Diagnostic; /// 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 { +class CompilerInvocation : public llvm::RefCountedBase<CompilerInvocation> { /// Options controlling the static analyzer. AnalyzerOptions AnalyzerOpts; diff --git a/include/clang/Frontend/DeclContextXML.def b/include/clang/Frontend/DeclContextXML.def deleted file mode 100644 index 39ed5f9..0000000 --- a/include/clang/Frontend/DeclContextXML.def +++ /dev/null @@ -1,113 +0,0 @@ -//===-- DeclContextXML.def - Metadata about Context XML nodes ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the XML context info database as written in the -// <ReferenceSection>/<Contexts> sub-nodes of the XML document. Type nodes -// are referred by "context" reference attributes throughout the document. -// A context node never contains sub-nodes. -// The semantics of the attributes and enums are mostly self-documenting -// by looking at the appropriate internally used functions and values. -// The following macros are used: -// -// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete -// context of class CLASS where CLASS is a class name used internally by clang. -// After a NODE_XML the definition of all (optional) attributes of that context -// node and possible sub-nodes follows. -// -// END_NODE_XML - Closes the attribute definition of the current node. -// -// ID_ATTRIBUTE_XML - Context nodes have an "id" attribute containing a -// string, which value uniquely identify that statement. Other nodes may refer -// by "context" attributes to this value. -// -// TYPE_ATTRIBUTE_XML( FN ) - Context nodes may refer to the ids of type -// nodes by a "type" attribute, if they create a type during declaration. -// For instance 'struct S;' creates both a context 'S::' and a type 'S'. -// Contexts and types always have different ids, however declarations and -// contexts may share the same ids. FN is internally used by clang. -// -// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally -// used by clang. A boolean attribute have the values "0" or "1". -// -// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value -// is an enumeration defined with ENUM_XML macros immediately following after -// that macro. An optional attribute is ommited, if the particular enum is the -// empty string. FN is internally used by clang. -// -// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is -// internally used by clang. -// -// END_ENUM_XML - Closes the enumeration definition of the current attribute. -// -//===----------------------------------------------------------------------===// - -#ifndef TYPE_ATTRIBUTE_XML -# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#endif - -#ifndef CONTEXT_ATTRIBUTE_XML -# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context") -#endif - -NODE_XML(TranslationUnitDecl, "TranslationUnit") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(FunctionDecl, "Function") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAsFunctionType()) -END_NODE_XML - -NODE_XML(NamespaceDecl, "Namespace") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") -END_NODE_XML - -NODE_XML(RecordDecl, "Record") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getTypeForDecl()) -END_NODE_XML - -NODE_XML(EnumDecl, "Enum") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getTypeForDecl()) -END_NODE_XML - -NODE_XML(LinkageSpecDecl, "LinkageSpec") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_ENUM_OPT_XML(getLanguage(), "lang") - ENUM_XML(LinkageSpecDecl::lang_c, "C") - ENUM_XML(LinkageSpecDecl::lang_cxx, "CXX") - END_ENUM_XML -END_NODE_XML - -//===----------------------------------------------------------------------===// -#undef NODE_XML -#undef ID_ATTRIBUTE_XML -#undef TYPE_ATTRIBUTE_XML -#undef ATTRIBUTE_XML -#undef ATTRIBUTE_SPECIAL_XML -#undef ATTRIBUTE_OPT_XML -#undef ATTRIBUTE_ENUM_XML -#undef ATTRIBUTE_ENUM_OPT_XML -#undef ATTRIBUTE_FILE_LOCATION_XML -#undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_XML -#undef SUB_NODE_XML -#undef SUB_NODE_SEQUENCE_XML -#undef SUB_NODE_OPT_XML diff --git a/include/clang/Frontend/DeclXML.def b/include/clang/Frontend/DeclXML.def deleted file mode 100644 index 58f7e55..0000000 --- a/include/clang/Frontend/DeclXML.def +++ /dev/null @@ -1,372 +0,0 @@ -//===-- DeclXML.def - Metadata about Decl XML nodes ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the XML statement database structure as written in -// <TranslationUnit> sub-nodes of the XML document. -// The semantics of the attributes and enums are mostly self-documenting -// by looking at the appropriate internally used functions and values. -// The following macros are used: -// -// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete -// statement of class CLASS where CLASS is a class name used internally by clang. -// After a NODE_XML the definition of all (optional) attributes of that statement -// node and possible sub-nodes follows. -// -// END_NODE_XML - Closes the attribute definition of the current node. -// -// ID_ATTRIBUTE_XML - Some statement nodes have an "id" attribute containing a -// string, which value uniquely identify that statement. Other nodes may refer -// by reference attributes to this value (currently used only for Label). -// -// TYPE_ATTRIBUTE_XML( FN ) - Type nodes refer to the result type id of an -// expression by a "type" attribute. FN is internally used by clang. -// -// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally -// used by clang. A boolean attribute have the values "0" or "1". -// -// ATTRIBUTE_SPECIAL_XML( FN, NAME ) - An attribute named NAME which deserves -// a special handling. See the appropriate documentations. -// -// ATTRIBUTE_FILE_LOCATION_XML - A bunch of attributes denoting the location of -// a statement in the source file(s). -// -// ATTRIBUTE_OPT_XML( FN, NAME ) - An optional attribute named NAME. -// Optional attributes are omitted for boolean types, if the value is false, -// for integral types, if the value is null and for strings, -// if the value is the empty string. FN is internally used by clang. -// -// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value -// is an enumeration defined with ENUM_XML macros immediately following after -// that macro. An optional attribute is ommited, if the particular enum is the -// empty string. FN is internally used by clang. -// -// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is -// internally used by clang. -// -// END_ENUM_XML - Closes the enumeration definition of the current attribute. -// -// SUB_NODE_XML( CLASS ) - A mandatory sub-node of class CLASS or its sub-classes. -// -// SUB_NODE_OPT_XML( CLASS ) - An optional sub-node of class CLASS or its sub-classes. -// -// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or -// its sub-classes. -// -//===----------------------------------------------------------------------===// - -#ifndef ATTRIBUTE_FILE_LOCATION_XML -# define ATTRIBUTE_FILE_LOCATION_XML \ - ATTRIBUTE_XML(getFilename(), "file") \ - ATTRIBUTE_XML(getLine(), "line") \ - ATTRIBUTE_XML(getColumn(), "col") \ - ATTRIBUTE_OPT_XML(getFilename(), "endfile") \ - ATTRIBUTE_OPT_XML(getLine(), "endline") \ - ATTRIBUTE_OPT_XML(getColumn(), "endcol") -#endif - -#ifndef TYPE_ATTRIBUTE_XML -# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#endif - -#ifndef CONTEXT_ATTRIBUTE_XML -# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context") -#endif - -//NODE_XML(TranslationUnitDecl, "TranslationUnit") -// SUB_NODE_SEQUENCE_XML(Decl) -//END_NODE_XML - -NODE_XML(Decl, "FIXME_Decl") - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclKindName(), "unhandled_decl_name") -END_NODE_XML - -NODE_XML(FunctionDecl, "Function") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType()) - ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type") - ATTRIBUTE_ENUM_OPT_XML(getStorageClass(), "storage_class") - ENUM_XML(SC_None, "") - ENUM_XML(SC_Extern, "extern") - ENUM_XML(SC_Static, "static") - ENUM_XML(SC_PrivateExtern, "__private_extern__") - END_ENUM_XML - ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline") - //ATTRIBUTE_OPT_XML(isVariadic(), "variadic") // in the type reference - ATTRIBUTE_XML(getNumParams(), "num_args") - ATTRIBUTE_OPT_XML(isMain(), "main") - ATTRIBUTE_OPT_XML(isExternC(), "externc") - ATTRIBUTE_OPT_XML(isGlobal(), "global") - SUB_NODE_SEQUENCE_XML(ParmVarDecl) - SUB_NODE_FN_BODY_XML -END_NODE_XML - -NODE_XML(CXXMethodDecl, "CXXMethod") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType()) - ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type") - ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline") - ATTRIBUTE_OPT_XML(isStatic(), "static") - ATTRIBUTE_OPT_XML(isVirtual(), "virtual") - ATTRIBUTE_OPT_XML(isPure(), "pure") - ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access") - ENUM_XML(AS_none, "") - ENUM_XML(AS_public, "public") - ENUM_XML(AS_protected, "protected") - ENUM_XML(AS_private, "private") - END_ENUM_XML - ATTRIBUTE_XML(getNumParams(), "num_args") - SUB_NODE_SEQUENCE_XML(ParmVarDecl) - SUB_NODE_FN_BODY_XML -END_NODE_XML - -NODE_XML(CXXConstructorDecl, "CXXConstructor") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType()) - ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type") - ATTRIBUTE_OPT_XML(isExplicit(), "is_explicit") - ATTRIBUTE_OPT_XML(isDefaultConstructor(), "is_default_ctor") - ATTRIBUTE_OPT_XML(isCopyConstructor(), "is_copy_ctor") - ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline") - ATTRIBUTE_OPT_XML(isStatic(), "static") - ATTRIBUTE_OPT_XML(isVirtual(), "virtual") - ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access") - ENUM_XML(AS_none, "") - ENUM_XML(AS_public, "public") - ENUM_XML(AS_protected, "protected") - ENUM_XML(AS_private, "private") - END_ENUM_XML - ATTRIBUTE_XML(getNumParams(), "num_args") - SUB_NODE_SEQUENCE_XML(ParmVarDecl) - SUB_NODE_FN_BODY_XML -END_NODE_XML - -NODE_XML(CXXDestructorDecl, "CXXDestructor") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType()) - ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type") - ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline") - ATTRIBUTE_OPT_XML(isStatic(), "static") - ATTRIBUTE_OPT_XML(isVirtual(), "virtual") - ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access") - ENUM_XML(AS_none, "") - ENUM_XML(AS_public, "public") - ENUM_XML(AS_protected, "protected") - ENUM_XML(AS_private, "private") - END_ENUM_XML - ATTRIBUTE_XML(getNumParams(), "num_args") - SUB_NODE_SEQUENCE_XML(ParmVarDecl) - SUB_NODE_FN_BODY_XML -END_NODE_XML - -NODE_XML(CXXConversionDecl, "CXXConversion") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType()) - ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type") - ATTRIBUTE_OPT_XML(isExplicit(), "is_explicit") - ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline") - ATTRIBUTE_OPT_XML(isStatic(), "static") - ATTRIBUTE_OPT_XML(isVirtual(), "virtual") - ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access") - ENUM_XML(AS_none, "") - ENUM_XML(AS_public, "public") - ENUM_XML(AS_protected, "protected") - ENUM_XML(AS_private, "private") - END_ENUM_XML - ATTRIBUTE_XML(getNumParams(), "num_args") - SUB_NODE_SEQUENCE_XML(ParmVarDecl) - SUB_NODE_FN_BODY_XML -END_NODE_XML - -NODE_XML(NamespaceDecl, "Namespace") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - SUB_NODE_SEQUENCE_XML(DeclContext) -END_NODE_XML - -NODE_XML(UsingDirectiveDecl, "UsingDirective") - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - ATTRIBUTE_XML(getNominatedNamespace(), "ref") -END_NODE_XML - -NODE_XML(NamespaceAliasDecl, "NamespaceAlias") - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - ATTRIBUTE_XML(getNamespace(), "ref") -END_NODE_XML - -NODE_XML(RecordDecl, "Record") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - ATTRIBUTE_OPT_XML(isDefinition() == false, "forward") - ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates - SUB_NODE_SEQUENCE_XML(FieldDecl) -END_NODE_XML - -NODE_XML(CXXRecordDecl, "CXXRecord") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - ATTRIBUTE_OPT_XML(isDefinition() == false, "forward") - ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates - SUB_NODE_SEQUENCE_XML(FieldDecl) -END_NODE_XML - -NODE_XML(EnumDecl, "Enum") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - ATTRIBUTE_OPT_XML(isDefinition() == false, "forward") - ATTRIBUTE_SPECIAL_XML(getIntegerType(), "type") // is NULL in pure declarations thus deserves special handling - SUB_NODE_SEQUENCE_XML(EnumConstantDecl) // only present in definition -END_NODE_XML - -NODE_XML(EnumConstantDecl, "EnumConstant") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getInitVal().toString(10, true), "value") // integer - SUB_NODE_OPT_XML(Expr) // init expr of this constant -END_NODE_XML - -NODE_XML(FieldDecl, "Field") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_OPT_XML(isMutable(), "mutable") - ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access") - ENUM_XML(AS_none, "") - ENUM_XML(AS_public, "public") - ENUM_XML(AS_protected, "protected") - ENUM_XML(AS_private, "private") - END_ENUM_XML - ATTRIBUTE_OPT_XML(isBitField(), "bitfield") - SUB_NODE_OPT_XML(Expr) // init expr of a bit field -END_NODE_XML - -NODE_XML(TypedefDecl, "Typedef") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getUnderlyingType()) -END_NODE_XML - -NODE_XML(VarDecl, "Var") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_ENUM_OPT_XML(getStorageClass(), "storage_class") - ENUM_XML(SC_None, "") - ENUM_XML(SC_Auto, "auto") - ENUM_XML(SC_Register, "register") - ENUM_XML(SC_Extern, "extern") - ENUM_XML(SC_Static, "static") - ENUM_XML(SC_PrivateExtern, "__private_extern__") - END_ENUM_XML - SUB_NODE_OPT_XML(Expr) // init expr -END_NODE_XML - -NODE_XML(ParmVarDecl, "ParmVar") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_OPT_XML(Expr) // default argument expression -END_NODE_XML - -NODE_XML(LinkageSpecDecl, "LinkageSpec") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_ENUM_OPT_XML(getLanguage(), "lang") - ENUM_XML(LinkageSpecDecl::lang_c, "C") - ENUM_XML(LinkageSpecDecl::lang_cxx, "CXX") - END_ENUM_XML - SUB_NODE_XML(DeclContext) -END_NODE_XML - -NODE_XML(TemplateDecl, "Template") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") -END_NODE_XML - -NODE_XML(TemplateTypeParmDecl, "TemplateTypeParm") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getNameAsString(), "name") -END_NODE_XML - -NODE_XML(UsingShadowDecl, "UsingShadow") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getTargetDecl(), "target_decl") - ATTRIBUTE_XML(getUsingDecl(), "using_decl") -END_NODE_XML - -NODE_XML(UsingDecl, "Using") - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getDeclContext(), "context") - ATTRIBUTE_XML(getQualifier(), "target_nested_namespace_decl") - ATTRIBUTE_XML(isTypeName(), "is_typename") -END_NODE_XML - -//===----------------------------------------------------------------------===// -#undef NODE_XML -#undef ID_ATTRIBUTE_XML -#undef TYPE_ATTRIBUTE_XML -#undef ATTRIBUTE_XML -#undef ATTRIBUTE_SPECIAL_XML -#undef ATTRIBUTE_OPT_XML -#undef ATTRIBUTE_ENUM_XML -#undef ATTRIBUTE_ENUM_OPT_XML -#undef ATTRIBUTE_FILE_LOCATION_XML -#undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_XML -#undef SUB_NODE_XML -#undef SUB_NODE_SEQUENCE_XML -#undef SUB_NODE_OPT_XML -#undef SUB_NODE_FN_BODY_XML diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h index f7f498b..ff92058 100644 --- a/include/clang/Frontend/DiagnosticOptions.h +++ b/include/clang/Frontend/DiagnosticOptions.h @@ -31,8 +31,10 @@ public: unsigned ShowFixits : 1; /// Show fixit information. unsigned ShowSourceRanges : 1; /// Show source ranges in numeric form. unsigned ShowParseableFixits : 1; /// Show machine parseable fix-its. - unsigned ShowOptionNames : 1; /// Show the diagnostic name for mappable + unsigned ShowNames : 1; /// Show the diagnostic name + unsigned ShowOptionNames : 1; /// Show the option name for mappable /// diagnostics. + unsigned ShowNoteIncludeStack : 1; /// Show include stacks for notes. unsigned ShowCategories : 2; /// Show categories: 0 -> none, 1 -> Number, /// 2 -> Full Name. unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences. @@ -60,6 +62,9 @@ public: /// testing and analysis. std::string DumpBuildInformation; + /// The file to log diagnostic output to. + std::string DiagnosticLogFile; + /// The list of -W... options used to alter the diagnostic mappings, with the /// prefixes removed. std::vector<std::string> Warnings; @@ -78,6 +83,7 @@ public: ShowColumn = 1; ShowFixits = 1; ShowLocation = 1; + ShowNames = 0; ShowOptionNames = 0; ShowCategories = 0; ShowSourceRanges = 0; diff --git a/include/clang/Frontend/DocumentXML.def b/include/clang/Frontend/DocumentXML.def deleted file mode 100644 index 4c52bd8..0000000 --- a/include/clang/Frontend/DocumentXML.def +++ /dev/null @@ -1,75 +0,0 @@ -//===-- DocumentXML.def - Metadata about Document XML nodes -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the XML root database structure as written in -// an AST XML document. -// The following macros are used: -// -// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete -// statement of class CLASS where CLASS is a class name used internally by clang. -// After a NODE_XML the definition of all (optional) attributes of that statement -// node and possible sub-nodes follows. -// -// END_NODE_XML - Closes the attribute definition of the current node. -// -// ID_ATTRIBUTE_XML - Some nodes have an "id" attribute containing a -// string, which value uniquely identify the entity represented by that node. -// Other nodes may refer by reference attributes to this value. -// -// ATTRIBUTE_SPECIAL_XML( FN, NAME ) - An attribute named NAME which deserves -// a special handling. See the appropriate documentations. -// -// SUB_NODE_XML( CLASS ) - A mandatory sub-node of class CLASS or its sub-classes. -// -// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or -// its sub-classes. -// -//===----------------------------------------------------------------------===// - -ROOT_NODE_XML("CLANG_XML") - ATTRIBUTE_SPECIAL_XML(ignore, "version") // special retrieving needed - SUB_NODE_XML("TranslationUnit") - SUB_NODE_XML("ReferenceSection") -END_NODE_XML - -NODE_XML("TranslationUnit") - SUB_NODE_SEQUENCE_XML(Decl) -END_NODE_XML - -NODE_XML("ReferenceSection") - SUB_NODE_XML("Types") - SUB_NODE_XML("Contexts") - SUB_NODE_XML("Files") -END_NODE_XML - -NODE_XML("Types") - SUB_NODE_SEQUENCE_XML(Type) -END_NODE_XML - -NODE_XML("Contexts") - SUB_NODE_SEQUENCE_XML(DeclContext) -END_NODE_XML - -NODE_XML("Files") - SUB_NODE_SEQUENCE_XML("File") -END_NODE_XML - -NODE_XML("File") - ID_ATTRIBUTE_XML - ATTRIBUTE_SPECIAL_XML(ignore, "name") // special retrieving needed, denotes the source file name -END_NODE_XML - - -//===----------------------------------------------------------------------===// -#undef NODE_XML -#undef ID_ATTRIBUTE_XML -#undef ATTRIBUTE_SPECIAL_XML -#undef END_NODE_XML -#undef SUB_NODE_XML -#undef SUB_NODE_SEQUENCE_XML diff --git a/include/clang/Frontend/DocumentXML.h b/include/clang/Frontend/DocumentXML.h deleted file mode 100644 index 602d846..0000000 --- a/include/clang/Frontend/DocumentXML.h +++ /dev/null @@ -1,185 +0,0 @@ -//===--- DocumentXML.h - XML document for ASTs ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the XML document class, which provides the means to -// dump out the AST in a XML form that exposes type details and other fields. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_FRONTEND_DOCUMENTXML_H -#define LLVM_CLANG_FRONTEND_DOCUMENTXML_H - -#include <string> -#include <map> -#include <stack> -#include "clang/AST/Type.h" -#include "clang/AST/TypeOrdering.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/ADT/DenseMap.h" - -namespace clang { - -//--------------------------------------------------------- forwards -class DeclContext; -class Decl; -class NamedDecl; -class FunctionDecl; -class ASTContext; -class LabelStmt; - -//--------------------------------------------------------- -namespace XML { - // id maps: - template<class T> - struct IdMap : llvm::DenseMap<T, unsigned> {}; - - template<> - struct IdMap<QualType> : std::map<QualType, unsigned, QualTypeOrdering> {}; - - template<> - struct IdMap<std::string> : std::map<std::string, unsigned> {}; -} - -//--------------------------------------------------------- -class DocumentXML { -public: - DocumentXML(const std::string& rootName, llvm::raw_ostream& out); - - void initialize(ASTContext &Context); - void PrintDecl(Decl *D); - void PrintStmt(const Stmt *S); // defined in StmtXML.cpp - void finalize(); - - - DocumentXML& addSubNode(const std::string& name); // also enters the sub node, returns *this - DocumentXML& toParent(); // returns *this - - void addAttribute(const char* pName, const QualType& pType); - void addAttribute(const char* pName, bool value); - - template<class T> - void addAttribute(const char* pName, const T* value) { - addPtrAttribute(pName, value); - } - - template<class T> - void addAttribute(const char* pName, T* value) { - addPtrAttribute(pName, value); - } - - template<class T> - void addAttribute(const char* pName, const T& value); - - template<class T> - void addAttributeOptional(const char* pName, const T& value); - - void addSourceFileAttribute(const std::string& fileName); - - PresumedLoc addLocation(const SourceLocation& Loc); - void addLocationRange(const SourceRange& R); - - static std::string escapeString(const char* pStr, std::string::size_type len); - -private: - DocumentXML(const DocumentXML&); // not defined - DocumentXML& operator=(const DocumentXML&); // not defined - - std::stack<std::string> NodeStack; - llvm::raw_ostream& Out; - ASTContext *Ctx; - bool HasCurrentNodeSubNodes; - - - XML::IdMap<QualType> Types; - XML::IdMap<const DeclContext*> Contexts; - XML::IdMap<const Type*> BasicTypes; - XML::IdMap<std::string> SourceFiles; - XML::IdMap<const NamedDecl*> Decls; - XML::IdMap<const LabelStmt*> Labels; - - void addContextsRecursively(const DeclContext *DC); - void addTypeRecursively(const Type* pType); - void addTypeRecursively(const QualType& pType); - - void Indent(); - - // forced pointer dispatch: - void addPtrAttribute(const char* pName, const Type* pType); - void addPtrAttribute(const char* pName, const NamedDecl* D); - void addPtrAttribute(const char* pName, const DeclContext* D); - void addPtrAttribute(const char* pName, const NamespaceDecl* D); // disambiguation - void addPtrAttribute(const char* pName, const NestedNameSpecifier* N); - void addPtrAttribute(const char* pName, const LabelStmt* L); - void addPtrAttribute(const char* pName, const char* text); - - // defined in TypeXML.cpp: - void addParentTypes(const Type* pType); - void writeTypeToXML(const Type* pType); - void writeTypeToXML(const QualType& pType); - class TypeAdder; - friend class TypeAdder; - - // defined in DeclXML.cpp: - void writeDeclToXML(Decl *D); - class DeclPrinter; - friend class DeclPrinter; - - // for addAttributeOptional: - static bool isDefault(unsigned value) { return value == 0; } - static bool isDefault(bool value) { return !value; } - static bool isDefault(Qualifiers::GC value) { return value == Qualifiers::GCNone; } - static bool isDefault(const std::string& value) { return value.empty(); } -}; - -//--------------------------------------------------------- inlines - -inline void DocumentXML::initialize(ASTContext &Context) { - Ctx = &Context; -} - -//--------------------------------------------------------- -template<class T> -inline void DocumentXML::addAttribute(const char* pName, const T& value) { - std::string repr; - { - llvm::raw_string_ostream buf(repr); - buf << value; - } - - Out << ' ' << pName << "=\"" - << DocumentXML::escapeString(repr.c_str(), repr.size()) - << "\""; -} - -//--------------------------------------------------------- -inline void DocumentXML::addPtrAttribute(const char* pName, const char* text) { - Out << ' ' << pName << "=\"" - << DocumentXML::escapeString(text, strlen(text)) - << "\""; -} - -//--------------------------------------------------------- -inline void DocumentXML::addAttribute(const char* pName, bool value) { - addPtrAttribute(pName, value ? "1" : "0"); -} - -//--------------------------------------------------------- -template<class T> -inline void DocumentXML::addAttributeOptional(const char* pName, - const T& value) { - if (!isDefault(value)) { - addAttribute(pName, value); - } -} - -//--------------------------------------------------------- - -} //namespace clang - -#endif //LLVM_CLANG_DOCUMENTXML_H diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index 4df2e71..4e67449 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -42,12 +42,6 @@ protected: llvm::StringRef InFile); }; -class ASTPrintXMLAction : public ASTFrontendAction { -protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile); -}; - class ASTDumpAction : public ASTFrontendAction { protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, diff --git a/include/clang/Frontend/FrontendDiagnostic.h b/include/clang/Frontend/FrontendDiagnostic.h index 2efbc81..3e9508c 100644 --- a/include/clang/Frontend/FrontendDiagnostic.h +++ b/include/clang/Frontend/FrontendDiagnostic.h @@ -15,7 +15,8 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE,ACCESS,CATEGORY) ENUM, +#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ + SFINAE,ACCESS,CATEGORY,BRIEF,FULL) 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 19d39c3..02f6f86 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -23,7 +23,6 @@ namespace frontend { ASTDump, ///< Parse ASTs and dump them. ASTDumpXML, ///< Parse ASTs and dump them in XML. ASTPrint, ///< Parse ASTs and print them. - ASTPrintXML, ///< Parse ASTs and print them in XML. ASTView, ///< Parse ASTs and view them in Graphviz. BoostCon, ///< BoostCon mode. CreateModule, ///< Create module definition diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h index 441d34f..74ca519 100644 --- a/include/clang/Frontend/LangStandard.h +++ b/include/clang/Frontend/LangStandard.h @@ -19,12 +19,13 @@ namespace frontend { enum LangFeatures { BCPLComment = (1 << 0), C99 = (1 << 1), - CPlusPlus = (1 << 2), - CPlusPlus0x = (1 << 3), - Digraphs = (1 << 4), - GNUMode = (1 << 5), - HexFloat = (1 << 6), - ImplicitInt = (1 << 7) + C1X = (1 << 2), + CPlusPlus = (1 << 3), + CPlusPlus0x = (1 << 4), + Digraphs = (1 << 5), + GNUMode = (1 << 6), + HexFloat = (1 << 7), + ImplicitInt = (1 << 8) }; } @@ -56,6 +57,9 @@ public: /// isC99 - Language is a superset of C99. bool isC99() const { return Flags & frontend::C99; } + /// isC1X - Language is a superset of C1X. + bool isC1X() const { return Flags & frontend::C1X; } + /// isCPlusPlus - Language is a C++ variant. bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; } diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index d4046b3..586e5c8 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -54,11 +54,23 @@ LANGSTANDARD(iso9899_199x, LANGSTANDARD(gnu99, "gnu99", "ISO C 1999 with GNU extensions", - BCPLComment | C99 | Digraphs | GNUMode | HexFloat | Digraphs) + BCPLComment | C99 | Digraphs | GNUMode | HexFloat) LANGSTANDARD(gnu9x, "gnu9x", "ISO C 1999 with GNU extensions", BCPLComment | C99 | Digraphs | GNUMode | HexFloat) +// C1X modes +LANGSTANDARD(c1x, "c1x", + "ISO C 201X", + BCPLComment | C99 | C1X | Digraphs | HexFloat) +LANGSTANDARD(iso9899_201x, + "iso9899:201x", "ISO C 201X", + BCPLComment | C99 | C1X | Digraphs | HexFloat) + +LANGSTANDARD(gnu1x, "gnu1x", + "ISO C 201X with GNU extensions", + BCPLComment | C99 | C1X | Digraphs | GNUMode | HexFloat) + // C++ modes LANGSTANDARD(cxx98, "c++98", "ISO C++ 1998 with amendments", diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h new file mode 100644 index 0000000..b6fc23c --- /dev/null +++ b/include/clang/Frontend/LogDiagnosticPrinter.h @@ -0,0 +1,77 @@ +//===--- LogDiagnosticPrinter.h - Log Diagnostic Client ---------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_FRONTEND_LOG_DIAGNOSTIC_PRINTER_H_ +#define LLVM_CLANG_FRONTEND_LOG_DIAGNOSTIC_PRINTER_H_ + +#include "clang/Basic/Diagnostic.h" +#include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/SmallVector.h" + +namespace clang { +class DiagnosticOptions; +class LangOptions; + +class LogDiagnosticPrinter : public DiagnosticClient { + struct DiagEntry { + /// The primary message line of the diagnostic. + std::string Message; + + /// The source file name, if available. + std::string Filename; + + /// The source file line number, if available. + unsigned Line; + + /// The source file column number, if available. + unsigned Column; + + /// The ID of the diagnostic. + unsigned DiagnosticID; + + /// The level of the diagnostic. + Diagnostic::Level DiagnosticLevel; + }; + + llvm::raw_ostream &OS; + const LangOptions *LangOpts; + const DiagnosticOptions *DiagOpts; + + SourceLocation LastWarningLoc; + FullSourceLoc LastLoc; + unsigned OwnsOutputStream : 1; + + llvm::SmallVector<DiagEntry, 8> Entries; + + std::string MainFilename; + std::string DwarfDebugFlags; + +public: + LogDiagnosticPrinter(llvm::raw_ostream &OS, const DiagnosticOptions &Diags, + bool OwnsOutputStream = false); + virtual ~LogDiagnosticPrinter(); + + void setDwarfDebugFlags(llvm::StringRef Value) { + DwarfDebugFlags = Value; + } + + void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) { + LangOpts = &LO; + } + + void EndSourceFile(); + + virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + const DiagnosticInfo &Info); +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h index 560178b..4242f01 100644 --- a/include/clang/Frontend/MultiplexConsumer.h +++ b/include/clang/Frontend/MultiplexConsumer.h @@ -12,6 +12,9 @@ // //===----------------------------------------------------------------------===// +#ifndef CLANG_FRONTEND_MULTIPLEXCONSUMER_H +#define CLANG_FRONTEND_MULTIPLEXCONSUMER_H + #include "clang/Sema/SemaConsumer.h" #include "llvm/ADT/OwningPtr.h" #include <vector> @@ -52,3 +55,5 @@ private: }; } // end namespace clang + +#endif diff --git a/include/clang/Frontend/PreprocessorOptions.h b/include/clang/Frontend/PreprocessorOptions.h index 0d52e53..e875ec1 100644 --- a/include/clang/Frontend/PreprocessorOptions.h +++ b/include/clang/Frontend/PreprocessorOptions.h @@ -44,6 +44,9 @@ public: /// The implicit PCH included at the start of the translation unit, or empty. std::string ImplicitPCHInclude; + /// \brief Headers that will be converted to chained PCHs in memory. + std::vector<std::string> ChainedIncludes; + /// \brief When true, disables most of the normal validation performed on /// precompiled headers. bool DisablePCHValidation; @@ -73,6 +76,10 @@ public: /// If given, a PTH cache file to use for speeding up header parsing. std::string TokenCache; + /// \brief True if the SourceManager should report the original file name for + /// contents of files that were remapped to other files. Defaults to true. + bool RemappedFilesKeepOriginalName; + /// \brief The set of file remappings, which take existing files on /// the system (the first part of each pair) and gives them the /// contents of other files on the system (the second part of each @@ -132,6 +139,7 @@ public: DisablePCHValidation(false), DisableStatCache(false), DumpDeserializedPCHDecls(false), PrecompiledPreambleBytes(0, true), + RemappedFilesKeepOriginalName(true), RetainRemappedFileBuffers(false) { } void addMacroDef(llvm::StringRef Name) { diff --git a/include/clang/Frontend/StmtXML.def b/include/clang/Frontend/StmtXML.def deleted file mode 100644 index 8a859e6..0000000 --- a/include/clang/Frontend/StmtXML.def +++ /dev/null @@ -1,520 +0,0 @@ -//===-- StmtXML.def - Metadata about Stmt XML nodes ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the XML statement database structure as written in -// <TranslationUnit> sub-nodes of the XML document. -// The semantics of the attributes and enums are mostly self-documenting -// by looking at the appropriate internally used functions and values. -// The following macros are used: -// -// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete -// statement of class CLASS where CLASS is a class name used internally by clang. -// After a NODE_XML the definition of all (optional) attributes of that statement -// node and possible sub-nodes follows. -// -// END_NODE_XML - Closes the attribute definition of the current node. -// -// ID_ATTRIBUTE_XML - Some statement nodes have an "id" attribute containing a -// string, which value uniquely identify that statement. Other nodes may refer -// by reference attributes to this value (currently used only for Label). -// -// TYPE_ATTRIBUTE_XML( FN ) - Type nodes refer to the result type id of an -// expression by a "type" attribute. FN is internally used by clang. -// -// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally -// used by clang. A boolean attribute have the values "0" or "1". -// -// ATTRIBUTE_SPECIAL_XML( FN, NAME ) - An attribute named NAME which deserves -// a special handling. See the appropriate documentations. -// -// ATTRIBUTE_FILE_LOCATION_XML - A bunch of attributes denoting the location of -// a statement in the source file(s). -// -// ATTRIBUTE_OPT_XML( FN, NAME ) - An optional attribute named NAME. -// Optional attributes are omitted for boolean types, if the value is false, -// for integral types, if the value is null and for strings, -// if the value is the empty string. FN is internally used by clang. -// -// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value -// is an enumeration defined with ENUM_XML macros immediately following after -// that macro. An optional attribute is ommited, if the particular enum is the -// empty string. FN is internally used by clang. -// -// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is -// internally used by clang. -// -// END_ENUM_XML - Closes the enumeration definition of the current attribute. -// -// SUB_NODE_XML( CLASS ) - A mandatory sub-node of class CLASS or its sub-classes. -// -// SUB_NODE_OPT_XML( CLASS ) - An optional sub-node of class CLASS or its sub-classes. -// -// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or -// its sub-classes. -// -//===----------------------------------------------------------------------===// - -#ifndef ATTRIBUTE_FILE_LOCATION_XML -# define ATTRIBUTE_FILE_LOCATION_XML \ - ATTRIBUTE_XML(getFilename(), "file") \ - ATTRIBUTE_XML(getLine(), "line") \ - ATTRIBUTE_XML(getColumn(), "col") \ - ATTRIBUTE_OPT_XML(getFilename(), "endfile") \ - ATTRIBUTE_OPT_XML(getLine(), "endline") \ - ATTRIBUTE_OPT_XML(getColumn(), "endcol") -#endif - -#ifndef TYPE_ATTRIBUTE_XML -# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#endif - -#ifndef CONTEXT_ATTRIBUTE_XML -# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context") -#endif - -NODE_XML(Stmt, "Stmt_Unsupported") // fallback for unsupproted statements - ATTRIBUTE_FILE_LOCATION_XML -END_NODE_XML - -NODE_XML(NullStmt, "NullStmt") - ATTRIBUTE_FILE_LOCATION_XML -END_NODE_XML - -NODE_XML(CompoundStmt, "CompoundStmt") - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(size(), "num_stmts") - SUB_NODE_SEQUENCE_XML(Stmt) -END_NODE_XML - -NODE_XML(CaseStmt, "CaseStmt") // case expr: body; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Stmt) // body - SUB_NODE_XML(Expr) // expr - SUB_NODE_XML(Expr) // rhs expr in gc extension: case expr .. expr: body; -END_NODE_XML - -NODE_XML(DefaultStmt, "DefaultStmt") // default: body; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(LabelStmt, "LabelStmt") // Label: body; - ID_ATTRIBUTE_XML - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getName(), "name") // string - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(IfStmt, "IfStmt") // if (cond) stmt1; else stmt2; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // cond - SUB_NODE_XML(Stmt) // stmt1 - SUB_NODE_XML(Stmt) // stmt2 -END_NODE_XML - -NODE_XML(SwitchStmt, "SwitchStmt") // switch (cond) body; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // cond - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(WhileStmt, "WhileStmt") // while (cond) body; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // cond - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(DoStmt, "DoStmt") // do body while (cond); - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // cond - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(ForStmt, "ForStmt") // for (init; cond; inc) body; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Stmt) // init - SUB_NODE_XML(Expr) // cond - SUB_NODE_XML(Expr) // inc - SUB_NODE_XML(Stmt) // body -END_NODE_XML - -NODE_XML(GotoStmt, "GotoStmt") // goto label; - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getLabel()->getName(), "name") // informal string - ATTRIBUTE_XML(getLabel(), "ref") // id string -END_NODE_XML - -NODE_XML(IndirectGotoStmt, "IndirectGotoStmt") // goto expr; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(ContinueStmt, "ContinueStmt") // continue - ATTRIBUTE_FILE_LOCATION_XML -END_NODE_XML - -NODE_XML(BreakStmt, "BreakStmt") // break - ATTRIBUTE_FILE_LOCATION_XML -END_NODE_XML - -NODE_XML(ReturnStmt, "ReturnStmt") // return expr; - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(AsmStmt, "AsmStmt") // GNU inline-assembly statement extension - ATTRIBUTE_FILE_LOCATION_XML - // FIXME -END_NODE_XML - -NODE_XML(DeclStmt, "DeclStmt") // a declaration statement - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_SEQUENCE_XML(Decl) -END_NODE_XML - -// C++ statements -NODE_XML(CXXTryStmt, "CXXTryStmt") // try CompoundStmt CXXCatchStmt1 CXXCatchStmt2 .. - ATTRIBUTE_FILE_LOCATION_XML - ATTRIBUTE_XML(getNumHandlers(), "num_handlers") - SUB_NODE_XML(CompoundStmt) - SUB_NODE_SEQUENCE_XML(CXXCatchStmt) -END_NODE_XML - -NODE_XML(CXXCatchStmt, "CXXCatchStmt") // catch (decl) Stmt - ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(VarDecl) - SUB_NODE_XML(Stmt) -END_NODE_XML - -// Expressions -NODE_XML(PredefinedExpr, "PredefinedExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_ENUM_XML(getIdentType(), "kind") - ENUM_XML(PredefinedExpr::Func, "__func__") - ENUM_XML(PredefinedExpr::Function, "__FUNCTION__") - ENUM_XML(PredefinedExpr::PrettyFunction, "__PRETTY_FUNCTION__") - END_ENUM_XML -END_NODE_XML - -NODE_XML(DeclRefExpr, "DeclRefExpr") // an expression referring to a declared entity - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getDecl(), "ref") // id string of the declaration - ATTRIBUTE_XML(getDecl()->getNameAsString(), "name") // informal - //ATTRIBUTE_ENUM_XML(getDecl()->getKind(), "kind") // really needed here? -END_NODE_XML - -NODE_XML(IntegerLiteral, "IntegerLiteral") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getValue(), "value") // (signed) integer -END_NODE_XML - -NODE_XML(CharacterLiteral, "CharacterLiteral") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getValue(), "value") // unsigned -END_NODE_XML - -NODE_XML(FloatingLiteral, "FloatingLiteral") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - // FIXME: output float as written in source (no approximation or the like) - //ATTRIBUTE_XML(getValueAsApproximateDouble(), "value") // float -END_NODE_XML - -NODE_XML(StringLiteral, "StringLiteral") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_SPECIAL_XML(getStrData(), "value") // string, special handling for escaping needed - ATTRIBUTE_OPT_XML(isWide(), "is_wide") // boolean -END_NODE_XML - -NODE_XML(UnaryOperator, "UnaryOperator") // op(expr) or (expr)op - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_ENUM_XML(getOpcode(), "kind") - ENUM_XML(UO_PostInc, "postinc") - ENUM_XML(UO_PostDec, "postdec") - ENUM_XML(UO_PreInc, "preinc") - ENUM_XML(UO_PreDec, "predec") - ENUM_XML(UO_AddrOf, "addrof") - ENUM_XML(UO_Deref, "deref") - ENUM_XML(UO_Plus, "plus") - ENUM_XML(UO_Minus, "minus") - ENUM_XML(UO_Not, "not") // bitwise not - ENUM_XML(UO_LNot, "lnot") // boolean not - ENUM_XML(UO_Real, "__real") - ENUM_XML(UO_Imag, "__imag") - ENUM_XML(UO_Extension, "__extension__") - END_ENUM_XML - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(BinaryOperator, "BinaryOperator") // (expr1) op (expr2) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_ENUM_XML(getOpcode(), "kind") - ENUM_XML(BO_PtrMemD , "ptrmemd") - ENUM_XML(BO_PtrMemI , "ptrmemi") - ENUM_XML(BO_Mul , "mul") - ENUM_XML(BO_Div , "div") - ENUM_XML(BO_Rem , "rem") - ENUM_XML(BO_Add , "add") - ENUM_XML(BO_Sub , "sub") - ENUM_XML(BO_Shl , "shl") - ENUM_XML(BO_Shr , "shr") - ENUM_XML(BO_LT , "lt") - ENUM_XML(BO_GT , "gt") - ENUM_XML(BO_LE , "le") - ENUM_XML(BO_GE , "ge") - ENUM_XML(BO_EQ , "eq") - ENUM_XML(BO_NE , "ne") - ENUM_XML(BO_And , "and") // bitwise and - ENUM_XML(BO_Xor , "xor") - ENUM_XML(BO_Or , "or") // bitwise or - ENUM_XML(BO_LAnd , "land") // boolean and - ENUM_XML(BO_LOr , "lor") // boolean or - ENUM_XML(BO_Assign , "assign") - ENUM_XML(BO_MulAssign, "mulassign") - ENUM_XML(BO_DivAssign, "divassign") - ENUM_XML(BO_RemAssign, "remassign") - ENUM_XML(BO_AddAssign, "addassign") - ENUM_XML(BO_SubAssign, "subassign") - ENUM_XML(BO_ShlAssign, "shlassign") - ENUM_XML(BO_ShrAssign, "shrassign") - ENUM_XML(BO_AndAssign, "andassign") - ENUM_XML(BO_XorAssign, "xorassign") - ENUM_XML(BO_OrAssign , "orassign") - ENUM_XML(BO_Comma , "comma") - END_ENUM_XML - SUB_NODE_XML(Expr) // expr1 - SUB_NODE_XML(Expr) // expr2 -END_NODE_XML - -// FIXME: is there a special class needed or is BinaryOperator sufficient? -//NODE_XML(CompoundAssignOperator, "CompoundAssignOperator") - -NODE_XML(ConditionalOperator, "ConditionalOperator") // expr1 ? expr2 : expr3 - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // expr1 - SUB_NODE_XML(Expr) // expr2 - SUB_NODE_XML(Expr) // expr3 -END_NODE_XML - -NODE_XML(OffsetOfExpr, "OffsetOfExpr") // offsetof(basetype, components) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getTypeSourceInfo()->getType()) - ATTRIBUTE_XML(getNumComponents(), "num_components") - SUB_NODE_SEQUENCE_XML(OffsetOfExpr::OffsetOfNode) -END_NODE_XML - -NODE_XML(SizeOfAlignOfExpr, "SizeOfAlignOfExpr") // sizeof(expr) or alignof(expr) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(isSizeOf(), "is_sizeof") - ATTRIBUTE_XML(isArgumentType(), "is_type") // "1" if expr denotes a type - ATTRIBUTE_SPECIAL_XML(getArgumentType(), "type_ref") // optional, denotes the type of expr, if is_type=="1", special handling needed since getArgumentType() could assert - SUB_NODE_OPT_XML(Expr) // expr, if is_type=="0" -END_NODE_XML - -NODE_XML(ArraySubscriptExpr, "ArraySubscriptExpr") // expr1[expr2] - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // expr1 - SUB_NODE_XML(Expr) // expr2 -END_NODE_XML - -NODE_XML(CallExpr, "CallExpr") // fnexpr(arg1, arg2, ...) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getNumArgs(), "num_args") // unsigned - SUB_NODE_XML(Expr) // fnexpr - SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN -END_NODE_XML - -NODE_XML(MemberExpr, "MemberExpr") // expr->F or expr.F - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(isArrow(), "is_deref") - ATTRIBUTE_XML(getMemberDecl(), "ref") // refers to F - ATTRIBUTE_XML(getMemberDecl()->getNameAsString(), "name") // informal - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(CStyleCastExpr, "CStyleCastExpr") // (type)expr - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getTypeAsWritten(), "type_ref") // denotes the type as written in the source code - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(ImplicitCastExpr, "ImplicitCastExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) -END_NODE_XML - -NODE_XML(CompoundLiteralExpr, "CompoundLiteralExpr") // [C99 6.5.2.5] - SUB_NODE_XML(Expr) // init -END_NODE_XML - -NODE_XML(ExtVectorElementExpr, "ExtVectorElementExpr") - SUB_NODE_XML(Expr) // base -END_NODE_XML - -NODE_XML(InitListExpr, "InitListExpr") // struct foo x = { expr1, { expr2, expr3 } }; - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_OPT_XML(getInitializedFieldInUnion(), "field_ref") // if a union is initialized, this refers to the initialized union field id - ATTRIBUTE_XML(getNumInits(), "num_inits") // unsigned - SUB_NODE_SEQUENCE_XML(Expr) // expr1..exprN -END_NODE_XML - -NODE_XML(DesignatedInitExpr, "DesignatedInitExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) -END_NODE_XML - -NODE_XML(ImplicitValueInitExpr, "ImplicitValueInitExpr") // Implicit value initializations occur within InitListExpr - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) -END_NODE_XML - -NODE_XML(VAArgExpr, "VAArgExpr") // used for the builtin function __builtin_va_start(expr) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(ParenExpr, "ParenExpr") // this represents a parethesized expression "(expr)". Only formed if full location information is requested. - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -// GNU Extensions -NODE_XML(AddrLabelExpr, "AddrLabelExpr") // the GNU address of label extension, representing &&label. - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getLabel(), "ref") // id string - SUB_NODE_XML(LabelStmt) // expr -END_NODE_XML - -NODE_XML(StmtExpr, "StmtExpr") // StmtExpr contains a single CompoundStmt node, which it evaluates and takes the value of the last subexpression. - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(CompoundStmt) -END_NODE_XML - -NODE_XML(ChooseExpr, "ChooseExpr") // GNU builtin-in function __builtin_choose_expr(expr1, expr2, expr3) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // expr1 - SUB_NODE_XML(Expr) // expr2 - SUB_NODE_XML(Expr) // expr3 -END_NODE_XML - -NODE_XML(GNUNullExpr, "GNUNullExpr") // GNU __null extension - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) -END_NODE_XML - -// C++ Expressions -NODE_XML(CXXOperatorCallExpr, "CXXOperatorCallExpr") // fnexpr(arg1, arg2, ...) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getNumArgs(), "num_args") // unsigned - SUB_NODE_XML(Expr) // fnexpr - SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN -END_NODE_XML - -NODE_XML(CXXConstructExpr, "CXXConstructExpr") // ctor(arg1, arg2, ...) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getNumArgs(), "num_args") // unsigned - SUB_NODE_XML(Expr) // fnexpr - SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN -END_NODE_XML - -NODE_XML(CXXNamedCastExpr, "CXXNamedCastExpr") // xxx_cast<type>(expr) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_ENUM_XML(getStmtClass(), "kind") - ENUM_XML(Stmt::CXXStaticCastExprClass, "static_cast") - ENUM_XML(Stmt::CXXDynamicCastExprClass, "dynamic_cast") - ENUM_XML(Stmt::CXXReinterpretCastExprClass, "reinterpret_cast") - ENUM_XML(Stmt::CXXConstCastExprClass, "const_cast") - END_ENUM_XML - ATTRIBUTE_XML(getTypeAsWritten(), "type_ref") // denotes the type as written in the source code - SUB_NODE_XML(Expr) // expr -END_NODE_XML - -NODE_XML(CXXMemberCallExpr, "CXXMemberCallExpr") // fnexpr(arg1, arg2, ...) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getNumArgs(), "num_args") // unsigned - SUB_NODE_XML(Expr) // fnexpr - SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN -END_NODE_XML - -NODE_XML(CXXBoolLiteralExpr, "CXXBoolLiteralExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getValue(), "value") // boolean -END_NODE_XML - -NODE_XML(CXXNullPtrLiteralExpr, "CXXNullPtrLiteralExpr") // [C++0x 2.14.7] C++ Pointer Literal - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) -END_NODE_XML - -NODE_XML(CXXTypeidExpr, "CXXTypeidExpr") // typeid(expr) - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(isTypeOperand(), "is_type") // "1" if expr denotes a type - ATTRIBUTE_SPECIAL_XML(getTypeOperand(), "type_ref") // optional, denotes the type of expr, if is_type=="1", special handling needed since getTypeOperand() could assert - SUB_NODE_OPT_XML(Expr) // expr, if is_type=="0" -END_NODE_XML - -NODE_XML(CXXThisExpr, "CXXThisExpr") // this - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) -END_NODE_XML - -NODE_XML(CXXThrowExpr, "CXXThrowExpr") // throw (expr); - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(Expr) // NULL in case of "throw;" -END_NODE_XML - -NODE_XML(CXXDefaultArgExpr, "CXXDefaultArgExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getParam(), "ref") // id of the parameter declaration (the expression is a subnode of the declaration) -END_NODE_XML - -//===----------------------------------------------------------------------===// -#undef NODE_XML -#undef ID_ATTRIBUTE_XML -#undef TYPE_ATTRIBUTE_XML -#undef ATTRIBUTE_XML -#undef ATTRIBUTE_SPECIAL_XML -#undef ATTRIBUTE_OPT_XML -#undef ATTRIBUTE_ENUM_XML -#undef ATTRIBUTE_ENUM_OPT_XML -#undef ATTRIBUTE_FILE_LOCATION_XML -#undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_XML -#undef SUB_NODE_XML -#undef SUB_NODE_SEQUENCE_XML -#undef SUB_NODE_OPT_XML diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index f530294..d7d2692 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -53,7 +53,8 @@ public: LangOpts = 0; } - void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM); + void PrintIncludeStack(Diagnostic::Level Level, SourceLocation Loc, + const SourceManager &SM); void HighlightRange(const CharSourceRange &R, const SourceManager &SrcMgr, @@ -61,7 +62,7 @@ public: std::string &CaretLine, const std::string &SourceLine); - void EmitCaretDiagnostic(SourceLocation Loc, + void EmitCaretDiagnostic(Diagnostic::Level Level, SourceLocation Loc, CharSourceRange *Ranges, unsigned NumRanges, const SourceManager &SM, const FixItHint *Hints, @@ -71,7 +72,7 @@ public: unsigned MacroSkipStart, unsigned MacroSkipEnd); - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(Diagnostic::Level Level, const DiagnosticInfo &Info); }; diff --git a/include/clang/Frontend/TypeXML.def b/include/clang/Frontend/TypeXML.def deleted file mode 100644 index b78e70f..0000000 --- a/include/clang/Frontend/TypeXML.def +++ /dev/null @@ -1,304 +0,0 @@ -//===-- TypeXML.def - Metadata about Type XML nodes ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the XML type info database as written in the -// <ReferenceSection>/<Types> sub-nodes of the XML document. Type nodes -// are referred by "type" reference attributes throughout the document. -// A type node never contains sub-nodes. -// The semantics of the attributes and enums are mostly self-documenting -// by looking at the appropriate internally used functions and values. -// The following macros are used: -// -// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete -// type of class CLASS where CLASS is a class name used internally by clang. -// After a NODE_XML the definition of all (optional) attributes of that type -// node follows. -// -// END_NODE_XML - Closes the attribute definition of the current node. -// -// ID_ATTRIBUTE_XML - Each type node has an "id" attribute containing a -// string, which value uniquely identify the type. Other nodes may refer -// by "type" reference attributes to this value. -// -// TYPE_ATTRIBUTE_XML( FN ) - Type nodes may refer to the ids of other type -// nodes by a "type" attribute. FN is internally used by clang. -// -// CONTEXT_ATTRIBUTE_XML( FN ) - Type nodes may refer to the ids of their -// declaration contexts by a "context" attribute. FN is internally used by -// clang. -// -// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally -// used by clang. A boolean attribute have the values "0" or "1". -// -// ATTRIBUTE_OPT_XML( FN, NAME ) - An optional attribute named NAME. -// Optional attributes are omitted for boolean types, if the value is false, -// for integral types, if the value is null and for strings, -// if the value is the empty string. FN is internally used by clang. -// -// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value -// is an enumeration defined with ENUM_XML macros immediately following after -// that macro. An optional attribute is ommited, if the particular enum is the -// empty string. FN is internally used by clang. -// -// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is -// internally used by clang. -// -// END_ENUM_XML - Closes the enumeration definition of the current attribute. -// -//===----------------------------------------------------------------------===// - -#ifndef TYPE_ATTRIBUTE_XML -# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#endif - -#ifndef CONTEXT_ATTRIBUTE_XML -# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context") -#endif - -NODE_XML(Type, "FIXME_Type") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getTypeClassName(), "unhandled_type_name") -END_NODE_XML - -NODE_XML(QualType, "CvQualifiedType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getTypePtr()) // the qualified type, e.g. for 'T* const' it's 'T*' - ATTRIBUTE_OPT_XML(isLocalConstQualified(), "const") // boolean - ATTRIBUTE_OPT_XML(isLocalVolatileQualified(), "volatile") // boolean - ATTRIBUTE_OPT_XML(isLocalRestrictQualified(), "restrict") // boolean - ATTRIBUTE_OPT_XML(getObjCGCAttr(), "objc_gc") // Qualifiers::GC - ATTRIBUTE_OPT_XML(getAddressSpace(), "address_space") // unsigned -END_NODE_XML - -NODE_XML(BuiltinType, "FundamentalType") - ID_ATTRIBUTE_XML - ATTRIBUTE_ENUM_XML(getKind(), "kind") - ENUM_XML(BuiltinType::Void, "void") - ENUM_XML(BuiltinType::Bool, "bool") - ENUM_XML(BuiltinType::Char_U, "char") // not explicitely qualified char, depends on target platform - ENUM_XML(BuiltinType::Char_S, "char") // not explicitely qualified char, depends on target platform - ENUM_XML(BuiltinType::SChar, "signed char") - ENUM_XML(BuiltinType::Short, "short"); - ENUM_XML(BuiltinType::Int, "int"); - ENUM_XML(BuiltinType::Long, "long"); - ENUM_XML(BuiltinType::LongLong, "long long"); - ENUM_XML(BuiltinType::Int128, "__int128_t"); - ENUM_XML(BuiltinType::UChar, "unsigned char"); - ENUM_XML(BuiltinType::UShort, "unsigned short"); - ENUM_XML(BuiltinType::UInt, "unsigned int"); - ENUM_XML(BuiltinType::ULong, "unsigned long"); - ENUM_XML(BuiltinType::ULongLong, "unsigned long long"); - ENUM_XML(BuiltinType::UInt128, "__uint128_t"); - ENUM_XML(BuiltinType::Float, "float"); - ENUM_XML(BuiltinType::Double, "double"); - ENUM_XML(BuiltinType::LongDouble, "long double"); - ENUM_XML(BuiltinType::WChar_U, "wchar_t"); - ENUM_XML(BuiltinType::WChar_S, "wchar_t"); - ENUM_XML(BuiltinType::Char16, "char16_t"); - ENUM_XML(BuiltinType::Char32, "char32_t"); - ENUM_XML(BuiltinType::NullPtr, "nullptr_t"); // This is the type of C++0x 'nullptr'. - ENUM_XML(BuiltinType::Overload, "overloaded"); - ENUM_XML(BuiltinType::Dependent, "dependent"); - END_ENUM_XML -END_NODE_XML - -NODE_XML(PointerType, "PointerType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getPointeeType()) -END_NODE_XML - -NODE_XML(LValueReferenceType, "ReferenceType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getPointeeType()) -END_NODE_XML - -NODE_XML(RValueReferenceType, "ReferenceType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getPointeeType()) -END_NODE_XML - -NODE_XML(FunctionNoProtoType, "FunctionNoProtoType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(FunctionProtoType, "FunctionType") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getResultType(), "result_type") - ATTRIBUTE_OPT_XML(isVariadic(), "variadic") - ATTRIBUTE_ENUM_XML(getCallConv(), "call_conv") - ENUM_XML(CC_Default, "") - ENUM_XML(CC_C, "C") - ENUM_XML(CC_X86StdCall, "X86StdCall") - ENUM_XML(CC_X86FastCall, "X86FastCall") - ENUM_XML(CC_X86ThisCall, "X86ThisCall") - END_ENUM_XML -END_NODE_XML - -NODE_XML(TypedefType, "Typedef") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getDecl()->getUnderlyingType()) - ATTRIBUTE_XML(getDecl()->getNameAsString(), "name") // string - CONTEXT_ATTRIBUTE_XML(getDecl()->getDeclContext()) -END_NODE_XML - -NODE_XML(ComplexType, "ComplexType") // C99 complex types (_Complex float etc) - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) -END_NODE_XML - -NODE_XML(BlockPointerType, "BlockPointerType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getPointeeType()) // alway refers to a function type -END_NODE_XML - -NODE_XML(MemberPointerType, "MemberPointerType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getPointeeType()) - ATTRIBUTE_XML(getClass(), "class_type") // refers to the class type id of which the pointee is a member -END_NODE_XML - -NODE_XML(ConstantArrayType, "ArrayType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) - ATTRIBUTE_XML(getSize(), "size") // unsigned - ATTRIBUTE_ENUM_OPT_XML(getSizeModifier(), "size_modifier") - ENUM_XML(ArrayType::Normal, "") - ENUM_XML(ArrayType::Static, "static") - ENUM_XML(ArrayType::Star, "star") - END_ENUM_XML - ATTRIBUTE_OPT_XML(getIndexTypeCVRQualifiers(), "index_type_qualifier") // unsigned -END_NODE_XML - -NODE_XML(IncompleteArrayType, "IncompleteArrayType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) -END_NODE_XML - -NODE_XML(VariableArrayType, "VariableArrayType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) - // note: the size expression is print at the point of declaration -END_NODE_XML - -NODE_XML(DependentSizedArrayType, "DependentSizedArrayType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) - // FIXME: how to deal with size expression? -END_NODE_XML - -NODE_XML(VectorType, "VectorType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) - ATTRIBUTE_XML(getNumElements(), "size") // unsigned -END_NODE_XML - -NODE_XML(ExtVectorType, "ExtVectorType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getElementType()) - ATTRIBUTE_XML(getNumElements(), "size") // unsigned -END_NODE_XML - -NODE_XML(TypeOfExprType, "TypeOfExprType") - ID_ATTRIBUTE_XML - // note: the typeof expression is print at the point of use -END_NODE_XML - -NODE_XML(TypeOfType, "TypeOfType") - ID_ATTRIBUTE_XML - TYPE_ATTRIBUTE_XML(getUnderlyingType()) -END_NODE_XML - - -NODE_XML(RecordType, "Record") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDecl()->getNameAsString(), "name") // string - ATTRIBUTE_ENUM_XML(getDecl()->getTagKind(), "kind") - ENUM_XML(TTK_Struct, "struct") - ENUM_XML(TTK_Union, "union") - ENUM_XML(TTK_Class, "class") - END_ENUM_XML - CONTEXT_ATTRIBUTE_XML(getDecl()->getDeclContext()) -END_NODE_XML - -NODE_XML(EnumType, "Enum") - ID_ATTRIBUTE_XML - ATTRIBUTE_XML(getDecl()->getNameAsString(), "name") // string - CONTEXT_ATTRIBUTE_XML(getDecl()->getDeclContext()) -END_NODE_XML - -NODE_XML(TemplateTypeParmType, "TemplateTypeParmType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(TemplateSpecializationType, "TemplateSpecializationType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(ElaboratedType, "ElaboratedType") - ID_ATTRIBUTE_XML - ATTRIBUTE_ENUM_XML(getKeyword(), "keyword") - ENUM_XML(ETK_None, "none") - ENUM_XML(ETK_Typename, "typename") - ENUM_XML(ETK_Struct, "struct") - ENUM_XML(ETK_Union, "union") - ENUM_XML(ETK_Class, "class") - ENUM_XML(ETK_Enum, "enum") - END_ENUM_XML - TYPE_ATTRIBUTE_XML(getNamedType()) -END_NODE_XML - -NODE_XML(InjectedClassNameType, "InjectedClassNameType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(DependentNameType, "DependentNameType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(DependentTemplateSpecializationType, - "DependentTemplateSpecializationType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(ObjCInterfaceType, "ObjCInterfaceType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(ObjCObjectPointerType, "ObjCObjectPointerType") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(SubstTemplateTypeParmType, "SubstTemplateTypeParm") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(DependentSizedExtVectorType, "DependentSizedExtVector") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(UnresolvedUsingType, "UnresolvedUsing") - ID_ATTRIBUTE_XML -END_NODE_XML - -NODE_XML(DecltypeType, "Decltype") - ID_ATTRIBUTE_XML -END_NODE_XML - -//===----------------------------------------------------------------------===// -#undef NODE_XML -#undef ID_ATTRIBUTE_XML -#undef TYPE_ATTRIBUTE_XML -#undef CONTEXT_ATTRIBUTE_XML -#undef ATTRIBUTE_XML -#undef ATTRIBUTE_OPT_XML -#undef ATTRIBUTE_ENUM_XML -#undef ATTRIBUTE_ENUM_OPT_XML -#undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_XML diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 02342c1..e499716 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -14,7 +14,10 @@ #ifndef LLVM_CLANG_FRONTEND_UTILS_H #define LLVM_CLANG_FRONTEND_UTILS_H +#include "clang/Basic/Diagnostic.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/Support/raw_ostream.h" namespace llvm { @@ -24,6 +27,7 @@ class Triple; namespace clang { class ASTConsumer; class CompilerInstance; +class CompilerInvocation; class Decl; class DependencyOutputOptions; class Diagnostic; @@ -85,12 +89,23 @@ void AttachDependencyFileGen(Preprocessor &PP, /// \param OutputPath - If non-empty, a path to write the header include /// information to, instead of writing to stderr. void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false, - llvm::StringRef OutputPath = ""); + llvm::StringRef OutputPath = "", + bool ShowDepth = true); /// CacheTokens - Cache tokens for use with PCH. Note that this requires /// a seekable stream. void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS); +/// createInvocationFromCommandLine - Construct a compiler invocation object for +/// a command line argument vector. +/// +/// \return A CompilerInvocation, or 0 if none was built for the given +/// argument vector. +CompilerInvocation * +createInvocationFromCommandLine(llvm::ArrayRef<const char *> Args, + llvm::IntrusiveRefCntPtr<Diagnostic> Diags = + llvm::IntrusiveRefCntPtr<Diagnostic>()); + } // end namespace clang #endif |