================ @@ -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) { ---------------- ziqingluo-90 wrote:
Discussion: These WPA unit tests basically serve an identical purpose as they would if they were written as lit-tests, because the input is a program and the testing component goes all the way down to WPA. I'm not sure if there is any value in saying this kind of test would be better as a lit-test. https://github.com/llvm/llvm-project/pull/213317 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
