ASTBitCodes.h 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155
  1. //===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This header defines Bitcode enum values for Clang serialized AST files.
  10. //
  11. // The enum values defined in this file should be considered permanent. If
  12. // new features are added, they should have values added at the end of the
  13. // respective lists.
  14. //
  15. //===----------------------------------------------------------------------===//
  16. #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
  17. #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
  18. #include "clang/AST/DeclarationName.h"
  19. #include "clang/AST/Type.h"
  20. #include "clang/Basic/IdentifierTable.h"
  21. #include "clang/Basic/OperatorKinds.h"
  22. #include "clang/Basic/SourceLocation.h"
  23. #include "llvm/ADT/DenseMapInfo.h"
  24. #include "llvm/Bitstream/BitCodes.h"
  25. #include <cassert>
  26. #include <cstdint>
  27. namespace clang {
  28. namespace serialization {
  29. /// AST file major version number supported by this version of
  30. /// Clang.
  31. ///
  32. /// Whenever the AST file format changes in a way that makes it
  33. /// incompatible with previous versions (such that a reader
  34. /// designed for the previous version could not support reading
  35. /// the new version), this number should be increased.
  36. ///
  37. /// Version 4 of AST files also requires that the version control branch and
  38. /// revision match exactly, since there is no backward compatibility of
  39. /// AST files at this time.
  40. const unsigned VERSION_MAJOR = 8;
  41. /// AST file minor version number supported by this version of
  42. /// Clang.
  43. ///
  44. /// Whenever the AST format changes in a way that is still
  45. /// compatible with previous versions (such that a reader designed
  46. /// for the previous version could still support reading the new
  47. /// version by ignoring new kinds of subblocks), this number
  48. /// should be increased.
  49. const unsigned VERSION_MINOR = 0;
  50. /// An ID number that refers to an identifier in an AST file.
  51. ///
  52. /// The ID numbers of identifiers are consecutive (in order of discovery)
  53. /// and start at 1. 0 is reserved for NULL.
  54. using IdentifierID = uint32_t;
  55. /// An ID number that refers to a declaration in an AST file.
  56. ///
  57. /// The ID numbers of declarations are consecutive (in order of
  58. /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved.
  59. /// At the start of a chain of precompiled headers, declaration ID 1 is
  60. /// used for the translation unit declaration.
  61. using DeclID = uint32_t;
  62. // FIXME: Turn these into classes so we can have some type safety when
  63. // we go from local ID to global and vice-versa.
  64. using LocalDeclID = DeclID;
  65. using GlobalDeclID = DeclID;
  66. /// An ID number that refers to a type in an AST file.
  67. ///
  68. /// The ID of a type is partitioned into two parts: the lower
  69. /// three bits are used to store the const/volatile/restrict
  70. /// qualifiers (as with QualType) and the upper bits provide a
  71. /// type index. The type index values are partitioned into two
  72. /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
  73. /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
  74. /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
  75. /// other types that have serialized representations.
  76. using TypeID = uint32_t;
  77. /// A type index; the type ID with the qualifier bits removed.
  78. class TypeIdx {
  79. uint32_t Idx = 0;
  80. public:
  81. TypeIdx() = default;
  82. explicit TypeIdx(uint32_t index) : Idx(index) {}
  83. uint32_t getIndex() const { return Idx; }
  84. TypeID asTypeID(unsigned FastQuals) const {
  85. if (Idx == uint32_t(-1))
  86. return TypeID(-1);
  87. return (Idx << Qualifiers::FastWidth) | FastQuals;
  88. }
  89. static TypeIdx fromTypeID(TypeID ID) {
  90. if (ID == TypeID(-1))
  91. return TypeIdx(-1);
  92. return TypeIdx(ID >> Qualifiers::FastWidth);
  93. }
  94. };
  95. /// A structure for putting "fast"-unqualified QualTypes into a
  96. /// DenseMap. This uses the standard pointer hash function.
  97. struct UnsafeQualTypeDenseMapInfo {
  98. static bool isEqual(QualType A, QualType B) { return A == B; }
  99. static QualType getEmptyKey() {
  100. return QualType::getFromOpaquePtr((void*) 1);
  101. }
  102. static QualType getTombstoneKey() {
  103. return QualType::getFromOpaquePtr((void*) 2);
  104. }
  105. static unsigned getHashValue(QualType T) {
  106. assert(!T.getLocalFastQualifiers() &&
  107. "hash invalid for types with fast quals");
  108. uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
  109. return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
  110. }
  111. };
  112. /// An ID number that refers to an identifier in an AST file.
  113. using IdentID = uint32_t;
  114. /// The number of predefined identifier IDs.
  115. const unsigned int NUM_PREDEF_IDENT_IDS = 1;
  116. /// An ID number that refers to a macro in an AST file.
  117. using MacroID = uint32_t;
  118. /// A global ID number that refers to a macro in an AST file.
  119. using GlobalMacroID = uint32_t;
  120. /// A local to a module ID number that refers to a macro in an
  121. /// AST file.
  122. using LocalMacroID = uint32_t;
  123. /// The number of predefined macro IDs.
  124. const unsigned int NUM_PREDEF_MACRO_IDS = 1;
  125. /// An ID number that refers to an ObjC selector in an AST file.
  126. using SelectorID = uint32_t;
  127. /// The number of predefined selector IDs.
  128. const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
  129. /// An ID number that refers to a set of CXXBaseSpecifiers in an
  130. /// AST file.
  131. using CXXBaseSpecifiersID = uint32_t;
  132. /// An ID number that refers to a list of CXXCtorInitializers in an
  133. /// AST file.
  134. using CXXCtorInitializersID = uint32_t;
  135. /// An ID number that refers to an entity in the detailed
  136. /// preprocessing record.
  137. using PreprocessedEntityID = uint32_t;
  138. /// An ID number that refers to a submodule in a module file.
  139. using SubmoduleID = uint32_t;
  140. /// The number of predefined submodule IDs.
  141. const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
  142. /// Source range/offset of a preprocessed entity.
  143. struct PPEntityOffset {
  144. /// Raw source location of beginning of range.
  145. unsigned Begin;
  146. /// Raw source location of end of range.
  147. unsigned End;
  148. /// Offset in the AST file.
  149. uint32_t BitOffset;
  150. PPEntityOffset(SourceRange R, uint32_t BitOffset)
  151. : Begin(R.getBegin().getRawEncoding()),
  152. End(R.getEnd().getRawEncoding()), BitOffset(BitOffset) {}
  153. SourceLocation getBegin() const {
  154. return SourceLocation::getFromRawEncoding(Begin);
  155. }
  156. SourceLocation getEnd() const {
  157. return SourceLocation::getFromRawEncoding(End);
  158. }
  159. };
  160. /// Source range of a skipped preprocessor region
  161. struct PPSkippedRange {
  162. /// Raw source location of beginning of range.
  163. unsigned Begin;
  164. /// Raw source location of end of range.
  165. unsigned End;
  166. PPSkippedRange(SourceRange R)
  167. : Begin(R.getBegin().getRawEncoding()),
  168. End(R.getEnd().getRawEncoding()) { }
  169. SourceLocation getBegin() const {
  170. return SourceLocation::getFromRawEncoding(Begin);
  171. }
  172. SourceLocation getEnd() const {
  173. return SourceLocation::getFromRawEncoding(End);
  174. }
  175. };
  176. /// Source range/offset of a preprocessed entity.
  177. struct DeclOffset {
  178. /// Raw source location.
  179. unsigned Loc = 0;
  180. /// Offset in the AST file.
  181. uint32_t BitOffset = 0;
  182. DeclOffset() = default;
  183. DeclOffset(SourceLocation Loc, uint32_t BitOffset)
  184. : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {}
  185. void setLocation(SourceLocation L) {
  186. Loc = L.getRawEncoding();
  187. }
  188. SourceLocation getLocation() const {
  189. return SourceLocation::getFromRawEncoding(Loc);
  190. }
  191. };
  192. /// The number of predefined preprocessed entity IDs.
  193. const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
  194. /// Describes the various kinds of blocks that occur within
  195. /// an AST file.
  196. enum BlockIDs {
  197. /// The AST block, which acts as a container around the
  198. /// full AST block.
  199. AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
  200. /// The block containing information about the source
  201. /// manager.
  202. SOURCE_MANAGER_BLOCK_ID,
  203. /// The block containing information about the
  204. /// preprocessor.
  205. PREPROCESSOR_BLOCK_ID,
  206. /// The block containing the definitions of all of the
  207. /// types and decls used within the AST file.
  208. DECLTYPES_BLOCK_ID,
  209. /// The block containing the detailed preprocessing record.
  210. PREPROCESSOR_DETAIL_BLOCK_ID,
  211. /// The block containing the submodule structure.
  212. SUBMODULE_BLOCK_ID,
  213. /// The block containing comments.
  214. COMMENTS_BLOCK_ID,
  215. /// The control block, which contains all of the
  216. /// information that needs to be validated prior to committing
  217. /// to loading the AST file.
  218. CONTROL_BLOCK_ID,
  219. /// The block of input files, which were used as inputs
  220. /// to create this AST file.
  221. ///
  222. /// This block is part of the control block.
  223. INPUT_FILES_BLOCK_ID,
  224. /// The block of configuration options, used to check that
  225. /// a module is being used in a configuration compatible with the
  226. /// configuration in which it was built.
  227. ///
  228. /// This block is part of the control block.
  229. OPTIONS_BLOCK_ID,
  230. /// A block containing a module file extension.
  231. EXTENSION_BLOCK_ID,
  232. /// A block with unhashed content.
  233. ///
  234. /// These records should not change the \a ASTFileSignature. See \a
  235. /// UnhashedControlBlockRecordTypes for the list of records.
  236. UNHASHED_CONTROL_BLOCK_ID,
  237. };
  238. /// Record types that occur within the control block.
  239. enum ControlRecordTypes {
  240. /// AST file metadata, including the AST file version number
  241. /// and information about the compiler used to build this AST file.
  242. METADATA = 1,
  243. /// Record code for the list of other AST files imported by
  244. /// this AST file.
  245. IMPORTS,
  246. /// Record code for the original file that was used to
  247. /// generate the AST file, including both its file ID and its
  248. /// name.
  249. ORIGINAL_FILE,
  250. /// The directory that the PCH was originally created in.
  251. ORIGINAL_PCH_DIR,
  252. /// Record code for file ID of the file or buffer that was used to
  253. /// generate the AST file.
  254. ORIGINAL_FILE_ID,
  255. /// Offsets into the input-files block where input files
  256. /// reside.
  257. INPUT_FILE_OFFSETS,
  258. /// Record code for the module name.
  259. MODULE_NAME,
  260. /// Record code for the module map file that was used to build this
  261. /// AST file.
  262. MODULE_MAP_FILE,
  263. /// Record code for the module build directory.
  264. MODULE_DIRECTORY,
  265. };
  266. /// Record types that occur within the options block inside
  267. /// the control block.
  268. enum OptionsRecordTypes {
  269. /// Record code for the language options table.
  270. ///
  271. /// The record with this code contains the contents of the
  272. /// LangOptions structure. We serialize the entire contents of
  273. /// the structure, and let the reader decide which options are
  274. /// actually important to check.
  275. LANGUAGE_OPTIONS = 1,
  276. /// Record code for the target options table.
  277. TARGET_OPTIONS,
  278. /// Record code for the filesystem options table.
  279. FILE_SYSTEM_OPTIONS,
  280. /// Record code for the headers search options table.
  281. HEADER_SEARCH_OPTIONS,
  282. /// Record code for the preprocessor options table.
  283. PREPROCESSOR_OPTIONS,
  284. };
  285. /// Record codes for the unhashed control block.
  286. enum UnhashedControlBlockRecordTypes {
  287. /// Record code for the signature that identifiers this AST file.
  288. SIGNATURE = 1,
  289. /// Record code for the diagnostic options table.
  290. DIAGNOSTIC_OPTIONS,
  291. /// Record code for \#pragma diagnostic mappings.
  292. DIAG_PRAGMA_MAPPINGS,
  293. };
  294. /// Record code for extension blocks.
  295. enum ExtensionBlockRecordTypes {
  296. /// Metadata describing this particular extension.
  297. EXTENSION_METADATA = 1,
  298. /// The first record ID allocated to the extensions themselves.
  299. FIRST_EXTENSION_RECORD_ID = 4
  300. };
  301. /// Record types that occur within the input-files block
  302. /// inside the control block.
  303. enum InputFileRecordTypes {
  304. /// An input file.
  305. INPUT_FILE = 1
  306. };
  307. /// Record types that occur within the AST block itself.
  308. enum ASTRecordTypes {
  309. /// Record code for the offsets of each type.
  310. ///
  311. /// The TYPE_OFFSET constant describes the record that occurs
  312. /// within the AST block. The record itself is an array of offsets that
  313. /// point into the declarations and types block (identified by
  314. /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
  315. /// of a type. For a given type ID @c T, the lower three bits of
  316. /// @c T are its qualifiers (const, volatile, restrict), as in
  317. /// the QualType class. The upper bits, after being shifted and
  318. /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
  319. /// TYPE_OFFSET block to determine the offset of that type's
  320. /// corresponding record within the DECLTYPES_BLOCK_ID block.
  321. TYPE_OFFSET = 1,
  322. /// Record code for the offsets of each decl.
  323. ///
  324. /// The DECL_OFFSET constant describes the record that occurs
  325. /// within the block identified by DECL_OFFSETS_BLOCK_ID within
  326. /// the AST block. The record itself is an array of offsets that
  327. /// point into the declarations and types block (identified by
  328. /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
  329. /// record, after subtracting one to account for the use of
  330. /// declaration ID 0 for a NULL declaration pointer. Index 0 is
  331. /// reserved for the translation unit declaration.
  332. DECL_OFFSET = 2,
  333. /// Record code for the table of offsets of each
  334. /// identifier ID.
  335. ///
  336. /// The offset table contains offsets into the blob stored in
  337. /// the IDENTIFIER_TABLE record. Each offset points to the
  338. /// NULL-terminated string that corresponds to that identifier.
  339. IDENTIFIER_OFFSET = 3,
  340. /// This is so that older clang versions, before the introduction
  341. /// of the control block, can read and reject the newer PCH format.
  342. /// *DON'T CHANGE THIS NUMBER*.
  343. METADATA_OLD_FORMAT = 4,
  344. /// Record code for the identifier table.
  345. ///
  346. /// The identifier table is a simple blob that contains
  347. /// NULL-terminated strings for all of the identifiers
  348. /// referenced by the AST file. The IDENTIFIER_OFFSET table
  349. /// contains the mapping from identifier IDs to the characters
  350. /// in this blob. Note that the starting offsets of all of the
  351. /// identifiers are odd, so that, when the identifier offset
  352. /// table is loaded in, we can use the low bit to distinguish
  353. /// between offsets (for unresolved identifier IDs) and
  354. /// IdentifierInfo pointers (for already-resolved identifier
  355. /// IDs).
  356. IDENTIFIER_TABLE = 5,
  357. /// Record code for the array of eagerly deserialized decls.
  358. ///
  359. /// The AST file contains a list of all of the declarations that should be
  360. /// eagerly deserialized present within the parsed headers, stored as an
  361. /// array of declaration IDs. These declarations will be
  362. /// reported to the AST consumer after the AST file has been
  363. /// read, since their presence can affect the semantics of the
  364. /// program (e.g., for code generation).
  365. EAGERLY_DESERIALIZED_DECLS = 6,
  366. /// Record code for the set of non-builtin, special
  367. /// types.
  368. ///
  369. /// This record contains the type IDs for the various type nodes
  370. /// that are constructed during semantic analysis (e.g.,
  371. /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
  372. /// offsets into this record.
  373. SPECIAL_TYPES = 7,
  374. /// Record code for the extra statistics we gather while
  375. /// generating an AST file.
  376. STATISTICS = 8,
  377. /// Record code for the array of tentative definitions.
  378. TENTATIVE_DEFINITIONS = 9,
  379. // ID 10 used to be for a list of extern "C" declarations.
  380. /// Record code for the table of offsets into the
  381. /// Objective-C method pool.
  382. SELECTOR_OFFSETS = 11,
  383. /// Record code for the Objective-C method pool,
  384. METHOD_POOL = 12,
  385. /// The value of the next __COUNTER__ to dispense.
  386. /// [PP_COUNTER_VALUE, Val]
  387. PP_COUNTER_VALUE = 13,
  388. /// Record code for the table of offsets into the block
  389. /// of source-location information.
  390. SOURCE_LOCATION_OFFSETS = 14,
  391. /// Record code for the set of source location entries
  392. /// that need to be preloaded by the AST reader.
  393. ///
  394. /// This set contains the source location entry for the
  395. /// predefines buffer and for any file entries that need to be
  396. /// preloaded.
  397. SOURCE_LOCATION_PRELOADS = 15,
  398. /// Record code for the set of ext_vector type names.
  399. EXT_VECTOR_DECLS = 16,
  400. /// Record code for the array of unused file scoped decls.
  401. UNUSED_FILESCOPED_DECLS = 17,
  402. /// Record code for the table of offsets to entries in the
  403. /// preprocessing record.
  404. PPD_ENTITIES_OFFSETS = 18,
  405. /// Record code for the array of VTable uses.
  406. VTABLE_USES = 19,
  407. // ID 20 used to be for a list of dynamic classes.
  408. /// Record code for referenced selector pool.
  409. REFERENCED_SELECTOR_POOL = 21,
  410. /// Record code for an update to the TU's lexically contained
  411. /// declarations.
  412. TU_UPDATE_LEXICAL = 22,
  413. // ID 23 used to be for a list of local redeclarations.
  414. /// Record code for declarations that Sema keeps references of.
  415. SEMA_DECL_REFS = 24,
  416. /// Record code for weak undeclared identifiers.
  417. WEAK_UNDECLARED_IDENTIFIERS = 25,
  418. /// Record code for pending implicit instantiations.
  419. PENDING_IMPLICIT_INSTANTIATIONS = 26,
  420. // ID 27 used to be for a list of replacement decls.
  421. /// Record code for an update to a decl context's lookup table.
  422. ///
  423. /// In practice, this should only be used for the TU and namespaces.
  424. UPDATE_VISIBLE = 28,
  425. /// Record for offsets of DECL_UPDATES records for declarations
  426. /// that were modified after being deserialized and need updates.
  427. DECL_UPDATE_OFFSETS = 29,
  428. // ID 30 used to be a decl update record. These are now in the DECLTYPES
  429. // block.
  430. // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
  431. // ID 32 used to be the code for \#pragma diagnostic mappings.
  432. /// Record code for special CUDA declarations.
  433. CUDA_SPECIAL_DECL_REFS = 33,
  434. /// Record code for header search information.
  435. HEADER_SEARCH_TABLE = 34,
  436. /// Record code for floating point \#pragma options.
  437. FP_PRAGMA_OPTIONS = 35,
  438. /// Record code for enabled OpenCL extensions.
  439. OPENCL_EXTENSIONS = 36,
  440. /// The list of delegating constructor declarations.
  441. DELEGATING_CTORS = 37,
  442. /// Record code for the set of known namespaces, which are used
  443. /// for typo correction.
  444. KNOWN_NAMESPACES = 38,
  445. /// Record code for the remapping information used to relate
  446. /// loaded modules to the various offsets and IDs(e.g., source location
  447. /// offests, declaration and type IDs) that are used in that module to
  448. /// refer to other modules.
  449. MODULE_OFFSET_MAP = 39,
  450. /// Record code for the source manager line table information,
  451. /// which stores information about \#line directives.
  452. SOURCE_MANAGER_LINE_TABLE = 40,
  453. /// Record code for map of Objective-C class definition IDs to the
  454. /// ObjC categories in a module that are attached to that class.
  455. OBJC_CATEGORIES_MAP = 41,
  456. /// Record code for a file sorted array of DeclIDs in a module.
  457. FILE_SORTED_DECLS = 42,
  458. /// Record code for an array of all of the (sub)modules that were
  459. /// imported by the AST file.
  460. IMPORTED_MODULES = 43,
  461. // ID 44 used to be a table of merged canonical declarations.
  462. // ID 45 used to be a list of declaration IDs of local redeclarations.
  463. /// Record code for the array of Objective-C categories (including
  464. /// extensions).
  465. ///
  466. /// This array can only be interpreted properly using the Objective-C
  467. /// categories map.
  468. OBJC_CATEGORIES = 46,
  469. /// Record code for the table of offsets of each macro ID.
  470. ///
  471. /// The offset table contains offsets into the blob stored in
  472. /// the preprocessor block. Each offset points to the corresponding
  473. /// macro definition.
  474. MACRO_OFFSET = 47,
  475. /// A list of "interesting" identifiers. Only used in C++ (where we
  476. /// don't normally do lookups into the serialized identifier table). These
  477. /// are eagerly deserialized.
  478. INTERESTING_IDENTIFIERS = 48,
  479. /// Record code for undefined but used functions and variables that
  480. /// need a definition in this TU.
  481. UNDEFINED_BUT_USED = 49,
  482. /// Record code for late parsed template functions.
  483. LATE_PARSED_TEMPLATE = 50,
  484. /// Record code for \#pragma optimize options.
  485. OPTIMIZE_PRAGMA_OPTIONS = 51,
  486. /// Record code for potentially unused local typedef names.
  487. UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
  488. // ID 53 used to be a table of constructor initializer records.
  489. /// Delete expressions that will be analyzed later.
  490. DELETE_EXPRS_TO_ANALYZE = 54,
  491. /// Record code for \#pragma ms_struct options.
  492. MSSTRUCT_PRAGMA_OPTIONS = 55,
  493. /// Record code for \#pragma ms_struct options.
  494. POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56,
  495. /// Number of unmatched #pragma clang cuda_force_host_device begin
  496. /// directives we've seen.
  497. CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH = 57,
  498. /// Record code for types associated with OpenCL extensions.
  499. OPENCL_EXTENSION_TYPES = 58,
  500. /// Record code for declarations associated with OpenCL extensions.
  501. OPENCL_EXTENSION_DECLS = 59,
  502. MODULAR_CODEGEN_DECLS = 60,
  503. /// Record code for \#pragma pack options.
  504. PACK_PRAGMA_OPTIONS = 61,
  505. /// The stack of open #ifs/#ifdefs recorded in a preamble.
  506. PP_CONDITIONAL_STACK = 62,
  507. /// A table of skipped ranges within the preprocessing record.
  508. PPD_SKIPPED_RANGES = 63
  509. };
  510. /// Record types used within a source manager block.
  511. enum SourceManagerRecordTypes {
  512. /// Describes a source location entry (SLocEntry) for a
  513. /// file.
  514. SM_SLOC_FILE_ENTRY = 1,
  515. /// Describes a source location entry (SLocEntry) for a
  516. /// buffer.
  517. SM_SLOC_BUFFER_ENTRY = 2,
  518. /// Describes a blob that contains the data for a buffer
  519. /// entry. This kind of record always directly follows a
  520. /// SM_SLOC_BUFFER_ENTRY record or a SM_SLOC_FILE_ENTRY with an
  521. /// overridden buffer.
  522. SM_SLOC_BUFFER_BLOB = 3,
  523. /// Describes a zlib-compressed blob that contains the data for
  524. /// a buffer entry.
  525. SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
  526. /// Describes a source location entry (SLocEntry) for a
  527. /// macro expansion.
  528. SM_SLOC_EXPANSION_ENTRY = 5
  529. };
  530. /// Record types used within a preprocessor block.
  531. enum PreprocessorRecordTypes {
  532. // The macros in the PP section are a PP_MACRO_* instance followed by a
  533. // list of PP_TOKEN instances for each token in the definition.
  534. /// An object-like macro definition.
  535. /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
  536. PP_MACRO_OBJECT_LIKE = 1,
  537. /// A function-like macro definition.
  538. /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
  539. /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
  540. PP_MACRO_FUNCTION_LIKE = 2,
  541. /// Describes one token.
  542. /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
  543. PP_TOKEN = 3,
  544. /// The macro directives history for a particular identifier.
  545. PP_MACRO_DIRECTIVE_HISTORY = 4,
  546. /// A macro directive exported by a module.
  547. /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
  548. PP_MODULE_MACRO = 5,
  549. };
  550. /// Record types used within a preprocessor detail block.
  551. enum PreprocessorDetailRecordTypes {
  552. /// Describes a macro expansion within the preprocessing record.
  553. PPD_MACRO_EXPANSION = 0,
  554. /// Describes a macro definition within the preprocessing record.
  555. PPD_MACRO_DEFINITION = 1,
  556. /// Describes an inclusion directive within the preprocessing
  557. /// record.
  558. PPD_INCLUSION_DIRECTIVE = 2
  559. };
  560. /// Record types used within a submodule description block.
  561. enum SubmoduleRecordTypes {
  562. /// Metadata for submodules as a whole.
  563. SUBMODULE_METADATA = 0,
  564. /// Defines the major attributes of a submodule, including its
  565. /// name and parent.
  566. SUBMODULE_DEFINITION = 1,
  567. /// Specifies the umbrella header used to create this module,
  568. /// if any.
  569. SUBMODULE_UMBRELLA_HEADER = 2,
  570. /// Specifies a header that falls into this (sub)module.
  571. SUBMODULE_HEADER = 3,
  572. /// Specifies a top-level header that falls into this (sub)module.
  573. SUBMODULE_TOPHEADER = 4,
  574. /// Specifies an umbrella directory.
  575. SUBMODULE_UMBRELLA_DIR = 5,
  576. /// Specifies the submodules that are imported by this
  577. /// submodule.
  578. SUBMODULE_IMPORTS = 6,
  579. /// Specifies the submodules that are re-exported from this
  580. /// submodule.
  581. SUBMODULE_EXPORTS = 7,
  582. /// Specifies a required feature.
  583. SUBMODULE_REQUIRES = 8,
  584. /// Specifies a header that has been explicitly excluded
  585. /// from this submodule.
  586. SUBMODULE_EXCLUDED_HEADER = 9,
  587. /// Specifies a library or framework to link against.
  588. SUBMODULE_LINK_LIBRARY = 10,
  589. /// Specifies a configuration macro for this module.
  590. SUBMODULE_CONFIG_MACRO = 11,
  591. /// Specifies a conflict with another module.
  592. SUBMODULE_CONFLICT = 12,
  593. /// Specifies a header that is private to this submodule.
  594. SUBMODULE_PRIVATE_HEADER = 13,
  595. /// Specifies a header that is part of the module but must be
  596. /// textually included.
  597. SUBMODULE_TEXTUAL_HEADER = 14,
  598. /// Specifies a header that is private to this submodule but
  599. /// must be textually included.
  600. SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
  601. /// Specifies some declarations with initializers that must be
  602. /// emitted to initialize the module.
  603. SUBMODULE_INITIALIZERS = 16,
  604. /// Specifies the name of the module that will eventually
  605. /// re-export the entities in this module.
  606. SUBMODULE_EXPORT_AS = 17,
  607. };
  608. /// Record types used within a comments block.
  609. enum CommentRecordTypes {
  610. COMMENTS_RAW_COMMENT = 0
  611. };
  612. /// \defgroup ASTAST AST file AST constants
  613. ///
  614. /// The constants in this group describe various components of the
  615. /// abstract syntax tree within an AST file.
  616. ///
  617. /// @{
  618. /// Predefined type IDs.
  619. ///
  620. /// These type IDs correspond to predefined types in the AST
  621. /// context, such as built-in types (int) and special place-holder
  622. /// types (the \<overload> and \<dependent> type markers). Such
  623. /// types are never actually serialized, since they will be built
  624. /// by the AST context when it is created.
  625. enum PredefinedTypeIDs {
  626. /// The NULL type.
  627. PREDEF_TYPE_NULL_ID = 0,
  628. /// The void type.
  629. PREDEF_TYPE_VOID_ID = 1,
  630. /// The 'bool' or '_Bool' type.
  631. PREDEF_TYPE_BOOL_ID = 2,
  632. /// The 'char' type, when it is unsigned.
  633. PREDEF_TYPE_CHAR_U_ID = 3,
  634. /// The 'unsigned char' type.
  635. PREDEF_TYPE_UCHAR_ID = 4,
  636. /// The 'unsigned short' type.
  637. PREDEF_TYPE_USHORT_ID = 5,
  638. /// The 'unsigned int' type.
  639. PREDEF_TYPE_UINT_ID = 6,
  640. /// The 'unsigned long' type.
  641. PREDEF_TYPE_ULONG_ID = 7,
  642. /// The 'unsigned long long' type.
  643. PREDEF_TYPE_ULONGLONG_ID = 8,
  644. /// The 'char' type, when it is signed.
  645. PREDEF_TYPE_CHAR_S_ID = 9,
  646. /// The 'signed char' type.
  647. PREDEF_TYPE_SCHAR_ID = 10,
  648. /// The C++ 'wchar_t' type.
  649. PREDEF_TYPE_WCHAR_ID = 11,
  650. /// The (signed) 'short' type.
  651. PREDEF_TYPE_SHORT_ID = 12,
  652. /// The (signed) 'int' type.
  653. PREDEF_TYPE_INT_ID = 13,
  654. /// The (signed) 'long' type.
  655. PREDEF_TYPE_LONG_ID = 14,
  656. /// The (signed) 'long long' type.
  657. PREDEF_TYPE_LONGLONG_ID = 15,
  658. /// The 'float' type.
  659. PREDEF_TYPE_FLOAT_ID = 16,
  660. /// The 'double' type.
  661. PREDEF_TYPE_DOUBLE_ID = 17,
  662. /// The 'long double' type.
  663. PREDEF_TYPE_LONGDOUBLE_ID = 18,
  664. /// The placeholder type for overloaded function sets.
  665. PREDEF_TYPE_OVERLOAD_ID = 19,
  666. /// The placeholder type for dependent types.
  667. PREDEF_TYPE_DEPENDENT_ID = 20,
  668. /// The '__uint128_t' type.
  669. PREDEF_TYPE_UINT128_ID = 21,
  670. /// The '__int128_t' type.
  671. PREDEF_TYPE_INT128_ID = 22,
  672. /// The type of 'nullptr'.
  673. PREDEF_TYPE_NULLPTR_ID = 23,
  674. /// The C++ 'char16_t' type.
  675. PREDEF_TYPE_CHAR16_ID = 24,
  676. /// The C++ 'char32_t' type.
  677. PREDEF_TYPE_CHAR32_ID = 25,
  678. /// The ObjC 'id' type.
  679. PREDEF_TYPE_OBJC_ID = 26,
  680. /// The ObjC 'Class' type.
  681. PREDEF_TYPE_OBJC_CLASS = 27,
  682. /// The ObjC 'SEL' type.
  683. PREDEF_TYPE_OBJC_SEL = 28,
  684. /// The 'unknown any' placeholder type.
  685. PREDEF_TYPE_UNKNOWN_ANY = 29,
  686. /// The placeholder type for bound member functions.
  687. PREDEF_TYPE_BOUND_MEMBER = 30,
  688. /// The "auto" deduction type.
  689. PREDEF_TYPE_AUTO_DEDUCT = 31,
  690. /// The "auto &&" deduction type.
  691. PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
  692. /// The OpenCL 'half' / ARM NEON __fp16 type.
  693. PREDEF_TYPE_HALF_ID = 33,
  694. /// ARC's unbridged-cast placeholder type.
  695. PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
  696. /// The pseudo-object placeholder type.
  697. PREDEF_TYPE_PSEUDO_OBJECT = 35,
  698. /// The placeholder type for builtin functions.
  699. PREDEF_TYPE_BUILTIN_FN = 36,
  700. /// OpenCL event type.
  701. PREDEF_TYPE_EVENT_ID = 37,
  702. /// OpenCL clk event type.
  703. PREDEF_TYPE_CLK_EVENT_ID = 38,
  704. /// OpenCL sampler type.
  705. PREDEF_TYPE_SAMPLER_ID = 39,
  706. /// OpenCL queue type.
  707. PREDEF_TYPE_QUEUE_ID = 40,
  708. /// OpenCL reserve_id type.
  709. PREDEF_TYPE_RESERVE_ID_ID = 41,
  710. /// The placeholder type for OpenMP array section.
  711. PREDEF_TYPE_OMP_ARRAY_SECTION = 42,
  712. /// The '__float128' type
  713. PREDEF_TYPE_FLOAT128_ID = 43,
  714. /// The '_Float16' type
  715. PREDEF_TYPE_FLOAT16_ID = 44,
  716. /// The C++ 'char8_t' type.
  717. PREDEF_TYPE_CHAR8_ID = 45,
  718. /// \brief The 'short _Accum' type
  719. PREDEF_TYPE_SHORT_ACCUM_ID = 46,
  720. /// \brief The '_Accum' type
  721. PREDEF_TYPE_ACCUM_ID = 47,
  722. /// \brief The 'long _Accum' type
  723. PREDEF_TYPE_LONG_ACCUM_ID = 48,
  724. /// \brief The 'unsigned short _Accum' type
  725. PREDEF_TYPE_USHORT_ACCUM_ID = 49,
  726. /// \brief The 'unsigned _Accum' type
  727. PREDEF_TYPE_UACCUM_ID = 50,
  728. /// \brief The 'unsigned long _Accum' type
  729. PREDEF_TYPE_ULONG_ACCUM_ID = 51,
  730. /// \brief The 'short _Fract' type
  731. PREDEF_TYPE_SHORT_FRACT_ID = 52,
  732. /// \brief The '_Fract' type
  733. PREDEF_TYPE_FRACT_ID = 53,
  734. /// \brief The 'long _Fract' type
  735. PREDEF_TYPE_LONG_FRACT_ID = 54,
  736. /// \brief The 'unsigned short _Fract' type
  737. PREDEF_TYPE_USHORT_FRACT_ID = 55,
  738. /// \brief The 'unsigned _Fract' type
  739. PREDEF_TYPE_UFRACT_ID = 56,
  740. /// \brief The 'unsigned long _Fract' type
  741. PREDEF_TYPE_ULONG_FRACT_ID = 57,
  742. /// \brief The '_Sat short _Accum' type
  743. PREDEF_TYPE_SAT_SHORT_ACCUM_ID = 58,
  744. /// \brief The '_Sat _Accum' type
  745. PREDEF_TYPE_SAT_ACCUM_ID = 59,
  746. /// \brief The '_Sat long _Accum' type
  747. PREDEF_TYPE_SAT_LONG_ACCUM_ID = 60,
  748. /// \brief The '_Sat unsigned short _Accum' type
  749. PREDEF_TYPE_SAT_USHORT_ACCUM_ID = 61,
  750. /// \brief The '_Sat unsigned _Accum' type
  751. PREDEF_TYPE_SAT_UACCUM_ID = 62,
  752. /// \brief The '_Sat unsigned long _Accum' type
  753. PREDEF_TYPE_SAT_ULONG_ACCUM_ID = 63,
  754. /// \brief The '_Sat short _Fract' type
  755. PREDEF_TYPE_SAT_SHORT_FRACT_ID = 64,
  756. /// \brief The '_Sat _Fract' type
  757. PREDEF_TYPE_SAT_FRACT_ID = 65,
  758. /// \brief The '_Sat long _Fract' type
  759. PREDEF_TYPE_SAT_LONG_FRACT_ID = 66,
  760. /// \brief The '_Sat unsigned short _Fract' type
  761. PREDEF_TYPE_SAT_USHORT_FRACT_ID = 67,
  762. /// \brief The '_Sat unsigned _Fract' type
  763. PREDEF_TYPE_SAT_UFRACT_ID = 68,
  764. /// \brief The '_Sat unsigned long _Fract' type
  765. PREDEF_TYPE_SAT_ULONG_FRACT_ID = 69,
  766. /// OpenCL image types with auto numeration
  767. #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
  768. PREDEF_TYPE_##Id##_ID,
  769. #include "clang/Basic/OpenCLImageTypes.def"
  770. /// \brief OpenCL extension types with auto numeration
  771. #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
  772. PREDEF_TYPE_##Id##_ID,
  773. #include "clang/Basic/OpenCLExtensionTypes.def"
  774. // \brief SVE types with auto numeration
  775. #define SVE_TYPE(Name, Id, SingletonId) PREDEF_TYPE_##Id##_ID,
  776. #include "clang/Basic/AArch64SVEACLETypes.def"
  777. };
  778. /// The number of predefined type IDs that are reserved for
  779. /// the PREDEF_TYPE_* constants.
  780. ///
  781. /// Type IDs for non-predefined types will start at
  782. /// NUM_PREDEF_TYPE_IDs.
  783. const unsigned NUM_PREDEF_TYPE_IDS = 200;
  784. /// Record codes for each kind of type.
  785. ///
  786. /// These constants describe the type records that can occur within a
  787. /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
  788. /// constant describes a record for a specific type class in the
  789. /// AST. Note that DeclCode values share this code space.
  790. enum TypeCode {
  791. /// An ExtQualType record.
  792. TYPE_EXT_QUAL = 1,
  793. /// A ComplexType record.
  794. TYPE_COMPLEX = 3,
  795. /// A PointerType record.
  796. TYPE_POINTER = 4,
  797. /// A BlockPointerType record.
  798. TYPE_BLOCK_POINTER = 5,
  799. /// An LValueReferenceType record.
  800. TYPE_LVALUE_REFERENCE = 6,
  801. /// An RValueReferenceType record.
  802. TYPE_RVALUE_REFERENCE = 7,
  803. /// A MemberPointerType record.
  804. TYPE_MEMBER_POINTER = 8,
  805. /// A ConstantArrayType record.
  806. TYPE_CONSTANT_ARRAY = 9,
  807. /// An IncompleteArrayType record.
  808. TYPE_INCOMPLETE_ARRAY = 10,
  809. /// A VariableArrayType record.
  810. TYPE_VARIABLE_ARRAY = 11,
  811. /// A VectorType record.
  812. TYPE_VECTOR = 12,
  813. /// An ExtVectorType record.
  814. TYPE_EXT_VECTOR = 13,
  815. /// A FunctionNoProtoType record.
  816. TYPE_FUNCTION_NO_PROTO = 14,
  817. /// A FunctionProtoType record.
  818. TYPE_FUNCTION_PROTO = 15,
  819. /// A TypedefType record.
  820. TYPE_TYPEDEF = 16,
  821. /// A TypeOfExprType record.
  822. TYPE_TYPEOF_EXPR = 17,
  823. /// A TypeOfType record.
  824. TYPE_TYPEOF = 18,
  825. /// A RecordType record.
  826. TYPE_RECORD = 19,
  827. /// An EnumType record.
  828. TYPE_ENUM = 20,
  829. /// An ObjCInterfaceType record.
  830. TYPE_OBJC_INTERFACE = 21,
  831. /// An ObjCObjectPointerType record.
  832. TYPE_OBJC_OBJECT_POINTER = 22,
  833. /// a DecltypeType record.
  834. TYPE_DECLTYPE = 23,
  835. /// An ElaboratedType record.
  836. TYPE_ELABORATED = 24,
  837. /// A SubstTemplateTypeParmType record.
  838. TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
  839. /// An UnresolvedUsingType record.
  840. TYPE_UNRESOLVED_USING = 26,
  841. /// An InjectedClassNameType record.
  842. TYPE_INJECTED_CLASS_NAME = 27,
  843. /// An ObjCObjectType record.
  844. TYPE_OBJC_OBJECT = 28,
  845. /// An TemplateTypeParmType record.
  846. TYPE_TEMPLATE_TYPE_PARM = 29,
  847. /// An TemplateSpecializationType record.
  848. TYPE_TEMPLATE_SPECIALIZATION = 30,
  849. /// A DependentNameType record.
  850. TYPE_DEPENDENT_NAME = 31,
  851. /// A DependentTemplateSpecializationType record.
  852. TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
  853. /// A DependentSizedArrayType record.
  854. TYPE_DEPENDENT_SIZED_ARRAY = 33,
  855. /// A ParenType record.
  856. TYPE_PAREN = 34,
  857. /// A PackExpansionType record.
  858. TYPE_PACK_EXPANSION = 35,
  859. /// An AttributedType record.
  860. TYPE_ATTRIBUTED = 36,
  861. /// A SubstTemplateTypeParmPackType record.
  862. TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
  863. /// A AutoType record.
  864. TYPE_AUTO = 38,
  865. /// A UnaryTransformType record.
  866. TYPE_UNARY_TRANSFORM = 39,
  867. /// An AtomicType record.
  868. TYPE_ATOMIC = 40,
  869. /// A DecayedType record.
  870. TYPE_DECAYED = 41,
  871. /// An AdjustedType record.
  872. TYPE_ADJUSTED = 42,
  873. /// A PipeType record.
  874. TYPE_PIPE = 43,
  875. /// An ObjCTypeParamType record.
  876. TYPE_OBJC_TYPE_PARAM = 44,
  877. /// A DeducedTemplateSpecializationType record.
  878. TYPE_DEDUCED_TEMPLATE_SPECIALIZATION = 45,
  879. /// A DependentSizedExtVectorType record.
  880. TYPE_DEPENDENT_SIZED_EXT_VECTOR = 46,
  881. /// A DependentAddressSpaceType record.
  882. TYPE_DEPENDENT_ADDRESS_SPACE = 47,
  883. /// A dependentSizedVectorType record.
  884. TYPE_DEPENDENT_SIZED_VECTOR = 48,
  885. /// A type defined in a macro.
  886. TYPE_MACRO_QUALIFIED = 49
  887. };
  888. /// The type IDs for special types constructed by semantic
  889. /// analysis.
  890. ///
  891. /// The constants in this enumeration are indices into the
  892. /// SPECIAL_TYPES record.
  893. enum SpecialTypeIDs {
  894. /// CFConstantString type
  895. SPECIAL_TYPE_CF_CONSTANT_STRING = 0,
  896. /// C FILE typedef type
  897. SPECIAL_TYPE_FILE = 1,
  898. /// C jmp_buf typedef type
  899. SPECIAL_TYPE_JMP_BUF = 2,
  900. /// C sigjmp_buf typedef type
  901. SPECIAL_TYPE_SIGJMP_BUF = 3,
  902. /// Objective-C "id" redefinition type
  903. SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4,
  904. /// Objective-C "Class" redefinition type
  905. SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5,
  906. /// Objective-C "SEL" redefinition type
  907. SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6,
  908. /// C ucontext_t typedef type
  909. SPECIAL_TYPE_UCONTEXT_T = 7
  910. };
  911. /// The number of special type IDs.
  912. const unsigned NumSpecialTypeIDs = 8;
  913. /// Predefined declaration IDs.
  914. ///
  915. /// These declaration IDs correspond to predefined declarations in the AST
  916. /// context, such as the NULL declaration ID. Such declarations are never
  917. /// actually serialized, since they will be built by the AST context when
  918. /// it is created.
  919. enum PredefinedDeclIDs {
  920. /// The NULL declaration.
  921. PREDEF_DECL_NULL_ID = 0,
  922. /// The translation unit.
  923. PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
  924. /// The Objective-C 'id' type.
  925. PREDEF_DECL_OBJC_ID_ID = 2,
  926. /// The Objective-C 'SEL' type.
  927. PREDEF_DECL_OBJC_SEL_ID = 3,
  928. /// The Objective-C 'Class' type.
  929. PREDEF_DECL_OBJC_CLASS_ID = 4,
  930. /// The Objective-C 'Protocol' type.
  931. PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
  932. /// The signed 128-bit integer type.
  933. PREDEF_DECL_INT_128_ID = 6,
  934. /// The unsigned 128-bit integer type.
  935. PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
  936. /// The internal 'instancetype' typedef.
  937. PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
  938. /// The internal '__builtin_va_list' typedef.
  939. PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
  940. /// The internal '__va_list_tag' struct, if any.
  941. PREDEF_DECL_VA_LIST_TAG = 10,
  942. /// The internal '__builtin_ms_va_list' typedef.
  943. PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
  944. /// The extern "C" context.
  945. PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
  946. /// The internal '__make_integer_seq' template.
  947. PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
  948. /// The internal '__NSConstantString' typedef.
  949. PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
  950. /// The internal '__NSConstantString' tag type.
  951. PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
  952. /// The internal '__type_pack_element' template.
  953. PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
  954. };
  955. /// The number of declaration IDs that are predefined.
  956. ///
  957. /// For more information about predefined declarations, see the
  958. /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
  959. const unsigned int NUM_PREDEF_DECL_IDS = 17;
  960. /// Record of updates for a declaration that was modified after
  961. /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
  962. const unsigned int DECL_UPDATES = 49;
  963. /// Record code for a list of local redeclarations of a declaration.
  964. /// This can occur within DECLTYPES_BLOCK_ID.
  965. const unsigned int LOCAL_REDECLARATIONS = 50;
  966. /// Record codes for each kind of declaration.
  967. ///
  968. /// These constants describe the declaration records that can occur within
  969. /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
  970. /// constant describes a record for a specific declaration class
  971. /// in the AST. Note that TypeCode values share this code space.
  972. enum DeclCode {
  973. /// A TypedefDecl record.
  974. DECL_TYPEDEF = 51,
  975. /// A TypeAliasDecl record.
  976. DECL_TYPEALIAS,
  977. /// An EnumDecl record.
  978. DECL_ENUM,
  979. /// A RecordDecl record.
  980. DECL_RECORD,
  981. /// An EnumConstantDecl record.
  982. DECL_ENUM_CONSTANT,
  983. /// A FunctionDecl record.
  984. DECL_FUNCTION,
  985. /// A ObjCMethodDecl record.
  986. DECL_OBJC_METHOD,
  987. /// A ObjCInterfaceDecl record.
  988. DECL_OBJC_INTERFACE,
  989. /// A ObjCProtocolDecl record.
  990. DECL_OBJC_PROTOCOL,
  991. /// A ObjCIvarDecl record.
  992. DECL_OBJC_IVAR,
  993. /// A ObjCAtDefsFieldDecl record.
  994. DECL_OBJC_AT_DEFS_FIELD,
  995. /// A ObjCCategoryDecl record.
  996. DECL_OBJC_CATEGORY,
  997. /// A ObjCCategoryImplDecl record.
  998. DECL_OBJC_CATEGORY_IMPL,
  999. /// A ObjCImplementationDecl record.
  1000. DECL_OBJC_IMPLEMENTATION,
  1001. /// A ObjCCompatibleAliasDecl record.
  1002. DECL_OBJC_COMPATIBLE_ALIAS,
  1003. /// A ObjCPropertyDecl record.
  1004. DECL_OBJC_PROPERTY,
  1005. /// A ObjCPropertyImplDecl record.
  1006. DECL_OBJC_PROPERTY_IMPL,
  1007. /// A FieldDecl record.
  1008. DECL_FIELD,
  1009. /// A MSPropertyDecl record.
  1010. DECL_MS_PROPERTY,
  1011. /// A VarDecl record.
  1012. DECL_VAR,
  1013. /// An ImplicitParamDecl record.
  1014. DECL_IMPLICIT_PARAM,
  1015. /// A ParmVarDecl record.
  1016. DECL_PARM_VAR,
  1017. /// A DecompositionDecl record.
  1018. DECL_DECOMPOSITION,
  1019. /// A BindingDecl record.
  1020. DECL_BINDING,
  1021. /// A FileScopeAsmDecl record.
  1022. DECL_FILE_SCOPE_ASM,
  1023. /// A BlockDecl record.
  1024. DECL_BLOCK,
  1025. /// A CapturedDecl record.
  1026. DECL_CAPTURED,
  1027. /// A record that stores the set of declarations that are
  1028. /// lexically stored within a given DeclContext.
  1029. ///
  1030. /// The record itself is a blob that is an array of declaration IDs,
  1031. /// in the order in which those declarations were added to the
  1032. /// declaration context. This data is used when iterating over
  1033. /// the contents of a DeclContext, e.g., via
  1034. /// DeclContext::decls_begin() and DeclContext::decls_end().
  1035. DECL_CONTEXT_LEXICAL,
  1036. /// A record that stores the set of declarations that are
  1037. /// visible from a given DeclContext.
  1038. ///
  1039. /// The record itself stores a set of mappings, each of which
  1040. /// associates a declaration name with one or more declaration
  1041. /// IDs. This data is used when performing qualified name lookup
  1042. /// into a DeclContext via DeclContext::lookup.
  1043. DECL_CONTEXT_VISIBLE,
  1044. /// A LabelDecl record.
  1045. DECL_LABEL,
  1046. /// A NamespaceDecl record.
  1047. DECL_NAMESPACE,
  1048. /// A NamespaceAliasDecl record.
  1049. DECL_NAMESPACE_ALIAS,
  1050. /// A UsingDecl record.
  1051. DECL_USING,
  1052. /// A UsingPackDecl record.
  1053. DECL_USING_PACK,
  1054. /// A UsingShadowDecl record.
  1055. DECL_USING_SHADOW,
  1056. /// A ConstructorUsingShadowDecl record.
  1057. DECL_CONSTRUCTOR_USING_SHADOW,
  1058. /// A UsingDirecitveDecl record.
  1059. DECL_USING_DIRECTIVE,
  1060. /// An UnresolvedUsingValueDecl record.
  1061. DECL_UNRESOLVED_USING_VALUE,
  1062. /// An UnresolvedUsingTypenameDecl record.
  1063. DECL_UNRESOLVED_USING_TYPENAME,
  1064. /// A LinkageSpecDecl record.
  1065. DECL_LINKAGE_SPEC,
  1066. /// An ExportDecl record.
  1067. DECL_EXPORT,
  1068. /// A CXXRecordDecl record.
  1069. DECL_CXX_RECORD,
  1070. /// A CXXDeductionGuideDecl record.
  1071. DECL_CXX_DEDUCTION_GUIDE,
  1072. /// A CXXMethodDecl record.
  1073. DECL_CXX_METHOD,
  1074. /// A CXXConstructorDecl record.
  1075. DECL_CXX_CONSTRUCTOR,
  1076. /// A CXXDestructorDecl record.
  1077. DECL_CXX_DESTRUCTOR,
  1078. /// A CXXConversionDecl record.
  1079. DECL_CXX_CONVERSION,
  1080. /// An AccessSpecDecl record.
  1081. DECL_ACCESS_SPEC,
  1082. /// A FriendDecl record.
  1083. DECL_FRIEND,
  1084. /// A FriendTemplateDecl record.
  1085. DECL_FRIEND_TEMPLATE,
  1086. /// A ClassTemplateDecl record.
  1087. DECL_CLASS_TEMPLATE,
  1088. /// A ClassTemplateSpecializationDecl record.
  1089. DECL_CLASS_TEMPLATE_SPECIALIZATION,
  1090. /// A ClassTemplatePartialSpecializationDecl record.
  1091. DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
  1092. /// A VarTemplateDecl record.
  1093. DECL_VAR_TEMPLATE,
  1094. /// A VarTemplateSpecializationDecl record.
  1095. DECL_VAR_TEMPLATE_SPECIALIZATION,
  1096. /// A VarTemplatePartialSpecializationDecl record.
  1097. DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
  1098. /// A FunctionTemplateDecl record.
  1099. DECL_FUNCTION_TEMPLATE,
  1100. /// A TemplateTypeParmDecl record.
  1101. DECL_TEMPLATE_TYPE_PARM,
  1102. /// A NonTypeTemplateParmDecl record.
  1103. DECL_NON_TYPE_TEMPLATE_PARM,
  1104. /// A TemplateTemplateParmDecl record.
  1105. DECL_TEMPLATE_TEMPLATE_PARM,
  1106. /// A TypeAliasTemplateDecl record.
  1107. DECL_TYPE_ALIAS_TEMPLATE,
  1108. /// \brief A ConceptDecl record.
  1109. DECL_CONCEPT,
  1110. /// \brief A StaticAssertDecl record.
  1111. DECL_STATIC_ASSERT,
  1112. /// A record containing CXXBaseSpecifiers.
  1113. DECL_CXX_BASE_SPECIFIERS,
  1114. /// A record containing CXXCtorInitializers.
  1115. DECL_CXX_CTOR_INITIALIZERS,
  1116. /// A IndirectFieldDecl record.
  1117. DECL_INDIRECTFIELD,
  1118. /// A NonTypeTemplateParmDecl record that stores an expanded
  1119. /// non-type template parameter pack.
  1120. DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
  1121. /// A TemplateTemplateParmDecl record that stores an expanded
  1122. /// template template parameter pack.
  1123. DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
  1124. /// A ClassScopeFunctionSpecializationDecl record a class scope
  1125. /// function specialization. (Microsoft extension).
  1126. DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
  1127. /// An ImportDecl recording a module import.
  1128. DECL_IMPORT,
  1129. /// An OMPThreadPrivateDecl record.
  1130. DECL_OMP_THREADPRIVATE,
  1131. /// An OMPRequiresDecl record.
  1132. DECL_OMP_REQUIRES,
  1133. /// An OMPAllocateDcl record.
  1134. DECL_OMP_ALLOCATE,
  1135. /// An EmptyDecl record.
  1136. DECL_EMPTY,
  1137. /// An ObjCTypeParamDecl record.
  1138. DECL_OBJC_TYPE_PARAM,
  1139. /// An OMPCapturedExprDecl record.
  1140. DECL_OMP_CAPTUREDEXPR,
  1141. /// A PragmaCommentDecl record.
  1142. DECL_PRAGMA_COMMENT,
  1143. /// A PragmaDetectMismatchDecl record.
  1144. DECL_PRAGMA_DETECT_MISMATCH,
  1145. /// An OMPDeclareMapperDecl record.
  1146. DECL_OMP_DECLARE_MAPPER,
  1147. /// An OMPDeclareReductionDecl record.
  1148. DECL_OMP_DECLARE_REDUCTION,
  1149. DECL_LAST = DECL_OMP_DECLARE_REDUCTION
  1150. };
  1151. /// Record codes for each kind of statement or expression.
  1152. ///
  1153. /// These constants describe the records that describe statements
  1154. /// or expressions. These records occur within type and declarations
  1155. /// block, so they begin with record values of 128. Each constant
  1156. /// describes a record for a specific statement or expression class in the
  1157. /// AST.
  1158. enum StmtCode {
  1159. /// A marker record that indicates that we are at the end
  1160. /// of an expression.
  1161. STMT_STOP = DECL_LAST + 1,
  1162. /// A NULL expression.
  1163. STMT_NULL_PTR,
  1164. /// A reference to a previously [de]serialized Stmt record.
  1165. STMT_REF_PTR,
  1166. /// A NullStmt record.
  1167. STMT_NULL,
  1168. /// A CompoundStmt record.
  1169. STMT_COMPOUND,
  1170. /// A CaseStmt record.
  1171. STMT_CASE,
  1172. /// A DefaultStmt record.
  1173. STMT_DEFAULT,
  1174. /// A LabelStmt record.
  1175. STMT_LABEL,
  1176. /// An AttributedStmt record.
  1177. STMT_ATTRIBUTED,
  1178. /// An IfStmt record.
  1179. STMT_IF,
  1180. /// A SwitchStmt record.
  1181. STMT_SWITCH,
  1182. /// A WhileStmt record.
  1183. STMT_WHILE,
  1184. /// A DoStmt record.
  1185. STMT_DO,
  1186. /// A ForStmt record.
  1187. STMT_FOR,
  1188. /// A GotoStmt record.
  1189. STMT_GOTO,
  1190. /// An IndirectGotoStmt record.
  1191. STMT_INDIRECT_GOTO,
  1192. /// A ContinueStmt record.
  1193. STMT_CONTINUE,
  1194. /// A BreakStmt record.
  1195. STMT_BREAK,
  1196. /// A ReturnStmt record.
  1197. STMT_RETURN,
  1198. /// A DeclStmt record.
  1199. STMT_DECL,
  1200. /// A CapturedStmt record.
  1201. STMT_CAPTURED,
  1202. /// A GCC-style AsmStmt record.
  1203. STMT_GCCASM,
  1204. /// A MS-style AsmStmt record.
  1205. STMT_MSASM,
  1206. /// A constant expression context.
  1207. EXPR_CONSTANT,
  1208. /// A PredefinedExpr record.
  1209. EXPR_PREDEFINED,
  1210. /// A DeclRefExpr record.
  1211. EXPR_DECL_REF,
  1212. /// An IntegerLiteral record.
  1213. EXPR_INTEGER_LITERAL,
  1214. /// A FloatingLiteral record.
  1215. EXPR_FLOATING_LITERAL,
  1216. /// An ImaginaryLiteral record.
  1217. EXPR_IMAGINARY_LITERAL,
  1218. /// A StringLiteral record.
  1219. EXPR_STRING_LITERAL,
  1220. /// A CharacterLiteral record.
  1221. EXPR_CHARACTER_LITERAL,
  1222. /// A ParenExpr record.
  1223. EXPR_PAREN,
  1224. /// A ParenListExpr record.
  1225. EXPR_PAREN_LIST,
  1226. /// A UnaryOperator record.
  1227. EXPR_UNARY_OPERATOR,
  1228. /// An OffsetOfExpr record.
  1229. EXPR_OFFSETOF,
  1230. /// A SizefAlignOfExpr record.
  1231. EXPR_SIZEOF_ALIGN_OF,
  1232. /// An ArraySubscriptExpr record.
  1233. EXPR_ARRAY_SUBSCRIPT,
  1234. /// A CallExpr record.
  1235. EXPR_CALL,
  1236. /// A MemberExpr record.
  1237. EXPR_MEMBER,
  1238. /// A BinaryOperator record.
  1239. EXPR_BINARY_OPERATOR,
  1240. /// A CompoundAssignOperator record.
  1241. EXPR_COMPOUND_ASSIGN_OPERATOR,
  1242. /// A ConditionOperator record.
  1243. EXPR_CONDITIONAL_OPERATOR,
  1244. /// An ImplicitCastExpr record.
  1245. EXPR_IMPLICIT_CAST,
  1246. /// A CStyleCastExpr record.
  1247. EXPR_CSTYLE_CAST,
  1248. /// A CompoundLiteralExpr record.
  1249. EXPR_COMPOUND_LITERAL,
  1250. /// An ExtVectorElementExpr record.
  1251. EXPR_EXT_VECTOR_ELEMENT,
  1252. /// An InitListExpr record.
  1253. EXPR_INIT_LIST,
  1254. /// A DesignatedInitExpr record.
  1255. EXPR_DESIGNATED_INIT,
  1256. /// A DesignatedInitUpdateExpr record.
  1257. EXPR_DESIGNATED_INIT_UPDATE,
  1258. /// An NoInitExpr record.
  1259. EXPR_NO_INIT,
  1260. /// An ArrayInitLoopExpr record.
  1261. EXPR_ARRAY_INIT_LOOP,
  1262. /// An ArrayInitIndexExpr record.
  1263. EXPR_ARRAY_INIT_INDEX,
  1264. /// An ImplicitValueInitExpr record.
  1265. EXPR_IMPLICIT_VALUE_INIT,
  1266. /// A VAArgExpr record.
  1267. EXPR_VA_ARG,
  1268. /// An AddrLabelExpr record.
  1269. EXPR_ADDR_LABEL,
  1270. /// A StmtExpr record.
  1271. EXPR_STMT,
  1272. /// A ChooseExpr record.
  1273. EXPR_CHOOSE,
  1274. /// A GNUNullExpr record.
  1275. EXPR_GNU_NULL,
  1276. /// A SourceLocExpr record.
  1277. EXPR_SOURCE_LOC,
  1278. /// A ShuffleVectorExpr record.
  1279. EXPR_SHUFFLE_VECTOR,
  1280. /// A ConvertVectorExpr record.
  1281. EXPR_CONVERT_VECTOR,
  1282. /// BlockExpr
  1283. EXPR_BLOCK,
  1284. /// A GenericSelectionExpr record.
  1285. EXPR_GENERIC_SELECTION,
  1286. /// A PseudoObjectExpr record.
  1287. EXPR_PSEUDO_OBJECT,
  1288. /// An AtomicExpr record.
  1289. EXPR_ATOMIC,
  1290. // Objective-C
  1291. /// An ObjCStringLiteral record.
  1292. EXPR_OBJC_STRING_LITERAL,
  1293. EXPR_OBJC_BOXED_EXPRESSION,
  1294. EXPR_OBJC_ARRAY_LITERAL,
  1295. EXPR_OBJC_DICTIONARY_LITERAL,
  1296. /// An ObjCEncodeExpr record.
  1297. EXPR_OBJC_ENCODE,
  1298. /// An ObjCSelectorExpr record.
  1299. EXPR_OBJC_SELECTOR_EXPR,
  1300. /// An ObjCProtocolExpr record.
  1301. EXPR_OBJC_PROTOCOL_EXPR,
  1302. /// An ObjCIvarRefExpr record.
  1303. EXPR_OBJC_IVAR_REF_EXPR,
  1304. /// An ObjCPropertyRefExpr record.
  1305. EXPR_OBJC_PROPERTY_REF_EXPR,
  1306. /// An ObjCSubscriptRefExpr record.
  1307. EXPR_OBJC_SUBSCRIPT_REF_EXPR,
  1308. /// UNUSED
  1309. EXPR_OBJC_KVC_REF_EXPR,
  1310. /// An ObjCMessageExpr record.
  1311. EXPR_OBJC_MESSAGE_EXPR,
  1312. /// An ObjCIsa Expr record.
  1313. EXPR_OBJC_ISA,
  1314. /// An ObjCIndirectCopyRestoreExpr record.
  1315. EXPR_OBJC_INDIRECT_COPY_RESTORE,
  1316. /// An ObjCForCollectionStmt record.
  1317. STMT_OBJC_FOR_COLLECTION,
  1318. /// An ObjCAtCatchStmt record.
  1319. STMT_OBJC_CATCH,
  1320. /// An ObjCAtFinallyStmt record.
  1321. STMT_OBJC_FINALLY,
  1322. /// An ObjCAtTryStmt record.
  1323. STMT_OBJC_AT_TRY,
  1324. /// An ObjCAtSynchronizedStmt record.
  1325. STMT_OBJC_AT_SYNCHRONIZED,
  1326. /// An ObjCAtThrowStmt record.
  1327. STMT_OBJC_AT_THROW,
  1328. /// An ObjCAutoreleasePoolStmt record.
  1329. STMT_OBJC_AUTORELEASE_POOL,
  1330. /// An ObjCBoolLiteralExpr record.
  1331. EXPR_OBJC_BOOL_LITERAL,
  1332. /// An ObjCAvailabilityCheckExpr record.
  1333. EXPR_OBJC_AVAILABILITY_CHECK,
  1334. // C++
  1335. /// A CXXCatchStmt record.
  1336. STMT_CXX_CATCH,
  1337. /// A CXXTryStmt record.
  1338. STMT_CXX_TRY,
  1339. /// A CXXForRangeStmt record.
  1340. STMT_CXX_FOR_RANGE,
  1341. /// A CXXOperatorCallExpr record.
  1342. EXPR_CXX_OPERATOR_CALL,
  1343. /// A CXXMemberCallExpr record.
  1344. EXPR_CXX_MEMBER_CALL,
  1345. /// A CXXConstructExpr record.
  1346. EXPR_CXX_CONSTRUCT,
  1347. /// A CXXInheritedCtorInitExpr record.
  1348. EXPR_CXX_INHERITED_CTOR_INIT,
  1349. /// A CXXTemporaryObjectExpr record.
  1350. EXPR_CXX_TEMPORARY_OBJECT,
  1351. /// A CXXStaticCastExpr record.
  1352. EXPR_CXX_STATIC_CAST,
  1353. /// A CXXDynamicCastExpr record.
  1354. EXPR_CXX_DYNAMIC_CAST,
  1355. /// A CXXReinterpretCastExpr record.
  1356. EXPR_CXX_REINTERPRET_CAST,
  1357. /// A CXXConstCastExpr record.
  1358. EXPR_CXX_CONST_CAST,
  1359. /// A CXXFunctionalCastExpr record.
  1360. EXPR_CXX_FUNCTIONAL_CAST,
  1361. /// A UserDefinedLiteral record.
  1362. EXPR_USER_DEFINED_LITERAL,
  1363. /// A CXXStdInitializerListExpr record.
  1364. EXPR_CXX_STD_INITIALIZER_LIST,
  1365. /// A CXXBoolLiteralExpr record.
  1366. EXPR_CXX_BOOL_LITERAL,
  1367. EXPR_CXX_NULL_PTR_LITERAL, // CXXNullPtrLiteralExpr
  1368. EXPR_CXX_TYPEID_EXPR, // CXXTypeidExpr (of expr).
  1369. EXPR_CXX_TYPEID_TYPE, // CXXTypeidExpr (of type).
  1370. EXPR_CXX_THIS, // CXXThisExpr
  1371. EXPR_CXX_THROW, // CXXThrowExpr
  1372. EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
  1373. EXPR_CXX_DEFAULT_INIT, // CXXDefaultInitExpr
  1374. EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
  1375. EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
  1376. EXPR_CXX_NEW, // CXXNewExpr
  1377. EXPR_CXX_DELETE, // CXXDeleteExpr
  1378. EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
  1379. EXPR_EXPR_WITH_CLEANUPS, // ExprWithCleanups
  1380. EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
  1381. EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
  1382. EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
  1383. EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
  1384. EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
  1385. EXPR_CXX_EXPRESSION_TRAIT, // ExpressionTraitExpr
  1386. EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
  1387. EXPR_OPAQUE_VALUE, // OpaqueValueExpr
  1388. EXPR_BINARY_CONDITIONAL_OPERATOR, // BinaryConditionalOperator
  1389. EXPR_TYPE_TRAIT, // TypeTraitExpr
  1390. EXPR_ARRAY_TYPE_TRAIT, // ArrayTypeTraitIntExpr
  1391. EXPR_PACK_EXPANSION, // PackExpansionExpr
  1392. EXPR_SIZEOF_PACK, // SizeOfPackExpr
  1393. EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
  1394. EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
  1395. EXPR_FUNCTION_PARM_PACK, // FunctionParmPackExpr
  1396. EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
  1397. EXPR_CXX_FOLD, // CXXFoldExpr
  1398. // CUDA
  1399. EXPR_CUDA_KERNEL_CALL, // CUDAKernelCallExpr
  1400. // OpenCL
  1401. EXPR_ASTYPE, // AsTypeExpr
  1402. // Microsoft
  1403. EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
  1404. EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
  1405. EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).
  1406. EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).
  1407. STMT_SEH_LEAVE, // SEHLeaveStmt
  1408. STMT_SEH_EXCEPT, // SEHExceptStmt
  1409. STMT_SEH_FINALLY, // SEHFinallyStmt
  1410. STMT_SEH_TRY, // SEHTryStmt
  1411. // OpenMP directives
  1412. STMT_OMP_PARALLEL_DIRECTIVE,
  1413. STMT_OMP_SIMD_DIRECTIVE,
  1414. STMT_OMP_FOR_DIRECTIVE,
  1415. STMT_OMP_FOR_SIMD_DIRECTIVE,
  1416. STMT_OMP_SECTIONS_DIRECTIVE,
  1417. STMT_OMP_SECTION_DIRECTIVE,
  1418. STMT_OMP_SINGLE_DIRECTIVE,
  1419. STMT_OMP_MASTER_DIRECTIVE,
  1420. STMT_OMP_CRITICAL_DIRECTIVE,
  1421. STMT_OMP_PARALLEL_FOR_DIRECTIVE,
  1422. STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
  1423. STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
  1424. STMT_OMP_TASK_DIRECTIVE,
  1425. STMT_OMP_TASKYIELD_DIRECTIVE,
  1426. STMT_OMP_BARRIER_DIRECTIVE,
  1427. STMT_OMP_TASKWAIT_DIRECTIVE,
  1428. STMT_OMP_FLUSH_DIRECTIVE,
  1429. STMT_OMP_ORDERED_DIRECTIVE,
  1430. STMT_OMP_ATOMIC_DIRECTIVE,
  1431. STMT_OMP_TARGET_DIRECTIVE,
  1432. STMT_OMP_TARGET_DATA_DIRECTIVE,
  1433. STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
  1434. STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
  1435. STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
  1436. STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
  1437. STMT_OMP_TEAMS_DIRECTIVE,
  1438. STMT_OMP_TASKGROUP_DIRECTIVE,
  1439. STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
  1440. STMT_OMP_CANCEL_DIRECTIVE,
  1441. STMT_OMP_TASKLOOP_DIRECTIVE,
  1442. STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
  1443. STMT_OMP_MASTER_TASKLOOP_DIRECTIVE,
  1444. STMT_OMP_DISTRIBUTE_DIRECTIVE,
  1445. STMT_OMP_TARGET_UPDATE_DIRECTIVE,
  1446. STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
  1447. STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
  1448. STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
  1449. STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
  1450. STMT_OMP_TARGET_SIMD_DIRECTIVE,
  1451. STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE,
  1452. STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
  1453. STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
  1454. STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
  1455. STMT_OMP_TARGET_TEAMS_DIRECTIVE,
  1456. STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
  1457. STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
  1458. STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
  1459. STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
  1460. EXPR_OMP_ARRAY_SECTION,
  1461. // ARC
  1462. EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr
  1463. STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt
  1464. EXPR_LAMBDA, // LambdaExpr
  1465. STMT_COROUTINE_BODY,
  1466. STMT_CORETURN,
  1467. EXPR_COAWAIT,
  1468. EXPR_COYIELD,
  1469. EXPR_DEPENDENT_COAWAIT,
  1470. };
  1471. /// The kinds of designators that can occur in a
  1472. /// DesignatedInitExpr.
  1473. enum DesignatorTypes {
  1474. /// Field designator where only the field name is known.
  1475. DESIG_FIELD_NAME = 0,
  1476. /// Field designator where the field has been resolved to
  1477. /// a declaration.
  1478. DESIG_FIELD_DECL = 1,
  1479. /// Array designator.
  1480. DESIG_ARRAY = 2,
  1481. /// GNU array range designator.
  1482. DESIG_ARRAY_RANGE = 3
  1483. };
  1484. /// The different kinds of data that can occur in a
  1485. /// CtorInitializer.
  1486. enum CtorInitializerType {
  1487. CTOR_INITIALIZER_BASE,
  1488. CTOR_INITIALIZER_DELEGATING,
  1489. CTOR_INITIALIZER_MEMBER,
  1490. CTOR_INITIALIZER_INDIRECT_MEMBER
  1491. };
  1492. /// Describes the redeclarations of a declaration.
  1493. struct LocalRedeclarationsInfo {
  1494. // The ID of the first declaration
  1495. DeclID FirstID;
  1496. // Offset into the array of redeclaration chains.
  1497. unsigned Offset;
  1498. friend bool operator<(const LocalRedeclarationsInfo &X,
  1499. const LocalRedeclarationsInfo &Y) {
  1500. return X.FirstID < Y.FirstID;
  1501. }
  1502. friend bool operator>(const LocalRedeclarationsInfo &X,
  1503. const LocalRedeclarationsInfo &Y) {
  1504. return X.FirstID > Y.FirstID;
  1505. }
  1506. friend bool operator<=(const LocalRedeclarationsInfo &X,
  1507. const LocalRedeclarationsInfo &Y) {
  1508. return X.FirstID <= Y.FirstID;
  1509. }
  1510. friend bool operator>=(const LocalRedeclarationsInfo &X,
  1511. const LocalRedeclarationsInfo &Y) {
  1512. return X.FirstID >= Y.FirstID;
  1513. }
  1514. };
  1515. /// Describes the categories of an Objective-C class.
  1516. struct ObjCCategoriesInfo {
  1517. // The ID of the definition
  1518. DeclID DefinitionID;
  1519. // Offset into the array of category lists.
  1520. unsigned Offset;
  1521. friend bool operator<(const ObjCCategoriesInfo &X,
  1522. const ObjCCategoriesInfo &Y) {
  1523. return X.DefinitionID < Y.DefinitionID;
  1524. }
  1525. friend bool operator>(const ObjCCategoriesInfo &X,
  1526. const ObjCCategoriesInfo &Y) {
  1527. return X.DefinitionID > Y.DefinitionID;
  1528. }
  1529. friend bool operator<=(const ObjCCategoriesInfo &X,
  1530. const ObjCCategoriesInfo &Y) {
  1531. return X.DefinitionID <= Y.DefinitionID;
  1532. }
  1533. friend bool operator>=(const ObjCCategoriesInfo &X,
  1534. const ObjCCategoriesInfo &Y) {
  1535. return X.DefinitionID >= Y.DefinitionID;
  1536. }
  1537. };
  1538. /// A key used when looking up entities by \ref DeclarationName.
  1539. ///
  1540. /// Different \ref DeclarationNames are mapped to different keys, but the
  1541. /// same key can occasionally represent multiple names (for names that
  1542. /// contain types, in particular).
  1543. class DeclarationNameKey {
  1544. using NameKind = unsigned;
  1545. NameKind Kind = 0;
  1546. uint64_t Data = 0;
  1547. public:
  1548. DeclarationNameKey() = default;
  1549. DeclarationNameKey(DeclarationName Name);
  1550. DeclarationNameKey(NameKind Kind, uint64_t Data)
  1551. : Kind(Kind), Data(Data) {}
  1552. NameKind getKind() const { return Kind; }
  1553. IdentifierInfo *getIdentifier() const {
  1554. assert(Kind == DeclarationName::Identifier ||
  1555. Kind == DeclarationName::CXXLiteralOperatorName ||
  1556. Kind == DeclarationName::CXXDeductionGuideName);
  1557. return (IdentifierInfo *)Data;
  1558. }
  1559. Selector getSelector() const {
  1560. assert(Kind == DeclarationName::ObjCZeroArgSelector ||
  1561. Kind == DeclarationName::ObjCOneArgSelector ||
  1562. Kind == DeclarationName::ObjCMultiArgSelector);
  1563. return Selector(Data);
  1564. }
  1565. OverloadedOperatorKind getOperatorKind() const {
  1566. assert(Kind == DeclarationName::CXXOperatorName);
  1567. return (OverloadedOperatorKind)Data;
  1568. }
  1569. /// Compute a fingerprint of this key for use in on-disk hash table.
  1570. unsigned getHash() const;
  1571. friend bool operator==(const DeclarationNameKey &A,
  1572. const DeclarationNameKey &B) {
  1573. return A.Kind == B.Kind && A.Data == B.Data;
  1574. }
  1575. };
  1576. /// @}
  1577. } // namespace serialization
  1578. } // namespace clang
  1579. namespace llvm {
  1580. template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
  1581. static clang::serialization::DeclarationNameKey getEmptyKey() {
  1582. return clang::serialization::DeclarationNameKey(-1, 1);
  1583. }
  1584. static clang::serialization::DeclarationNameKey getTombstoneKey() {
  1585. return clang::serialization::DeclarationNameKey(-1, 2);
  1586. }
  1587. static unsigned
  1588. getHashValue(const clang::serialization::DeclarationNameKey &Key) {
  1589. return Key.getHash();
  1590. }
  1591. static bool isEqual(const clang::serialization::DeclarationNameKey &L,
  1592. const clang::serialization::DeclarationNameKey &R) {
  1593. return L == R;
  1594. }
  1595. };
  1596. } // namespace llvm
  1597. #endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H