================
@@ -1078,9 +1078,13 @@ void OptPassGateInstrumentation::registerCallbacks(
if (!PassGate.isEnabled())
return;
- PIC.registerShouldRunOptionalPassCallback([this](StringRef PassName, Any IR)
{
- return this->shouldRun(PassName, IR);
- });
+ PIC.registerShouldRunOptionalPassCallback(
+ [this, &PIC](StringRef ClassName, Any IR) {
+ StringRef PassName = PIC.getPassNameForClassName(ClassName);
+ if (PassName.empty())
----------------
danilaml wrote:
Our downstream code had hit an issue (sanitizer heap-use-after-free) with this
code and I believe @snehasish concern was correct. In out case, we generate
pass name dynamically (it's of the form `"PassName Step N" where N differs from
run to run), so it's stored as a `std::string` instead of a string literal. So
when `getPassNameForClassName` is called with such pass it creates an empty
densemap entry with `StringRef` referring to the `std::string` name of our pass
which is later destroyed leaving the reference dangling.
https://github.com/llvm/llvm-project/pull/145059
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits