diff options
| author | Zhao Wei Liew <zhaoweiliew@gmail.com> | 2022-01-03 11:30:24 +0100 |
|---|---|---|
| committer | Marek Kurdej <marek.kurdej+llvm.org@gmail.com> | 2022-01-03 11:36:00 +0100 |
| commit | 0090cd4e7a24bedeb24dfe5b3b55167ad74e231e (patch) | |
| tree | d639ae82ff2496eb2f73b063c4728f9c3d2b4cc2 /llvm/unittests/Support/TargetParserTest.cpp | |
| parent | 791523bae6153b13bb41ba05c9fc89e502cc4a1a (diff) | |
| download | llvm-0090cd4e7a24bedeb24dfe5b3b55167ad74e231e.zip llvm-0090cd4e7a24bedeb24dfe5b3b55167ad74e231e.tar.gz llvm-0090cd4e7a24bedeb24dfe5b3b55167ad74e231e.tar.bz2 | |
[clang-format] Support inheriting from more than 1 parents in the fallback case
Currently, we are unable to inherit from a chain of parent configs where the outermost parent config has `BasedOnStyle: InheritParentConfig` set. This patch adds a test case for this scenario, and adds support for it.
To illustrate, suppose we have the following directory structure:
```
- e/
|- .clang-format (BasedOnStyle: InheritParentConfig) <-- outermost config
|- sub/
|- .clang-format (BasedOnStyle: InheritParentConfig)
|- sub/
|- .clang-format (BasedOnStyle: InheritParentConfig)
|- code.cpp
```
Now consider what happens when we run `clang-format --style=file /e/sub/sub/code.cpp`.
Without this patch, on a release build, only the innermost config will be applied. On a debug build, clang-format crashes due to an assertion failure.
With this patch, clang-format behaves as we'd expect, applying all 3 configs.
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D116371
Diffstat (limited to 'llvm/unittests/Support/TargetParserTest.cpp')
0 files changed, 0 insertions, 0 deletions
