[PATCH] D112916: [clang-tidy] Confusable identifiers detection
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 14 04:15:04 PDT 2022
aaron.ballman added a comment.
In D112916#3554181 <https://reviews.llvm.org/D112916#3554181>, @tstellar wrote:
> In D112916#3554158 <https://reviews.llvm.org/D112916#3554158>, @Mordante wrote:
>
>> In D112916#3113140 <https://reviews.llvm.org/D112916#3113140>, @tstellar wrote:
>>
>>> The LLVM Board of Directors will do a legal review of this change. We will give an update in 4-6 weeks.
>>
>> @tstellar, is there an update from the LLVM Board of Directors regarding using Unicode data?
>> I'm implementing extended grapheme clustering in libc++ which requires using Unicode data.
>> Note that MSVC STL (which is using the same license as the LLVM project) already uses Unicode data in the following generated header
>> https://github.com/microsoft/STL/blob/main/stl/inc/__msvc_format_ucd_tables.hpp
>
> Yes, it's fine to include the unicode data.
@tstellar -- Do we have any license requirements we need to follow? @rsmith pointed out:
> (b) this copyright and permission notice appear in associated Documentation.
which sounds like we need to update one of our license files.
(I'll assume the same answer applies for the Unicode named escape sequences patch happening in Clang currently.)
================
Comment at: clang-tools-extra/clang-tidy/misc/Homoglyph.cpp:84
+ if (const auto *ND = Result.Nodes.getNodeAs<NamedDecl>("nameddecl")) {
+ if(IdentifierInfo * II = ND->getIdentifier()) {
+ StringRef NDName = II->getName();
----------------
(Formatting -- might just want to run clang-format over the patch.)
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-homoglyph.rst:6-10
+Warn about confusable identifiers, i.e. identifiers that are visually close to
+each other, but use different unicode characters. This detetcs potential attack
+as described in `Trojan Source <https://www.trojansource.codes>`_.
+
+Example:
----------------
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-homoglyph.rst:14-15
+
+ int fo;
+ int 𝐟o;
----------------
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112916/new/
https://reviews.llvm.org/D112916
More information about the cfe-commits
mailing list