//===-- 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 // / 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