Page MenuHomePhabricator

[AST][RecoveryExpr] Part1: Support dependent binary operator in C for error recovery.
Needs ReviewPublic

Authored by hokein on Jul 21 2020, 2:41 AM.

Details

Reviewers
sammccall
Summary

Introduce a new cc1 flag to enable build the dependent AST nodes for C.

see the whole view in: https://reviews.llvm.org/D85025

Diff Detail

Event Timeline

hokein created this revision.Jul 21 2020, 2:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2020, 2:41 AM
hokein marked an inline comment as done.Jul 21 2020, 2:44 AM
hokein added inline comments.
clang/lib/Sema/SemaExpr.cpp
14268

I think we probably need a new cc1 flag e.g. CDependenceType to control the typo-correction and whether we build dependent ast node for C.

hokein updated this revision to Diff 279751.Jul 22 2020, 3:16 AM

Add a cc1 flag to enable building dependent nodes in C.

hokein updated this revision to Diff 284358.Aug 10 2020, 7:19 AM
  • rebase;
  • add comments for CreateDependentBinOp, and make it private based on Richard's comment;
hokein edited the summary of this revision. (Show Details)Aug 10 2020, 7:20 AM
hokein retitled this revision from [AST][RecoveryExpr] Support dependent binary operator in C for error recovery. to [AST][RecoveryExpr] Support dependent binary operator in C for error recovery Part 1..Aug 17 2020, 4:02 AM
hokein retitled this revision from [AST][RecoveryExpr] Support dependent binary operator in C for error recovery Part 1. to [AST][RecoveryExpr] Part1: Support dependent binary operator in C for error recovery..Aug 17 2020, 4:05 AM
sammccall added inline comments.Fri, Sep 18, 3:21 AM
clang/include/clang/Basic/LangOptions.def
153

Why is this not just the RecoveryAST flag? Is there some use of dependence outside the error-handling path?

If the language is C, recovery-AST only works if this flag is on too. So they might as well always have the same value.
If the language is C++, this flag is meaningless, right?

sammccall added inline comments.Fri, Sep 18, 3:50 AM
clang/lib/Sema/SemaExpr.cpp
14255

I think we can do better on types here: for several binary operators the type is boolean in C regardless of operands. (except for vector types I think, but those might be rare enough to ignore in recovery)

14258

In C the result type is the unqualified type of the LHS

14260

I don't think we need to override the computation types, we can just leave them null?