ASTBitCodes.h 60 KB

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