diff options
21 files changed, 0 insertions, 2441 deletions
diff --git a/clang/include/clang/Driver/CC1Options.td b/clang/include/clang/Driver/CC1Options.td index 0696f7d08e2..12f2556b9ea 100644 --- a/clang/include/clang/Driver/CC1Options.td +++ b/clang/include/clang/Driver/CC1Options.td @@ -318,8 +318,6 @@ def emit_html : Flag<"-emit-html">, HelpText<"Output input source as HTML">; def ast_print : Flag<"-ast-print">, HelpText<"Build ASTs and then pretty-print them">; -def ast_print_xml : Flag<"-ast-print-xml">, - HelpText<"Build ASTs and then print them in XML format">; def ast_dump : Flag<"-ast-dump">, HelpText<"Build ASTs and then debug dump them">; def ast_dump_xml : Flag<"-ast-dump-xml">, diff --git a/clang/include/clang/Frontend/ASTConsumers.h b/clang/include/clang/Frontend/ASTConsumers.h index c45bd407060..f82d616eca5 100644 --- a/clang/include/clang/Frontend/ASTConsumers.h +++ b/clang/include/clang/Frontend/ASTConsumers.h @@ -36,12 +36,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/clang/include/clang/Frontend/DeclContextXML.def b/clang/include/clang/Frontend/DeclContextXML.def deleted file mode 100644 index 39ed5f9432b..00000000000 --- a/clang/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/clang/include/clang/Frontend/DeclXML.def b/clang/include/clang/Frontend/DeclXML.def deleted file mode 100644 index 58f7e55fbe8..00000000000 --- a/clang/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/clang/include/clang/Frontend/DocumentXML.def b/clang/include/clang/Frontend/DocumentXML.def deleted file mode 100644 index 4c52bd84422..00000000000 --- a/clang/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/clang/include/clang/Frontend/DocumentXML.h b/clang/include/clang/Frontend/DocumentXML.h deleted file mode 100644 index 602d8465582..00000000000 --- a/clang/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/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h index 4df2e71571f..4e67449b854 100644 --- a/clang/include/clang/Frontend/FrontendActions.h +++ b/clang/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/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h index 19d39c3ca1b..02f6f868fe4 100644 --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/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/clang/include/clang/Frontend/StmtXML.def b/clang/include/clang/Frontend/StmtXML.def deleted file mode 100644 index 8a859e6898b..00000000000 --- a/clang/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/clang/include/clang/Frontend/TypeXML.def b/clang/include/clang/Frontend/TypeXML.def deleted file mode 100644 index b78e70f5aa8..00000000000 --- a/clang/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/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 92fb1e8cbeb..f198d955e86 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/ASTConsumers.h" -#include "clang/Frontend/DocumentXML.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/FileManager.h" @@ -51,39 +50,6 @@ ASTConsumer *clang::CreateASTPrinter(llvm::raw_ostream* out) { return new ASTPrinter(out); } -//===----------------------------------------------------------------------===// -/// ASTPrinterXML - XML-printer of ASTs - -namespace { - class ASTPrinterXML : public ASTConsumer { - DocumentXML Doc; - - public: - ASTPrinterXML(llvm::raw_ostream& o) : Doc("CLANG_XML", o) {} - - void Initialize(ASTContext &Context) { - Doc.initialize(Context); - } - - virtual void HandleTranslationUnit(ASTContext &Ctx) { - Doc.addSubNode("TranslationUnit"); - for (DeclContext::decl_iterator - D = Ctx.getTranslationUnitDecl()->decls_begin(), - DEnd = Ctx.getTranslationUnitDecl()->decls_end(); - D != DEnd; - ++D) - Doc.PrintDecl(*D); - Doc.toParent(); - Doc.finalize(); - } - }; -} // end anonymous namespace - - -ASTConsumer *clang::CreateASTPrinterXML(llvm::raw_ostream* out) { - return new ASTPrinterXML(out ? *out : llvm::outs()); -} - ASTConsumer *clang::CreateASTDumper() { return new ASTPrinter(0, true); } diff --git a/clang/lib/Frontend/CMakeLists.txt b/clang/lib/Frontend/CMakeLists.txt index 9f197b4f876..91c3a68dea8 100644 --- a/clang/lib/Frontend/CMakeLists.txt +++ b/clang/lib/Frontend/CMakeLists.txt @@ -16,10 +16,8 @@ add_clang_library(clangFrontend CacheTokens.cpp CompilerInstance.cpp CompilerInvocation.cpp - DeclXML.cpp DependencyFile.cpp DiagChecker.cpp - DocumentXML.cpp FrontendAction.cpp FrontendActions.cpp FrontendOptions.cpp @@ -29,10 +27,8 @@ add_clang_library(clangFrontend LangStandards.cpp MultiplexConsumer.cpp PrintPreprocessedOutput.cpp - StmtXML.cpp TextDiagnosticBuffer.cpp TextDiagnosticPrinter.cpp - TypeXML.cpp VerifyDiagnosticsClient.cpp Warnings.cpp ) diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index bf4d6cd86ad..8f994039235 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -322,7 +322,6 @@ static const char *getActionName(frontend::ActionKind Kind) { case frontend::ASTDump: return "-ast-dump"; case frontend::ASTDumpXML: return "-ast-dump-xml"; case frontend::ASTPrint: return "-ast-print"; - case frontend::ASTPrintXML: return "-ast-print-xml"; case frontend::ASTView: return "-ast-view"; case frontend::BoostCon: return "-boostcon"; case frontend::CreateModule: return "-create-module"; @@ -1039,8 +1038,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.ProgramAction = frontend::ASTDumpXML; break; case OPT_ast_print: Opts.ProgramAction = frontend::ASTPrint; break; - case OPT_ast_print_xml: - Opts.ProgramAction = frontend::ASTPrintXML; break; case OPT_ast_view: Opts.ProgramAction = frontend::ASTView; break; case OPT_boostcon: diff --git a/clang/lib/Frontend/DeclXML.cpp b/clang/lib/Frontend/DeclXML.cpp deleted file mode 100644 index 8d3d225a4b3..00000000000 --- a/clang/lib/Frontend/DeclXML.cpp +++ /dev/null @@ -1,183 +0,0 @@ -//===--- DeclXML.cpp - XML implementation for Decl ASTs -------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include "clang/Frontend/DocumentXML.h" -#include "clang/AST/DeclVisitor.h" -#include "clang/AST/Expr.h" - -namespace clang { - -//--------------------------------------------------------- -class DocumentXML::DeclPrinter : public DeclVisitor<DocumentXML::DeclPrinter> { - DocumentXML& Doc; - - void addSubNodes(FunctionDecl* FD) { - for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) { - Visit(FD->getParamDecl(i)); - Doc.toParent(); - } - } - - void addFunctionBody(FunctionDecl* FD) { - if (FD->isThisDeclarationADefinition()) { - Doc.addSubNode("Body"); - Doc.PrintStmt(FD->getBody()); - Doc.toParent(); - } - } - - void addSubNodes(RecordDecl* RD) { - for (RecordDecl::decl_iterator i = RD->decls_begin(), - e = RD->decls_end(); i != e; ++i) { - if (!(*i)->isImplicit()) { - Visit(*i); - Doc.toParent(); - } - } - } - - void addSubNodes(CXXRecordDecl* RD) { - addSubNodes(cast<RecordDecl>(RD)); - - if (RD->isDefinition()) { - // FIXME: This breaks XML generation - //Doc.addAttribute("num_bases", RD->getNumBases()); - - for (CXXRecordDecl::base_class_iterator - base = RD->bases_begin(), - bend = RD->bases_end(); - base != bend; - ++base) { - Doc.addSubNode("Base"); - Doc.addAttribute("id", base->getType()); - AccessSpecifier as = base->getAccessSpecifierAsWritten(); - const char* as_name = ""; - switch(as) { - case AS_none: as_name = ""; break; - case AS_public: as_name = "public"; break; - case AS_protected: as_name = "protected"; break; - case AS_private: as_name = "private"; break; - } - Doc.addAttributeOptional("access", as_name); - Doc.addAttribute("is_virtual", base->isVirtual()); - Doc.toParent(); - } - } - } - - void addSubNodes(EnumDecl* ED) { - for (EnumDecl::enumerator_iterator i = ED->enumerator_begin(), - e = ED->enumerator_end(); i != e; ++i) { - Visit(*i); - Doc.toParent(); - } - } - - void addSubNodes(EnumConstantDecl* ECD) { - if (ECD->getInitExpr()) - Doc.PrintStmt(ECD->getInitExpr()); - } - - void addSubNodes(FieldDecl* FdD) { - if (FdD->isBitField()) - Doc.PrintStmt(FdD->getBitWidth()); - } - - void addSubNodes(VarDecl* V) { - if (V->getInit()) - Doc.PrintStmt(V->getInit()); - } - - void addSubNodes(ParmVarDecl* argDecl) { - if (argDecl->getDefaultArg()) - Doc.PrintStmt(argDecl->getDefaultArg()); - } - - void addSubNodes(DeclContext* ns) { - - for (DeclContext::decl_iterator - d = ns->decls_begin(), - dend = ns->decls_end(); - d != dend; - ++d) { - Visit(*d); - Doc.toParent(); - } - } - - void addSpecialAttribute(const char* pName, EnumDecl* ED) { - const QualType& enumType = ED->getIntegerType(); - if (!enumType.isNull()) - Doc.addAttribute(pName, enumType); - } - - void addIdAttribute(LinkageSpecDecl* ED) { - Doc.addAttribute("id", ED); - } - - void addIdAttribute(NamedDecl* ND) { - Doc.addAttribute("id", ND); - } - -public: - DeclPrinter(DocumentXML& doc) : Doc(doc) {} - -#define NODE_XML( CLASS, NAME ) \ - void Visit##CLASS(CLASS* T) \ - { \ - Doc.addSubNode(NAME); - -#define ID_ATTRIBUTE_XML addIdAttribute(T); -#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, T->FN); -#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, T->FN); -#define ATTRIBUTE_FILE_LOCATION_XML Doc.addLocation(T->getLocation()); -#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, T); - -#define ATTRIBUTE_ENUM_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = false; \ - switch (T->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = true; \ - switch (T->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break; -#define END_ENUM_XML } } -#define END_NODE_XML } - -#define SUB_NODE_XML( CLASS ) addSubNodes(T); -#define SUB_NODE_SEQUENCE_XML( CLASS ) addSubNodes(T); -#define SUB_NODE_OPT_XML( CLASS ) addSubNodes(T); - -#define SUB_NODE_FN_BODY_XML addFunctionBody(T); - -#include "clang/Frontend/DeclXML.def" -}; - - -//--------------------------------------------------------- -void DocumentXML::writeDeclToXML(Decl *D) { - DeclPrinter(*this).Visit(D); - toParent(); -} - -//--------------------------------------------------------- -} // NS clang - diff --git a/clang/lib/Frontend/DocumentXML.cpp b/clang/lib/Frontend/DocumentXML.cpp deleted file mode 100644 index a09db0be473..00000000000 --- a/clang/lib/Frontend/DocumentXML.cpp +++ /dev/null @@ -1,381 +0,0 @@ -//===--- DocumentXML.cpp - XML document for ASTs --------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include "clang/Frontend/DocumentXML.h" -#include "clang/AST/Decl.h" -#include "clang/AST/DeclCXX.h" -#include "clang/AST/ASTContext.h" -#include "clang/Basic/SourceManager.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/Config/config.h" -#include <cstdio> - -namespace clang { - -//--------------------------------------------------------- -DocumentXML::DocumentXML(const std::string& rootName, llvm::raw_ostream& out) : - Out(out), - Ctx(0), - HasCurrentNodeSubNodes(false) { - NodeStack.push(rootName); - Out << "<?xml version=\"1.0\"?>\n<" << rootName; -} - -//--------------------------------------------------------- -DocumentXML& DocumentXML::addSubNode(const std::string& name) { - if (!HasCurrentNodeSubNodes) - Out << ">\n"; - NodeStack.push(name); - HasCurrentNodeSubNodes = false; - Indent(); - Out << "<" << NodeStack.top(); - return *this; -} - -//--------------------------------------------------------- -void DocumentXML::Indent() { - for (size_t i = 0, e = (NodeStack.size() - 1) * 2; i < e; ++i) - Out << ' '; -} - -//--------------------------------------------------------- -DocumentXML& DocumentXML::toParent() { - assert(NodeStack.size() > 1 && "too much backtracking"); - - if (HasCurrentNodeSubNodes) { - Indent(); - Out << "</" << NodeStack.top() << ">\n"; - } else - Out << "/>\n"; - NodeStack.pop(); - HasCurrentNodeSubNodes = true; - return *this; -} - -//--------------------------------------------------------- -namespace { - -enum tIdType { ID_NORMAL, ID_FILE, ID_LABEL, ID_LAST }; - -unsigned getNewId(tIdType idType) { - static unsigned int idCounts[ID_LAST] = { 0 }; - return ++idCounts[idType]; -} - -//--------------------------------------------------------- -inline std::string getPrefixedId(unsigned uId, tIdType idType) { - static const char idPrefix[ID_LAST] = { '_', 'f', 'l' }; - char buffer[20]; - char* BufPtr = llvm::utohex_buffer(uId, buffer + 20); - *--BufPtr = idPrefix[idType]; - return BufPtr; -} - -//--------------------------------------------------------- -template<class T, class V> -bool addToMap(T& idMap, const V& value, tIdType idType = ID_NORMAL) { - typename T::iterator i = idMap.find(value); - bool toAdd = i == idMap.end(); - if (toAdd) - idMap.insert(typename T::value_type(value, getNewId(idType))); - return toAdd; -} - -} // anon NS - - -//--------------------------------------------------------- -std::string DocumentXML::escapeString(const char* pStr, - std::string::size_type len) { - std::string value; - value.reserve(len + 1); - char buffer[16]; - for (unsigned i = 0; i < len; ++i) { - switch (char C = pStr[i]) { - default: - if (isprint(C)) - value += C; - else { -#ifdef LLVM_ON_WIN32 - sprintf(buffer, "\\%03o", C); -#else - snprintf(buffer, sizeof(buffer), "\\%03o", C); -#endif - value += buffer; - } - break; - - case '\n': value += "\\n"; break; - case '\t': value += "\\t"; break; - case '\a': value += "\\a"; break; - case '\b': value += "\\b"; break; - case '\r': value += "\\r"; break; - - case '&': value += "&"; break; - case '<': value += "<"; break; - case '>': value += ">"; break; - case '"': value += """; break; - case '\'': value += "'"; break; - - } - } - return value; -} - -//--------------------------------------------------------- -void DocumentXML::finalize() { - assert(NodeStack.size() == 1 && "not completely backtracked"); - - addSubNode("ReferenceSection"); - addSubNode("Types"); - - for (XML::IdMap<QualType>::iterator i = Types.begin(), e = Types.end(); - i != e; ++i) { - if (i->first.hasLocalQualifiers()) { - writeTypeToXML(i->first); - addAttribute("id", getPrefixedId(i->second, ID_NORMAL)); - toParent(); - } - } - - for (XML::IdMap<const Type*>::iterator i = BasicTypes.begin(), - e = BasicTypes.end(); i != e; ++i) { - writeTypeToXML(i->first); - addAttribute("id", getPrefixedId(i->second, ID_NORMAL)); - toParent(); - } - - - toParent().addSubNode("Contexts"); - - for (XML::IdMap<const DeclContext*>::iterator i = Contexts.begin(), - e = Contexts.end(); i != e; ++i) { - addSubNode(i->first->getDeclKindName()); - addAttribute("id", getPrefixedId(i->second, ID_NORMAL)); - if (const NamedDecl *ND = dyn_cast<NamedDecl>(i->first)) - addAttribute("name", ND->getNameAsString()); - if (const TagDecl *TD = dyn_cast<TagDecl>(i->first)) - addAttribute("type", getPrefixedId(BasicTypes[TD->getTypeForDecl()], ID_NORMAL)); - else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(i->first)) - addAttribute("type", getPrefixedId(BasicTypes[FD->getType()->getAs<FunctionType>()], ID_NORMAL)); - - if (const DeclContext* parent = i->first->getParent()) - addAttribute("context", parent); - toParent(); - } - - toParent().addSubNode("Files"); - - for (XML::IdMap<std::string>::iterator i = SourceFiles.begin(), - e = SourceFiles.end(); i != e; ++i) { - addSubNode("File"); - addAttribute("id", getPrefixedId(i->second, ID_FILE)); - addAttribute("name", escapeString(i->first.c_str(), i->first.size())); - toParent(); - } - - toParent().toParent(); - - // write the root closing node (which has always subnodes) - Out << "</" << NodeStack.top() << ">\n"; -} - -//--------------------------------------------------------- -void DocumentXML::addAttribute(const char* pAttributeName, - const QualType& pType) { - addTypeRecursively(pType); - addAttribute(pAttributeName, getPrefixedId(Types[pType], ID_NORMAL)); -} - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pAttributeName, - const Type* pType) { - addTypeRecursively(pType); - addAttribute(pAttributeName, getPrefixedId(BasicTypes[pType], ID_NORMAL)); -} - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pAttributeName, - const NestedNameSpecifier* pNNS) { - switch (pNNS->getKind()) { - case NestedNameSpecifier::Identifier: { - IdentifierInfo *ii = pNNS->getAsIdentifier(); - // FIXME how should we handle those ? - addPtrAttribute(pAttributeName, ii->getName().data()); - break; - } - case NestedNameSpecifier::Namespace: { - addPtrAttribute(pAttributeName, pNNS->getAsNamespace()); - break; - } - case NestedNameSpecifier::NamespaceAlias: { - addPtrAttribute(pAttributeName, pNNS->getAsNamespaceAlias()); - break; - } - case NestedNameSpecifier::TypeSpec: { - addPtrAttribute(pAttributeName, pNNS->getAsType()); - break; - } - case NestedNameSpecifier::TypeSpecWithTemplate: { - addPtrAttribute(pAttributeName, pNNS->getAsType()); - break; - } - case NestedNameSpecifier::Global: { - addPtrAttribute(pAttributeName, "::"); - break; - } - } -} - -//--------------------------------------------------------- -void DocumentXML::addTypeRecursively(const QualType& pType) -{ - if (addToMap(Types, pType)) - { - addTypeRecursively(pType.getTypePtr()); - // beautifier: a non-qualified type shall be transparent - if (!pType.hasLocalQualifiers()) - { - Types[pType] = BasicTypes[pType.getTypePtr()]; - } - } -} - -//--------------------------------------------------------- -void DocumentXML::addTypeRecursively(const Type* pType) -{ - if (addToMap(BasicTypes, pType)) - { - addParentTypes(pType); -/* - // FIXME: doesn't work in the immediate streaming approach - if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(pType)) - { - addSubNode("VariableArraySizeExpression"); - PrintStmt(VAT->getSizeExpr()); - toParent(); - } -*/ - } -} - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pName, const DeclContext* DC) -{ - addContextsRecursively(DC); - addAttribute(pName, getPrefixedId(Contexts[DC], ID_NORMAL)); -} - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pAttributeName, const NamedDecl* D) -{ - if (const DeclContext* DC = dyn_cast<DeclContext>(D)) - { - addContextsRecursively(DC); - addAttribute(pAttributeName, getPrefixedId(Contexts[DC], ID_NORMAL)); - } - else - { - addToMap(Decls, D); - addAttribute(pAttributeName, getPrefixedId(Decls[D], ID_NORMAL)); - } -} - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pName, const NamespaceDecl* D) -{ - addPtrAttribute(pName, static_cast<const DeclContext*>(D)); -} - -//--------------------------------------------------------- -void DocumentXML::addContextsRecursively(const DeclContext *DC) -{ - if (DC != 0 && addToMap(Contexts, DC)) - { - addContextsRecursively(DC->getParent()); - } -} - -//--------------------------------------------------------- -void DocumentXML::addSourceFileAttribute(const std::string& fileName) -{ - addToMap(SourceFiles, fileName, ID_FILE); - addAttribute("file", getPrefixedId(SourceFiles[fileName], ID_FILE)); -} - - -//--------------------------------------------------------- -void DocumentXML::addPtrAttribute(const char* pName, const LabelStmt* L) -{ - addToMap(Labels, L, ID_LABEL); - addAttribute(pName, getPrefixedId(Labels[L], ID_LABEL)); -} - - -//--------------------------------------------------------- -PresumedLoc DocumentXML::addLocation(const SourceLocation& Loc) -{ - SourceManager& SM = Ctx->getSourceManager(); - SourceLocation SpellingLoc = SM.getSpellingLoc(Loc); - PresumedLoc PLoc; - if (!SpellingLoc.isInvalid()) - { - PLoc = SM.getPresumedLoc(SpellingLoc); - if (PLoc.isValid()) { - addSourceFileAttribute(PLoc.getFilename()); - addAttribute("line", PLoc.getLine()); - addAttribute("col", PLoc.getColumn()); - } - } - // else there is no error in some cases (eg. CXXThisExpr) - return PLoc; -} - -//--------------------------------------------------------- -void DocumentXML::addLocationRange(const SourceRange& R) -{ - PresumedLoc PStartLoc = addLocation(R.getBegin()); - if (R.getBegin() != R.getEnd()) - { - SourceManager& SM = Ctx->getSourceManager(); - SourceLocation SpellingLoc = SM.getSpellingLoc(R.getEnd()); - if (!SpellingLoc.isInvalid()) - { - PresumedLoc PLoc = SM.getPresumedLoc(SpellingLoc); - if (PLoc.isInvalid()) { - } else if (PStartLoc.isInvalid() || - strcmp(PLoc.getFilename(), PStartLoc.getFilename()) != 0) { - addToMap(SourceFiles, PLoc.getFilename(), ID_FILE); - addAttribute("endfile", PLoc.getFilename()); - addAttribute("endline", PLoc.getLine()); - addAttribute("endcol", PLoc.getColumn()); - } else if (PLoc.getLine() != PStartLoc.getLine()) { - addAttribute("endline", PLoc.getLine()); - addAttribute("endcol", PLoc.getColumn()); - } else { - addAttribute("endcol", PLoc.getColumn()); - } - } - } -} - -//--------------------------------------------------------- -void DocumentXML::PrintDecl(Decl *D) -{ - writeDeclToXML(D); -} - -//--------------------------------------------------------- -} // NS clang - diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index d8e7d290450..7b06c7e49ac 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -47,13 +47,6 @@ ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI, return 0; } -ASTConsumer *ASTPrintXMLAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "xml")) - return CreateASTPrinterXML(OS); - return 0; -} - ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, llvm::StringRef InFile) { return CreateASTDumper(); diff --git a/clang/lib/Frontend/StmtXML.cpp b/clang/lib/Frontend/StmtXML.cpp deleted file mode 100644 index 257c1ccb005..00000000000 --- a/clang/lib/Frontend/StmtXML.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//===--- StmtXML.cpp - XML implementation for Stmt ASTs ------------------===// -// -// 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 Stmt::dumpXML methods, which dump out the -// AST to an XML document. -// -//===----------------------------------------------------------------------===// - -#include "clang/Frontend/DocumentXML.h" -#include "clang/AST/StmtVisitor.h" -#include "clang/AST/DeclObjC.h" -#include "clang/AST/DeclCXX.h" -#include "clang/Basic/SourceManager.h" -using namespace clang; - -//===----------------------------------------------------------------------===// -// StmtXML Visitor -//===----------------------------------------------------------------------===// - -namespace { - class StmtXML : public StmtVisitor<StmtXML> { - DocumentXML& Doc; - - //static const char *getOpcodeStr(UnaryOperator::Opcode Op); - //static const char *getOpcodeStr(BinaryOperator::Opcode Op); - - - void addSpecialAttribute(const char* pName, StringLiteral* Str) { - Doc.addAttribute(pName, Doc.escapeString(Str->getString().data(), - Str->getString().size())); - } - - void addSpecialAttribute(const char* pName, SizeOfAlignOfExpr* S) { - if (S->isArgumentType()) - Doc.addAttribute(pName, S->getArgumentType()); - } - - void addSpecialAttribute(const char* pName, CXXTypeidExpr* S) { - if (S->isTypeOperand()) - Doc.addAttribute(pName, S->getTypeOperand()); - } - - - public: - StmtXML(DocumentXML& doc) - : Doc(doc) { - } - - void DumpSubTree(Stmt *S) { - if (S) { - Visit(S); - if (DeclStmt* DS = dyn_cast<DeclStmt>(S)) { - for (DeclStmt::decl_iterator DI = DS->decl_begin(), - DE = DS->decl_end(); DI != DE; ++DI) { - Doc.PrintDecl(*DI); - } - } else { - for (Stmt::child_range i = S->children(); i; ++i) - DumpSubTree(*i); - } - Doc.toParent(); - } else { - Doc.addSubNode("NULL").toParent(); - } - } - - -#define NODE_XML( CLASS, NAME ) \ - void Visit##CLASS(CLASS* S) \ - { \ - typedef CLASS tStmtType; \ - Doc.addSubNode(NAME); - -#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, S->FN); -#define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, S->FN); -#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, S); -#define ATTRIBUTE_FILE_LOCATION_XML Doc.addLocationRange(S->getSourceRange()); - - -#define ATTRIBUTE_ENUM_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = false; \ - switch (S->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = true; \ - switch (S->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break; -#define END_ENUM_XML } } -#define END_NODE_XML } - -#define ID_ATTRIBUTE_XML Doc.addAttribute("id", S); -#define SUB_NODE_XML( CLASS ) -#define SUB_NODE_SEQUENCE_XML( CLASS ) -#define SUB_NODE_OPT_XML( CLASS ) - -#include "clang/Frontend/StmtXML.def" - }; -} - -//===----------------------------------------------------------------------===// -// Stmt method implementations -//===----------------------------------------------------------------------===// - -/// dumpAll - This does a dump of the specified AST fragment and all subtrees. -void DocumentXML::PrintStmt(const Stmt *S) { - StmtXML P(*this); - P.DumpSubTree(const_cast<Stmt*>(S)); -} - diff --git a/clang/lib/Frontend/TypeXML.cpp b/clang/lib/Frontend/TypeXML.cpp deleted file mode 100644 index a8c8f75d4b7..00000000000 --- a/clang/lib/Frontend/TypeXML.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//===--- DocumentXML.cpp - XML document for ASTs --------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include "clang/Frontend/DocumentXML.h" -#include "clang/AST/TypeVisitor.h" -#include "clang/AST/Type.h" -#include "clang/AST/Decl.h" - -namespace clang { - namespace XML { - namespace { - -//--------------------------------------------------------- -class TypeWriter : public TypeVisitor<TypeWriter> { - DocumentXML& Doc; - -public: - TypeWriter(DocumentXML& doc) : Doc(doc) {} - -#define NODE_XML( CLASS, NAME ) \ - void Visit##CLASS(const CLASS* T) { \ - Doc.addSubNode(NAME); - -#define ID_ATTRIBUTE_XML // done by the Document class itself -#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, T->FN); -#define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type") -#define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context") -#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, T->FN); - -#define ATTRIBUTE_ENUM_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = false; \ - switch (T->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \ - { \ - const char* pAttributeName = NAME; \ - const bool optional = true; \ - switch (T->FN) { \ - default: assert(0 && "unknown enum value"); - -#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break; -#define END_ENUM_XML } } -#define END_NODE_XML } - -#include "clang/Frontend/TypeXML.def" - -}; - -//--------------------------------------------------------- - } // anon clang - } // NS XML - -//--------------------------------------------------------- -class DocumentXML::TypeAdder : public TypeVisitor<DocumentXML::TypeAdder> { - DocumentXML& Doc; - - void addIfType(const Type* pType) { - Doc.addTypeRecursively(pType); - } - - void addIfType(const QualType& pType) { - Doc.addTypeRecursively(pType); - } - - template<class T> void addIfType(T) {} - -public: - TypeAdder(DocumentXML& doc) : Doc(doc) {} - -#define NODE_XML( CLASS, NAME ) \ - void Visit##CLASS(const CLASS* T) \ - { - -#define ID_ATTRIBUTE_XML -#define TYPE_ATTRIBUTE_XML( FN ) Doc.addTypeRecursively(T->FN); -#define CONTEXT_ATTRIBUTE_XML( FN ) -#define ATTRIBUTE_XML( FN, NAME ) addIfType(T->FN); -#define ATTRIBUTE_OPT_XML( FN, NAME ) -#define ATTRIBUTE_ENUM_XML( FN, NAME ) -#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) -#define ENUM_XML( VALUE, NAME ) -#define END_ENUM_XML -#define END_NODE_XML } - -#include "clang/Frontend/TypeXML.def" -}; - -//--------------------------------------------------------- -void DocumentXML::addParentTypes(const Type* pType) { - TypeAdder(*this).Visit(pType); -} - -//--------------------------------------------------------- -void DocumentXML::writeTypeToXML(const Type* pType) { - XML::TypeWriter(*this).Visit(const_cast<Type*>(pType)); -} - -//--------------------------------------------------------- -void DocumentXML::writeTypeToXML(const QualType& pType) { - XML::TypeWriter(*this).VisitQualType(const_cast<QualType*>(&pType)); -} - -//--------------------------------------------------------- -} // NS clang - diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 65fad6da51f..664b53351dc 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -37,7 +37,6 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { case ASTDump: return new ASTDumpAction(); case ASTDumpXML: return new ASTDumpXMLAction(); case ASTPrint: return new ASTPrintAction(); - case ASTPrintXML: return new ASTPrintXMLAction(); case ASTView: return new ASTViewAction(); case BoostCon: return new BoostConAction(); case CreateModule: return 0; diff --git a/clang/test/Coverage/ast-printing.c b/clang/test/Coverage/ast-printing.c index bbbc366eb71..ecaf3abeaa8 100644 --- a/clang/test/Coverage/ast-printing.c +++ b/clang/test/Coverage/ast-printing.c @@ -1,7 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only %s // RUN: %clang_cc1 -ast-print %s // RUN: %clang_cc1 -ast-dump %s -// RUN: %clang_cc1 -ast-print-xml -o %t %s // RUN: %clang_cc1 -print-decl-contexts %s #include "c-language-features.inc" diff --git a/clang/test/Coverage/ast-printing.cpp b/clang/test/Coverage/ast-printing.cpp index 0de56422895..3205078758f 100644 --- a/clang/test/Coverage/ast-printing.cpp +++ b/clang/test/Coverage/ast-printing.cpp @@ -1,7 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only %s // RUN: %clang_cc1 -ast-print %s // RUN: %clang_cc1 -ast-dump %s -// RUN: %clang_cc1 -ast-print-xml -o %t %s // RUN: %clang_cc1 -print-decl-contexts %s // RUN: %clang_cc1 -fdump-record-layouts %s |