[clang] [SSAF] Extract the virtual method override relation per TU (PR #213316)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 14:51:15 PDT 2026


================
@@ -0,0 +1,51 @@
+//===- VirtualMethodFamily.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_VIRTUALMETHODFAMILY_VIRTUALMETHODFAMILY_H
+#define LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_VIRTUALMETHODFAMILY_VIRTUALMETHODFAMILY_H
+
+#include "clang/ScalableStaticAnalysis/Core/Model/EntityId.h"
+#include "clang/ScalableStaticAnalysis/Core/Model/SummaryName.h"
+#include "clang/ScalableStaticAnalysis/Core/TUSummary/EntitySummary.h"
+#include "llvm/ADT/StringRef.h"
+#include <optional>
+#include <tuple>
+#include <vector>
+
+namespace clang::ssaf {
+
+struct VirtualMethodSummary final : public EntitySummary {
+  static constexpr llvm::StringLiteral Name = "VirtualMethod";
+
+  static SummaryName summaryName() { return SummaryName(Name.str()); }
+
+  SummaryName getSummaryName() const override { return summaryName(); }
+
+  /// EntityIds of each ParmVarDecl, in source order.
+  std::vector<EntityId> ParamEntities;
+
+  /// EntityId of the synthetic return-slot entity for this method.
+  std::optional<EntityId> ReturnEntity;
----------------
ziqingluo-90 wrote:

I wonder when the return entity is going to make a difference?  Or why it is needed?

https://github.com/llvm/llvm-project/pull/213316


More information about the cfe-commits mailing list