arphaman added inline comments.

================
Comment at: lib/Sema/SemaChecking.cpp:10304
   CharUnits SrcAlign = Context.getTypeAlignInChars(SrcPointee);
+  Expr *SE = nullptr;
+
----------------
NIT, but I think you don't need the extra variable and the `if (SE)` below if 
you extract the code inside `if (SE) {` into a static function that returns 
SrcAlign. Then the if/else below can be rewritten like:

```
  if (auto *CE = dyn_cast<CastExpr>(Op)) {
    if (CE->getCastKind() == CK_ArrayToPointerDecay)
      SrcAlign = newFunction(CE->getSubExpr(), Context);
  } else if (auto *UO = dyn_cast<UnaryOperator>(Op)) {
    if (UO->getOpcode() == UO_AddrOf)
      SrcAlign = newFunction(UO->getSubExpr(), Context);
  }
```


================
Comment at: lib/Sema/SemaChecking.cpp:10315
+  if (SE) {
+    if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(SE))
+      SrcAlign = Context.getDeclAlign(DRE->getDecl());
----------------
You can use `const auto` here.


================
Comment at: lib/Sema/SemaChecking.cpp:10317
+      SrcAlign = Context.getDeclAlign(DRE->getDecl());
+    else if (const MemberExpr *ME = dyn_cast<MemberExpr>(SE))
+      SrcAlign = Context.getDeclAlign(ME->getMemberDecl());
----------------
Same here.


https://reviews.llvm.org/D21099



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

Reply via email to