[clang] [clang][ssaf] Introduce entity abstraction for SSAF (PR #169131)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 4 03:04:11 PST 2025
================
@@ -0,0 +1,84 @@
+//===- BuildNamespace.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_ANALYSIS_SCALABLE_BUILD_NAMESPACE_H
+#define LLVM_CLANG_ANALYSIS_SCALABLE_BUILD_NAMESPACE_H
+
+#include "llvm/ADT/StringRef.h"
+#include <optional>
+#include <string>
+#include <vector>
+
+namespace clang {
+namespace ssaf {
+
+enum class BuildNamespaceKind : unsigned short {
+ CompilationUnit,
+ LinkUnit
+};
+
+std::string toString(BuildNamespaceKind BNK);
+
+std::optional<BuildNamespaceKind> parseBuildNamespaceKind(llvm::StringRef Str);
+
+/// Represents a single step in the build process.
+class BuildNamespace {
+ BuildNamespaceKind Kind;
+ std::string Name;
+public:
+ BuildNamespace(BuildNamespaceKind Kind, llvm::StringRef Name)
+ : Kind(Kind), Name(Name.str()) {}
+
+ static BuildNamespace makeTU(llvm::StringRef CompilationId);
+
+ bool operator==(const BuildNamespace& Other) const;
+ bool operator!=(const BuildNamespace& Other) const;
+ bool operator<(const BuildNamespace& Other) const;
+
+ friend class SerializationFormat;
+};
+
+/// Represents a sequence of steps in the build process.
----------------
Xazax-hun wrote:
I do not have a strong preference or reason other than I feel like this would make the implementation a bit more concise and I usually prefer the more concise form until there is a need to split functionality out.
https://github.com/llvm/llvm-project/pull/169131
More information about the cfe-commits
mailing list