Commit 1d75b188 authored by Donát Nagy's avatar Donát Nagy
Browse files

[analyzer][NFC] Fix dangling StringRef in barely used code

CheckerContext::getNoteTag has a shorthand version that takes a
plain 'StringRef Note' instead of a lambda that calculates the note.

The old implementation of this method was incorrect because it created a
lambda that captured the StringRef, which was dereferenced much later,
when the NoteTags were visited.

In the current codebase this does not cause errors because this method
is called only once, and there the `Note` argument is a string literal
that remains valid. However, I tried to use this method in a checker
that I was prototyping, and there it printed random memory junk (instead
of the message that I composed in a local variable).

Differential Revision: https://reviews.llvm.org/D153889
parent 0e93c4a5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment