Fix stack-use-after-scope.
Since https://reviews.llvm.org/D120334, passing a temporary LangOptions
object to Lexer results in stack-use-after-scope. I missed this when I
submitted the integrate: TAP failed to run some tests (which is the part I
missed), and then I had to add NO_SQ to get around some other problem (which
was fine). Fixing it forward.
PiperOrigin-RevId: 431587591
diff --git a/lifetime_annotations/lifetime_annotations.cc b/lifetime_annotations/lifetime_annotations.cc
index 45188d4..4f73411 100644
--- a/lifetime_annotations/lifetime_annotations.cc
+++ b/lifetime_annotations/lifetime_annotations.cc
@@ -135,7 +135,8 @@
return error(toString(std::move(err)));
}
std::string lifetimes_str = lifetimes.str();
- clang::Lexer lexer(attr->getLoc(), clang::LangOptions(), lifetimes_str.data(),
+ clang::LangOptions lang_opts;
+ clang::Lexer lexer(attr->getLoc(), lang_opts, lifetimes_str.data(),
lifetimes_str.data(),
lifetimes_str.data() + lifetimes_str.size());