# Changeset View

Changeset View

# Standalone View

Standalone View

# clang/lib/AST/ASTContext.cpp

- This file is larger than 256 KB, so syntax highlighting is disabled by default.

Show First 20 Lines • Show All 5,448 Lines • ▼ Show 20 Lines | |||||

/// on canonical types (which are always unique). | /// on canonical types (which are always unique). | ||||

QualType ASTContext::getTypeOfType(QualType tofType) const { | QualType ASTContext::getTypeOfType(QualType tofType) const { | ||||

QualType Canonical = getCanonicalType(tofType); | QualType Canonical = getCanonicalType(tofType); | ||||

auto *tot = new (*this, TypeAlignment) TypeOfType(tofType, Canonical); | auto *tot = new (*this, TypeAlignment) TypeOfType(tofType, Canonical); | ||||

Types.push_back(tot); | Types.push_back(tot); | ||||

return QualType(tot, 0); | return QualType(tot, 0); | ||||

} | } | ||||

/// getReferenceQualifiedType - Given an expr, will return the type for | |||||

/// that expression, as in [dcl.type.simple]p4 but without taking id-expressions | |||||

/// and class member access into account. | |||||

QualType ASTContext::getReferenceQualifiedType(const Expr *E) const { | |||||

// C++11 [dcl.type.simple]p4: | |||||

rsmith: This check doesn't seem like it belongs here. | |||||

// [...] | |||||

QualType T = E->getType(); | |||||

switch (E->getValueKind()) { | |||||

// - otherwise, if e is an xvalue, decltype(e) is T&&, where T is the | |||||

// type of e; | |||||

case VK_XValue: | |||||

return getRValueReferenceType(T); | |||||

// - otherwise, if e is an lvalue, decltype(e) is T&, where T is the | |||||

// type of e; | |||||

case VK_LValue: | |||||

return getLValueReferenceType(T); | |||||

// - otherwise, decltype(e) is the type of e. | |||||

case VK_PRValue: | |||||

return T; | |||||

} | |||||

llvm_unreachable("Unknown value kind"); | |||||

} | |||||

/// Unlike many "get<Type>" functions, we don't unique DecltypeType | /// Unlike many "get<Type>" functions, we don't unique DecltypeType | ||||

/// nodes. This would never be helpful, since each such type has its own | /// nodes. This would never be helpful, since each such type has its own | ||||

/// expression, and would not give a significant memory saving, since there | /// expression, and would not give a significant memory saving, since there | ||||

/// is an Expr tree under each such type. | /// is an Expr tree under each such type. | ||||

QualType ASTContext::getDecltypeType(Expr *e, QualType UnderlyingType) const { | QualType ASTContext::getDecltypeType(Expr *e, QualType UnderlyingType) const { | ||||

DecltypeType *dt; | DecltypeType *dt; | ||||

// C++11 [temp.type]p2: | // C++11 [temp.type]p2: | ||||

▲ Show 20 Lines • Show All 6,333 Lines • Show Last 20 Lines |

This check doesn't seem like it belongs here.