diff options
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/ASTConsumers.h | 1 | ||||
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 43 | ||||
-rw-r--r-- | include/clang/Frontend/AnalysisConsumer.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/CommandLineSourceLoc.h | 49 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 18 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 18 | ||||
-rw-r--r-- | include/clang/Frontend/DeclXML.def | 58 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 17 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/LangStandard.h | 83 | ||||
-rw-r--r-- | include/clang/Frontend/LangStandards.def | 83 | ||||
-rw-r--r-- | include/clang/Frontend/PCHBitCodes.h | 8 | ||||
-rw-r--r-- | include/clang/Frontend/PathDiagnosticClients.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/StmtXML.def | 89 | ||||
-rw-r--r-- | include/clang/Frontend/TextDiagnosticBuffer.h | 4 |
15 files changed, 331 insertions, 146 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index 0e7d55e..26efa97 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -83,6 +83,7 @@ ASTConsumer *CreateBackendConsumer(BackendAction Action, const LangOptions &Features, const CodeGenOptions &CodeGenOpts, const TargetOptions &TargetOpts, + bool TimePasses, const std::string &ModuleID, llvm::raw_ostream *OS, llvm::LLVMContext& C); diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 7dfabba..04dc5ed 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -22,16 +22,17 @@ #include <string> namespace clang { - class FileManager; - class FileEntry; - class SourceManager; - class Diagnostic; - class TextDiagnosticBuffer; - class HeaderSearch; - class TargetInfo; - class Preprocessor; - class ASTContext; - class Decl; +class ASTContext; +class CompilerInvocation; +class Decl; +class Diagnostic; +class FileEntry; +class FileManager; +class HeaderSearch; +class Preprocessor; +class SourceManager; +class TargetInfo; +class TextDiagnosticBuffer; using namespace idx; @@ -92,21 +93,35 @@ public: /// /// \param Filename - The PCH file to load. /// - /// \param diagClient - The diagnostics client to use. Specify NULL + /// \param DiagClient - The diagnostics client to use. Specify NULL /// to use a default client that emits warnings/errors to standard error. /// The ASTUnit objects takes ownership of this object. /// - /// \param FileMgr - The FileManager to use. - /// /// \param ErrMsg - Error message to report if the PCH file could not be /// loaded. /// /// \returns - The initialized ASTUnit or null if the PCH failed to load. static ASTUnit *LoadFromPCHFile(const std::string &Filename, std::string *ErrMsg = 0, - DiagnosticClient *diagClient = NULL, + DiagnosticClient *DiagClient = NULL, bool OnlyLocalDecls = false, bool UseBumpAllocator = false); + + /// LoadFromCompilerInvocation - Create an ASTUnit from a source file, via a + /// CompilerInvocation object. + /// + /// \param CI - The compiler invocation to use; it must have exactly one input + /// source file. + /// + /// \param Diags - The diagnostics engine to use for reporting errors. + // + // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we + // shouldn't need to specify them at construction time. + static ASTUnit *LoadFromCompilerInvocation(const CompilerInvocation &CI, + Diagnostic &Diags, + bool OnlyLocalDecls = false, + bool UseBumpAllocator = false); + }; } // namespace clang diff --git a/include/clang/Frontend/AnalysisConsumer.h b/include/clang/Frontend/AnalysisConsumer.h index 7a32433..24fed6e 100644 --- a/include/clang/Frontend/AnalysisConsumer.h +++ b/include/clang/Frontend/AnalysisConsumer.h @@ -77,7 +77,7 @@ public: AnalyzeAll = 0; AnalyzerDisplayProgress = 0; EagerlyAssume = 0; - PurgeDead = 0; + PurgeDead = 1; TrimGraph = 0; VisualizeEGDot = 0; VisualizeEGUbi = 0; diff --git a/include/clang/Frontend/CommandLineSourceLoc.h b/include/clang/Frontend/CommandLineSourceLoc.h index d5a0598..bea468b 100644 --- a/include/clang/Frontend/CommandLineSourceLoc.h +++ b/include/clang/Frontend/CommandLineSourceLoc.h @@ -16,7 +16,7 @@ #define LLVM_CLANG_FRONTEND_COMMANDLINESOURCELOC_H #include "llvm/Support/CommandLine.h" -#include <cstdio> +#include "llvm/Support/raw_ostream.h" namespace clang { @@ -25,6 +25,23 @@ struct ParsedSourceLocation { std::string FileName; unsigned Line; unsigned Column; + +public: + /// Construct a parsed source location from a string; the Filename is empty on + /// error. + static ParsedSourceLocation FromString(llvm::StringRef Str) { + ParsedSourceLocation PSL; + std::pair<llvm::StringRef, llvm::StringRef> ColSplit = Str.rsplit(':'); + std::pair<llvm::StringRef, llvm::StringRef> LineSplit = + ColSplit.first.rsplit(':'); + + // If both tail splits were valid integers, return success. + if (!ColSplit.second.getAsInteger(10, PSL.Column) && + !LineSplit.second.getAsInteger(10, PSL.Line)) + PSL.FileName = LineSplit.first; + + return PSL; + } }; } @@ -48,35 +65,13 @@ namespace llvm { clang::ParsedSourceLocation &Val) { using namespace clang; - const char *ExpectedFormat - = "source location must be of the form filename:line:column"; - StringRef::size_type SecondColon = ArgValue.rfind(':'); - if (SecondColon == std::string::npos) { - std::fprintf(stderr, "%s\n", ExpectedFormat); - return true; - } - - unsigned Column; - if (ArgValue.substr(SecondColon + 1).getAsInteger(10, Column)) { - std::fprintf(stderr, "%s\n", ExpectedFormat); - return true; - } - ArgValue = ArgValue.substr(0, SecondColon); - - StringRef::size_type FirstColon = ArgValue.rfind(':'); - if (FirstColon == std::string::npos) { - std::fprintf(stderr, "%s\n", ExpectedFormat); - return true; - } - unsigned Line; - if (ArgValue.substr(FirstColon + 1).getAsInteger(10, Line)) { - std::fprintf(stderr, "%s\n", ExpectedFormat); + Val = ParsedSourceLocation::FromString(ArgValue); + if (Val.FileName.empty()) { + errs() << "error: " + << "source location must be of the form filename:line:column\n"; return true; } - Val.FileName = ArgValue.substr(0, FirstColon); - Val.Line = Line; - Val.Column = Column; return false; } } diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index ed28050..d7e7d99 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -21,6 +21,7 @@ namespace llvm { class LLVMContext; class raw_ostream; class raw_fd_ostream; +class Timer; } namespace clang { @@ -89,6 +90,9 @@ class CompilerInstance { /// The code completion consumer. llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer; + /// The frontend timer + llvm::OwningPtr<llvm::Timer> FrontendTimer; + /// The list of active output files. std::list< std::pair<std::string, llvm::raw_ostream*> > OutputFiles; @@ -367,6 +371,17 @@ public: void setCodeCompletionConsumer(CodeCompleteConsumer *Value); /// } + /// @name Frontend timer + /// { + + bool hasFrontendTimer() const { return FrontendTimer != 0; } + + llvm::Timer &getFrontendTimer() const { + assert(FrontendTimer && "Compiler instance has no frontend timer!"); + return *FrontendTimer; + } + + /// } /// @name Output Files /// { @@ -462,6 +477,9 @@ public: bool UseDebugPrinter, bool ShowMacros, llvm::raw_ostream &OS); + /// Create the frontend timer and replace any existing one with it. + void createFrontendTimer(); + /// Create the default output file (from the invocation's options) and add it /// to the list of tracked output files. llvm::raw_fd_ostream * diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 9d068c5..e7c51aa 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -31,6 +31,8 @@ namespace llvm { namespace clang { +class Diagnostic; + /// CompilerInvocation - Helper class for holding the data necessary to invoke /// the compiler. /// @@ -77,12 +79,18 @@ public: /// CreateFromArgs - Create a compiler invocation from a list of input /// options. /// - /// FIXME: Documenting error behavior. - /// /// \param Res [out] - The resulting invocation. - /// \param Args - The input argument strings. - static void CreateFromArgs(CompilerInvocation &Res, - const llvm::SmallVectorImpl<llvm::StringRef> &Args); + /// \param ArgBegin - The first element in the argument vector. + /// \param ArgEnd - The last element in the argument vector. + /// \param Argv0 - The program path (from argv[0]), for finding the builtin + /// compiler path. + /// \param MainAddr - The address of main (or some other function in the main + /// executable), for finding the builtin compiler path. + /// \param Diags - The diagnostic engine to use for errors. + static void CreateFromArgs(CompilerInvocation &Res, const char **ArgBegin, + const char **ArgEnd, const char *Argv0, + void *MainAddr, + Diagnostic &Diags); /// toArgs - Convert the CompilerInvocation to a list of strings suitable for /// passing to CreateFromArgs. diff --git a/include/clang/Frontend/DeclXML.def b/include/clang/Frontend/DeclXML.def index 8b80d1d..c750492 100644 --- a/include/clang/Frontend/DeclXML.def +++ b/include/clang/Frontend/DeclXML.def @@ -7,46 +7,46 @@ // //===----------------------------------------------------------------------===// // -// This file defines the XML statement database structure as written in -// <TranslationUnit> sub-nodes of the XML document. +// 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_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 +// 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 +// +// 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_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, +// 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 +// 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 +// +// 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. @@ -55,7 +55,7 @@ // // 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 +// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or // its sub-classes. // //===----------------------------------------------------------------------===// @@ -114,8 +114,8 @@ NODE_XML(CXXMethodDecl, "CXXMethodDecl") 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(isStatic(), "static") + ATTRIBUTE_OPT_XML(isVirtual(), "virtual") ATTRIBUTE_XML(getNumParams(), "num_args") SUB_NODE_SEQUENCE_XML(ParmVarDecl) //SUB_NODE_OPT_XML("Body") @@ -124,7 +124,7 @@ END_NODE_XML //NODE_XML("Body") // SUB_NODE_XML(Stmt) //END_NODE_XML - + NODE_XML(NamespaceDecl, "Namespace") ID_ATTRIBUTE_XML ATTRIBUTE_FILE_LOCATION_XML @@ -152,7 +152,7 @@ NODE_XML(RecordDecl, "Record") 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 + ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates SUB_NODE_SEQUENCE_XML(FieldDecl) END_NODE_XML @@ -162,7 +162,7 @@ NODE_XML(EnumDecl, "Enum") 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 + 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 @@ -209,7 +209,7 @@ NODE_XML(VarDecl, "Var") ENUM_XML(VarDecl::Static, "static") ENUM_XML(VarDecl::PrivateExtern, "__private_extern__") END_ENUM_XML - SUB_NODE_OPT_XML(Expr) // init expr + SUB_NODE_OPT_XML(Expr) // init expr END_NODE_XML NODE_XML(ParmVarDecl, "ParmVar") @@ -218,7 +218,7 @@ NODE_XML(ParmVarDecl, "ParmVar") ATTRIBUTE_XML(getDeclContext(), "context") ATTRIBUTE_XML(getNameAsString(), "name") TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_OPT_XML(Expr) // default argument expression + SUB_NODE_OPT_XML(Expr) // default argument expression END_NODE_XML NODE_XML(LinkageSpecDecl, "LinkageSpec") @@ -234,7 +234,7 @@ END_NODE_XML //===----------------------------------------------------------------------===// #undef NODE_XML -#undef ID_ATTRIBUTE_XML +#undef ID_ATTRIBUTE_XML #undef TYPE_ATTRIBUTE_XML #undef ATTRIBUTE_XML #undef ATTRIBUTE_SPECIAL_XML @@ -243,8 +243,8 @@ END_NODE_XML #undef ATTRIBUTE_ENUM_OPT_XML #undef ATTRIBUTE_FILE_LOCATION_XML #undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_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/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index 469ea53..3042767 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -14,10 +14,6 @@ #include "llvm/ADT/OwningPtr.h" #include <string> -namespace llvm { -class Timer; -} - namespace clang { class ASTUnit; class ASTConsumer; @@ -29,7 +25,6 @@ class FrontendAction { std::string CurrentFile; llvm::OwningPtr<ASTUnit> CurrentASTUnit; CompilerInstance *Instance; - llvm::Timer *CurrentTimer; protected: /// @name Implementation Action Interface @@ -112,18 +107,6 @@ public: void setCurrentFile(llvm::StringRef Value, ASTUnit *AST = 0); /// @} - /// @name Timing Utilities - /// @{ - - llvm::Timer *getCurrentTimer() const { - return CurrentTimer; - } - - void setCurrentTimer(llvm::Timer *Value) { - CurrentTimer = Value; - } - - /// @} /// @name Supported Modes /// @{ diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 197a2a0..c1ec8e7 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -107,7 +107,7 @@ public: public: FrontendOptions() { - DebugCodeCompletionPrinter = 0; + DebugCodeCompletionPrinter = 1; DisableFree = 0; EmptyInputOnly = 0; ProgramAction = frontend::ParseSyntaxOnly; diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h new file mode 100644 index 0000000..441d34f --- /dev/null +++ b/include/clang/Frontend/LangStandard.h @@ -0,0 +1,83 @@ +//===--- LangStandard.h -----------------------------------------*- 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_LANGSTANDARD_H +#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H + +#include "llvm/ADT/StringRef.h" + +namespace clang { + +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) +}; + +} + +/// LangStandard - Information about the properties of a particular language +/// standard. +struct LangStandard { + enum Kind { +#define LANGSTANDARD(id, name, desc, features) \ + lang_##id, +#include "clang/Frontend/LangStandards.def" + lang_unspecified + }; + + const char *ShortName; + const char *Description; + unsigned Flags; + +public: + /// getName - Get the name of this standard. + const char *getName() const { return ShortName; } + + /// getDescription - Get the description of this standard. + const char *getDescription() const { return Description; } + + /// hasBCPLComments - Language supports '//' comments. + bool hasBCPLComments() const { return Flags & frontend::BCPLComment; } + + /// isC99 - Language is a superset of C99. + bool isC99() const { return Flags & frontend::C99; } + + /// 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; } + + /// hasDigraphs - Language supports digraphs. + bool hasDigraphs() const { return Flags & frontend::Digraphs; } + + /// isGNUMode - Language includes GNU extensions. + bool isGNUMode() const { return Flags & frontend::GNUMode; } + + /// hasHexFloats - Language supports hexadecimal float constants. + bool hasHexFloats() const { return Flags & frontend::HexFloat; } + + /// hasImplicitInt - Language allows variables to be typed as int implicitly. + bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; } + + static const LangStandard &getLangStandardForKind(Kind K); + static const LangStandard *getLangStandardForName(llvm::StringRef Name); +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def new file mode 100644 index 0000000..52aa463 --- /dev/null +++ b/include/clang/Frontend/LangStandards.def @@ -0,0 +1,83 @@ +//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LANGSTANDARD +#error "LANGSTANDARD must be defined before including this file" +#endif + +/// LANGSTANDARD(IDENT, NAME, DESC, FEATURES) +/// +/// \param IDENT - The name of the standard as a C++ identifier. +/// \param NAME - The name of the standard. +/// \param DESC - A short description of the standard. +/// \param FEATURES - The standard features as flags, these are enums from the +/// clang::frontend namespace, which is assumed to be be available. + +// C89-ish modes. +LANGSTANDARD(c89, "c89", + "ISO C 1990", + ImplicitInt) +LANGSTANDARD(c90, "c90", + "ISO C 1990", + ImplicitInt) +LANGSTANDARD(iso9899_1990, "iso9899:1990", + "ISO C 1990", + ImplicitInt) + +LANGSTANDARD(c94, "iso9899:199409", + "ISO C 1990 with amendment 1", + Digraphs | ImplicitInt) + +LANGSTANDARD(gnu89, "gnu89", + "ISO C 1990 with GNU extensions", + BCPLComment | Digraphs | GNUMode | ImplicitInt) + +// C99-ish modes +LANGSTANDARD(c99, "c99", + "ISO C 1999", + BCPLComment | C99 | Digraphs | HexFloat) +LANGSTANDARD(c9x, "c9x", + "ISO C 1999", + BCPLComment | C99 | Digraphs | HexFloat) +LANGSTANDARD(iso9899_1999, + "iso9899:1999", "ISO C 1999", + BCPLComment | C99 | Digraphs | HexFloat) +LANGSTANDARD(iso9899_199x, + "iso9899:199x", "ISO C 1999", + BCPLComment | C99 | Digraphs | HexFloat) + +LANGSTANDARD(gnu99, "gnu99", + "ISO C 1999 with GNU extensions", + BCPLComment | C99 | Digraphs | GNUMode | HexFloat | Digraphs) +LANGSTANDARD(gnu9x, "gnu9x", + "ISO C 1999 with GNU extensions", + BCPLComment | C99 | Digraphs | GNUMode | HexFloat) + +// C++ modes +LANGSTANDARD(cxx98, "c++98", + "ISO C++ 1998 with amendments", + BCPLComment | CPlusPlus | Digraphs) +LANGSTANDARD(gnucxx98, "gnu++98", + "ISO C++ 1998 with " "amendments and GNU extensions", + BCPLComment | CPlusPlus | Digraphs | GNUMode) + +LANGSTANDARD(cxx0x, "c++0x", + "Upcoming ISO C++ 200x with amendments", + BCPLComment | CPlusPlus | CPlusPlus0x | Digraphs) +LANGSTANDARD(gnucxx0x, "gnu++0x", + "Upcoming ISO C++ 200x with amendments and GNU extensions", + BCPLComment | CPlusPlus | CPlusPlus0x | Digraphs | GNUMode) + +// OpenCL + +LANGSTANDARD(opencl, "cl", + "OpenCL 1.0", + BCPLComment | C99 | Digraphs | HexFloat) + +#undef LANGSTANDARD diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h index b2bb9a1..98463c3 100644 --- a/include/clang/Frontend/PCHBitCodes.h +++ b/include/clang/Frontend/PCHBitCodes.h @@ -336,7 +336,9 @@ namespace clang { /// \brief The ObjC 'id' type. PREDEF_TYPE_OBJC_ID = 26, /// \brief The ObjC 'Class' type. - PREDEF_TYPE_OBJC_CLASS = 27 + PREDEF_TYPE_OBJC_CLASS = 27, + /// \brief The ObjC 'SEL' type. + PREDEF_TYPE_OBJC_SEL = 28 }; /// \brief The number of predefined type IDs that are reserved for @@ -438,7 +440,9 @@ namespace clang { /// \brief Block descriptor type for Blocks CodeGen SPECIAL_TYPE_BLOCK_DESCRIPTOR = 12, /// \brief Block extedned descriptor type for Blocks CodeGen - SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR = 13 + SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR = 13, + /// \brief Objective-C "SEL" redefinition type + SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14 }; /// \brief Record codes for each kind of declaration. diff --git a/include/clang/Frontend/PathDiagnosticClients.h b/include/clang/Frontend/PathDiagnosticClients.h index 98831ba..f8d2eeb 100644 --- a/include/clang/Frontend/PathDiagnosticClients.h +++ b/include/clang/Frontend/PathDiagnosticClients.h @@ -14,9 +14,7 @@ #ifndef LLVM_CLANG_FRONTEND_PATH_DIAGNOSTIC_CLIENTS_H #define LLVM_CLANG_FRONTEND_PATH_DIAGNOSTIC_CLiENTS_H -#include <memory> #include <string> -#include "llvm/ADT/SmallVector.h" namespace clang { diff --git a/include/clang/Frontend/StmtXML.def b/include/clang/Frontend/StmtXML.def index fd79cf0..2f0da9e 100644 --- a/include/clang/Frontend/StmtXML.def +++ b/include/clang/Frontend/StmtXML.def @@ -7,46 +7,46 @@ // //===----------------------------------------------------------------------===// // -// This file defines the XML statement database structure as written in -// <TranslationUnit> sub-nodes of the XML document. +// 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_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 +// 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 +// +// 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_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, +// 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 +// 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 +// +// 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. @@ -55,7 +55,7 @@ // // 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 +// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or // its sub-classes. // //===----------------------------------------------------------------------===// @@ -94,21 +94,21 @@ END_NODE_XML NODE_XML(CaseStmt, "CaseStmt") // case expr: body; ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_XML(Stmt) // body + 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 + 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 + SUB_NODE_XML(Stmt) // body END_NODE_XML NODE_XML(IfStmt, "IfStmt") // if (cond) stmt1; else stmt2; @@ -173,23 +173,23 @@ NODE_XML(AsmStmt, "AsmStmt") // GNU inline-assembly sta // FIXME END_NODE_XML -NODE_XML(DeclStmt, "DeclStmt") // a declaration statement +NODE_XML(DeclStmt, "DeclStmt") // a declaration statement ATTRIBUTE_FILE_LOCATION_XML - SUB_NODE_SEQUENCE_XML(Decl) + 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) + 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) + SUB_NODE_XML(Stmt) END_NODE_XML // Expressions @@ -234,7 +234,7 @@ 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 + ATTRIBUTE_OPT_XML(isWide(), "is_wide") // boolean END_NODE_XML NODE_XML(UnaryOperator, "UnaryOperator") // op(expr) or (expr)op @@ -251,7 +251,7 @@ NODE_XML(UnaryOperator, "UnaryOperator") // op(expr) or (expr)op ENUM_XML(UnaryOperator::Minus, "minus") ENUM_XML(UnaryOperator::Not, "not") // bitwise not ENUM_XML(UnaryOperator::LNot, "lnot") // boolean not - ENUM_XML(UnaryOperator::Real, "__real") + ENUM_XML(UnaryOperator::Real, "__real") ENUM_XML(UnaryOperator::Imag, "__imag") ENUM_XML(UnaryOperator::Extension, "__extension__") ENUM_XML(UnaryOperator::OffsetOf, "__builtin_offsetof") @@ -314,7 +314,7 @@ 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(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" @@ -346,29 +346,29 @@ END_NODE_XML NODE_XML(CStyleCastExpr, "CStyleCastExpr") // (type)expr ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) + 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) + TYPE_ATTRIBUTE_XML(getType()) + SUB_NODE_XML(Expr) END_NODE_XML -NODE_XML(CompoundLiteralExpr, "CompoundLiteralExpr") // [C99 6.5.2.5] +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 + 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_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 @@ -412,8 +412,8 @@ END_NODE_XML NODE_XML(TypesCompatibleExpr, "TypesCompatibleExpr") // GNU builtin-in function __builtin_types_compatible_p ATTRIBUTE_FILE_LOCATION_XML TYPE_ATTRIBUTE_XML(getType()) - ATTRIBUTE_XML(getArgType1(), "type1_ref") // id of type1 - ATTRIBUTE_XML(getArgType2(), "type2_ref") // id of type2 + ATTRIBUTE_XML(getArgType1(), "type1_ref") // id of type1 + ATTRIBUTE_XML(getArgType2(), "type2_ref") // id of type2 END_NODE_XML NODE_XML(ChooseExpr, "ChooseExpr") // GNU builtin-in function __builtin_choose_expr(expr1, expr2, expr3) @@ -495,16 +495,9 @@ NODE_XML(CXXDefaultArgExpr, "CXXDefaultArgExpr") ATTRIBUTE_XML(getParam(), "ref") // id of the parameter declaration (the expression is a subnode of the declaration) END_NODE_XML -NODE_XML(CXXConditionDeclExpr, "CXXConditionDeclExpr") - ATTRIBUTE_FILE_LOCATION_XML - TYPE_ATTRIBUTE_XML(getType()) - SUB_NODE_XML(VarDecl) // a CXXConditionDeclExpr owns the declaration -END_NODE_XML - - //===----------------------------------------------------------------------===// #undef NODE_XML -#undef ID_ATTRIBUTE_XML +#undef ID_ATTRIBUTE_XML #undef TYPE_ATTRIBUTE_XML #undef ATTRIBUTE_XML #undef ATTRIBUTE_SPECIAL_XML @@ -513,8 +506,8 @@ END_NODE_XML #undef ATTRIBUTE_ENUM_OPT_XML #undef ATTRIBUTE_FILE_LOCATION_XML #undef ENUM_XML -#undef END_ENUM_XML -#undef END_NODE_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/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h index 4e907e1..380a1dd 100644 --- a/include/clang/Frontend/TextDiagnosticBuffer.h +++ b/include/clang/Frontend/TextDiagnosticBuffer.h @@ -41,6 +41,10 @@ public: virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info); + + /// FlushDiagnostics - Flush the buffered diagnostics to an given + /// diagnostic engine. + void FlushDiagnostics(Diagnostic &Diags) const; }; } // end namspace clang |