clang  6.0.0svn
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 /// \brief 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 
39  : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
42  DeclInfo(TInfo) {
43  assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
44  }
45  friend class Sema;
46 
47 public:
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
A (possibly-)qualified type.
Definition: Type.h:653
C Language Family Type Representation.
The base class of the type hierarchy.
Definition: Type.h:1353
A container of type source information.
Definition: Decl.h:86
QualType getType() const
Definition: LocInfoType.h:48
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Definition: Type.h:1574
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1635
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
Definition: SemaType.cpp:5593
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:274
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
const FunctionProtoType * T
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:1876
TypeClass getTypeClass() const
Definition: Type.h:1615
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1866
static bool classof(const Type *T)
Definition: LocInfoType.h:54
Dataflow Directional Tag Classes.
TypeSourceInfo * getTypeSourceInfo() const
Definition: LocInfoType.h:49
QualType getCanonicalTypeInternal() const
Definition: Type.h:2109
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1860