Clang Project

clang_source_code/include/clang/AST/LocInfoType.h
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
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
37  LocInfoType(QualType tyTypeSourceInfo *TInfo)
38      : Type((TypeClass)LocInfotyty->isDependentType(),
39             ty->isInstantiationDependentType(), ty->isVariablyModifiedType(),
40             ty->containsUnexpandedParameterPack()),
41        DeclInfo(TInfo) {
42     (0) . __assert_fail ("getTypeClass() == (TypeClass)LocInfo && \"LocInfo didn't fit in TC?\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/LocInfoType.h", 42, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
43  }
44  friend class Sema;
45
46public:
47  QualType getType() const { return getCanonicalTypeInternal(); }
48  TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; }
49
50  void getAsStringInternal(std::string &Str,
51                           const PrintingPolicy &Policyconst;
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
61
clang::LocInfoType::DeclInfo
clang::LocInfoType::getType
clang::LocInfoType::getTypeSourceInfo
clang::LocInfoType::getAsStringInternal
clang::LocInfoType::classof