Make package lifetime_annotations compile under macOS.
Specifically, this is with the Blaze options
--config=darwin_x86_64 --macos_minimum_os=10.14
This is needed to unblock integrating package lifetime_analysis into clang_tidy
(see unknown commit and presubmit failures there).
PiperOrigin-RevId: 415477220
diff --git a/lifetime_annotations/lifetime_annotations_test.cc b/lifetime_annotations/lifetime_annotations_test.cc
index 52eca48..610b020 100644
--- a/lifetime_annotations/lifetime_annotations_test.cc
+++ b/lifetime_annotations/lifetime_annotations_test.cc
@@ -37,7 +37,7 @@
clang::tooling::FileContentMappings()) {
absl::StatusOr<NamedFuncLifetimes> result;
runOnCodeWithLifetimeHandlers(
- code,
+ llvm::StringRef(code.data(), code.size()),
[&result](clang::ASTContext& ast_context,
const LifetimeAnnotationContext& lifetime_context) {
using clang::ast_matchers::findAll;
diff --git a/lifetime_annotations/lifetime_symbol_table.cc b/lifetime_annotations/lifetime_symbol_table.cc
index 040a0a7..415b312 100644
--- a/lifetime_annotations/lifetime_symbol_table.cc
+++ b/lifetime_annotations/lifetime_symbol_table.cc
@@ -63,7 +63,7 @@
std::string name;
name.reserve(num_chars);
for (int i = 0; i < num_chars; ++i) {
- name.insert(0, 1, 'a' + index % 26);
+ name.insert(0, static_cast<size_t>(1), 'a' + index % 26);
index /= 26;
}
return name;