-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nfc][BoundsChecking] Rename BoundsCheckingOptions into Options #122359
[nfc][BoundsChecking] Rename BoundsCheckingOptions into Options #122359
Conversation
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
@llvm/pr-subscribers-clang-codegen Author: Vitaly Buka (vitalybuka) ChangesFull diff: https://github.com/llvm/llvm-project/pull/122359.diff 5 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f350accfc530bf..37ef2bd203fdfd 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1027,7 +1027,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
PB.registerScalarOptimizerLateEPCallback([this](FunctionPassManager &FPM,
OptimizationLevel Level) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
Options.Merge =
CodeGenOpts.SanitizeMergeHandlers.has(SanitizerKind::LocalBounds);
if (!CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) {
diff --git a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
index 9c0506428bd625..836fc907375d30 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
@@ -20,7 +20,7 @@ class Function;
class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
public:
- struct BoundsCheckingOptions {
+ struct Options {
struct Runtime {
Runtime(bool MinRuntime, bool MayReturn)
: MinRuntime(MinRuntime), MayReturn(MayReturn) {}
@@ -31,14 +31,14 @@ class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
bool Merge = false;
};
- BoundsCheckingPass(BoundsCheckingOptions Options) : Options(Options) {}
+ BoundsCheckingPass(Options Opts) : Opts(Opts) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
private:
- BoundsCheckingOptions Options;
+ Options Opts;
};
} // end namespace llvm
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index b75387ac556e39..aac44077400550 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1284,9 +1284,9 @@ parseRegAllocFastPassOptions(PassBuilder &PB, StringRef Params) {
return Opts;
}
-Expected<BoundsCheckingPass::BoundsCheckingOptions>
+Expected<BoundsCheckingPass::Options>
parseBoundsCheckingOptions(StringRef Params) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
while (!Params.empty()) {
StringRef ParamName;
std::tie(ParamName, Params) = Params.split(';');
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 13e192fffbdd95..1021d7fcd92474 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -623,7 +623,7 @@ FUNCTION_PASS_WITH_PARAMS(
parseWinEHPrepareOptions, "demote-catchswitch-only")
FUNCTION_PASS_WITH_PARAMS(
"bounds-checking", "BoundsCheckingPass",
- [](BoundsCheckingPass::BoundsCheckingOptions Options) {
+ [](BoundsCheckingPass::Options Options) {
return BoundsCheckingPass(Options);
},
parseBoundsCheckingOptions, "trap")
diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
index 3d2a2663230c06..10596f87fbcaba 100644
--- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -162,8 +162,8 @@ static void insertBoundsCheck(Value *Or, BuilderTy &IRB, GetTrapBBT GetTrapBB) {
BranchInst::Create(TrapBB, Cont, Or, OldBB);
}
-static std::string getRuntimeCallName(
- const BoundsCheckingPass::BoundsCheckingOptions::Runtime &Opts) {
+static std::string
+getRuntimeCallName(const BoundsCheckingPass::Options::Runtime &Opts) {
std::string Name = "__ubsan_handle_local_out_of_bounds";
if (Opts.MinRuntime)
Name += "_minimal";
@@ -172,9 +172,9 @@ static std::string getRuntimeCallName(
return Name;
}
-static bool
-addBoundsChecking(Function &F, TargetLibraryInfo &TLI, ScalarEvolution &SE,
- const BoundsCheckingPass::BoundsCheckingOptions &Opts) {
+static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI,
+ ScalarEvolution &SE,
+ const BoundsCheckingPass::Options &Opts) {
if (F.hasFnAttribute(Attribute::NoSanitizeBounds))
return false;
@@ -271,7 +271,7 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager &
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
auto &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
- if (!addBoundsChecking(F, TLI, SE, Options))
+ if (!addBoundsChecking(F, TLI, SE, Opts))
return PreservedAnalyses::all();
return PreservedAnalyses::none();
@@ -282,16 +282,16 @@ void BoundsCheckingPass::printPipeline(
static_cast<PassInfoMixin<BoundsCheckingPass> *>(this)->printPipeline(
OS, MapClassName2PassName);
OS << "<";
- if (Options.Rt) {
- if (Options.Rt->MinRuntime)
+ if (Opts.Rt) {
+ if (Opts.Rt->MinRuntime)
OS << "min-";
OS << "rt";
- if (!Options.Rt->MayReturn)
+ if (!Opts.Rt->MayReturn)
OS << "-abort";
} else {
OS << "trap";
}
- if (Options.Merge)
+ if (Opts.Merge)
OS << ";merge";
OS << ">";
}
|
@llvm/pr-subscribers-clang Author: Vitaly Buka (vitalybuka) ChangesFull diff: https://github.com/llvm/llvm-project/pull/122359.diff 5 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f350accfc530bf..37ef2bd203fdfd 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1027,7 +1027,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
PB.registerScalarOptimizerLateEPCallback([this](FunctionPassManager &FPM,
OptimizationLevel Level) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
Options.Merge =
CodeGenOpts.SanitizeMergeHandlers.has(SanitizerKind::LocalBounds);
if (!CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) {
diff --git a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
index 9c0506428bd625..836fc907375d30 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
@@ -20,7 +20,7 @@ class Function;
class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
public:
- struct BoundsCheckingOptions {
+ struct Options {
struct Runtime {
Runtime(bool MinRuntime, bool MayReturn)
: MinRuntime(MinRuntime), MayReturn(MayReturn) {}
@@ -31,14 +31,14 @@ class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
bool Merge = false;
};
- BoundsCheckingPass(BoundsCheckingOptions Options) : Options(Options) {}
+ BoundsCheckingPass(Options Opts) : Opts(Opts) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
private:
- BoundsCheckingOptions Options;
+ Options Opts;
};
} // end namespace llvm
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index b75387ac556e39..aac44077400550 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1284,9 +1284,9 @@ parseRegAllocFastPassOptions(PassBuilder &PB, StringRef Params) {
return Opts;
}
-Expected<BoundsCheckingPass::BoundsCheckingOptions>
+Expected<BoundsCheckingPass::Options>
parseBoundsCheckingOptions(StringRef Params) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
while (!Params.empty()) {
StringRef ParamName;
std::tie(ParamName, Params) = Params.split(';');
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 13e192fffbdd95..1021d7fcd92474 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -623,7 +623,7 @@ FUNCTION_PASS_WITH_PARAMS(
parseWinEHPrepareOptions, "demote-catchswitch-only")
FUNCTION_PASS_WITH_PARAMS(
"bounds-checking", "BoundsCheckingPass",
- [](BoundsCheckingPass::BoundsCheckingOptions Options) {
+ [](BoundsCheckingPass::Options Options) {
return BoundsCheckingPass(Options);
},
parseBoundsCheckingOptions, "trap")
diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
index 3d2a2663230c06..10596f87fbcaba 100644
--- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -162,8 +162,8 @@ static void insertBoundsCheck(Value *Or, BuilderTy &IRB, GetTrapBBT GetTrapBB) {
BranchInst::Create(TrapBB, Cont, Or, OldBB);
}
-static std::string getRuntimeCallName(
- const BoundsCheckingPass::BoundsCheckingOptions::Runtime &Opts) {
+static std::string
+getRuntimeCallName(const BoundsCheckingPass::Options::Runtime &Opts) {
std::string Name = "__ubsan_handle_local_out_of_bounds";
if (Opts.MinRuntime)
Name += "_minimal";
@@ -172,9 +172,9 @@ static std::string getRuntimeCallName(
return Name;
}
-static bool
-addBoundsChecking(Function &F, TargetLibraryInfo &TLI, ScalarEvolution &SE,
- const BoundsCheckingPass::BoundsCheckingOptions &Opts) {
+static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI,
+ ScalarEvolution &SE,
+ const BoundsCheckingPass::Options &Opts) {
if (F.hasFnAttribute(Attribute::NoSanitizeBounds))
return false;
@@ -271,7 +271,7 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager &
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
auto &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
- if (!addBoundsChecking(F, TLI, SE, Options))
+ if (!addBoundsChecking(F, TLI, SE, Opts))
return PreservedAnalyses::all();
return PreservedAnalyses::none();
@@ -282,16 +282,16 @@ void BoundsCheckingPass::printPipeline(
static_cast<PassInfoMixin<BoundsCheckingPass> *>(this)->printPipeline(
OS, MapClassName2PassName);
OS << "<";
- if (Options.Rt) {
- if (Options.Rt->MinRuntime)
+ if (Opts.Rt) {
+ if (Opts.Rt->MinRuntime)
OS << "min-";
OS << "rt";
- if (!Options.Rt->MayReturn)
+ if (!Opts.Rt->MayReturn)
OS << "-abort";
} else {
OS << "trap";
}
- if (Options.Merge)
+ if (Opts.Merge)
OS << ";merge";
OS << ">";
}
|
@llvm/pr-subscribers-llvm-transforms Author: Vitaly Buka (vitalybuka) ChangesFull diff: https://github.com/llvm/llvm-project/pull/122359.diff 5 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f350accfc530bf..37ef2bd203fdfd 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1027,7 +1027,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
PB.registerScalarOptimizerLateEPCallback([this](FunctionPassManager &FPM,
OptimizationLevel Level) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
Options.Merge =
CodeGenOpts.SanitizeMergeHandlers.has(SanitizerKind::LocalBounds);
if (!CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) {
diff --git a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
index 9c0506428bd625..836fc907375d30 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
@@ -20,7 +20,7 @@ class Function;
class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
public:
- struct BoundsCheckingOptions {
+ struct Options {
struct Runtime {
Runtime(bool MinRuntime, bool MayReturn)
: MinRuntime(MinRuntime), MayReturn(MayReturn) {}
@@ -31,14 +31,14 @@ class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
bool Merge = false;
};
- BoundsCheckingPass(BoundsCheckingOptions Options) : Options(Options) {}
+ BoundsCheckingPass(Options Opts) : Opts(Opts) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
private:
- BoundsCheckingOptions Options;
+ Options Opts;
};
} // end namespace llvm
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index b75387ac556e39..aac44077400550 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1284,9 +1284,9 @@ parseRegAllocFastPassOptions(PassBuilder &PB, StringRef Params) {
return Opts;
}
-Expected<BoundsCheckingPass::BoundsCheckingOptions>
+Expected<BoundsCheckingPass::Options>
parseBoundsCheckingOptions(StringRef Params) {
- BoundsCheckingPass::BoundsCheckingOptions Options;
+ BoundsCheckingPass::Options Options;
while (!Params.empty()) {
StringRef ParamName;
std::tie(ParamName, Params) = Params.split(';');
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 13e192fffbdd95..1021d7fcd92474 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -623,7 +623,7 @@ FUNCTION_PASS_WITH_PARAMS(
parseWinEHPrepareOptions, "demote-catchswitch-only")
FUNCTION_PASS_WITH_PARAMS(
"bounds-checking", "BoundsCheckingPass",
- [](BoundsCheckingPass::BoundsCheckingOptions Options) {
+ [](BoundsCheckingPass::Options Options) {
return BoundsCheckingPass(Options);
},
parseBoundsCheckingOptions, "trap")
diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
index 3d2a2663230c06..10596f87fbcaba 100644
--- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -162,8 +162,8 @@ static void insertBoundsCheck(Value *Or, BuilderTy &IRB, GetTrapBBT GetTrapBB) {
BranchInst::Create(TrapBB, Cont, Or, OldBB);
}
-static std::string getRuntimeCallName(
- const BoundsCheckingPass::BoundsCheckingOptions::Runtime &Opts) {
+static std::string
+getRuntimeCallName(const BoundsCheckingPass::Options::Runtime &Opts) {
std::string Name = "__ubsan_handle_local_out_of_bounds";
if (Opts.MinRuntime)
Name += "_minimal";
@@ -172,9 +172,9 @@ static std::string getRuntimeCallName(
return Name;
}
-static bool
-addBoundsChecking(Function &F, TargetLibraryInfo &TLI, ScalarEvolution &SE,
- const BoundsCheckingPass::BoundsCheckingOptions &Opts) {
+static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI,
+ ScalarEvolution &SE,
+ const BoundsCheckingPass::Options &Opts) {
if (F.hasFnAttribute(Attribute::NoSanitizeBounds))
return false;
@@ -271,7 +271,7 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager &
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
auto &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
- if (!addBoundsChecking(F, TLI, SE, Options))
+ if (!addBoundsChecking(F, TLI, SE, Opts))
return PreservedAnalyses::all();
return PreservedAnalyses::none();
@@ -282,16 +282,16 @@ void BoundsCheckingPass::printPipeline(
static_cast<PassInfoMixin<BoundsCheckingPass> *>(this)->printPipeline(
OS, MapClassName2PassName);
OS << "<";
- if (Options.Rt) {
- if (Options.Rt->MinRuntime)
+ if (Opts.Rt) {
+ if (Opts.Rt->MinRuntime)
OS << "min-";
OS << "rt";
- if (!Options.Rt->MayReturn)
+ if (!Opts.Rt->MayReturn)
OS << "-abort";
} else {
OS << "trap";
}
- if (Options.Merge)
+ if (Opts.Merge)
OS << ";merge";
OS << ">";
}
|
No description provided.