[PATCH] D38718: Patch to Bugzilla 20951

Erik Viktorsson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 03:42:38 PDT 2017


erikv created this revision.

Submitting a patch to Bugzilla 20951.

Simply replaced the function call IgnoreImpCasts to IgnoreParenImpCasts which seems to more appropriate.
I also had to modify a test cast in test/Sema/conditional-expr.c

/E


https://reviews.llvm.org/D38718

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/conditional-expr.c


Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9933,7 +9933,7 @@
         IsInAnyMacroBody(SM, Range.getBegin()))
       return;
   }
-  E = E->IgnoreImpCasts();
+  E = E->IgnoreParenImpCasts();
 
   const bool IsCompare = NullKind != Expr::NPCK_NotNull;
 
Index: test/Sema/conditional-expr.c
===================================================================
--- test/Sema/conditional-expr.c
+++ test/Sema/conditional-expr.c
@@ -79,9 +79,9 @@
   (test0 ? (test0 ? adr2 : adr2) : nonconst_int); // expected-warning {{pointer type mismatch}} expected-warning {{expression result unused}}
 }
 
-int Postgresql() {
-  char x;
-  return ((((&x) != ((void *) 0)) ? (*(&x) = ((char) 1)) : (void) ((void *) 0)), (unsigned long) ((void *) 0)); // expected-warning {{C99 forbids conditional expressions with only one void side}}
+int Postgresql(char *x) {
+  //char x;
+  return (((x != ((void *) 0)) ? (*x = ((char) 1)) : (void) ((void *) 0)), (unsigned long) ((void *) 0)); // expected-warning {{C99 forbids conditional expressions with only one void side}}
 }
 
 #define nil ((void*) 0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38718.118339.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171010/d4ca5b5b/attachment.bin>


More information about the cfe-commits mailing list