llvm/clang/lib/AST/TypeLoc.cpp

//===- TypeLoc.cpp - Type Source Info Wrapper -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  This file defines the TypeLoc subclasses implementations.
//
//===----------------------------------------------------------------------===//

#include "clang/AST/TypeLoc.h"
#include "clang/AST/ASTConcept.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>

usingnamespaceclang;

static const unsigned TypeLocMaxDataAlign =;

//===----------------------------------------------------------------------===//
// TypeLoc Implementation
//===----------------------------------------------------------------------===//

namespace {

class TypeLocRanger : public TypeLocVisitor<TypeLocRanger, SourceRange> {};

} // namespace

SourceRange TypeLoc::getLocalSourceRangeImpl(TypeLoc TL) {}

namespace {

class TypeAligner : public TypeLocVisitor<TypeAligner, unsigned> {};

} // namespace

/// Returns the alignment of the type source info data block.
unsigned TypeLoc::getLocalAlignmentForType(QualType Ty) {}

namespace {

class TypeSizer : public TypeLocVisitor<TypeSizer, unsigned> {};

} // namespace

/// Returns the size of the type source info data block.
unsigned TypeLoc::getFullDataSizeForType(QualType Ty) {}

namespace {

class NextLoc : public TypeLocVisitor<NextLoc, TypeLoc> {};

} // namespace

/// Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
/// TypeLoc is a PointerLoc and next TypeLoc is for "int".
TypeLoc TypeLoc::getNextTypeLocImpl(TypeLoc TL) {}

/// Initializes a type location, and all of its children
/// recursively, as if the entire tree had been written in the
/// given location.
void TypeLoc::initializeImpl(ASTContext &Context, TypeLoc TL,
                             SourceLocation Loc) {}

namespace {

class TypeLocCopier : public TypeLocVisitor<TypeLocCopier> {};

} // namespace

void TypeLoc::copy(TypeLoc other) {}

SourceLocation TypeLoc::getBeginLoc() const {}

SourceLocation TypeLoc::getEndLoc() const {}

namespace {

struct TSTChecker : public TypeLocVisitor<TSTChecker, bool> {};

} // namespace

/// Determines if the given type loc corresponds to a
/// TypeSpecTypeLoc.  Since there is not actually a TypeSpecType in
/// the type hierarchy, this is made somewhat complicated.
///
/// There are a lot of types that currently use TypeSpecTypeLoc
/// because it's a convenient base class.  Ideally we would not accept
/// those here, but ideally we would have better implementations for
/// them.
bool TypeSpecTypeLoc::isKind(const TypeLoc &TL) {}

bool TagTypeLoc::isDefinition() const {}

// Reimplemented to account for GNU/C++ extension
//     typeof unary-expression
// where there are no parentheses.
SourceRange TypeOfExprTypeLoc::getLocalSourceRange() const {}


TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {}

TypeLoc TypeLoc::IgnoreParensImpl(TypeLoc TL) {}

SourceLocation TypeLoc::findNullabilityLoc() const {}

TypeLoc TypeLoc::findExplicitQualifierLoc() const {}

void ObjCTypeParamTypeLoc::initializeLocal(ASTContext &Context,
                                           SourceLocation Loc) {}

void ObjCObjectTypeLoc::initializeLocal(ASTContext &Context,
                                        SourceLocation Loc) {}

SourceRange AttributedTypeLoc::getLocalSourceRange() const {}

SourceRange CountAttributedTypeLoc::getLocalSourceRange() const {}

SourceRange BTFTagAttributedTypeLoc::getLocalSourceRange() const {}

void TypeOfTypeLoc::initializeLocal(ASTContext &Context,
                                       SourceLocation Loc) {}

void UnaryTransformTypeLoc::initializeLocal(ASTContext &Context,
                                       SourceLocation Loc) {}

void ElaboratedTypeLoc::initializeLocal(ASTContext &Context,
                                        SourceLocation Loc) {}

void DependentNameTypeLoc::initializeLocal(ASTContext &Context,
                                           SourceLocation Loc) {}

void
DependentTemplateSpecializationTypeLoc::initializeLocal(ASTContext &Context,
                                                        SourceLocation Loc) {}

void TemplateSpecializationTypeLoc::initializeArgLocs(
    ASTContext &Context, ArrayRef<TemplateArgument> Args,
    TemplateArgumentLocInfo *ArgInfos, SourceLocation Loc) {}

// Builds a ConceptReference where all locations point at the same token,
// for use in trivial TypeSourceInfo for constrained AutoType
static ConceptReference *createTrivialConceptReference(ASTContext &Context,
                                                       SourceLocation Loc,
                                                       const AutoType *AT) {}

void AutoTypeLoc::initializeLocal(ASTContext &Context, SourceLocation Loc) {}

namespace {

  class GetContainedAutoTypeLocVisitor :
    public TypeLocVisitor<GetContainedAutoTypeLocVisitor, TypeLoc> {};

} // namespace

AutoTypeLoc TypeLoc::getContainedAutoTypeLoc() const {}

SourceLocation TypeLoc::getTemplateKeywordLoc() const {}