[PATCH] D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 14:46:18 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/CodeGen/CGExprScalar.cpp:979-1003
+bool ScalarExprEmitter::IsTopCastPartOfExplictCast() {
+  assert(!CastExprStack.empty());
+  // Walk the current stack of CastExprs in reverse order.
+  // That is, the current CastExpr, which is the top()/back() one,
+  // will be processed first.
+  const CastExpr *PreviousCast = nullptr;
+  for (auto CastRef : llvm::reverse(CastExprStack)) {
----------------
Based on IRC disscussion with @rsmith, it seems this should be just `return !Cast->getIsPartOfExplicitCast();` (and inline it), and no need for the `CastExprStack` and stuff.


Repository:
  rC Clang

https://reviews.llvm.org/D48958





More information about the cfe-commits mailing list