Sema::CheckCastAlign currently ignores the aligned attribute attached to the declared variables, which causes clang to issue spurious warnings. This patch fixes the bug.
Details
Diff Detail
Event Timeline
| lib/Sema/SemaChecking.cpp | ||
|---|---|---|
| 10311 | 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);
} | |
| 10322 | You can use const auto here. | |
| 10324 | Same here. | |
| lib/Sema/SemaChecking.cpp | ||
|---|---|---|
| 10270 | I'm not sure if you can, since I don't really know CharUnits, but I think you should just return it instead of passing it as a parameter if it's a POD type (if you will end up doing that you should rename this function as well). | |
| 10270 | Please add a brief doc comment as well. | |
I'm not sure if you can, since I don't really know CharUnits, but I think you should just return it instead of passing it as a parameter if it's a POD type (if you will end up doing that you should rename this function as well).