[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-08 Thread Elliot Goodrich via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG39d8e6e22cd1: Add missing StringExtras.h includes (authored 
by IncludeGuardian).

Changed prior to commit:
  https://reviews.llvm.org/D154543?vs=538238=538337#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154543/new/

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,6 +14,7 @@
 #include "XCOFFDump.h"
 
 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCSubtargetInfo.h"
Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Analysis/VectorUtils.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
@@ -19,6 +20,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/xxhash.h"
+
 using namespace llvm;
 
 #define DEBUG_TYPE "moduleutils"
Index: llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
===
--- llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -11,6 +11,7 @@
 //===--===//
 
 #include "llvm/Transforms/Utils/MemoryOpRemark.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/DebugInfo.h"
Index: llvm/lib/Transforms/Scalar/MergeICmps.cpp
===
--- llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -42,6 +42,7 @@
 //===--===//
 
 #include "llvm/Transforms/Scalar/MergeICmps.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/DomTreeUpdater.h"
 #include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/Loads.h"
Index: llvm/lib/Transforms/IPO/Internalize.cpp
===
--- llvm/lib/Transforms/IPO/Internalize.cpp
+++ llvm/lib/Transforms/IPO/Internalize.cpp
@@ -19,6 +19,7 @@
 //===--===//
 
 #include "llvm/Transforms/IPO/Internalize.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Analysis/CallGraph.h"
Index: llvm/lib/Analysis/VectorUtils.cpp
===
--- llvm/lib/Analysis/VectorUtils.cpp
+++ llvm/lib/Analysis/VectorUtils.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Analysis/VectorUtils.h"
 #include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/DemandedBits.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/LoopIterator.h"
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -18,6 +18,7 @@
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/MultilibBuilder.h"
 #include "clang/Driver/Options.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VirtualFileSystem.h"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -26,6 +26,7 @@
 

[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 538238.
IncludeGuardian added a comment.

Rebasing on `main`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154543/new/

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,99 +12,100 @@

 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "gtest/gtest.h"

 using namespace llvm;
 using namespace llvm::compression;

 namespace {

 #if LLVM_ENABLE_ZLIB
 static void testZlibCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zlib::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zlib::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Z dispatches to zlib::decompress.
   E = compression::decompress(DebugCompressionType::Zlib, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zlib::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zlib) {
   testZlibCompression("", zlib::DefaultCompression);

   testZlibCompression("hello, world!", zlib::NoCompression);
   testZlibCompression("hello, world!", zlib::BestSizeCompression);
   testZlibCompression("hello, world!", zlib::BestSpeedCompression);
   testZlibCompression("hello, world!", zlib::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZlibCompression(BinaryDataStr, zlib::NoCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSizeCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSpeedCompression);
   testZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 #endif

 #if LLVM_ENABLE_ZSTD
 static void testZstdCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zstd::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zstd::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Zstd dispatches to zstd::decompress.
   E = compression::decompress(DebugCompressionType::Zstd, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zstd::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("Destination buffer is too small", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zstd) {
   testZstdCompression("", zstd::DefaultCompression);

   testZstdCompression("hello, world!", zstd::NoCompression);
   testZstdCompression("hello, world!", zstd::BestSizeCompression);
   testZstdCompression("hello, world!", zstd::BestSpeedCompression);
   testZstdCompression("hello, world!", zstd::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZstdCompression(BinaryDataStr, zstd::NoCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSizeCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSpeedCompression);
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,6 +14,7 @@
 #include "XCOFFDump.h"

 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include 

[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@MaskRay Thanks. I have updated the title to use `[Support]` and I will land 
the additional includes separately to the removal.  This was very good advice 
last attempt as it I did have to revert the change.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154543/new/

https://reviews.llvm.org/D154543

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits