[PATCH] D33932: [clang-format] Add support for case-insensitive header matching and use it to improve support for LLVM-style include sorting.

Nikolaus Wittenstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 08:59:19 PDT 2019


adzenith added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I just came across this case-insensitive behavior when trying to regroup include blocks and it was surprising. I'm trying to put system headers after other angle-bracket includes (like for Qt), and I was trying:

  - Regex:           '^<[a-z_]*>'
    Priority:        5
  - Regex:           '^<[A-Za-z_]*>'
    Priority:        4

Unfortunately, `#include <QWidget>` matches the first regex and so Qt headers get sorted in with system headers. Would it be possible to add the option to do case-sensitive matching after all? Should I open a new issue?

For anyone else who wants case-sensitive matching, I just did discover that `(?-i)` seems to do the trick. I thought it wouldn't because the docs mention extended regex, but I guess it's more extended than I thought! Using `'(?-i)^<[a-z_]*>'` does the trick for me.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D33932/new/

https://reviews.llvm.org/D33932





More information about the llvm-commits mailing list