diff options
author | Jino Park <pjessesco@gmail.com> | 2022-01-20 08:42:19 +0100 |
---|---|---|
committer | Marek Kurdej <marek.kurdej+llvm.org@gmail.com> | 2022-01-20 08:59:04 +0100 |
commit | 560eb2277bb5aea0982ce5f90321788cda3fe4b3 (patch) | |
tree | 3c9f0edeb6dc0daa42a2ae5116a679700c686bff /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | 8eae99dfe5411707605250d32a735d7b16453a55 (diff) | |
download | llvm-560eb2277bb5aea0982ce5f90321788cda3fe4b3.zip llvm-560eb2277bb5aea0982ce5f90321788cda3fe4b3.tar.gz llvm-560eb2277bb5aea0982ce5f90321788cda3fe4b3.tar.bz2 |
[clang-format] Fix bug in parsing `operator<` with template
Fixes https://github.com/llvm/llvm-project/issues/44601.
This patch handles a bug when parsing a below example code :
```
template <class> class S;
template <class T> bool operator<(S<T> const &x, S<T> const &y) {
return x.i < y.i;
}
template <class T> class S {
int i = 42;
friend bool operator< <>(S const &, S const &);
};
int main() { return S<int>{} < S<int>{}; }
```
which parse `< <>` as `<< >`, not `< <>` in terms of tokens as discussed in discord.
1. Add a condition in `tryMergeLessLess()` considering `operator` keyword and `>`
2. Force to leave a whitespace between `tok::less` and a template opener
3. Add unit test
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D117398
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
0 files changed, 0 insertions, 0 deletions