[PATCH] D74116: [Sema][C++] Propagate conversion type in order to specialize the diagnostics
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 19 12:14:55 PST 2020
Anastasia marked an inline comment as done.
Anastasia added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:14829
+ if (getLangOpts().CPlusPlus)
+ isInvalid = true;
break;
----------------
rjmccall wrote:
> Could you hoist this up to the place where we pick the diagnostic and then make it unconditional in the path that always selects an error?
>
> That's a general comment: we should be setting `isInvalid` for all the places below where we select an error diagnostic.
> That's a general comment: we should be setting isInvalid for all the places below where we select an error diagnostic.
If I change to set `isInvalid` for all error cases I get less diagnostics. I guess it's because we now stop earlier and don't continue to diagnosing in some cases.
```
FAIL: Clang :: Sema/block-call.c (9327 of 16808)
******************** TEST 'Clang :: Sema/block-call.c' FAILED ********************
Script:
--
: 'RUN: at line 1'; /data/llvm/llvm-forcommits/build/bin/clang -cc1 -internal-isystem /data/llvm/llvm-forcommits/build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify /data/llvm/llvm-forcommits/clang/test/Sema/block-call.c -fblocks
--
Exit Code: 1
Command Output (stderr):
--
error: 'error' diagnostics expected but not seen:
File /data/llvm/llvm-forcommits/clang/test/Sema/block-call.c Line 36: invalid block pointer conversion assigning to 'int *(^)()' from 'int'
1 error generated.
--
********************
FAIL: Clang :: SemaObjC/arc.m (10804 of 16808)
******************** TEST 'Clang :: SemaObjC/arc.m' FAILED ********************
Script:
--
: 'RUN: at line 1'; /data/llvm/llvm-forcommits/build/bin/clang -cc1 -internal-isystem /data/llvm/llvm-forcommits/build/lib/clang/11.0.0/include -nostdsysteminc -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class /data/llvm/llvm-forcommits/clang/test/SemaObjC/arc.m
: 'RUN: at line 2'; not /data/llvm/llvm-forcommits/build/bin/clang -cc1 -internal-isystem /data/llvm/llvm-forcommits/build/lib/clang/11.0.0/include -nostdsysteminc -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -Wno-objc-root-class -fdiagnostics-parseable-fixits /data/llvm/llvm-forcommits/clang/test/SemaObjC/arc.m 2>&1
--
Exit Code: 1
Command Output (stderr):
--
error: 'error' diagnostics expected but not seen:
File /data/llvm/llvm-forcommits/clang/test/SemaObjC/arc.m Line 117: assigning '__strong id *' to '__autoreleasing id *' changes retain/release properties of pointer
1 error generated.
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74116/new/
https://reviews.llvm.org/D74116
More information about the cfe-commits
mailing list