[PATCH] D89946: [clang] Suppress "follow-up" diagnostics on recovery call expressions.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 03:40:16 PDT 2020


hokein created this revision.
hokein added reviewers: rsmith, sammccall.
Herald added a subscriber: kristof.beyls.
Herald added a project: clang.
hokein requested review of this revision.

Because of typo-correction, the AST can be transformed, and the transformed
AST is marginally useful for diagnostics purpose, the following
diagnostics usually do harm than good (easily cause confusions).

Given the following code:

  void abcc();
  void test() {
    if (abc());
    // diagnostic 1 (for the typo-correction): the typo is correct to `abcc()`, so the code is treate as `if (abcc())` in AST perspective;
    // diagnostic 2 (for mismatch type): we perform an type-analysis on `if`, discover the type is not match
  }

The secondary diagnostic "convertable to bool" is likely bogus to users.

The idea is to use RecoveryExpr (clang's dependent mechanism) to preserve the
recovery behavior but suppress all follow-up diagnostics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89946

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
  clang/test/Modules/submodules-merge-defs.cpp
  clang/test/SemaCXX/enable_if.cpp
  clang/test/SemaCXX/typo-correction-delayed.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89946.299916.patch
Type: text/x-patch
Size: 4894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201022/6e723938/attachment.bin>


More information about the cfe-commits mailing list