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

46

51 Base.DynamicAllocType = Type.getAsOpaquePtr();

53}

54

62

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

66

67

68

69

70

71

72

73 for (auto *Redecl = cast(D->getMostRecentDecl()); Redecl;

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

76 if (T->isIncompleteArrayType())

77 return T;

78 }

79 return D->getType();

80 }

81

84

87

89

90

91

93 llvm::dyn_cast(Base)) {

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

98 Adjustments);

99

100

101 if (!Adjustments.empty())

103 }

104

105 return Base->getType();

106}

107

110 : Local.CallIndex;

111}

112

116

121

126

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

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())

149 BaseOrMember.setPointer(D->getCanonicalDecl());

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

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

224

225

226

227

228 union {

231 };

232

235

237 if (Length == PathLength)

238 return;

241 PathLength = Length;

244 }

245

248

253};

254

255namespace {

256 struct MemberPointerBase {

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

258 unsigned PathLength;

259 };

260}

261

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

266 union {

269 };

270

273

275 if (Length == PathLength)

276 return;

279 PathLength = Length;

282 }

283

285

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

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

309}

310

312 : Kind(None), AllowConstexprUnknown(RHS.AllowConstexprUnknown) {

314 case None:

315 case Indeterminate:

316 Kind = RHS.getKind();

317 break;

318 case Int:

319 MakeInt();

320 setInt(RHS.getInt());

321 break;

322 case Float:

323 MakeFloat();

324 setFloat(RHS.getFloat());

325 break;

326 case FixedPoint: {

327 APFixedPoint FXCopy = RHS.getFixedPoint();

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

329 break;

330 }

332 MakeVector();

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

335 break;

337 MakeComplexInt();

339 break;

341 MakeComplexFloat();

343 break;

345 MakeLValue();

349 else

352 break;

359 break;

366 break;

368 MakeUnion();

370 break;

375 break;

377 MakeAddrLabelDiff();

379 break;

380 }

381}

382

384 : Kind(RHS.Kind), AllowConstexprUnknown(RHS.AllowConstexprUnknown),

385 Data(RHS.Data) {

386 RHS.Kind = None;

387}

388

390 if (this != &RHS)

392

393 return *this;

394}

395

397 if (this != &RHS) {

399 DestroyDataAndMakeUninit();

400 Kind = RHS.Kind;

401 Data = RHS.Data;

402 AllowConstexprUnknown = RHS.AllowConstexprUnknown;

403 RHS.Kind = None;

404 }

405 return *this;

406}

407

408void APValue::DestroyDataAndMakeUninit() {

409 if (Kind == Int)

410 ((APSInt *)(char *)&Data)->~APSInt();

411 else if (Kind == Float)

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

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

415 else if (Kind == Vector)

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

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

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

421 else if (Kind == LValue)

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

423 else if (Kind == Array)

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

425 else if (Kind == Struct)

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

427 else if (Kind == Union)

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

429 else if (Kind == MemberPointer)

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

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

434 AllowConstexprUnknown = false;

435}

436

442 return false;

447 return true;

448 case Int:

449 return getInt().needsCleanup();

451 return getFloat().needsCleanup();

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

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

458 "same size.");

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

464 "same size.");

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

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

470 }

471 llvm_unreachable("Unknown APValue kind!");

472}

473

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

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

477

478 bool tmp = AllowConstexprUnknown;

479 AllowConstexprUnknown = RHS.AllowConstexprUnknown;

480 RHS.AllowConstexprUnknown = tmp;

481}

482

483

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

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

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

487}

488

490

491

492

493

494

495 ID.AddInteger(Kind);

496

497 switch (Kind) {

500 return;

501

505 return;

506

512 return;

513

516 ID.AddInteger(0);

517 return;

518 }

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

521 return;

522

525 return;

526

527

528

529

530

531

532

533

534

535 llvm::FoldingSetNodeID FillerID;

539 ID.AddNodeID(FillerID);

542

543

544

545

546 while (true) {

547 if (N == 0) {

548

550 ID.AddInteger(NumFillers);

551 break;

552 }

553

554

555

557 llvm::FoldingSetNodeID ElemID;

559 if (ElemID != FillerID) {

560 ID.AddInteger(NumFillers);

561 ID.AddNodeID(ElemID);

562 --N;

563 break;

564 }

565 }

