[libcxx-commits] [libcxx] [ASan][libc++] Turn on ASan annotations for short strings (PR #75882)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 19 17:23:59 PST 2023
AdvenamTacet wrote:
Based on https://github.com/llvm/llvm-project/pull/75845/files#r1431877764, I'm going to look at this test case and understand what is happening there for sure:
```cpp
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <string>
#include <string>
#include <cassert>
#include "asan_testing.h"
constexpr std::string s = "abcdef";
// launder 's' through a non-constexpr function
std::string const& hide() { return s; }
/* not constinit */
std::string s2 = hide();
int main() {
//LIBCPP_ASSERT(is_string_asan_correct(s));
LIBCPP_ASSERT(is_string_asan_correct(s2));
//LIBCPP_ASSERT(is_string_asan_correct(hide()));
assert(s == "abcdef");
assert(s2 == "abcdef");
assert(hide() == "abcdef");
}
```
This shouldn't affect other PRs.
https://github.com/llvm/llvm-project/pull/75882
More information about the libcxx-commits
mailing list