clang 8.0.0

LocInfoType.h
Go to the documentation of this file.
1 //===--- LocInfoType.h - Parsed Type with Location Information---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the LocInfoType class, which holds a type and its
11 // source-location information.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_SEMA_LOCINFOTYPE_H
15 #define LLVM_CLANG_SEMA_LOCINFOTYPE_H
16
17 #include "clang/AST/Type.h"
18
19 namespace clang {
20
21 class TypeSourceInfo;
22
23 /// Holds a QualType and a TypeSourceInfo* that came out of a declarator
24 /// parsing.
25 ///
26 /// LocInfoType is a "transient" type, only needed for passing to/from Parser
27 /// and Sema, when we want to preserve type source info for a parsed type.
28 /// It will not participate in the type system semantics in any way.
29 class LocInfoType : public Type {
30 enum {
31 // The last number that can fit in Type's TC.
32 // Avoids conflict with an existing Type class.
33 LocInfo = Type::TypeLast + 1
34 };
35
36 TypeSourceInfo *DeclInfo;
37
38 LocInfoType(QualType ty, TypeSourceInfo *TInfo)
39 : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
40 ty->isInstantiationDependentType(), ty->isVariablyModifiedType(),
41 ty->containsUnexpandedParameterPack()),
42 DeclInfo(TInfo) {
43 assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
44 }
45 friend class Sema;
46
47 public:
48 QualType getType() const { return getCanonicalTypeInternal(); }
49 TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; }
50
51 void getAsStringInternal(std::string &Str,
52 const PrintingPolicy &Policy) const;
53
54 static bool classof(const Type *T) {
55 return T->getTypeClass() == (TypeClass)LocInfo;
56 }
57 };
58
59 } // end namespace clang
60
61 #endif // LLVM_CLANG_SEMA_LOCINFOTYPE_H
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:638
Type.h
C Language Family Type Representation.
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1407
clang::TypeSourceInfo
A container of type source information.
Definition: Decl.h:87
clang::LocInfoType::getType
QualType getType() const
Definition: LocInfoType.h:48
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
clang::Type::Type
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Definition: Type.h:1770
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:1831
clang::LocInfoType::getAsStringInternal
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
Definition: SemaType.cpp:5714
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:278
clang::LocInfoType
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
clang::Type::isVariablyModifiedType
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2095
clang::Type::getTypeClass
TypeClass getTypeClass() const
Definition: Type.h:1811
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:2085
clang::LocInfoType::classof
static bool classof(const Type *T)
Definition: LocInfoType.h:54
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::LocInfoType::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: LocInfoType.h:49
clang::Type::TypeClass
TypeClass
Definition: Type.h:1409
clang::Type::getCanonicalTypeInternal
QualType getCanonicalTypeInternal() const
Definition: Type.h:2355
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:2079