[PATCH] D23657: Remove some false positives when taking the address of packed members

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 09:29:44 PST 2016


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Some minor changes then this looks good to go.



================
Comment at: lib/Sema/SemaChecking.cpp:11348-11350
+  // Not the scope of this diagnostic.
+  if (!AnyIsPacked)
+    return;
----------------
Move this to immediately after the loop.


================
Comment at: lib/Sema/SemaChecking.cpp:11367
+  // Compute the EffectiveAlignment as the alignment of the whole chain.
+  CharUnits EffectiveAlignment = Context.getTypeAlignInChars(
+      ReverseMemberChain.back()->getParent()->getTypeForDecl());
----------------
I think this would be a lot clearer as `CompleteObjectAlignment` or something like that.


================
Comment at: lib/Sema/SemaChecking.cpp:11383
+      // lower than the expected expression alignment.
+      || EffectiveAlignment < ExpectedAlignment) {
+    // If this happens, we want to determine a sensible culprit of this.
----------------
`||` should go on the previous line.


https://reviews.llvm.org/D23657





More information about the cfe-commits mailing list