forked from OSchip/llvm-project
[clang-tidy] Fix a use-after-free bug found by asan
llvm-svn: 256562
This commit is contained in:
parent
c2e4bb421a
commit
254825a356
|
@ -491,9 +491,10 @@ void SimplifyBooleanExprCheck::check(const MatchFinder::MatchResult &Result) {
|
||||||
bool containsDiscardedTokens(
|
bool containsDiscardedTokens(
|
||||||
const ast_matchers::MatchFinder::MatchResult &Result,
|
const ast_matchers::MatchFinder::MatchResult &Result,
|
||||||
CharSourceRange CharRange) {
|
CharSourceRange CharRange) {
|
||||||
StringRef ReplacementText =
|
std::string ReplacementText =
|
||||||
Lexer::getSourceText(CharRange, *Result.SourceManager,
|
Lexer::getSourceText(CharRange, *Result.SourceManager,
|
||||||
Result.Context->getLangOpts()).str();
|
Result.Context->getLangOpts())
|
||||||
|
.str();
|
||||||
Lexer Lex(CharRange.getBegin(), Result.Context->getLangOpts(),
|
Lexer Lex(CharRange.getBegin(), Result.Context->getLangOpts(),
|
||||||
ReplacementText.data(), ReplacementText.data(),
|
ReplacementText.data(), ReplacementText.data(),
|
||||||
ReplacementText.data() + ReplacementText.size());
|
ReplacementText.data() + ReplacementText.size());
|
||||||
|
|
Loading…
Reference in New Issue