clang: lib/AST/APValue.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

21#include "llvm/Support/ErrorHandling.h"

22#include "llvm/Support/raw_ostream.h"

23using namespace clang;

24

25

26

28 : T(T->getCanonicalTypeUnqualified().getTypePtr()) {}

29

32 Out << "typeid(";

34 Out << ")";

35}

36

37static_assert(

39 alignof(Type),

40 "Type is insufficiently aligned");

41

45 : Ptr(P), Local{I, V} {}

46

51 Base.DynamicAllocType = Type.getAsOpaquePtr();

53}

54

59 Base.TypeInfoType = TypeInfo.getAsOpaquePtr();

61}

62

64 if (!*this) return QualType();

65 if (const ValueDecl *D = dyn_cast<const ValueDecl*>()) {

66

67

68

69

70

71

72

74 Redecl = cast_or_null(Redecl->getPreviousDecl())) {

77 return T;

78 }

79 return D->getType();

80 }

81

82 if (is())

83 return getTypeInfoType();

84

85 if (is())

86 return getDynamicAllocType();

87

88 const Expr *Base = get<const Expr*>();

89

90

91

93 llvm::dyn_cast(Base)) {

96 const Expr *Temp = MTE->getSubExpr();

98 Adjustments);

99

100

101 if (!Adjustments.empty())

102 return Inner->getType();

103 }

104

105 return Base->getType();

106}

107

109 return (is() || is()) ? 0

110 : Local.CallIndex;

111}

112

114 return (is() || is()) ? 0 : Local.Version;

115}

116

118 assert(is() && "not a type_info lvalue");

120}

121

123 assert(is() && "not a dynamic allocation lvalue");

125}

126

128 ID.AddPointer(Ptr.getOpaqueValue());

129 if (is() || is())

130 return;

131 ID.AddInteger(Local.CallIndex);

132 ID.AddInteger(Local.Version);

133}

134

138 if (LHS.Ptr != RHS.Ptr)

139 return false;

141 return true;

142 return LHS.Local.CallIndex == RHS.Local.CallIndex &&

143 LHS.Local.Version == RHS.Local.Version;

144}

145}

146

148 if (const Decl *D = BaseOrMember.getPointer())

150 Value = reinterpret_cast<uintptr_t>(BaseOrMember.getOpaqueValue());

151}

152

154 ID.AddInteger(Value);

155}

156

159 : Ty((const void *)ElemTy.getTypePtrOrNull()), Path(Path) {}

160

163}

164

165namespace {

166 struct LVBase {

169 unsigned PathLength;

170 bool IsNullPtr : 1;

171 bool IsOnePastTheEnd : 1;

172 };

173}

174

176 return Ptr.getOpaqueValue();

177}

178

180 return Ptr.isNull();

181}

182

183APValue::LValueBase::operator bool () const {

184 return static_cast<bool>(Ptr);

185}

186

188llvm::DenseMapInfoclang::APValue::LValueBase::getEmptyKey() {

190 B.Ptr = DenseMapInfo<const ValueDecl*>::getEmptyKey();

191 return B;

192}

193

195llvm::DenseMapInfoclang::APValue::LValueBase::getTombstoneKey() {

197 B.Ptr = DenseMapInfo<const ValueDecl*>::getTombstoneKey();

198 return B;

199}

200

205 return llvm::hash_combine(Base.getOpaqueValue(), Base.getCallIndex(),

206 Base.getVersion());

207}

208}

209

210unsigned llvm::DenseMapInfoclang::APValue::LValueBase::getHashValue(

213}

214

215bool llvm::DenseMapInfoclang::APValue::LValueBase::isEqual(

218 return LHS == RHS;

219}

220

222 static const unsigned InlinePathSpace =

224

225

226

227

228 union {

231 };

232

234 ~LV() { resizePath(0); }

235

237 if (Length == PathLength)

238 return;

239 if (hasPathPtr())

240 delete [] PathPtr;

241 PathLength = Length;

242 if (hasPathPtr())

244 }

245

247 bool hasPathPtr() const { return hasPath() && PathLength > InlinePathSpace; }

248

251 return hasPathPtr() ? PathPtr : Path;

252 }

253};

254