566

567

568 ++NumFillers;

569 --N;

570 }

571

572

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

575 return;

576 }

577

581 return;

582

583 case Int:

585 return;

586

589 return;

590

593 return;

594

598 return;

599

603 return;

604

613

614

615

617 E.Profile(ID);

618 }

619 return;

620

625 ID.AddPointer(D);

626 return;

627 }

628

629 llvm_unreachable("Unknown APValue kind!");

630}

631

633 llvm::APFloat V = F;

634 bool ignored;

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

636 &ignored);

637 return V.convertToDouble();

638}

639

644 if (Inits.empty())

645 return false;

646

649 return false;

650

651

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

653 return false;

654

655 Inits = Inits.drop_back();

656

658 Buf.push_back('"');

659

660

661 constexpr size_t MaxN = 36;

662 StringRef Ellipsis;

664 Ellipsis = "[...]";

665 Inits =

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

667 }

668

669 for (auto &Val : Inits) {

670 if (!Val.isInt())

671 return false;

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

674 return false;

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

676

678 if (Escaped.empty()) {

680 return false;

681 Buf.emplace_back(Ch);

682 } else {

683 Buf.append(Escaped);

684 }

685 }

686

687 Buf.append(Ellipsis);

688 Buf.push_back('"');

689

691 Out << 'L';

693 Out << "u8";

695 Out << 'u';

697 Out << 'U';

698

699 Out << Buf;

700 return true;

701}

702

707

710

711

713 Out << "void()";

714 return;

715 }

716

718 Ty = AT->getValueType();

719

722 Out << "";

723 return;

725 Out << "";

726 return;

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

730 else

732 return;

735 return;

738 return;

740 Out << '{';

744 Out << ", ";

746 }

747 Out << '}';

748 return;

749 }

752 return;

756 return;

761 if (InnerTy.isNull())

762 InnerTy = Ty;

763

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

768 } else if (IsReference) {

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

771 } else {

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

774 }

775 return;

776 }

777

779

785 if (IsReference)

786 Out << "*(";

788 Out << "(char*)";

790 }

791 Out << '&';

792 } else if (!IsReference) {

793 Out << '&';

794 }

795

797 Out << *VD;

799 TI.print(Out, Policy);

801 Out << "{*new "

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

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

804 } else {

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

806 "Expecting non-null Expr");

808 }

809

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

812 if (IsReference)

813 Out << ')';

814 }

815 return;

816 }

817

818

819 if (!IsReference)

820 Out << '&';

822 Out << "*(&";

823

824 QualType ElemTy = Base.getType().getNonReferenceType();

826 Out << *VD;

828 TI.print(Out, Policy);

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

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

832 } else {

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

836 }

837

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

842

843

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

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

846 CastToBase = RD;

847

848

849 } else {

851 Out << ".";

852 if (CastToBase)

853 Out << *CastToBase << "::";

854 Out << *VD;

856 }

858

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

861 } else {

862

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

865 }

866 }

867

868

870

871

872 Out << " + 1";

873 if (IsReference)

874 Out << ')';

875 }

876 return;

877 }

883 return;

885 Out << '{';

886 unsigned I = 0;

887 switch (N) {

888 case 0:

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

890 Out << ", ";

892 Out << "...}";

893 return;

894 }

895 [[fallthrough]];

896 default:

898 }

899 }

900 Out << '}';

901 return;

902 }

904 Out << '{';

905 bool First = true;

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

913 Out << ", ";

916 }

917 }

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

920 Out << ", ";

921 if (FI->isUnnamedBitField())

922 continue;

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

926 }

927 Out << '}';

928 return;

929 }

931 Out << '{';

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

935 }

936 Out << '}';

937 return;

939

940

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

943 return;

944 }

945 Out << "0";

946 return;

949 Out << " - ";

951 return;

952 }

953 llvm_unreachable("Unknown APValue kind!");

954}

955

958 llvm::raw_string_ostream Out(Result);

961}

962

