[clang] [clang][docs] Add documentation for APValue constructors (PR #109994)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 3 23:46:45 PDT 2024
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/109994
>From 5a0832c88169e12e43deb498ead994e04966bb59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 25 Sep 2024 16:42:55 +0200
Subject: [PATCH] [clang][docs] Add documentation for APValue constructors
---
clang/include/clang/AST/APValue.h | 68 +++++++++++++++++++++++++------
1 file changed, 56 insertions(+), 12 deletions(-)
diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index c4206b73b11562..7869ee386689d7 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -314,51 +314,95 @@ class APValue {
DataType Data;
public:
+ /// Creates an empty APValue of type None.
APValue() : Kind(None) {}
+ /// Creates an integer APValue holding the given value.
explicit APValue(APSInt I) : Kind(None) {
MakeInt(); setInt(std::move(I));
}
+ /// Creates a float APValue holding the given value.
explicit APValue(APFloat F) : Kind(None) {
MakeFloat(); setFloat(std::move(F));
}
+ /// Creates a fixed-point APValue holding the given value.
explicit APValue(APFixedPoint FX) : Kind(None) {
MakeFixedPoint(std::move(FX));
}
+ /// Creates a vector APValue with \p N elements. The elements
+ /// are read from \p E.
explicit APValue(const APValue *E, unsigned N) : Kind(None) {
MakeVector(); setVector(E, N);
}
+ /// Creates an integer complex APValue with the given real and imaginary
+ /// values.
APValue(APSInt R, APSInt I) : Kind(None) {
MakeComplexInt(); setComplexInt(std::move(R), std::move(I));
}
+ /// Creates a float complex APValue with the given real and imaginary values.
APValue(APFloat R, APFloat I) : Kind(None) {
MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I));
}
APValue(const APValue &RHS);
APValue(APValue &&RHS);
- APValue(LValueBase B, const CharUnits &O, NoLValuePath N,
+ /// Creates an lvalue APValue without an lvalue path.
+ /// \param Base The base of the lvalue.
+ /// \param Offset The offset of the lvalue.
+ /// \param IsNullPtr Whether this lvalue is a null pointer.
+ APValue(LValueBase Base, const CharUnits &Offset, NoLValuePath,
bool IsNullPtr = false)
: Kind(None) {
- MakeLValue(); setLValue(B, O, N, IsNullPtr);
- }
- APValue(LValueBase B, const CharUnits &O, ArrayRef<LValuePathEntry> Path,
- bool OnePastTheEnd, bool IsNullPtr = false)
+ MakeLValue();
+ setLValue(Base, Offset, NoLValuePath{}, IsNullPtr);
+ }
+ /// Creates an lvalue APValue with an lvalue path.
+ /// \param Base The base of the lvalue.
+ /// \param Offset The offset of the lvalue.
+ /// \param Path The lvalue path.
+ /// \param OnePastTheEnd Whether this lvalue is one-past-the-end of the
+ /// subobject it points to.
+ /// \param IsNullPtr Whether this lvalue is a null pointer.
+ APValue(LValueBase Base, const CharUnits &Offset,
+ ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
+ bool IsNullPtr = false)
: Kind(None) {
- MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, IsNullPtr);
- }
+ MakeLValue();
+ setLValue(Base, Offset, Path, OnePastTheEnd, IsNullPtr);
+ }
+ /// Creates a new array APValue.
+ /// \param UninitArray Marker. Pass an empty UninitArray.
+ /// \param InitElts Number of elements you're going to initialize in the
+ /// array.
+ /// \param Size Full size of the array.
APValue(UninitArray, unsigned InitElts, unsigned Size) : Kind(None) {
MakeArray(InitElts, Size);
}
- APValue(UninitStruct, unsigned B, unsigned M) : Kind(None) {
- MakeStruct(B, M);
- }
- explicit APValue(const FieldDecl *D, const APValue &V = APValue())
+ /// Creates a new struct APValue.
+ /// \param UninitStruct Marker. Pass an empty UninitStruct.
+ /// \param NumBases Number of bases.
+ /// \param NumMembers Number of members.
+ APValue(UninitStruct, unsigned NumBases, unsigned NumMembers) : Kind(None) {
+ MakeStruct(NumBases, NumMembers);
+ }
+ /// Creates a new union APValue.
+ /// \param ActiveDecl The FieldDecl of the active union member.
+ /// \param ActiveValue The value of the active union member.
+ explicit APValue(const FieldDecl *ActiveDecl,
+ const APValue &ActiveValue = APValue())
: Kind(None) {
- MakeUnion(); setUnion(D, V);
+ MakeUnion();
+ setUnion(ActiveDecl, ActiveValue);
}
+ /// Creates a new member pointer APValue.
+ /// \param Member Declaration of the member
+ /// \param IsDerivedMember Whether member is a derived one.
+ /// \param Path The path of the member.
APValue(const ValueDecl *Member, bool IsDerivedMember,
ArrayRef<const CXXRecordDecl*> Path) : Kind(None) {
MakeMemberPointer(Member, IsDerivedMember, Path);
}
+ /// Creates a new address label diff APValue.
+ /// \param LHSExpr The left-hand side of the difference.
+ /// \param RHSExpr The right-hand side of the difference.
APValue(const AddrLabelExpr* LHSExpr, const AddrLabelExpr* RHSExpr)
: Kind(None) {
MakeAddrLabelDiff(); setAddrLabelDiff(LHSExpr, RHSExpr);
More information about the cfe-commits
mailing list