[all-commits] [llvm/llvm-project] d5be15: [clang-format] Don't crash on malformed preprocess...
eywdck2l via All-commits
all-commits at lists.llvm.org
Sat Oct 29 19:22:46 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d5be1550f1406844501ab87a3e92622927a203e0
https://github.com/llvm/llvm-project/commit/d5be1550f1406844501ab87a3e92622927a203e0
Author: sstwcw <f0gukp2nk at protonmail.com>
Date: 2022-10-30 (Sun, 30 Oct 2022)
Changed paths:
M clang/lib/Format/UnwrappedLineParser.cpp
M clang/unittests/Format/FormatTest.cpp
Log Message:
-----------
[clang-format] Don't crash on malformed preprocessor conditions
Previously the program would crash on this input:
```
#else
#if X
```
The problem was that in `parsePPElse`, `PPBranchLevel` would be
incremented when the first `#else` gets parsed, but `PPLevelBranchCount`
and `PPLevelBranchIndex` would not be updated together.
I found the problem when working on D135740.
Differential Revision: https://reviews.llvm.org/D135972
More information about the All-commits
mailing list