967 return true;

968 }

969

972 return true;

973 }

974

977 return true;

978 }

979

980 return false;

981}

982

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

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

986}

987

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

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

991}

992

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

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

996}

997

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

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

1001}

1002

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

1006 return {LVal.getPath(), LVal.PathLength};

1007}

1008

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

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

1012}

1013

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

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

1017}

1018

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

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

1022}

1023

1025 bool IsNullPtr) {

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

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

1028 LVal.Base = B;

1029 LVal.IsOnePastTheEnd = false;

1030 LVal.Offset = O;

1032 LVal.IsNullPtr = IsNullPtr;

1033}

1034

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

1037 bool IsOnePastTheEnd, bool IsNullPtr) {

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

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

1040 LVal.Base = B;

1041 LVal.IsOnePastTheEnd = IsOnePastTheEnd;

1042 LVal.Offset = O;

1043 LVal.IsNullPtr = IsNullPtr;

1044 LVal.resizePath(Size);

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

1046}

1047

1050 bool IsNullPtr) {

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

1053 if (Path.size()) {

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

1056 }

1057}

1058

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

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

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

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

1064}

1065

1070 return MPD.MemberAndIsDerivedMember.getPointer();

1071}

1072

1077 return MPD.MemberAndIsDerivedMember.getInt();

1078}

1079

1084 return {MPD.getPath(), MPD.PathLength};

1085}

1086

1087void APValue::MakeLValue() {

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

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

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

1091 Kind = LValue;

1092}

1093

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

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

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

1097 Kind = Array;

1098}

1099

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

1102 unsigned Size) {

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

1106 MPD->MemberAndIsDerivedMember.setPointer(

1108 MPD->MemberAndIsDerivedMember.setInt(IsDerivedMember);

1109 MPD->resizePath(Size);

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

1111}

1112

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

1115 MutableArrayRef<const CXXRecordDecl *> InternalPath =

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

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

1119}

1120

1124

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

1126 LV.merge(MergeLV);

1128 };

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

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

1131 };

1132

1133 switch (V.getKind()) {

1142 break;

1143

1145

1146

1148

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

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

1152 break;

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

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

1155 break;

1156 break;

1157 }

1158

1160 if (V.getUnionField())

1161 Merge(V.getUnionValue());

1162 break;

1163

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

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

1167 break;

1168 if (V.hasArrayFiller())

1169 Merge(V.getArrayFiller());

1170 break;

1171 }

1172

1174 if (V.getLValueBase()) {

1175

1176 } else if (const auto *VD =

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

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

1179 break;

1180 } else if (const auto TI = V.getLValueBase().dyn_cast()) {

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

1182 break;

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

1184

1185

1186

1187

1188

1189

1190 auto *MTE = dyn_cast(E);

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

1194 break;

1195 } else {

1196 assert(V.getLValueBase().is() &&

1197 "unexpected LValueBase kind");

1199 }

1200

1201

1202 break;

1203 }

1204

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

1208

1209

1210

1211 break;

1212 }

1213

1214 return LV;

1215}

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

Definition APValue.cpp:632

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

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

Definition APValue.cpp:484

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

Definition APValue.cpp:640

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

Definition APValue.cpp:127

QualType getType() const

Definition APValue.cpp:63

bool isNull() const

Definition APValue.cpp:179

unsigned getVersion() const

Definition APValue.cpp:113

QualType getDynamicAllocType() const

Definition APValue.cpp:122

QualType getTypeInfoType() const

Definition APValue.cpp:117

void * DynamicAllocType

The QualType, if this is a DynamicAllocLValue.

static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo)

Definition APValue.cpp:55

static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type)

Definition APValue.cpp:47

void * TypeInfoType

The type std::type_info, if this is a TypeInfoLValue.

void * getOpaqueValue() const

Definition APValue.cpp:175

unsigned getCallIndex() const

Definition APValue.cpp:108

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

void Profile(llvm::FoldingSetNodeID &ID) const

Definition APValue.cpp:153

QualType getType()

Definition APValue.cpp:161

ArrayRef< LValuePathEntry > Path

LValuePathSerializationHelper(ArrayRef< LValuePathEntry >, QualType)

