[all-commits] [llvm/llvm-project] afd20a: [clang-scan-deps] Fix "unterminated conditional di...
Ziqing Luo via All-commits
all-commits at lists.llvm.org
Thu Jul 3 21:53:44 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: afd20aaca5fd89dd14992c3fe2f735c5e16ad986
https://github.com/llvm/llvm-project/commit/afd20aaca5fd89dd14992c3fe2f735c5e16ad986
Author: Ziqing Luo <ziqing at udel.edu>
Date: 2025-07-04 (Fri, 04 Jul 2025)
Changed paths:
M clang/lib/Lex/DependencyDirectivesScanner.cpp
M clang/unittests/Lex/DependencyDirectivesScannerTest.cpp
Log Message:
-----------
[clang-scan-deps] Fix "unterminated conditional directive" bug (#146645)
`clang-scan-deps` threw "unterminated conditional directive" error
falsely on the following example:
```
#ifndef __TEST
#define __TEST
#if defined(__TEST_DUMMY)
#if defined(__TEST_DUMMY2)
#pragma GCC warning \
"Hello!"
#else
#pragma GCC error \
"World!"
#endif // defined(__TEST_DUMMY2)
#endif // defined(__TEST_DUMMY)
#endif // #ifndef __TEST
```
The issue comes from PR #143950, where the flag `LastNonWhitespace` does
not correctly represent the state for the example above. The PR aimed to
support that a line-continuation can be followed by whitespaces.
This commit fixes the issue by moving the `LastNonWhitespace` variable
to the inner loop so that it will be correctly reset.
rdar://153742186
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list