255namespace {

256 struct MemberPointerBase {

257 llvm::PointerIntPair<const ValueDecl*, 1, bool> MemberAndIsDerivedMember;

258 unsigned PathLength;

259 };

260}

261

263 static const unsigned InlinePathSpace =

264 (DataSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl*);

266 union {

269 };

270

273

275 if (Length == PathLength)

276 return;

277 if (hasPathPtr())

278 delete [] PathPtr;

279 PathLength = Length;

280 if (hasPathPtr())

281 PathPtr = new PathElem[Length];

282 }

283

284 bool hasPathPtr() const { return PathLength > InlinePathSpace; }

285

288 return hasPathPtr() ? PathPtr : Path;

289 }

290};

291

292

293

294APValue::Arr::Arr(unsigned NumElts, unsigned Size) :

295 Elts(new APValue[NumElts + (NumElts != Size ? 1 : 0)]),

296 NumElts(NumElts), ArrSize(Size) {}

297APValue::Arr::~Arr() { delete [] Elts; }

298

299APValue::StructData::StructData(unsigned NumBases, unsigned NumFields) :

300 Elts(new APValue[NumBases+NumFields]),

301 NumBases(NumBases), NumFields(NumFields) {}

302APValue::StructData::~StructData() {

303 delete [] Elts;

304}

305

306APValue::UnionData::UnionData() : Field(nullptr), Value(new APValue) {}

307APValue::UnionData::~UnionData () {

309}

310

316 break;

317 case Int:

318 MakeInt();

320 break;

322 MakeFloat();

324 break;

327 MakeFixedPoint(std::move(FXCopy));

328 break;

329 }

331 MakeVector();

332 setVector(((const Vec *)(const char *)&RHS.Data)->Elts,

334 break;

336 MakeComplexInt();

338 break;

340 MakeComplexFloat();

342 break;

344 MakeLValue();

348 else

351 break;

358 break;

365 break;

367 MakeUnion();

369 break;

374 break;

376 MakeAddrLabelDiff();

378 break;

379 }

380}

381

383 RHS.Kind = None;

384}

385

387 if (this != &RHS)

389 return *this;

390}

391

393 if (this != &RHS) {

395 DestroyDataAndMakeUninit();

396 Kind = RHS.Kind;

397 Data = RHS.Data;

398 RHS.Kind = None;

399 }

400 return *this;

401}

402

403void APValue::DestroyDataAndMakeUninit() {

404 if (Kind == Int)

406 else if (Kind == Float)

407 ((APFloat *)(char *)&Data)->~APFloat();

409 ((APFixedPoint *)(char *)&Data)->~APFixedPoint();

410 else if (Kind == Vector)

411 ((Vec *)(char *)&Data)->~Vec();

413 ((ComplexAPSInt *)(char *)&Data)->~ComplexAPSInt();

415 ((ComplexAPFloat *)(char *)&Data)->~ComplexAPFloat();

416 else if (Kind == LValue)

417 ((LV *)(char *)&Data)->~LV();

418 else if (Kind == Array)

419 ((Arr *)(char *)&Data)->~Arr();

420 else if (Kind == Struct)

421 ((StructData *)(char *)&Data)->~StructData();

422 else if (Kind == Union)

423 ((UnionData *)(char *)&Data)->~UnionData();

425 ((MemberPointerData *)(char *)&Data)->~MemberPointerData();

427 ((AddrLabelDiffData *)(char *)&Data)->~AddrLabelDiffData();

429}

430

436 return false;

441 return true;

442 case Int:

443 return getInt().needsCleanup();

445 return getFloat().needsCleanup();

447 return getFixedPoint().getValue().needsCleanup();

451 "In _Complex float types, real and imaginary values always have the "

452 "same size.");

457 "In _Complex int types, real and imaginary values must have the "

458 "same size.");

461 return reinterpret_cast<const LV *>(&Data)->hasPathPtr();

463 return reinterpret_cast<const MemberPointerData *>(&Data)->hasPathPtr();

464 }

465 llvm_unreachable("Unknown APValue kind!");

466}

467

469 std::swap(Kind, RHS.Kind);

470 std::swap(Data, RHS.Data);

471}

472

473

474static void profileIntValue(llvm::FoldingSetNodeID &ID, const llvm::APInt &V) {

475 for (unsigned I = 0, N = V.getBitWidth(); I < N; I += 32)

476 ID.AddInteger((uint32_t)V.extractBitsAsZExtValue(std::min(32u, N - I), I));

477}

478

480

481

482

483

484

485 ID.AddInteger(Kind);

486

487 switch (Kind) {

490 return;

491

495 return;

496

502 return;

503

506 ID.AddInteger(0);

507 return;

508 }

509 ID.AddInteger(getUnionField()->getFieldIndex() + 1);

511 return;

512

515 return;

516

517

518

519

520

521

522

523

524

525 llvm::FoldingSetNodeID FillerID;

529 ID.AddNodeID(FillerID);

532

533

534

535

536 while (true) {

537 if (N == 0) {

538

540 ID.AddInteger(NumFillers);

541 break;

542 }

543

544

545

547 llvm::FoldingSetNodeID ElemID;

549 if (ElemID != FillerID) {

550 ID.AddInteger(NumFillers);

551 ID.AddNodeID(ElemID);

552 --N;

553 break;

554 }

555 }

556

557

558 ++NumFillers;

559 --N;

560 }

561

562

563 for (; N != 0; --N)

565 return;

566 }

567

571 return;

572

573 case Int:

575 return;

576

579 return;

580

583 return;

584

588 return;

589

593 return;

594

603

604

605

608 }

609 return;

610

615 ID.AddPointer(D);

616 return;

617 }

618

619 llvm_unreachable("Unknown APValue kind!");

620}

621

623 llvm::APFloat V = F;

624 bool ignored;

625 V.convert(llvm::APFloat::IEEEdouble(), llvm::APFloat::rmNearestTiesToEven,

626 &ignored);

627 return V.convertToDouble();

628}

629

634 if (Inits.empty())

635 return false;

636

639 return false;

640

641

642 if (!Inits.back().isInt() || !Inits.back().getInt().isZero())

643 return false;

644

645 Inits = Inits.drop_back();

646

648 Buf.push_back('"');

649

650

651 constexpr size_t MaxN = 36;

652 StringRef Ellipsis;

654 Ellipsis = "[...]";

655 Inits =

656 Inits.take_front(std::min(MaxN - Ellipsis.size() / 2, Inits.size()));

657 }

658

659 for (auto &Val : Inits) {

660 if (!Val.isInt())

661 return false;

662 int64_t Char64 = Val.getInt().getExtValue();

664 return false;

665 auto Ch = static_cast<unsigned char>(Char64);

666

667 StringRef Escaped = escapeCStyleEscapeChar::SingleAndDouble(Ch);

668 if (Escaped.empty()) {

670 return false;

671 Buf.emplace_back(Ch);

672 } else {

673 Buf.append(Escaped);

674 }

675 }

676

677 Buf.append(Ellipsis);

678 Buf.push_back('"');

679

681 Out << 'L';

683 Out << "u8";

685 Out << 'u';

687 Out << 'U';

688

689 Out << Buf;

690 return true;

691}

692

696}

697

700

701

703 Out << "void()";

704 return;

705 }

706

708 Ty = AT->getValueType();

709

712 Out << "";

713 return;

715 Out << "";

716 return;

719 Out << (getInt().getBoolValue() ? "true" : "false");

720 else

722 return;

725 return;

728 return;

730 Out << '{';

734 Out << ", ";

736 }

737 Out << '}';

738 return;

739 }

742 return;

746 return;

751 if (InnerTy.isNull())

752 InnerTy = Ty;

753

757 Out << (Policy.Nullptr ? "nullptr" : "0");

758 } else if (IsReference) {

759 Out << "*(" << InnerTy.stream(Policy) << "*)"

761 } else {

762 Out << "(" << Ty.stream(Policy) << ")"

764 }

765 return;

766 }

767

769

775 if (IsReference)

776 Out << "*(";

777 if (S.isZero() || O % S) {

778 Out << "(char*)";

780 }

781 Out << '&';

782 } else if (!IsReference) {

783 Out << '&';

784 }

785

787 Out << *VD;

789 TI.print(Out, Policy);

791 Out << "{*new "

792 << Base.getDynamicAllocType().stream(Policy) << "#"

793 << DA.getIndex() << "}";

794 } else {

795 assert(Base.get<const Expr *>() != nullptr &&

796 "Expecting non-null Expr");

798 }

799

801 Out << " + " << (O / S);

802 if (IsReference)

803 Out << ')';

804 }

805 return;

806 }

807

808

809 if (!IsReference)

810 Out << '&';

812 Out << "*(&";

813

816 Out << *VD;

818 TI.print(Out, Policy);

820 Out << "{*new " << Base.getDynamicAllocType().stream(Policy) << "#"

821 << DA.getIndex() << "}";

822 } else {

824 assert(E != nullptr && "Expecting non-null Expr");

826 }

827

830 for (unsigned I = 0, N = Path.size(); I != N; ++I) {

832

833

834 const Decl *BaseOrMember = Path[I].getAsBaseOrMember().getPointer();

835 if (const CXXRecordDecl *RD = dyn_cast(BaseOrMember)) {

836 CastToBase = RD;

837

838

839 } else {

840 const ValueDecl *VD = cast(BaseOrMember);

841 Out << ".";

842 if (CastToBase)

843 Out << *CastToBase << "::";

844 Out << *VD;

846 }

848

849 Out << (Path[I].getAsArrayIndex() == 0 ? ".real" : ".imag");

851 } else {

852

853 Out << '[' << Path[I].getAsArrayIndex() << ']';

855 }

856 }

857

858

860

861

862 Out << " + 1";

863 if (IsReference)

864 Out << ')';

865 }

866 return;

867 }

873 return;

875 Out << '{';

876 unsigned I = 0;

877 switch (N) {

878 case 0:

879 for (; I != N; ++I) {

880 Out << ", ";

882 Out << "...}";

883 return;

884 }

885 [[fallthrough]];

886 default:

888 }

889 }

890 Out << '}';

891 return;

892 }

894 Out << '{';

896 bool First = true;

898 const CXXRecordDecl *CD = cast(RD);

900 for (unsigned I = 0; I != N; ++I, ++BI) {

903 Out << ", ";

906 }

907 }

908 for (const auto *FI : RD->fields()) {

910 Out << ", ";

911 if (FI->isUnnamedBitField())

912 continue;

914 printPretty(Out, Policy, FI->getType(), Ctx);

916 }

917 Out << '}';

918 return;

919 }

921 Out << '{';

923 Out << "." << *FD << " = ";

925 }

926 Out << '}';

927 return;

929

930

932 Out << '&' << *cast(VD->getDeclContext()) << "::" << *VD;

933 return;

934 }

935 Out << "0";

936 return;

939 Out << " - ";

941 return;

942 }

943 llvm_unreachable("Unknown APValue kind!");

944}

945

948 llvm::raw_string_ostream Out(Result);

951}

952

957 return true;

958 }

959

962 return true;

963 }

964

967 return true;

968 }

969

970 return false;

971}

972

974 assert(isLValue() && "Invalid accessor");

975 return ((const LV *)(const void *)&Data)->Base;

976}

977

979 assert(isLValue() && "Invalid accessor");

980 return ((const LV *)(const void *)&Data)->IsOnePastTheEnd;

981}

982

984 assert(isLValue() && "Invalid accessor");

985 return ((LV *)(void *)&Data)->Offset;

986}

987

989 assert(isLValue() && "Invalid accessor");

990 return ((const LV *)(const char *)&Data)->hasPath();

991}

992

995 const LV &LVal = *((const LV *)(const char *)&Data);

997}

998

1000 assert(isLValue() && "Invalid accessor");

1001 return ((const LV *)(const char *)&Data)->Base.getCallIndex();

1002}

1003

1005 assert(isLValue() && "Invalid accessor");

1006 return ((const LV *)(const char *)&Data)->Base.getVersion();

1007}

1008

1010 assert(isLValue() && "Invalid usage");

1011 return ((const LV *)(const char *)&Data)->IsNullPtr;

1012}

1013

1015 bool IsNullPtr) {

1016 assert(isLValue() && "Invalid accessor");

1017 LV &LVal = *((LV *)(char *)&Data);

1018 LVal.Base = B;

1019 LVal.IsOnePastTheEnd = false;

1020 LVal.Offset = O;

1022 LVal.IsNullPtr = IsNullPtr;

1023}

1024

