diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2025-02-14 10:19:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-14 10:19:50 +0000 |
commit | 1b6340d9c3b75c29dec5218dbab2bb8194edfc1e (patch) | |
tree | ef0319e6f3358bfba7058b6da2343223a215b343 /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | c65ed964657c93d51f3e05de9e0609419768a143 (diff) | |
download | llvm-1b6340d9c3b75c29dec5218dbab2bb8194edfc1e.zip llvm-1b6340d9c3b75c29dec5218dbab2bb8194edfc1e.tar.gz llvm-1b6340d9c3b75c29dec5218dbab2bb8194edfc1e.tar.bz2 |
[Debugify] applyDebugify - remove unnecessary defaults arg values and assert dereferencable values (#127186)
The applyDebugify helpers were providing default arguments despite all callers providing them, so strip them for clarity.
The Function variant was asserting that DebugInfoBeforePass was non-null before dereferencing so I've added an equivalent assert to the Method variant as well.
Fixes #97626
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index e47a6ce..e6b5e26 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -214,30 +214,27 @@ bool llvm::applyDebugifyMetadata( return true; } -static bool -applyDebugify(Function &F, - enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo, - DebugInfoPerPass *DebugInfoBeforePass = nullptr, - StringRef NameOfWrappedPass = "") { +static bool applyDebugify(Function &F, enum DebugifyMode Mode, + DebugInfoPerPass *DebugInfoBeforePass, + StringRef NameOfWrappedPass = "") { Module &M = *F.getParent(); auto FuncIt = F.getIterator(); if (Mode == DebugifyMode::SyntheticDebugInfo) return applyDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)), "FunctionDebugify: ", /*ApplyToMF*/ nullptr); - assert(DebugInfoBeforePass); + assert(DebugInfoBeforePass && "Missing debug info metadata"); return collectDebugInfoMetadata(M, M.functions(), *DebugInfoBeforePass, "FunctionDebugify (original debuginfo)", NameOfWrappedPass); } -static bool -applyDebugify(Module &M, - enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo, - DebugInfoPerPass *DebugInfoBeforePass = nullptr, - StringRef NameOfWrappedPass = "") { +static bool applyDebugify(Module &M, enum DebugifyMode Mode, + DebugInfoPerPass *DebugInfoBeforePass, + StringRef NameOfWrappedPass = "") { if (Mode == DebugifyMode::SyntheticDebugInfo) return applyDebugifyMetadata(M, M.functions(), "ModuleDebugify: ", /*ApplyToMF*/ nullptr); + assert(DebugInfoBeforePass && "Missing debug info metadata"); return collectDebugInfoMetadata(M, M.functions(), *DebugInfoBeforePass, "ModuleDebugify (original debuginfo)", NameOfWrappedPass); |