[llvm] d939eeb - llvm-reduce: Add some missing consts

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 07:14:43 PST 2022


Author: Matt Arsenault
Date: 2022-11-29T10:08:02-05:00
New Revision: d939eeb9db3edca2ebef9f9985e3806e10e5882b

URL: https://github.com/llvm/llvm-project/commit/d939eeb9db3edca2ebef9f9985e3806e10e5882b
DIFF: https://github.com/llvm/llvm-project/commit/d939eeb9db3edca2ebef9f9985e3806e10e5882b.diff

LOG: llvm-reduce: Add some missing consts

Added: 
    

Modified: 
    llvm/tools/llvm-reduce/TestRunner.cpp
    llvm/tools/llvm-reduce/TestRunner.h
    llvm/tools/llvm-reduce/deltas/Delta.cpp
    llvm/tools/llvm-reduce/llvm-reduce.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-reduce/TestRunner.cpp b/llvm/tools/llvm-reduce/TestRunner.cpp
index 6ac882a377f02..f79d10667fe3a 100644
--- a/llvm/tools/llvm-reduce/TestRunner.cpp
+++ b/llvm/tools/llvm-reduce/TestRunner.cpp
@@ -33,7 +33,7 @@ TestRunner::TestRunner(StringRef TestName,
 
 /// Runs the interestingness test, passes file to be tested as first argument
 /// and other specified test arguments after that.
-int TestRunner::run(StringRef Filename) {
+int TestRunner::run(StringRef Filename) const {
   std::vector<StringRef> ProgramArgs;
   ProgramArgs.push_back(TestName);
 

diff  --git a/llvm/tools/llvm-reduce/TestRunner.h b/llvm/tools/llvm-reduce/TestRunner.h
index 05363d3572f48..5530cbbe41ab3 100644
--- a/llvm/tools/llvm-reduce/TestRunner.h
+++ b/llvm/tools/llvm-reduce/TestRunner.h
@@ -33,7 +33,7 @@ class TestRunner {
 
   /// Runs the interesting-ness test for the specified file
   /// @returns 0 if test was successful, 1 if otherwise
-  int run(StringRef Filename);
+  int run(StringRef Filename) const;
 
   /// Returns the most reduced version of the original testcase
   ReducerWorkItem &getProgram() const { return *Program; }

diff  --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 509ee62252a3e..8381d0cd680bd 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -65,7 +65,7 @@ void writeBitcode(ReducerWorkItem &M, raw_ostream &OutStream);
 void readBitcode(ReducerWorkItem &M, MemoryBufferRef Data, LLVMContext &Ctx,
                  const char *ToolName);
 
-bool isReduced(ReducerWorkItem &M, TestRunner &Test) {
+bool isReduced(ReducerWorkItem &M, const TestRunner &Test) {
   const bool UseBitcode = Test.inputIsBitcode() || TmpFilesAsBitcode;
 
   SmallString<128> CurrentFilepath;
@@ -134,11 +134,11 @@ static bool increaseGranularity(std::vector<Chunk> &Chunks) {
 // Check if \p ChunkToCheckForUninterestingness is interesting. Returns the
 // modified module if the chunk resulted in a reduction.
 static std::unique_ptr<ReducerWorkItem>
-CheckChunk(Chunk &ChunkToCheckForUninterestingness,
-           std::unique_ptr<ReducerWorkItem> Clone, TestRunner &Test,
+CheckChunk(const Chunk &ChunkToCheckForUninterestingness,
+           std::unique_ptr<ReducerWorkItem> Clone, const TestRunner &Test,
            ReductionFunc ExtractChunksFromModule,
-           DenseSet<Chunk> &UninterestingChunks,
-           std::vector<Chunk> &ChunksStillConsideredInteresting) {
+           const DenseSet<Chunk> &UninterestingChunks,
+           const std::vector<Chunk> &ChunksStillConsideredInteresting) {
   // Take all of ChunksStillConsideredInteresting chunks, except those we've
   // already deemed uninteresting (UninterestingChunks) but didn't remove
   // from ChunksStillConsideredInteresting yet, and additionally ignore

diff  --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp
index ae4ccead4bf9d..07b54034f5c45 100644
--- a/llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -91,7 +91,7 @@ static cl::opt<int>
 
 static codegen::RegisterCodeGenFlags CGF;
 
-bool isReduced(ReducerWorkItem &M, TestRunner &Test);
+bool isReduced(ReducerWorkItem &M, const TestRunner &Test);
 
 static std::pair<StringRef, bool> determineOutputType(bool IsMIR,
                                                       bool InputIsBitcode) {


        


More information about the llvm-commits mailing list