[PATCH] D15324: [Sema] Emit warnings when comparing result of a function with `returns_nonnull` to null

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 12:21:20 PST 2015


aaron.ballman accepted this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Thank you for this, LGTM!


================
Comment at: lib/Sema/SemaChecking.cpp:7682
@@ +7681,3 @@
+      if (Callee->hasAttr<ReturnsNonNullAttr>()) {
+        ComplainAboutNonnullParamOrCall(false);
+        return;
----------------
Oops, I didn't notice that the function returns void, sorry about that. I also didn't notice that early return here is the correct thing because we're only checking one expression at a time within this function.


http://reviews.llvm.org/D15324





More information about the cfe-commits mailing list