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)
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)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits