[llvm] 8bb3b14 - [TensorSpec] Avoid JSON.h include (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 06:24:08 PDT 2024
Author: Nikita Popov
Date: 2024-06-21T15:23:40+02:00
New Revision: 8bb3b1440cb09d0bade79ab65a2909fa94e9309c
URL: https://github.com/llvm/llvm-project/commit/8bb3b1440cb09d0bade79ab65a2909fa94e9309c
DIFF: https://github.com/llvm/llvm-project/commit/8bb3b1440cb09d0bade79ab65a2909fa94e9309c.diff
LOG: [TensorSpec] Avoid JSON.h include (NFC)
Instead forward declare the two classes that are referenced.
Added:
Modified:
llvm/include/llvm/Analysis/TensorSpec.h
llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/unittests/Analysis/TensorSpecTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/TensorSpec.h b/llvm/include/llvm/Analysis/TensorSpec.h
index d6b23cf56f6a5..91b0ad2b22f81 100644
--- a/llvm/include/llvm/Analysis/TensorSpec.h
+++ b/llvm/include/llvm/Analysis/TensorSpec.h
@@ -13,13 +13,17 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/IR/LLVMContext.h"
-#include "llvm/Support/JSON.h"
#include <memory>
#include <optional>
#include <vector>
namespace llvm {
+namespace json {
+class OStream;
+class Value;
+} // namespace json
+
/// TensorSpec encapsulates the specification of a tensor: its dimensions, or
/// "shape" (row-major), its type (see TensorSpec::getDataType specializations
/// for supported types), its name and port (see "TensorFlow: Large-Scale
diff --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
index e36a411540967..0213801cd61b4 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
@@ -17,6 +17,7 @@
#include "llvm/Analysis/MLModelRunner.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/SlotIndexes.h"
+#include <map>
using namespace llvm;
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 8f517eb50dc76..98803d09e8874 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -45,6 +45,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
diff --git a/llvm/unittests/Analysis/TensorSpecTest.cpp b/llvm/unittests/Analysis/TensorSpecTest.cpp
index 0e3cfb10c4a03..2364f9e3a99a8 100644
--- a/llvm/unittests/Analysis/TensorSpecTest.cpp
+++ b/llvm/unittests/Analysis/TensorSpecTest.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/TensorSpec.h"
+#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Testing/Support/SupportHelpers.h"
@@ -65,4 +66,4 @@ TEST(TensorSpecTest, PrintValueForDebug) {
EXPECT_EQ(tensorValueToString(reinterpret_cast<const char *>(Values.data()),
TensorSpec::createSpec<int32_t>("name", {2})),
"1,3");
-}
\ No newline at end of file
+}
More information about the llvm-commits
mailing list