summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend/DeclContextXML.def
blob: 39ed5f9432b64d4cbae95279e507767a4388743a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//===-- 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
OpenPOWER on IntegriCloud