[llvm-branch-commits] [clang] [NFC][SSAF] Extract common code in Analyses to a shared file (PR #191932)

Balázs Benics via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 20 07:33:00 PDT 2026


================
@@ -0,0 +1,48 @@
+//===- SSAFAnalysesCommon.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
+//
+//===----------------------------------------------------------------------===//
+//
+//  Common code in SSAF analyses implementations
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_SSAFANALYSESCOMMON_H
+#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_SSAFANALYSESCOMMON_H
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Decl.h"
+#include "llvm/Support/JSON.h"
+
+template <typename NodeTy, typename... Ts>
+llvm::Error makeErrAtNode(clang::ASTContext &Ctx, const NodeTy *N,
+                          llvm::StringRef Fmt, const Ts &...Args) {
+  std::string LocStr = N->getBeginLoc().printToString(Ctx.getSourceManager());
+  return llvm::createStringError((Fmt + " at %s").str().c_str(), Args...,
+                                 LocStr.c_str());
+}
----------------
steakhal wrote:

I figured these declarations live within `clang::ssaf`, but they are not enclosed in the namespace. Why?

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


More information about the llvm-branch-commits mailing list