[llvm-branch-commits] [clang] [SSAF] Group virtual method slots into override families (PR #213317)

Balázs Benics via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Sep 26 05:53:28 PDT 2026


================
@@ -0,0 +1,336 @@
+//===- VirtualMethodFamilyAnalysisTest.cpp -------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "VirtualMethodFamilyTestSupport.h"
+#include "clang/ScalableStaticAnalysis/Analyses/VirtualMethodFamily/VirtualMethodFamily.h"
+#include "clang/ScalableStaticAnalysis/Core/EntityLinker/LUSummary.h"
+#include "clang/ScalableStaticAnalysis/Core/Model/BuildNamespace.h"
+#include "clang/ScalableStaticAnalysis/Core/Model/EntityId.h"
+#include "clang/ScalableStaticAnalysis/Core/Model/EntityName.h"
+#include "clang/ScalableStaticAnalysis/Core/WholeProgramAnalysis/AnalysisDriver.h"
+#include "clang/ScalableStaticAnalysis/Core/WholeProgramAnalysis/WPASuite.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/TargetParser/Triple.h"
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+
+#include <memory>
+#include <optional>
+#include <ostream>
+#include <string>
+#include <utility>
+
+using namespace clang;
+using namespace ssaf;
+
+namespace clang::ssaf {
+// NOLINTNEXTLINE(misc-use-internal-linkage)
+void PrintTo(const VirtualMethodFamilyAnalysisResult &R, std::ostream *OS) {
+  std::string Str;
+  llvm::raw_string_ostream(Str) << R;
+  *OS << Str;
+}
+} // namespace clang::ssaf
+
+namespace {
+
+class VirtualMethodFamilyAnalysisTest : public VirtualMethodFamilyTestBase {
+protected:
+  // Parses \p Code, runs the VirtualMethod extractor over it, and drives the
+  // family analysis on the extracted summaries. Must be called exactly once
+  // per test, before any of the lookup helpers below.
+  void analyze(llvm::StringRef Code) {
----------------
steakhal wrote:

I don't plan to act on this. Push back if you think I should.

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


More information about the llvm-branch-commits mailing list