1026APValue::setLValueUninit(LValueBase B, const CharUnits &O, unsigned Size,

1027 bool IsOnePastTheEnd, bool IsNullPtr) {

1028 assert(isLValue() && "Invalid accessor");

1029 LV &LVal = *((LV *)(char *)&Data);

1030 LVal.Base = B;

1031 LVal.IsOnePastTheEnd = IsOnePastTheEnd;

1032 LVal.Offset = O;

1033 LVal.IsNullPtr = IsNullPtr;

1034 LVal.resizePath(Size);

1035 return {LVal.getPath(), Size};

1036}

1037

1040 bool IsNullPtr) {

1042 setLValueUninit(B, O, Path.size(), IsOnePastTheEnd, IsNullPtr);

1043 if (Path.size()) {

1044 memcpy(InternalPath.data(), Path.data(),

1046 }

1047}

1048

1050 assert(isUnion() && "Invalid accessor");

1051 ((UnionData *)(char *)&Data)->Field =

1052 Field ? Field->getCanonicalDecl() : nullptr;

1053 *((UnionData *)(char *)&Data)->Value = Value;

1054}

1055

1060 return MPD.MemberAndIsDerivedMember.getPointer();

1061}

1062

1067 return MPD.MemberAndIsDerivedMember.getInt();

1068}

1069

1075}

1076

1077void APValue::MakeLValue() {

1078 assert(isAbsent() && "Bad state change");

1079 static_assert(sizeof(LV) <= DataSize, "LV too big");

1080 new ((void *)(char *)&Data) LV();

1082}

1083

1084void APValue::MakeArray(unsigned InitElts, unsigned Size) {

1085 assert(isAbsent() && "Bad state change");

1086 new ((void *)(char *)&Data) Arr(InitElts, Size);

1088}

1089

1091APValue::setMemberPointerUninit(const ValueDecl *Member, bool IsDerivedMember,

1092 unsigned Size) {

1093 assert(isAbsent() && "Bad state change");

1094 MemberPointerData *MPD = new ((void *)(char *)&Data) MemberPointerData;

1096 MPD->MemberAndIsDerivedMember.setPointer(

1097 Member ? cast(Member->getCanonicalDecl()) : nullptr);

1098 MPD->MemberAndIsDerivedMember.setInt(IsDerivedMember);

1099 MPD->resizePath(Size);

1100 return {MPD->getPath(), MPD->PathLength};

1101}

1102

1103void APValue::MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,

1106 setMemberPointerUninit(Member, IsDerivedMember, Path.size());

1107 for (unsigned I = 0; I != Path.size(); ++I)

1109}

1110

1114

1115 auto MergeLV = [&](LinkageInfo MergeLV) {

1116 LV.merge(MergeLV);

1118 };

1119 auto Merge = [&](const APValue &V) {

1120 return MergeLV(getLVForValue(V, computation));

1121 };

1122

1123 switch (V.getKind()) {

1132 break;

1133

1135

1136

1138

1140 for (unsigned I = 0, N = V.getStructNumBases(); I != N; ++I)

1141 if (Merge(V.getStructBase(I)))

1142 break;

1143 for (unsigned I = 0, N = V.getStructNumFields(); I != N; ++I)

1144 if (Merge(V.getStructField(I)))

1145 break;

1146 break;

1147 }

1148

1150 if (V.getUnionField())

1151 Merge(V.getUnionValue());

1152 break;

1153

1155 for (unsigned I = 0, N = V.getArrayInitializedElts(); I != N; ++I)

1156 if (Merge(V.getArrayInitializedElt(I)))

1157 break;

1158 if (V.hasArrayFiller())

1159 Merge(V.getArrayFiller());

1160 break;

1161 }

1162

1164 if (V.getLValueBase()) {

1165

1166 } else if (const auto *VD =

1167 V.getLValueBase().dyn_cast<const ValueDecl *>()) {

1168 if (VD && MergeLV(getLVForDecl(VD, computation)))

1169 break;

1170 } else if (const auto TI = V.getLValueBase().dyn_cast<TypeInfoLValue>()) {

1171 if (MergeLV(getLVForType(*TI.getType(), computation)))

1172 break;

1173 } else if (const Expr *E = V.getLValueBase().dyn_cast<const Expr *>()) {

1174

1175

1176

1177

1178

1179

1180 auto *MTE = dyn_cast(E);

1183 if (MergeLV(getLVForDecl(MTE->getExtendingDecl(), computation)))

1184 break;

1185 } else {

1187 "unexpected LValueBase kind");

1189 }

1190

1191

1192 break;

1193 }

1194

1196 if (const NamedDecl *D = V.getMemberPointerDecl())

1198

1199

1200

1201 break;

1202 }

1203

1204 return LV;

1205}

static double GetApproxValue(const llvm::APFloat &F)

static void profileIntValue(llvm::FoldingSetNodeID &ID, const llvm::APInt &V)

Profile the value of an APInt, excluding its bit-width.

static bool TryPrintAsStringLiteral(raw_ostream &Out, const PrintingPolicy &Policy, const ArrayType *ATy, ArrayRef< APValue > Inits)

Defines the clang::ASTContext interface.

Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....

Defines the clang::Expr interface and subclasses for C++ expressions.

static const Decl * getCanonicalDecl(const Decl *D)

C Language Family Type Representation.

__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)

void Profile(llvm::FoldingSetNodeID &ID) const

unsigned getVersion() const

QualType getDynamicAllocType() const

QualType getTypeInfoType() const

static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo)

static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type)

void * getOpaqueValue() const

unsigned getCallIndex() const

A non-discriminated union of a base, field, or array index.

void Profile(llvm::FoldingSetNodeID &ID) const

LValuePathSerializationHelper(ArrayRef< LValuePathEntry >, QualType)

APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...

bool hasArrayFiller() const

const LValueBase getLValueBase() const

APValue & getArrayInitializedElt(unsigned I)

ArrayRef< LValuePathEntry > getLValuePath() const

void swap(APValue &RHS)

Swaps the contents of this and the given APValue.

APValue & getStructField(unsigned i)

const FieldDecl * getUnionField() const

APSInt & getComplexIntImag()

unsigned getStructNumFields() const

llvm::PointerIntPair< const Decl *, 1, bool > BaseOrMemberType

A FieldDecl or CXXRecordDecl, along with a flag indicating whether we mean a virtual or non-virtual b...

ValueKind getKind() const

bool isLValueOnePastTheEnd() const

unsigned getLValueVersion() const

bool isMemberPointerToDerivedMember() const

unsigned getArrayInitializedElts() const

void setComplexInt(APSInt R, APSInt I)

void Profile(llvm::FoldingSetNodeID &ID) const

profile this value.

unsigned getStructNumBases() const

APFixedPoint & getFixedPoint()

bool needsCleanup() const

Returns whether the object performed allocations.

bool hasLValuePath() const

const ValueDecl * getMemberPointerDecl() const

APValue & getUnionValue()

const AddrLabelExpr * getAddrLabelDiffRHS() const

CharUnits & getLValueOffset()

