Tyker created this revision. Tyker added a reviewer: rsmith. Herald added a project: clang. Herald added a subscriber: cfe-commits. Tyker requested review of this revision.
Capitalize the profile function of APValue such that it can be used by FoldingSetNodeID Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D88643 Files: clang/include/clang/AST/APValue.h clang/lib/AST/APValue.cpp
Index: clang/lib/AST/APValue.cpp =================================================================== --- clang/lib/AST/APValue.cpp +++ clang/lib/AST/APValue.cpp @@ -77,7 +77,7 @@ return QualType::getFromOpaquePtr(DynamicAllocType); } -void APValue::LValueBase::profile(llvm::FoldingSetNodeID &ID) const { +void APValue::LValueBase::Profile(llvm::FoldingSetNodeID &ID) const { ID.AddPointer(Ptr.getOpaqueValue()); if (is<TypeInfoLValue>() || is<DynamicAllocLValue>()) return; @@ -103,7 +103,7 @@ Value = reinterpret_cast<uintptr_t>(BaseOrMember.getOpaqueValue()); } -void APValue::LValuePathEntry::profile(llvm::FoldingSetNodeID &ID) const { +void APValue::LValuePathEntry::Profile(llvm::FoldingSetNodeID &ID) const { ID.AddInteger(Value); } @@ -414,7 +414,7 @@ std::swap(Data, RHS.Data); } -void APValue::profile(llvm::FoldingSetNodeID &ID) const { +void APValue::Profile(llvm::FoldingSetNodeID &ID) const { ID.AddInteger(Kind); switch (Kind) { @@ -430,10 +430,10 @@ case Struct: ID.AddInteger(getStructNumBases()); for (unsigned I = 0, N = getStructNumBases(); I != N; ++I) - getStructBase(I).profile(ID); + getStructBase(I).Profile(ID); ID.AddInteger(getStructNumFields()); for (unsigned I = 0, N = getStructNumFields(); I != N; ++I) - getStructField(I).profile(ID); + getStructField(I).Profile(ID); return; case Union: @@ -442,7 +442,7 @@ return; } ID.AddPointer(getUnionField()->getCanonicalDecl()); - getUnionValue().profile(ID); + getUnionValue().Profile(ID); return; case Array: { @@ -459,9 +459,9 @@ // ['a', 'c', 'x', 'x', 'x'] is profiled as // [5, 'x', 3, 'c', 'a'] llvm::FoldingSetNodeID FillerID; - (hasArrayFiller() ? getArrayFiller() : - getArrayInitializedElt(getArrayInitializedElts() - - 1)).profile(FillerID); + (hasArrayFiller() ? getArrayFiller() + : getArrayInitializedElt(getArrayInitializedElts() - 1)) + .Profile(FillerID); ID.AddNodeID(FillerID); unsigned NumFillers = getArraySize() - getArrayInitializedElts(); unsigned N = getArrayInitializedElts(); @@ -481,7 +481,7 @@ // element. if (N != getArraySize()) { llvm::FoldingSetNodeID ElemID; - getArrayInitializedElt(N - 1).profile(ElemID); + getArrayInitializedElt(N - 1).Profile(ElemID); if (ElemID != FillerID) { ID.AddInteger(NumFillers); ID.AddNodeID(ElemID); @@ -497,14 +497,14 @@ // Emit the remaining elements. for (; N != 0; --N) - getArrayInitializedElt(N - 1).profile(ID); + getArrayInitializedElt(N - 1).Profile(ID); return; } case Vector: ID.AddInteger(getVectorLength()); for (unsigned I = 0, N = getVectorLength(); I != N; ++I) - getVectorElt(I).profile(ID); + getVectorElt(I).Profile(ID); return; case Int: @@ -533,7 +533,7 @@ return; case LValue: - getLValueBase().profile(ID); + getLValueBase().Profile(ID); ID.AddInteger(getLValueOffset().getQuantity()); ID.AddInteger(isNullPointer()); ID.AddInteger(isLValueOnePastTheEnd()); @@ -541,7 +541,7 @@ // to union members, but we don't have the type here so we don't know // how to interpret the entries. for (LValuePathEntry E : getLValuePath()) - E.profile(ID); + E.Profile(ID); return; case MemberPointer: Index: clang/include/clang/AST/APValue.h =================================================================== --- clang/include/clang/AST/APValue.h +++ clang/include/clang/AST/APValue.h @@ -150,7 +150,7 @@ static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type); static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo); - void profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const; template <class T> bool is() const { return Ptr.is<T>(); } @@ -218,7 +218,7 @@ } uint64_t getAsArrayIndex() const { return Value; } - void profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const; friend bool operator==(LValuePathEntry A, LValuePathEntry B) { return A.Value == B.Value; @@ -363,9 +363,9 @@ void swap(APValue &RHS); /// Profile this value. There is no guarantee that values of different - /// types will not produce the same profiled value, so the type should - /// typically also be profiled if it's not implied by the context. - void profile(llvm::FoldingSetNodeID &ID) const; + /// types will not produce the same Profiled value, so the type should + /// typically also be Profiled if it's not implied by the context. + void Profile(llvm::FoldingSetNodeID &ID) const; ValueKind getKind() const { return Kind; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits