clang 20.0.0git
LocInfoType.h
Go to the documentation of this file.
1//===--- LocInfoType.h - Parsed Type with Location Information---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the LocInfoType class, which holds a type and its
10// source-location information.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_CLANG_AST_LOCINFOTYPE_H
14#define LLVM_CLANG_AST_LOCINFOTYPE_H
15
16#include "clang/AST/Type.h"
17
18namespace clang {
19
20class TypeSourceInfo;
21
22/// Holds a QualType and a TypeSourceInfo* that came out of a declarator
23/// parsing.
24///
25/// LocInfoType is a "transient" type, only needed for passing to/from Parser
26/// and Sema, when we want to preserve type source info for a parsed type.
27/// It will not participate in the type system semantics in any way.
28class LocInfoType : public Type {
29 enum {
30 // The last number that can fit in Type's TC.
31 // Avoids conflict with an existing Type class.
32 LocInfo = Type::TypeLast + 1
33 };
34
35 TypeSourceInfo *DeclInfo;
36
38 : Type((TypeClass)LocInfo, ty, ty->getDependence()), DeclInfo(TInfo) {
39 assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
40 }
41 friend class Sema;
42
43public:
45 TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; }
46
47 void getAsStringInternal(std::string &Str,
48 const PrintingPolicy &Policy) const;
49
50 static bool classof(const Type *T) {
51 return T->getTypeClass() == (TypeClass)LocInfo;
52 }
53};
54
55} // end namespace clang
56
57#endif // LLVM_CLANG_AST_LOCINFOTYPE_H
C Language Family Type Representation.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:28
TypeSourceInfo * getTypeSourceInfo() const
Definition: LocInfoType.h:45
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
Definition: SemaType.cpp:6341
static bool classof(const Type *T)
Definition: LocInfoType.h:50
QualType getType() const
Definition: LocInfoType.h:44
A (possibly-)qualified type.
Definition: Type.h:941
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:493
A container of type source information.
Definition: Type.h:7726
The base class of the type hierarchy.
Definition: Type.h:1829
QualType getCanonicalTypeInternal() const
Definition: Type.h:2983
TypeDependence getDependence() const
Definition: Type.h:2689
TypeClass getTypeClass() const
Definition: Type.h:2339
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57