[PATCH] D23135: [clang-tidy] misc-argument-comment non-strict mode

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 07:22:41 PDT 2016

alexfh added inline comments.

Comment at: clang-tidy/misc/ArgumentCommentCheck.cpp:124
@@ +123,3 @@
+  InDecl = InDecl.trim('_');
+  return InComment.compare_lower(InDecl) == 0;
aaron.ballman wrote:
> Correct, which means this won't behave properly in some locales with UTF-8 identifiers. Consider Turkish, where İ (U+0130 “Latin Capital Letter I With Dot Above”) is the uppercase form of ı (U+0131 “Latin Small Letter Dotless I”). If the comment contains one version while the identifier contains the other, the comparison will currently fail, while a locale-aware comparison would succeed. You run into similar things with SS vs ß in German as well, where the uppercase form is two characters while the lowercase is only a single character.
Interesting, though it looks like there's now an official capital ẞ https://en.wikipedia.org/wiki/Capital_%E1%BA%9E (which is not frequently needed anyway, I guess).

At the end of the day, what we get is that the non-strict mode is currently somewhat stricter for non-ascii characters. Similar will happen with all other parts in LLVM that rely on `StringRef::compare_lower`. I don't think we need a separate test for this _here_, since it's a problem on a completely different level. And I guess the use non-ascii identifiers in C++ will cause much more serious problems than a slightly stricter clang-tidy warning ;]


More information about the cfe-commits mailing list