Author: DonĂ¡t Nagy Date: 2026-10-16T12:51:43+02:00 New Revision: 94e8b2165d9f87f2361b75763f34443c746e770a
URL: https://github.com/llvm/llvm-project/commit/94e8b2165d9f87f2361b75763f34443c746e770a DIFF: https://github.com/llvm/llvm-project/commit/94e8b2165d9f87f2361b75763f34443c746e770a.diff LOG: [NFC][analyzer] Deduplicate logic in ProgramPoint (#231527) Trivial cleanup to avoid the duplication of tricky pointer arithmetics and consistently assert the core invariants in both constructors. Added: Modified: clang/include/clang/Analysis/ProgramPoint.h Removed: ################################################################################ diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h index 068dae4831c6c..98537213dedc7 100644 --- a/clang/include/clang/Analysis/ProgramPoint.h +++ b/clang/include/clang/Analysis/ProgramPoint.h @@ -107,24 +107,23 @@ class ProgramPoint { protected: ProgramPoint() = default; - ProgramPoint(const void *P, Kind k, const StackFrame *SF, - const ProgramPointTag *tag = nullptr, + ProgramPoint(const void *P, Kind K, const StackFrame *SF, + const ProgramPointTag *T = nullptr, CFGBlock::ConstCFGElementRef ElemRef = {nullptr, 0}) - : Data1(P), Data2(nullptr, (((unsigned)k) >> 0) & 0x3), - S(SF, (((unsigned)k) >> 2) & 0x3), Tag(tag, (((unsigned)k) >> 4) & 0x3), + : ProgramPoint(P, nullptr, K, SF, T, ElemRef) {} + + ProgramPoint(const void *P1, const void *P2, Kind K, const StackFrame *SF, + const ProgramPointTag *T = nullptr, + CFGBlock::ConstCFGElementRef ElemRef = {nullptr, 0}) + : Data1(P1), Data2(P2, (((unsigned)K) >> 0) & 0x3), + S(SF, (((unsigned)K) >> 2) & 0x3), Tag(T, (((unsigned)K) >> 4) & 0x3), ElemRef(ElemRef) { - assert(getKind() == k); + assert(getKind() == K); assert(getStackFrame() == SF); - assert(getData1() == P); + assert(getData1() == P1); + assert(getData2() == P2); } - ProgramPoint(const void *P1, const void *P2, Kind k, const StackFrame *SF, - const ProgramPointTag *tag = nullptr, - CFGBlock::ConstCFGElementRef ElemRef = {nullptr, 0}) - : Data1(P1), Data2(P2, (((unsigned)k) >> 0) & 0x3), - S(SF, (((unsigned)k) >> 2) & 0x3), Tag(tag, (((unsigned)k) >> 4) & 0x3), - ElemRef(ElemRef) {} - protected: const void *getData1() const { return Data1; } const void *getData2() const { return Data2.getPointer(); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
