clang 10.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_SEMA_LOCINFOTYPE_H
14 #define LLVM_CLANG_SEMA_LOCINFOTYPE_H
15
16 #include "clang/AST/Type.h"
17
18 namespace clang {
19
20 class 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.
28 class 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
37 LocInfoType(QualType ty, TypeSourceInfo *TInfo)
38 : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
39 ty->isInstantiationDependentType(), ty->isVariablyModifiedType(),
40 ty->containsUnexpandedParameterPack()),
41 DeclInfo(TInfo) {
42 assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
43 }
44 friend class Sema;
45
46 public:
47 QualType getType() const { return getCanonicalTypeInternal(); }
48 TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; }
49
50 void getAsStringInternal(std::string &Str,
51 const PrintingPolicy &Policy) const;
52
53 static bool classof(const Type *T) {
54 return T->getTypeClass() == (TypeClass)LocInfo;
55 }
56 };
57
58 } // end namespace clang
59
60 #endif // LLVM_CLANG_SEMA_LOCINFOTYPE_H
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
Type.h
C Language Family Type Representation.
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1450
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6227
clang::LocInfoType::getType
QualType getType() const
Definition: LocInfoType.h:47
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:47
clang::Type::Type
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Definition: Type.h:1831
clang::Type::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1896
clang::LocInfoType::getAsStringInternal
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
Definition: SemaType.cpp:6019
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:336
clang::LocInfoType
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:28
clang::Type::isVariablyModifiedType
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2166
clang::Type::getTypeClass
TypeClass getTypeClass() const
Definition: Type.h:1876
clang::Type::isInstantiationDependentType
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2156
clang::LocInfoType::classof
static bool classof(const Type *T)
Definition: LocInfoType.h:53
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::LocInfoType::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: LocInfoType.h:48
clang::Type::TypeClass
TypeClass
Definition: Type.h:1452
clang::Type::getCanonicalTypeInternal
QualType getCanonicalTypeInternal() const
Definition: Type.h:2429
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2150