TemplateName.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- TemplateName.h - C++ Template Name Representation --------*- 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 file defines the TemplateName interface and subclasses.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CLANG_AST_TEMPLATENAME_H
  18. #define LLVM_CLANG_AST_TEMPLATENAME_H
  19. #include "clang/AST/DependenceFlags.h"
  20. #include "clang/AST/NestedNameSpecifier.h"
  21. #include "clang/Basic/LLVM.h"
  22. #include "llvm/ADT/FoldingSet.h"
  23. #include "llvm/ADT/PointerIntPair.h"
  24. #include "llvm/ADT/PointerUnion.h"
  25. #include "llvm/Support/PointerLikeTypeTraits.h"
  26. #include <cassert>
  27. #include <optional>
  28. namespace clang {
  29. class ASTContext;
  30. class Decl;
  31. class DependentTemplateName;
  32. class IdentifierInfo;
  33. class NamedDecl;
  34. class NestedNameSpecifier;
  35. enum OverloadedOperatorKind : int;
  36. class OverloadedTemplateStorage;
  37. class AssumedTemplateStorage;
  38. struct PrintingPolicy;
  39. class QualifiedTemplateName;
  40. class SubstTemplateTemplateParmPackStorage;
  41. class SubstTemplateTemplateParmStorage;
  42. class TemplateArgument;
  43. class TemplateDecl;
  44. class TemplateTemplateParmDecl;
  45. class UsingShadowDecl;
  46. /// Implementation class used to describe either a set of overloaded
  47. /// template names or an already-substituted template template parameter pack.
  48. class UncommonTemplateNameStorage {
  49. protected:
  50. enum Kind {
  51. Overloaded,
  52. Assumed, // defined in DeclarationName.h
  53. SubstTemplateTemplateParm,
  54. SubstTemplateTemplateParmPack
  55. };
  56. struct BitsTag {
  57. /// A Kind.
  58. unsigned Kind : 2;
  59. // The template parameter index.
  60. unsigned Index : 15;
  61. /// The pack index, or the number of stored templates
  62. /// or template arguments, depending on which subclass we have.
  63. unsigned Data : 15;
  64. };
  65. union {
  66. struct BitsTag Bits;
  67. void *PointerAlignment;
  68. };
  69. UncommonTemplateNameStorage(Kind Kind, unsigned Index, unsigned Data) {
  70. Bits.Kind = Kind;
  71. Bits.Index = Index;
  72. Bits.Data = Data;
  73. }
  74. public:
  75. OverloadedTemplateStorage *getAsOverloadedStorage() {
  76. return Bits.Kind == Overloaded
  77. ? reinterpret_cast<OverloadedTemplateStorage *>(this)
  78. : nullptr;
  79. }
  80. AssumedTemplateStorage *getAsAssumedTemplateName() {
  81. return Bits.Kind == Assumed
  82. ? reinterpret_cast<AssumedTemplateStorage *>(this)
  83. : nullptr;
  84. }
  85. SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() {
  86. return Bits.Kind == SubstTemplateTemplateParm
  87. ? reinterpret_cast<SubstTemplateTemplateParmStorage *>(this)
  88. : nullptr;
  89. }
  90. SubstTemplateTemplateParmPackStorage *getAsSubstTemplateTemplateParmPack() {
  91. return Bits.Kind == SubstTemplateTemplateParmPack
  92. ? reinterpret_cast<SubstTemplateTemplateParmPackStorage *>(this)
  93. : nullptr;
  94. }
  95. };
  96. /// A structure for storing the information associated with an
  97. /// overloaded template name.
  98. class OverloadedTemplateStorage : public UncommonTemplateNameStorage {
  99. friend class ASTContext;
  100. OverloadedTemplateStorage(unsigned size)
  101. : UncommonTemplateNameStorage(Overloaded, 0, size) {}
  102. NamedDecl **getStorage() {
  103. return reinterpret_cast<NamedDecl **>(this + 1);
  104. }
  105. NamedDecl * const *getStorage() const {
  106. return reinterpret_cast<NamedDecl *const *>(this + 1);
  107. }
  108. public:
  109. unsigned size() const { return Bits.Data; }
  110. using iterator = NamedDecl *const *;
  111. iterator begin() const { return getStorage(); }
  112. iterator end() const { return getStorage() + Bits.Data; }
  113. llvm::ArrayRef<NamedDecl*> decls() const {
  114. return llvm::ArrayRef(begin(), end());
  115. }
  116. };
  117. /// A structure for storing an already-substituted template template
  118. /// parameter pack.
  119. ///
  120. /// This kind of template names occurs when the parameter pack has been
  121. /// provided with a template template argument pack in a context where its
  122. /// enclosing pack expansion could not be fully expanded.
  123. class SubstTemplateTemplateParmPackStorage : public UncommonTemplateNameStorage,
  124. public llvm::FoldingSetNode {
  125. const TemplateArgument *Arguments;
  126. llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
  127. public:
  128. SubstTemplateTemplateParmPackStorage(ArrayRef<TemplateArgument> ArgPack,
  129. Decl *AssociatedDecl, unsigned Index,
  130. bool Final);
  131. /// A template-like entity which owns the whole pattern being substituted.
  132. /// This will own a set of template parameters.
  133. Decl *getAssociatedDecl() const;
  134. /// Returns the index of the replaced parameter in the associated declaration.
  135. /// This should match the result of `getParameterPack()->getIndex()`.
  136. unsigned getIndex() const { return Bits.Index; }
  137. // When true the substitution will be 'Final' (subst node won't be placed).
  138. bool getFinal() const;
  139. /// Retrieve the template template parameter pack being substituted.
  140. TemplateTemplateParmDecl *getParameterPack() const;
  141. /// Retrieve the template template argument pack with which this
  142. /// parameter was substituted.
  143. TemplateArgument getArgumentPack() const;
  144. void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context);
  145. static void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context,
  146. const TemplateArgument &ArgPack, Decl *AssociatedDecl,
  147. unsigned Index, bool Final);
  148. };
  149. /// Represents a C++ template name within the type system.
  150. ///
  151. /// A C++ template name refers to a template within the C++ type
  152. /// system. In most cases, a template name is simply a reference to a
  153. /// class template, e.g.
  154. ///
  155. /// \code
  156. /// template<typename T> class X { };
  157. ///
  158. /// X<int> xi;
  159. /// \endcode
  160. ///
  161. /// Here, the 'X' in \c X<int> is a template name that refers to the
  162. /// declaration of the class template X, above. Template names can
  163. /// also refer to function templates, C++0x template aliases, etc.
  164. ///
  165. /// Some template names are dependent. For example, consider:
  166. ///
  167. /// \code
  168. /// template<typename MetaFun, typename T1, typename T2> struct apply2 {
  169. /// typedef typename MetaFun::template apply<T1, T2>::type type;
  170. /// };
  171. /// \endcode
  172. ///
  173. /// Here, "apply" is treated as a template name within the typename
  174. /// specifier in the typedef. "apply" is a nested template, and can
  175. /// only be understood in the context of
  176. class TemplateName {
  177. // NameDecl is either a TemplateDecl or a UsingShadowDecl depending on the
  178. // NameKind.
  179. // !! There is no free low bits in 32-bit builds to discriminate more than 4
  180. // pointer types in PointerUnion.
  181. using StorageType =
  182. llvm::PointerUnion<Decl *, UncommonTemplateNameStorage *,
  183. QualifiedTemplateName *, DependentTemplateName *>;
  184. StorageType Storage;
  185. explicit TemplateName(void *Ptr);
  186. public:
  187. // Kind of name that is actually stored.
  188. enum NameKind {
  189. /// A single template declaration.
  190. Template,
  191. /// A set of overloaded template declarations.
  192. OverloadedTemplate,
  193. /// An unqualified-id that has been assumed to name a function template
  194. /// that will be found by ADL.
  195. AssumedTemplate,
  196. /// A qualified template name, where the qualification is kept
  197. /// to describe the source code as written.
  198. QualifiedTemplate,
  199. /// A dependent template name that has not been resolved to a
  200. /// template (or set of templates).
  201. DependentTemplate,
  202. /// A template template parameter that has been substituted
  203. /// for some other template name.
  204. SubstTemplateTemplateParm,
  205. /// A template template parameter pack that has been substituted for
  206. /// a template template argument pack, but has not yet been expanded into
  207. /// individual arguments.
  208. SubstTemplateTemplateParmPack,
  209. /// A template name that refers to a template declaration found through a
  210. /// specific using shadow declaration.
  211. UsingTemplate,
  212. };
  213. TemplateName() = default;
  214. explicit TemplateName(TemplateDecl *Template);
  215. explicit TemplateName(OverloadedTemplateStorage *Storage);
  216. explicit TemplateName(AssumedTemplateStorage *Storage);
  217. explicit TemplateName(SubstTemplateTemplateParmStorage *Storage);
  218. explicit TemplateName(SubstTemplateTemplateParmPackStorage *Storage);
  219. explicit TemplateName(QualifiedTemplateName *Qual);
  220. explicit TemplateName(DependentTemplateName *Dep);
  221. explicit TemplateName(UsingShadowDecl *Using);
  222. /// Determine whether this template name is NULL.
  223. bool isNull() const;
  224. // Get the kind of name that is actually stored.
  225. NameKind getKind() const;
  226. /// Retrieve the underlying template declaration that
  227. /// this template name refers to, if known.
  228. ///
  229. /// \returns The template declaration that this template name refers
  230. /// to, if any. If the template name does not refer to a specific
  231. /// declaration because it is a dependent name, or if it refers to a
  232. /// set of function templates, returns NULL.
  233. TemplateDecl *getAsTemplateDecl() const;
  234. /// Retrieve the underlying, overloaded function template
  235. /// declarations that this template name refers to, if known.
  236. ///
  237. /// \returns The set of overloaded function templates that this template
  238. /// name refers to, if known. If the template name does not refer to a
  239. /// specific set of function templates because it is a dependent name or
  240. /// refers to a single template, returns NULL.
  241. OverloadedTemplateStorage *getAsOverloadedTemplate() const;
  242. /// Retrieve information on a name that has been assumed to be a
  243. /// template-name in order to permit a call via ADL.
  244. AssumedTemplateStorage *getAsAssumedTemplateName() const;
  245. /// Retrieve the substituted template template parameter, if
  246. /// known.
  247. ///
  248. /// \returns The storage for the substituted template template parameter,
  249. /// if known. Otherwise, returns NULL.
  250. SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() const;
  251. /// Retrieve the substituted template template parameter pack, if
  252. /// known.
  253. ///
  254. /// \returns The storage for the substituted template template parameter pack,
  255. /// if known. Otherwise, returns NULL.
  256. SubstTemplateTemplateParmPackStorage *
  257. getAsSubstTemplateTemplateParmPack() const;
  258. /// Retrieve the underlying qualified template name
  259. /// structure, if any.
  260. QualifiedTemplateName *getAsQualifiedTemplateName() const;
  261. /// Retrieve the underlying dependent template name
  262. /// structure, if any.
  263. DependentTemplateName *getAsDependentTemplateName() const;
  264. /// Retrieve the using shadow declaration through which the underlying
  265. /// template declaration is introduced, if any.
  266. UsingShadowDecl *getAsUsingShadowDecl() const;
  267. TemplateName getUnderlying() const;
  268. /// Get the template name to substitute when this template name is used as a
  269. /// template template argument. This refers to the most recent declaration of
  270. /// the template, including any default template arguments.
  271. TemplateName getNameToSubstitute() const;
  272. TemplateNameDependence getDependence() const;
  273. /// Determines whether this is a dependent template name.
  274. bool isDependent() const;
  275. /// Determines whether this is a template name that somehow
  276. /// depends on a template parameter.
  277. bool isInstantiationDependent() const;
  278. /// Determines whether this template name contains an
  279. /// unexpanded parameter pack (for C++0x variadic templates).
  280. bool containsUnexpandedParameterPack() const;
  281. enum class Qualified { None, AsWritten, Fully };
  282. /// Print the template name.
  283. ///
  284. /// \param OS the output stream to which the template name will be
  285. /// printed.
  286. ///
  287. /// \param Qual print the (Qualified::None) simple name,
  288. /// (Qualified::AsWritten) any written (possibly partial) qualifier, or
  289. /// (Qualified::Fully) the fully qualified name.
  290. void print(raw_ostream &OS, const PrintingPolicy &Policy,
  291. Qualified Qual = Qualified::AsWritten) const;
  292. /// Debugging aid that dumps the template name.
  293. void dump(raw_ostream &OS) const;
  294. /// Debugging aid that dumps the template name to standard
  295. /// error.
  296. void dump() const;
  297. void Profile(llvm::FoldingSetNodeID &ID) {
  298. ID.AddPointer(Storage.getOpaqueValue());
  299. }
  300. /// Retrieve the template name as a void pointer.
  301. void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
  302. /// Build a template name from a void pointer.
  303. static TemplateName getFromVoidPointer(void *Ptr) {
  304. return TemplateName(Ptr);
  305. }
  306. };
  307. /// Insertion operator for diagnostics. This allows sending TemplateName's
  308. /// into a diagnostic with <<.
  309. const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
  310. TemplateName N);
  311. /// A structure for storing the information associated with a
  312. /// substituted template template parameter.
  313. class SubstTemplateTemplateParmStorage
  314. : public UncommonTemplateNameStorage, public llvm::FoldingSetNode {
  315. friend class ASTContext;
  316. TemplateName Replacement;
  317. Decl *AssociatedDecl;
  318. SubstTemplateTemplateParmStorage(TemplateName Replacement,
  319. Decl *AssociatedDecl, unsigned Index,
  320. std::optional<unsigned> PackIndex)
  321. : UncommonTemplateNameStorage(SubstTemplateTemplateParm, Index,
  322. PackIndex ? *PackIndex + 1 : 0),
  323. Replacement(Replacement), AssociatedDecl(AssociatedDecl) {
  324. assert(AssociatedDecl != nullptr);
  325. }
  326. public:
  327. /// A template-like entity which owns the whole pattern being substituted.
  328. /// This will own a set of template parameters.
  329. Decl *getAssociatedDecl() const { return AssociatedDecl; }
  330. /// Returns the index of the replaced parameter in the associated declaration.
  331. /// This should match the result of `getParameter()->getIndex()`.
  332. unsigned getIndex() const { return Bits.Index; }
  333. std::optional<unsigned> getPackIndex() const {
  334. if (Bits.Data == 0)
  335. return std::nullopt;
  336. return Bits.Data - 1;
  337. }
  338. TemplateTemplateParmDecl *getParameter() const;
  339. TemplateName getReplacement() const { return Replacement; }
  340. void Profile(llvm::FoldingSetNodeID &ID);
  341. static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Replacement,
  342. Decl *AssociatedDecl, unsigned Index,
  343. std::optional<unsigned> PackIndex);
  344. };
  345. inline TemplateName TemplateName::getUnderlying() const {
  346. if (SubstTemplateTemplateParmStorage *subst
  347. = getAsSubstTemplateTemplateParm())
  348. return subst->getReplacement().getUnderlying();
  349. return *this;
  350. }
  351. /// Represents a template name that was expressed as a
  352. /// qualified name.
  353. ///
  354. /// This kind of template name refers to a template name that was
  355. /// preceded by a nested name specifier, e.g., \c std::vector. Here,
  356. /// the nested name specifier is "std::" and the template name is the
  357. /// declaration for "vector". The QualifiedTemplateName class is only
  358. /// used to provide "sugar" for template names that were expressed
  359. /// with a qualified name, and has no semantic meaning. In this
  360. /// manner, it is to TemplateName what ElaboratedType is to Type,
  361. /// providing extra syntactic sugar for downstream clients.
  362. class QualifiedTemplateName : public llvm::FoldingSetNode {
  363. friend class ASTContext;
  364. /// The nested name specifier that qualifies the template name.
  365. ///
  366. /// The bit is used to indicate whether the "template" keyword was
  367. /// present before the template name itself. Note that the
  368. /// "template" keyword is always redundant in this case (otherwise,
  369. /// the template name would be a dependent name and we would express
  370. /// this name with DependentTemplateName).
  371. llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
  372. /// The underlying template name, it is either
  373. /// 1) a Template -- a template declaration that this qualified name refers
  374. /// to.
  375. /// 2) or a UsingTemplate -- a template declaration introduced by a
  376. /// using-shadow declaration.
  377. TemplateName UnderlyingTemplate;
  378. QualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword,
  379. TemplateName Template)
  380. : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(Template) {
  381. assert(UnderlyingTemplate.getKind() == TemplateName::Template ||
  382. UnderlyingTemplate.getKind() == TemplateName::UsingTemplate);
  383. }
  384. public:
  385. /// Return the nested name specifier that qualifies this name.
  386. NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
  387. /// Whether the template name was prefixed by the "template"
  388. /// keyword.
  389. bool hasTemplateKeyword() const { return Qualifier.getInt(); }
  390. /// Return the underlying template name.
  391. TemplateName getUnderlyingTemplate() const { return UnderlyingTemplate; }
  392. void Profile(llvm::FoldingSetNodeID &ID) {
  393. Profile(ID, getQualifier(), hasTemplateKeyword(), UnderlyingTemplate);
  394. }
  395. static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
  396. bool TemplateKeyword, TemplateName TN) {
  397. ID.AddPointer(NNS);
  398. ID.AddBoolean(TemplateKeyword);
  399. ID.AddPointer(TN.getAsVoidPointer());
  400. }
  401. };
  402. /// Represents a dependent template name that cannot be
  403. /// resolved prior to template instantiation.
  404. ///
  405. /// This kind of template name refers to a dependent template name,
  406. /// including its nested name specifier (if any). For example,
  407. /// DependentTemplateName can refer to "MetaFun::template apply",
  408. /// where "MetaFun::" is the nested name specifier and "apply" is the
  409. /// template name referenced. The "template" keyword is implied.
  410. class DependentTemplateName : public llvm::FoldingSetNode {
  411. friend class ASTContext;
  412. /// The nested name specifier that qualifies the template
  413. /// name.
  414. ///
  415. /// The bit stored in this qualifier describes whether the \c Name field
  416. /// is interpreted as an IdentifierInfo pointer (when clear) or as an
  417. /// overloaded operator kind (when set).
  418. llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
  419. /// The dependent template name.
  420. union {
  421. /// The identifier template name.
  422. ///
  423. /// Only valid when the bit on \c Qualifier is clear.
  424. const IdentifierInfo *Identifier;
  425. /// The overloaded operator name.
  426. ///
  427. /// Only valid when the bit on \c Qualifier is set.
  428. OverloadedOperatorKind Operator;
  429. };
  430. /// The canonical template name to which this dependent
  431. /// template name refers.
  432. ///
  433. /// The canonical template name for a dependent template name is
  434. /// another dependent template name whose nested name specifier is
  435. /// canonical.
  436. TemplateName CanonicalTemplateName;
  437. DependentTemplateName(NestedNameSpecifier *Qualifier,
  438. const IdentifierInfo *Identifier)
  439. : Qualifier(Qualifier, false), Identifier(Identifier),
  440. CanonicalTemplateName(this) {}
  441. DependentTemplateName(NestedNameSpecifier *Qualifier,
  442. const IdentifierInfo *Identifier,
  443. TemplateName Canon)
  444. : Qualifier(Qualifier, false), Identifier(Identifier),
  445. CanonicalTemplateName(Canon) {}
  446. DependentTemplateName(NestedNameSpecifier *Qualifier,
  447. OverloadedOperatorKind Operator)
  448. : Qualifier(Qualifier, true), Operator(Operator),
  449. CanonicalTemplateName(this) {}
  450. DependentTemplateName(NestedNameSpecifier *Qualifier,
  451. OverloadedOperatorKind Operator,
  452. TemplateName Canon)
  453. : Qualifier(Qualifier, true), Operator(Operator),
  454. CanonicalTemplateName(Canon) {}
  455. public:
  456. /// Return the nested name specifier that qualifies this name.
  457. NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
  458. /// Determine whether this template name refers to an identifier.
  459. bool isIdentifier() const { return !Qualifier.getInt(); }
  460. /// Returns the identifier to which this template name refers.
  461. const IdentifierInfo *getIdentifier() const {
  462. assert(isIdentifier() && "Template name isn't an identifier?");
  463. return Identifier;
  464. }
  465. /// Determine whether this template name refers to an overloaded
  466. /// operator.
  467. bool isOverloadedOperator() const { return Qualifier.getInt(); }
  468. /// Return the overloaded operator to which this template name refers.
  469. OverloadedOperatorKind getOperator() const {
  470. assert(isOverloadedOperator() &&
  471. "Template name isn't an overloaded operator?");
  472. return Operator;
  473. }
  474. void Profile(llvm::FoldingSetNodeID &ID) {
  475. if (isIdentifier())
  476. Profile(ID, getQualifier(), getIdentifier());
  477. else
  478. Profile(ID, getQualifier(), getOperator());
  479. }
  480. static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
  481. const IdentifierInfo *Identifier) {
  482. ID.AddPointer(NNS);
  483. ID.AddBoolean(false);
  484. ID.AddPointer(Identifier);
  485. }
  486. static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
  487. OverloadedOperatorKind Operator) {
  488. ID.AddPointer(NNS);
  489. ID.AddBoolean(true);
  490. ID.AddInteger(Operator);
  491. }
  492. };
  493. } // namespace clang.
  494. namespace llvm {
  495. /// The clang::TemplateName class is effectively a pointer.
  496. template<>
  497. struct PointerLikeTypeTraits<clang::TemplateName> {
  498. static inline void *getAsVoidPointer(clang::TemplateName TN) {
  499. return TN.getAsVoidPointer();
  500. }
  501. static inline clang::TemplateName getFromVoidPointer(void *Ptr) {
  502. return clang::TemplateName::getFromVoidPointer(Ptr);
  503. }
  504. // No bits are available!
  505. static constexpr int NumLowBitsAvailable = 0;
  506. };
  507. } // namespace llvm.
  508. #endif // LLVM_CLANG_AST_TEMPLATENAME_H
  509. #ifdef __GNUC__
  510. #pragma GCC diagnostic pop
  511. #endif