courbet created this revision.
courbet added reviewers: xazax.hun, alexfh.
Herald added subscribers: cfe-commits, rnkovacs.
Herald added a project: clang.

using CodePoint = uint32_t;
CodePoint cp;
casic_string<CodePoint> s;
s += cp;


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D58606

Files:
  clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp


Index: clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
===================================================================
--- clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
+++ clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
@@ -29,7 +29,9 @@
               hasTemplateArgument(0, 
refersToType(qualType().bind("type"))))))),
           hasArgument(1,
                       ignoringImpCasts(expr(hasType(isInteger()),
-                                            unless(hasType(isAnyCharacter())))
+                                            unless(hasType(isAnyCharacter())),
+                                            // Do not warn if assigning e.g. 
`CodePoint` to `basic_string<CodePoint>`
+                                            
unless(hasType(type(equalsBoundNode("type")))))
                                            .bind("expr"))),
           unless(isInTemplateInstantiation())),
       this);


Index: clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
===================================================================
--- clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
+++ clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
@@ -29,7 +29,9 @@
               hasTemplateArgument(0, refersToType(qualType().bind("type"))))))),
           hasArgument(1,
                       ignoringImpCasts(expr(hasType(isInteger()),
-                                            unless(hasType(isAnyCharacter())))
+                                            unless(hasType(isAnyCharacter())),
+                                            // Do not warn if assigning e.g. `CodePoint` to `basic_string<CodePoint>`
+                                            unless(hasType(type(equalsBoundNode("type")))))
                                            .bind("expr"))),
           unless(isInTemplateInstantiation())),
       this);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to