Definition APValue.cpp:157

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

bool hasArrayFiller() const

const LValueBase getLValueBase() const

Definition APValue.cpp:983

APValue & getArrayInitializedElt(unsigned I)

ArrayRef< LValuePathEntry > getLValuePath() const

Definition APValue.cpp:1003

void swap(APValue &RHS)

Swaps the contents of this and the given APValue.

Definition APValue.cpp:474

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

Definition APValue.cpp:988

unsigned getLValueVersion() const

Definition APValue.cpp:1014

bool isMemberPointerToDerivedMember() const

Definition APValue.cpp:1073

unsigned getArrayInitializedElts() const

void setComplexInt(APSInt R, APSInt I)

void Profile(llvm::FoldingSetNodeID &ID) const

profile this value.

Definition APValue.cpp:489

unsigned getStructNumBases() const

APFixedPoint & getFixedPoint()

bool needsCleanup() const

Returns whether the object performed allocations.

Definition APValue.cpp:437

bool hasLValuePath() const

Definition APValue.cpp:998

const ValueDecl * getMemberPointerDecl() const

Definition APValue.cpp:1066

APValue & getUnionValue()

const AddrLabelExpr * getAddrLabelDiffRHS() const

CharUnits & getLValueOffset()

Definition APValue.cpp:993

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

Definition APValue.cpp:703

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)

Definition APValue.cpp:1059

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

Definition APValue.cpp:1024

ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const

Definition APValue.cpp:1080

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.

Definition APValue.cpp:963

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

Definition APValue.cpp:956

APValue & operator=(const APValue &RHS)

Definition APValue.cpp:389

unsigned getLValueCallIndex() const

Definition APValue.cpp:1009

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

Definition APValue.cpp:1019

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

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()

const CXXBaseSpecifier * base_class_const_iterator

Iterator that traverses the base classes of a class.

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.

bool isMultipleOf(CharUnits N) const

Test whether this is a multiple of the other value.

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.

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.

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

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

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

const Type * getType() const

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

Definition APValue.cpp:30

The base class of the type hierarchy.

bool isBooleanType() 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.

RecordDecl * castAsRecordDecl() const

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 ...

LLVM_READONLY auto escapeCStyle(CharT Ch) -> StringRef

Return C-style escaped string for special characters, or an empty string if there is no such mapping.

@ Vector

'vector' clause, allowed on 'loop', Combined, and 'routine' directives.

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

nullptr

This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...

@ 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.

const FunctionProtoType * T

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

U cast(CodeGen::Address addr)

@ None

The alignment was not explicit in code.

@ Struct

The "struct" keyword introduces the elaborated-type-specifier.

@ Union

The "union" keyword introduces the elaborated-type-specifier.

hash_code hash_value(const clang::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...

Definition APValue.cpp:221

LValuePathEntry Path[InlinePathSpace]

Definition APValue.cpp:229

bool hasPathPtr() const

Definition APValue.cpp:247

void resizePath(unsigned Length)

Definition APValue.cpp:236

bool hasPath() const

Definition APValue.cpp:246

LV()

Definition APValue.cpp:233

LValuePathEntry * PathPtr

Definition APValue.cpp:230

static const unsigned InlinePathSpace

Definition APValue.cpp:222

const LValuePathEntry * getPath() const

Definition APValue.cpp:250

LValuePathEntry * getPath()

Definition APValue.cpp:249

~LV()

Definition APValue.cpp:234

Definition APValue.cpp:262

PathElem Path[InlinePathSpace]

Definition APValue.cpp:267

static const unsigned InlinePathSpace

Definition APValue.cpp:263

PathElem * PathPtr

Definition APValue.cpp:268

const CXXRecordDecl * PathElem

Definition APValue.cpp:265

PathElem * getPath()

Definition APValue.cpp:286

~MemberPointerData()

Definition APValue.cpp:272

MemberPointerData()

Definition APValue.cpp:271

void resizePath(unsigned Length)

Definition APValue.cpp:274

const PathElem * getPath() const

Definition APValue.cpp:287

bool hasPathPtr() const

Definition APValue.cpp:284

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,...