diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index f350accfc530b..37ef2bd203fdf 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 9c0506428bd62..836fc907375d3 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 { public: - struct BoundsCheckingOptions { + struct Options { struct Runtime { Runtime(bool MinRuntime, bool MayReturn) : MinRuntime(MinRuntime), MayReturn(MayReturn) {} @@ -31,14 +31,14 @@ class BoundsCheckingPass : public PassInfoMixin { 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 MapClassName2PassName); private: - BoundsCheckingOptions Options; + Options Opts; }; } // end namespace llvm diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index b75387ac556e3..aac4407740055 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 +Expected 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 13e192fffbdd9..1021d7fcd9247 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 3d2a2663230c0..10596f87fbcab 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(F); auto &SE = AM.getResult(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 *>(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 << ">"; }