aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-07 01:03:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-07 01:03:30 +0000
commite6ec11aa15c7104d57009c6e036bf4ae29c35fb2 (patch)
treeba116415fcaa54fd7f1ed765896b1b156c17333f
parent951c5705771a57eca0bca07aae5d4738619dd6c6 (diff)
Remove the AST printer (-ast-print-xml), which is too incomplete and
too low-level to actually be useful but is just interesting enough for people to try to use it (which won't actually work beyond toy examples). To bring back the AST printer, it needs to be: - Complete, covering all of C/C++/Objective-C - Documented, with appropriate Schema against which we can validate the output - Designed for C/C++/Objective-C, not Clang's specific ASTs - Stable across Clang versions - Well-tested git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127141 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/CC1Options.td2
-rw-r--r--include/clang/Frontend/ASTConsumers.h6
-rw-r--r--include/clang/Frontend/DeclContextXML.def113
-rw-r--r--include/clang/Frontend/DeclXML.def372
-rw-r--r--include/clang/Frontend/DocumentXML.def75
-rw-r--r--include/clang/Frontend/DocumentXML.h185
-rw-r--r--include/clang/Frontend/FrontendActions.h6
-rw-r--r--include/clang/Frontend/FrontendOptions.h1
-rw-r--r--include/clang/Frontend/StmtXML.def520
-rw-r--r--include/clang/Frontend/TypeXML.def304
-rw-r--r--lib/Frontend/ASTConsumers.cpp34
-rw-r--r--lib/Frontend/CMakeLists.txt4
-rw-r--r--lib/Frontend/CompilerInvocation.cpp3
-rw-r--r--lib/Frontend/DeclXML.cpp183
-rw-r--r--lib/Frontend/DocumentXML.cpp381
-rw-r--r--lib/Frontend/FrontendActions.cpp7
-rw-r--r--lib/Frontend/StmtXML.cpp123
-rw-r--r--lib/Frontend/TypeXML.cpp119
-rw-r--r--lib/FrontendTool/ExecuteCompilerInvocation.cpp1
-rw-r--r--test/Coverage/ast-printing.c1
-rw-r--r--test/Coverage/ast-printing.cpp1
21 files changed, 0 insertions, 2441 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 0696f7d08e..12f2556b9e 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/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/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index c45bd40706..f82d616eca 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/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/include/clang/Frontend/DeclContextXML.def b/include/clang/Frontend/DeclContextXML.def
deleted file mode 100644
index 39ed5f9432..0000000000
--- a/include/clang/Frontend/DeclContextXML.def
+++ /dev/null
@@ -1,113 +0,0 @@
-//===-- DeclContextXML.def - Metadata about Context XML nodes ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the XML context info database as written in the
-// <ReferenceSection>/<Contexts> sub-nodes of the XML document. Type nodes
-// are referred by "context" reference attributes throughout the document.
-// A context node never contains sub-nodes.
-// The semantics of the attributes and enums are mostly self-documenting
-// by looking at the appropriate internally used functions and values.
-// The following macros are used:
-//
-// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete
-// context of class CLASS where CLASS is a class name used internally by clang.
-// After a NODE_XML the definition of all (optional) attributes of that context
-// node and possible sub-nodes follows.
-//
-// END_NODE_XML - Closes the attribute definition of the current node.
-//
-// ID_ATTRIBUTE_XML - Context nodes have an "id" attribute containing a
-// string, which value uniquely identify that statement. Other nodes may refer
-// by "context" attributes to this value.
-//
-// TYPE_ATTRIBUTE_XML( FN ) - Context nodes may refer to the ids of type
-// nodes by a "type" attribute, if they create a type during declaration.
-// For instance 'struct S;' creates both a context 'S::' and a type 'S'.
-// Contexts and types always have different ids, however declarations and
-// contexts may share the same ids. FN is internally used by clang.
-//
-// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally
-// used by clang. A boolean attribute have the values "0" or "1".
-//
-// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value
-// is an enumeration defined with ENUM_XML macros immediately following after
-// that macro. An optional attribute is ommited, if the particular enum is the
-// empty string. FN is internally used by clang.
-//
-// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is
-// internally used by clang.
-//
-// END_ENUM_XML - Closes the enumeration definition of the current attribute.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TYPE_ATTRIBUTE_XML
-# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type")
-#endif
-
-#ifndef CONTEXT_ATTRIBUTE_XML
-# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context")
-#endif
-
-NODE_XML(TranslationUnitDecl, "TranslationUnit")
- ID_ATTRIBUTE_XML
-END_NODE_XML
-
-NODE_XML(FunctionDecl, "Function")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAsFunctionType())
-END_NODE_XML
-
-NODE_XML(NamespaceDecl, "Namespace")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
-END_NODE_XML
-
-NODE_XML(RecordDecl, "Record")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getTypeForDecl())
-END_NODE_XML
-
-NODE_XML(EnumDecl, "Enum")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getTypeForDecl())
-END_NODE_XML
-
-NODE_XML(LinkageSpecDecl, "LinkageSpec")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_ENUM_OPT_XML(getLanguage(), "lang")
- ENUM_XML(LinkageSpecDecl::lang_c, "C")
- ENUM_XML(LinkageSpecDecl::lang_cxx, "CXX")
- END_ENUM_XML
-END_NODE_XML
-
-//===----------------------------------------------------------------------===//
-#undef NODE_XML
-#undef ID_ATTRIBUTE_XML
-#undef TYPE_ATTRIBUTE_XML
-#undef ATTRIBUTE_XML
-#undef ATTRIBUTE_SPECIAL_XML
-#undef ATTRIBUTE_OPT_XML
-#undef ATTRIBUTE_ENUM_XML
-#undef ATTRIBUTE_ENUM_OPT_XML
-#undef ATTRIBUTE_FILE_LOCATION_XML
-#undef ENUM_XML
-#undef END_ENUM_XML
-#undef END_NODE_XML
-#undef SUB_NODE_XML
-#undef SUB_NODE_SEQUENCE_XML
-#undef SUB_NODE_OPT_XML
diff --git a/include/clang/Frontend/DeclXML.def b/include/clang/Frontend/DeclXML.def
deleted file mode 100644
index 58f7e55fbe..0000000000
--- a/include/clang/Frontend/DeclXML.def
+++ /dev/null
@@ -1,372 +0,0 @@
-//===-- DeclXML.def - Metadata about Decl XML nodes ------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the XML statement database structure as written in
-// <TranslationUnit> sub-nodes of the XML document.
-// The semantics of the attributes and enums are mostly self-documenting
-// by looking at the appropriate internally used functions and values.
-// The following macros are used:
-//
-// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete
-// statement of class CLASS where CLASS is a class name used internally by clang.
-// After a NODE_XML the definition of all (optional) attributes of that statement
-// node and possible sub-nodes follows.
-//
-// END_NODE_XML - Closes the attribute definition of the current node.
-//
-// ID_ATTRIBUTE_XML - Some statement nodes have an "id" attribute containing a
-// string, which value uniquely identify that statement. Other nodes may refer
-// by reference attributes to this value (currently used only for Label).
-//
-// TYPE_ATTRIBUTE_XML( FN ) - Type nodes refer to the result type id of an
-// expression by a "type" attribute. FN is internally used by clang.
-//
-// ATTRIBUTE_XML( FN, NAME ) - An attribute named NAME. FN is internally
-// used by clang. A boolean attribute have the values "0" or "1".
-//
-// ATTRIBUTE_SPECIAL_XML( FN, NAME ) - An attribute named NAME which deserves
-// a special handling. See the appropriate documentations.
-//
-// ATTRIBUTE_FILE_LOCATION_XML - A bunch of attributes denoting the location of
-// a statement in the source file(s).
-//
-// ATTRIBUTE_OPT_XML( FN, NAME ) - An optional attribute named NAME.
-// Optional attributes are omitted for boolean types, if the value is false,
-// for integral types, if the value is null and for strings,
-// if the value is the empty string. FN is internally used by clang.
-//
-// ATTRIBUTE_ENUM[_OPT]_XML( FN, NAME ) - An attribute named NAME. The value
-// is an enumeration defined with ENUM_XML macros immediately following after
-// that macro. An optional attribute is ommited, if the particular enum is the
-// empty string. FN is internally used by clang.
-//
-// ENUM_XML( VALUE, NAME ) - An enumeration element named NAME. VALUE is
-// internally used by clang.
-//
-// END_ENUM_XML - Closes the enumeration definition of the current attribute.
-//
-// SUB_NODE_XML( CLASS ) - A mandatory sub-node of class CLASS or its sub-classes.
-//
-// SUB_NODE_OPT_XML( CLASS ) - An optional sub-node of class CLASS or its sub-classes.
-//
-// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or
-// its sub-classes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef ATTRIBUTE_FILE_LOCATION_XML
-# define ATTRIBUTE_FILE_LOCATION_XML \
- ATTRIBUTE_XML(getFilename(), "file") \
- ATTRIBUTE_XML(getLine(), "line") \
- ATTRIBUTE_XML(getColumn(), "col") \
- ATTRIBUTE_OPT_XML(getFilename(), "endfile") \
- ATTRIBUTE_OPT_XML(getLine(), "endline") \
- ATTRIBUTE_OPT_XML(getColumn(), "endcol")
-#endif
-
-#ifndef TYPE_ATTRIBUTE_XML
-# define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type")
-#endif
-
-#ifndef CONTEXT_ATTRIBUTE_XML
-# define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context")
-#endif
-
-//NODE_XML(TranslationUnitDecl, "TranslationUnit")
-// SUB_NODE_SEQUENCE_XML(Decl)
-//END_NODE_XML
-
-NODE_XML(Decl, "FIXME_Decl")
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclKindName(), "unhandled_decl_name")
-END_NODE_XML
-
-NODE_XML(FunctionDecl, "Function")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
- ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_ENUM_OPT_XML(getStorageClass(), "storage_class")
- ENUM_XML(SC_None, "")
- ENUM_XML(SC_Extern, "extern")
- ENUM_XML(SC_Static, "static")
- ENUM_XML(SC_PrivateExtern, "__private_extern__")
- END_ENUM_XML
- ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
- //ATTRIBUTE_OPT_XML(isVariadic(), "variadic") // in the type reference
- ATTRIBUTE_XML(getNumParams(), "num_args")
- ATTRIBUTE_OPT_XML(isMain(), "main")
- ATTRIBUTE_OPT_XML(isExternC(), "externc")
- ATTRIBUTE_OPT_XML(isGlobal(), "global")
- SUB_NODE_SEQUENCE_XML(ParmVarDecl)
- SUB_NODE_FN_BODY_XML
-END_NODE_XML
-
-NODE_XML(CXXMethodDecl, "CXXMethod")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
- ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
- ATTRIBUTE_OPT_XML(isStatic(), "static")
- ATTRIBUTE_OPT_XML(isVirtual(), "virtual")
- ATTRIBUTE_OPT_XML(isPure(), "pure")
- ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access")
- ENUM_XML(AS_none, "")
- ENUM_XML(AS_public, "public")
- ENUM_XML(AS_protected, "protected")
- ENUM_XML(AS_private, "private")
- END_ENUM_XML
- ATTRIBUTE_XML(getNumParams(), "num_args")
- SUB_NODE_SEQUENCE_XML(ParmVarDecl)
- SUB_NODE_FN_BODY_XML
-END_NODE_XML
-
-NODE_XML(CXXConstructorDecl, "CXXConstructor")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
- ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_OPT_XML(isExplicit(), "is_explicit")
- ATTRIBUTE_OPT_XML(isDefaultConstructor(), "is_default_ctor")
- ATTRIBUTE_OPT_XML(isCopyConstructor(), "is_copy_ctor")
- ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
- ATTRIBUTE_OPT_XML(isStatic(), "static")
- ATTRIBUTE_OPT_XML(isVirtual(), "virtual")
- ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access")
- ENUM_XML(AS_none, "")
- ENUM_XML(AS_public, "public")
- ENUM_XML(AS_protected, "protected")
- ENUM_XML(AS_private, "private")
- END_ENUM_XML
- ATTRIBUTE_XML(getNumParams(), "num_args")
- SUB_NODE_SEQUENCE_XML(ParmVarDecl)
- SUB_NODE_FN_BODY_XML
-END_NODE_XML
-
-NODE_XML(CXXDestructorDecl, "CXXDestructor")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
- ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
- ATTRIBUTE_OPT_XML(isStatic(), "static")
- ATTRIBUTE_OPT_XML(isVirtual(), "virtual")
- ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access")
- ENUM_XML(AS_none, "")
- ENUM_XML(AS_public, "public")
- ENUM_XML(AS_protected, "protected")
- ENUM_XML(AS_private, "private")
- END_ENUM_XML
- ATTRIBUTE_XML(getNumParams(), "num_args")
- SUB_NODE_SEQUENCE_XML(ParmVarDecl)
- SUB_NODE_FN_BODY_XML
-END_NODE_XML
-
-NODE_XML(CXXConversionDecl, "CXXConversion")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
- ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_OPT_XML(isExplicit(), "is_explicit")
- ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
- ATTRIBUTE_OPT_XML(isStatic(), "static")
- ATTRIBUTE_OPT_XML(isVirtual(), "virtual")
- ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access")
- ENUM_XML(AS_none, "")
- ENUM_XML(AS_public, "public")
- ENUM_XML(AS_protected, "protected")
- ENUM_XML(AS_private, "private")
- END_ENUM_XML
- ATTRIBUTE_XML(getNumParams(), "num_args")
- SUB_NODE_SEQUENCE_XML(ParmVarDecl)
- SUB_NODE_FN_BODY_XML
-END_NODE_XML
-
-NODE_XML(NamespaceDecl, "Namespace")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- SUB_NODE_SEQUENCE_XML(DeclContext)
-END_NODE_XML
-
-NODE_XML(UsingDirectiveDecl, "UsingDirective")
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- ATTRIBUTE_XML(getNominatedNamespace(), "ref")
-END_NODE_XML
-
-NODE_XML(NamespaceAliasDecl, "NamespaceAlias")
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- ATTRIBUTE_XML(getNamespace(), "ref")
-END_NODE_XML
-
-NODE_XML(RecordDecl, "Record")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- ATTRIBUTE_OPT_XML(isDefinition() == false, "forward")
- ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates
- SUB_NODE_SEQUENCE_XML(FieldDecl)
-END_NODE_XML
-
-NODE_XML(CXXRecordDecl, "CXXRecord")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- ATTRIBUTE_OPT_XML(isDefinition() == false, "forward")
- ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates
- SUB_NODE_SEQUENCE_XML(FieldDecl)
-END_NODE_XML
-
-NODE_XML(EnumDecl, "Enum")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- ATTRIBUTE_OPT_XML(isDefinition() == false, "forward")
- ATTRIBUTE_SPECIAL_XML(getIntegerType(), "type") // is NULL in pure declarations thus deserves special handling
- SUB_NODE_SEQUENCE_XML(EnumConstantDecl) // only present in definition
-END_NODE_XML
-
-NODE_XML(EnumConstantDecl, "EnumConstant")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType())
- ATTRIBUTE_XML(getInitVal().toString(10, true), "value") // integer
- SUB_NODE_OPT_XML(Expr) // init expr of this constant
-END_NODE_XML
-
-NODE_XML(FieldDecl, "Field")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType())
- ATTRIBUTE_OPT_XML(isMutable(), "mutable")
- ATTRIBUTE_ENUM_OPT_XML(getAccess(), "access")
- ENUM_XML(AS_none, "")
- ENUM_XML(AS_public, "public")
- ENUM_XML(AS_protected, "protected")
- ENUM_XML(AS_private, "private")
- END_ENUM_XML
- ATTRIBUTE_OPT_XML(isBitField(), "bitfield")
- SUB_NODE_OPT_XML(Expr) // init expr of a bit field
-END_NODE_XML
-
-NODE_XML(TypedefDecl, "Typedef")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getUnderlyingType())
-END_NODE_XML
-
-NODE_XML(VarDecl, "Var")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType())
- ATTRIBUTE_ENUM_OPT_XML(getStorageClass(), "storage_class")
- ENUM_XML(SC_None, "")
- ENUM_XML(SC_Auto, "auto")
- ENUM_XML(SC_Register, "register")
- ENUM_XML(SC_Extern, "extern")
- ENUM_XML(SC_Static, "static")
- ENUM_XML(SC_PrivateExtern, "__private_extern__")
- END_ENUM_XML
- SUB_NODE_OPT_XML(Expr) // init expr
-END_NODE_XML
-
-NODE_XML(ParmVarDecl, "ParmVar")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
- TYPE_ATTRIBUTE_XML(getType())
- SUB_NODE_OPT_XML(Expr) // default argument expression
-END_NODE_XML
-
-NODE_XML(LinkageSpecDecl, "LinkageSpec")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_ENUM_OPT_XML(getLanguage(), "lang")
- ENUM_XML(LinkageSpecDecl::lang_c, "C")
- ENUM_XML(LinkageSpecDecl::lang_cxx, "CXX")
- END_ENUM_XML
- SUB_NODE_XML(DeclContext)
-END_NODE_XML
-
-NODE_XML(TemplateDecl, "Template")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
-END_NODE_XML
-
-NODE_XML(TemplateTypeParmDecl, "TemplateTypeParm")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getNameAsString(), "name")
-END_NODE_XML
-
-NODE_XML(UsingShadowDecl, "UsingShadow")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getTargetDecl(), "target_decl")
- ATTRIBUTE_XML(getUsingDecl(), "using_decl")
-END_NODE_XML
-
-NODE_XML(UsingDecl, "Using")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_FILE_LOCATION_XML
- ATTRIBUTE_XML(getDeclContext(), "context")
- ATTRIBUTE_XML(getQualifier(), "target_nested_namespace_decl")
- ATTRIBUTE_XML(isTypeName(), "is_typename")
-END_NODE_XML
-
-//===----------------------------------------------------------------------===//
-#undef NODE_XML
-#undef ID_ATTRIBUTE_XML
-#undef TYPE_ATTRIBUTE_XML
-#undef ATTRIBUTE_XML
-#undef ATTRIBUTE_SPECIAL_XML
-#undef ATTRIBUTE_OPT_XML
-#undef ATTRIBUTE_ENUM_XML
-#undef ATTRIBUTE_ENUM_OPT_XML
-#undef ATTRIBUTE_FILE_LOCATION_XML
-#undef ENUM_XML
-#undef END_ENUM_XML
-#undef END_NODE_XML
-#undef SUB_NODE_XML
-#undef SUB_NODE_SEQUENCE_XML
-#undef SUB_NODE_OPT_XML
-#undef SUB_NODE_FN_BODY_XML
diff --git a/include/clang/Frontend/DocumentXML.def b/include/clang/Frontend/DocumentXML.def
deleted file mode 100644
index 4c52bd8442..0000000000
--- a/include/clang/Frontend/DocumentXML.def
+++ /dev/null
@@ -1,75 +0,0 @@
-//===-- DocumentXML.def - Metadata about Document XML nodes -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the XML root database structure as written in
-// an AST XML document.
-// The following macros are used:
-//
-// NODE_XML( CLASS, NAME ) - A node of name NAME denotes a concrete
-// statement of class CLASS where CLASS is a class name used internally by clang.
-// After a NODE_XML the definition of all (optional) attributes of that statement
-// node and possible sub-nodes follows.
-//
-// END_NODE_XML - Closes the attribute definition of the current node.
-//
-// ID_ATTRIBUTE_XML - Some nodes have an "id" attribute containing a
-// string, which value uniquely identify the entity represented by that node.
-// Other nodes may refer by reference attributes to this value.
-//
-// ATTRIBUTE_SPECIAL_XML( FN, NAME ) - An attribute named NAME which deserves
-// a special handling. See the appropriate documentations.
-//
-// SUB_NODE_XML( CLASS ) - A mandatory sub-node of class CLASS or its sub-classes.
-//
-// SUB_NODE_SEQUENCE_XML( CLASS ) - Zero or more sub-nodes of class CLASS or
-// its sub-classes.
-//
-//===----------------------------------------------------------------------===//
-
-ROOT_NODE_XML("CLANG_XML")
- ATTRIBUTE_SPECIAL_XML(ignore, "version") // special retrieving needed
- SUB_NODE_XML("TranslationUnit")
- SUB_NODE_XML("ReferenceSection")
-END_NODE_XML
-
-NODE_XML("TranslationUnit")
- SUB_NODE_SEQUENCE_XML(Decl)
-END_NODE_XML
-
-NODE_XML("ReferenceSection")
- SUB_NODE_XML("Types")
- SUB_NODE_XML("Contexts")
- SUB_NODE_XML("Files")
-END_NODE_XML
-
-NODE_XML("Types")
- SUB_NODE_SEQUENCE_XML(Type)
-END_NODE_XML
-
-NODE_XML("Contexts")
- SUB_NODE_SEQUENCE_XML(DeclContext)
-END_NODE_XML
-
-NODE_XML("Files")
- SUB_NODE_SEQUENCE_XML("File")
-END_NODE_XML
-
-NODE_XML("File")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_SPECIAL_XML(ignore, "name") // special retrieving needed, denotes the source file name
-END_NODE_XML
-
-
-//===----------------------------------------------------------------------===//
-#undef NODE_XML
-#undef ID_ATTRIBUTE_XML
-#undef ATTRIBUTE_SPECIAL_XML
-#undef END_NODE_XML
-#undef SUB_NODE_XML
-#undef SUB_NODE_SEQUENCE_XML
diff --git a/include/clang/Frontend/DocumentXML.h b/include/clang/Frontend/DocumentXML.h
deleted file mode 100644
index 602d846558..0000000000
--- a/include/clang/Frontend/DocumentXML.h
+++ /dev/null
@@ -1,185 +0,0 @@
-//===--- DocumentXML.h - XML document for ASTs ------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the XML document class, which provides the means to
-// dump out the AST in a XML form that exposes type details and other fields.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_FRONTEND_DOCUMENTXML_H
-#define LLVM_CLANG_FRONTEND_DOCUMENTXML_H
-
-#include <string>
-#include <map>
-#include <stack>
-#include "clang/AST/Type.h"
-#include "clang/AST/TypeOrdering.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/ADT/DenseMap.h"
-
-namespace clang {
-
-//--------------------------------------------------------- forwards
-class DeclContext;
-class Decl;
-class NamedDecl;
-class FunctionDecl;
-class ASTContext;
-class LabelStmt;
-
-//---------------------------------------------------------
-namespace XML {
- // id maps:
- template<class T>
- struct IdMap : llvm::DenseMap<T, unsigned> {};
-
- template<>
- struct IdMap<QualType> : std::map<QualType, unsigned, QualTypeOrdering> {};
-
- template<>
- struct IdMap<std::string> : std::map<std::string, unsigned> {};
-}
-
-//---------------------------------------------------------
-class DocumentXML {
-public:
- DocumentXML(const std::string& rootName, llvm::raw_ostream& out);
-
- void initialize(ASTContext &Context);
- void PrintDecl(Decl *D);
- void PrintStmt(const Stmt *S); // defined in StmtXML.cpp
- void finalize();
-
-
- DocumentXML& addSubNode(const std::string& name); // also enters the sub node, returns *this
- DocumentXML& toParent(); // returns *this
-
- void addAttribute(const char* pName, const QualType& pType);
- void addAttribute(const char* pName, bool value);
-
- template<class T>
- void addAttribute(const char* pName, const T* value) {
- addPtrAttribute(pName, value);
- }
-
- template<class T>
- void addAttribute(const char* pName, T* value) {
- addPtrAttribute(pName, value);
- }
-
- template<class T>
- void addAttribute(const char* pName, const T& value);
-
- template<class T>
- void addAttributeOptional(const char* pName, const T& value);
-
- void addSourceFileAttribute(const std::string& fileName);
-
- PresumedLoc addLocation(const SourceLocation& Loc);
- void addLocationRange(const SourceRange& R);
-
- static std::string escapeString(const char* pStr, std::string::size_type len);
-
-private:
- DocumentXML(const DocumentXML&); // not defined
- DocumentXML& operator=(const DocumentXML&); // not defined
-
- std::stack<std::string> NodeStack;
- llvm::raw_ostream& Out;
- ASTContext *Ctx;
- bool HasCurrentNodeSubNodes;
-
-
- XML::IdMap<QualType> Types;
- XML::IdMap<const DeclContext*> Contexts;
- XML::IdMap<const Type*> BasicTypes;
- XML::IdMap<std::string> SourceFiles;
- XML::IdMap<const NamedDecl*> Decls;
- XML::IdMap<const LabelStmt*> Labels;
-
- void addContextsRecursively(const DeclContext *DC);
- void addTypeRecursively(const Type* pType);
- void addTypeRecursively(const QualType& pType);
-
- void Indent();
-
- // forced pointer dispatch:
- void addPtrAttribute(const char* pName, const Type* pType);
- void addPtrAttribute(const char* pName, const NamedDecl* D);
- void addPtrAttribute(const char* pName, const DeclContext* D);
- void addPtrAttribute(const char* pName, const NamespaceDecl* D); // disambiguation
- void addPtrAttribute(const char* pName, const NestedNameSpecifier* N);
- void addPtrAttribute(const char* pName, const LabelStmt* L);
- void addPtrAttribute(const char* pName, const char* text);
-
- // defined in TypeXML.cpp:
- void addParentTypes(const Type* pType);
- void writeTypeToXML(const Type* pType);
- void writeTypeToXML(const QualType& pType);
- class TypeAdder;
- friend class TypeAdder;
-
- // defined in DeclXML.cpp:
- void writeDeclToXML(Decl *D);
- class DeclPrinter;
- friend class DeclPrinter;
-
- // for addAttributeOptional:
- static bool isDefault(unsigned value) { return value == 0; }
- static bool isDefault(bool value) { return !value; }
- static bool isDefault(Qualifiers::GC value) { return value == Qualifiers::GCNone; }
- static bool isDefault(const std::string& value) { return value.empty(); }
-};
-
-//--------------------------------------------------------- inlines
-
-inline void DocumentXML::initialize(ASTContext &Context) {
- Ctx = &Context;
-}
-
-//---------------------------------------------------------
-template<class T>
-inline void DocumentXML::addAttribute(const char* pName, const T& value) {
- std::string repr;
- {
- llvm::raw_string_ostream buf(repr);
- buf << value;
- }
-
- Out << ' ' << pName << "=\""
- << DocumentXML::escapeString(repr.c_str(), repr.size())
- << "\"";
-}
-
-//---------------------------------------------------------
-inline void DocumentXML::addPtrAttribute(const char* pName, const char* text) {
- Out << ' ' << pName << "=\""
- << DocumentXML::escapeString(text, strlen(text))
- << "\"";
-}
-
-//---------------------------------------------------------
-inline void DocumentXML::addAttribute(const char* pName, bool value) {
- addPtrAttribute(pName, value ? "1" : "0");
-}
-
-//---------------------------------------------------------
-template<class T>
-inline void DocumentXML::addAttributeOptional(const char* pName,
- const T& value) {
- if (!isDefault(value)) {
- addAttribute(pName, value);
- }
-}
-
-//---------------------------------------------------------
-
-} //namespace clang
-
-#endif //LLVM_CLANG_DOCUMENTXML_H
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 4df2e71571..4e67449b85 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -42,12 +42,6 @@ protected:
llvm::StringRef InFile);
};
-class ASTPrintXMLAction : public ASTFrontendAction {
-protected:
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile);
-};
-
class ASTDumpAction : public ASTFrontendAction {
protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 19d39c3ca1..02f6f868fe 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Fronten