================
@@ -290,18 +293,38 @@ class CFGLoopExit : public CFGElement {
}
};
+/// Base class for representing elements related to the lifetime of automatic
+/// objects.
+class CFGScopeMarker : public CFGElement {
+public:
+ LLVM_ATTRIBUTE_RETURNS_NONNULL const Stmt *getTriggerStmt() const {
+ return static_cast<const Stmt *>(Data1.getPointer());
+ }
+
+private:
+ friend class CFGElement;
+
+ static bool isKind(const CFGElement &E) {
+ return E.getKind() >= SCOPE_BEGIN && E.getKind() <= SCOPE_END;
+ }
+
+protected:
+ CFGScopeMarker() = default;
+
+ explicit CFGScopeMarker(Kind K, const Stmt *S, const void *Ptr2 = nullptr)
+ : CFGElement(K, S, Ptr2) {
+ assert(isKind(*this));
+ }
+};
+
/// Represents the point where the lifetime of an automatic object ends
-class CFGLifetimeEnds : public CFGElement {
+class CFGLifetimeEnds : public CFGScopeMarker {
public:
explicit CFGLifetimeEnds(const VarDecl *var, const Stmt *stmt)
- : CFGElement(LifetimeEnds, var, stmt) {}
+ : CFGScopeMarker(LifetimeEnds, stmt, var) {}
----------------
necto wrote:
2788acdd8cd8 * [NFC] Capitalize params
https://github.com/llvm/llvm-project/pull/201123
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits