Skip to content

Commit 44b904b

Browse files
alanzhao1copybara-github
authored andcommitted
Fix LoggingTest.CheckContainingFunc
An upcoming LLVM change (llvm/llvm-project#107114) causes the optimizer to remove the checks for the value of the death_location variable since all calls to CheckContainingFunc(...) pass one of the 3 checked values. To avoid this, we add [[clang:optnone]] to the function to prevent this optimization. Bug: 369900509 Fixed: 369900509 Change-Id: I502f1dd301590b8673f000b3067327813628ae3c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5905531 Reviewed-by: Nico Weber <[email protected]> Commit-Queue: Nico Weber <[email protected]> Cr-Commit-Position: refs/heads/main@{#1363470} NOKEYCHECK=True GitOrigin-RevId: 2343bacd0698a54f1b58b633874cb65d6c725404
1 parent ab5835b commit 44b904b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

logging_unittest.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ TEST_F(LoggingTest, DuplicateLogFile) {
374374
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
375375

376376
#if !CHECK_WILL_STREAM() && BUILDFLAG(IS_WIN)
377-
NOINLINE void CheckContainingFunc(int death_location) {
377+
// Tell clang to not optimize this function or else it will remove the CHECKs.
378+
[[clang::optnone]] NOINLINE void CheckContainingFunc(int death_location) {
378379
CHECK(death_location != 1);
379380
CHECK(death_location != 2);
380381
CHECK(death_location != 3);

0 commit comments

Comments
 (0)