void printPretty(raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const

void setAddrLabelDiff(const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)

void setComplexFloat(APFloat R, APFloat I)

APValue & getVectorElt(unsigned I)

APValue & getArrayFiller()

unsigned getVectorLength() const

void setUnion(const FieldDecl *Field, const APValue &Value)

void setLValue(LValueBase B, const CharUnits &O, NoLValuePath, bool IsNullPtr)

ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const

bool isMemberPointer() const

unsigned getArraySize() const

bool toIntegralConstant(APSInt &Result, QualType SrcTy, const ASTContext &Ctx) const

Try to convert this value to an integral constant.

std::string getAsString(const ASTContext &Ctx, QualType Ty) const

APValue & operator=(const APValue &RHS)

unsigned getLValueCallIndex() const

void setVector(const APValue *E, unsigned N)

@ Indeterminate

This object has an indeterminate value (C++ [basic.indet]).

@ None

There is no such object (it's outside its lifetime).

bool isNullPointer() const

APSInt & getComplexIntReal()

APFloat & getComplexFloatImag()

APFloat & getComplexFloatReal()

APValue & getStructBase(unsigned i)

const AddrLabelExpr * getAddrLabelDiffLHS() const

APValue()

Creates an empty APValue of type None.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

uint64_t getTargetNullPointerValue(QualType QT) const

Get target-dependent integer value for null pointer which is used for constant folding.

const clang::PrintingPolicy & getPrintingPolicy() const

llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const

Make an APSInt of the appropriate width and signedness for the given Value and integer Type.

std::optional< CharUnits > getTypeSizeInCharsIfKnown(QualType Ty) const

LabelDecl * getLabel() const

Represents an array type, per C99 6.7.5.2 - Array Declarators.

QualType getElementType() const

Represents a base class of a C++ class.

QualType getType() const

Retrieves the type of the base class.

Represents a C++ struct/union/class.

base_class_iterator bases_end()

base_class_iterator bases_begin()

CharUnits - This is an opaque type for sizes expressed in character units.

bool isZero() const

isZero - Test whether the quantity equals zero.

QuantityType getQuantity() const

getQuantity - Get the raw integer representation of this quantity.

static CharUnits One()

One - Construct a CharUnits quantity of one.

static CharUnits Zero()

Zero - Construct a CharUnits quantity of zero.

Complex values, per C99 6.2.5p11.

Decl - This represents one declaration (or definition), e.g.

Decl * getMostRecentDecl()

Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...

virtual Decl * getCanonicalDecl()

Retrieves the "canonical" declaration of the given declaration.

Symbolic representation of a dynamic allocation.

This represents one expression.

const Expr * skipRValueSubobjectAdjustments(SmallVectorImpl< const Expr * > &CommaLHS, SmallVectorImpl< SubobjectAdjustment > &Adjustments) const

Walk outwards from an expression we want to bind a reference to and find the expression whose lifetim...

Represents a member of a struct/union/class.

LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)

getLVForDecl - Get the linkage and visibility for the given declaration.

static LinkageInfo external()

Linkage getLinkage() const

static LinkageInfo internal()

void merge(LinkageInfo other)

Merge both linkage and visibility.

Represents a prvalue temporary that is written into memory so that a reference can bind to it.

This represents a decl that may have a name.

StringRef getName() const

Get the name of identifier for this declaration as a StringRef.

A (possibly-)qualified type.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

static QualType getFromOpaquePtr(const void *Ptr)

void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const

QualType getNonReferenceType() const

If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...

StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const

Represents a struct/union/class.

field_range fields() const

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const

void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const

Produce a unique representation of the given statement.

Symbolic representation of typeid(T) for some type T.

const Type * getType() const

void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy) const

The base class of the type hierarchy.

bool isBooleanType() const

bool isIncompleteArrayType() const

const ArrayType * castAsArrayTypeUnsafe() const

A variant of castAs<> for array type which silently discards qualifiers from the outermost type.

const T * castAs() const

Member-template castAs.

bool isReferenceType() const

QualType getPointeeType() const

If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.

bool isAnyCharacterType() const

Determine whether this type is any of the built-in character types.

bool isChar16Type() const

bool isAnyComplexType() const

bool isChar32Type() const

bool isWideCharType() const

const T * getAs() const

Member-template getAs'.

bool isRecordType() const

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

Represents a GCC generic vector type.

The JSON file list parser is used to communicate input to InstallAPI.

LLVM_READNONE bool isASCII(char c)

Returns true if a byte is an ASCII character.

LLVM_READONLY bool isPrintable(unsigned char c)

Return true if this character is an ASCII printable character; that is, a character that should take ...

bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)

@ Internal

Internal linkage, which indicates that the entity can be referred to from within the translation unit...

@ SD_FullExpression

Full-expression storage duration (for temporaries).

@ Result

The result type of a method or function.

llvm::hash_code hash_value(const CustomizableOptional< T > &O)

const FunctionProtoType * T

U cast(CodeGen::Address addr)

hash_code hash_value(const clang::tooling::dependencies::ModuleID &ID)

__UINTPTR_TYPE__ uintptr_t

An unsigned integer type with the property that any valid pointer to void can be converted to this ty...

void resizePath(unsigned Length)

LValuePathEntry * PathPtr

const LValuePathEntry * getPath() const

LValuePathEntry * getPath()

const CXXRecordDecl * PathElem

void resizePath(unsigned Length)

const PathElem * getPath() const

Describes how types, statements, expressions, and declarations should be printed.

unsigned Nullptr

Whether we should use 'nullptr' rather than '0' as a null pointer constant.

unsigned EntireContentsOfLargeArray

Whether to print the entire array initializers, especially on non-type template parameters,...