baloghadamsoftware added inline comments.

================
Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:119
@@ -98,4 +118,3 @@
   if (Context.getIntWidth(CastType) == Context.getIntWidth(CalcType)) {
-    if (CalcType->isSpecificBuiltinType(BuiltinType::Int) ||
-        CalcType->isSpecificBuiltinType(BuiltinType::UInt)) {
-      // There should be a warning when casting from int to long or long long.
+    if (CalcType->isSpecificBuiltinType(BuiltinType::SChar) ||
+        CalcType->isSpecificBuiltinType(BuiltinType::UChar) ||
----------------
alexfh wrote:
> `isSpecificBuiltinType` is not the best tool here. Instead, we could get the 
> builtin type kinds and work with them 
> (`CalcType->getAs<BuiltinType>()->getKind()` and 
> `CastType->getAs<BuiltinType>()->getKind()` after checking that both are 
> `BuiltinTypes`).
I do not like it either, just reused the original code and copy-pasted it. I 
also think that getKind() should be used and instead of the long branches we 
could do the comparison using relative size table(s).


http://reviews.llvm.org/D17987



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to