This is an archive of the discontinued LLVM Phabricator instance.

[AST][RecoveryExpr] Preserve the AST for invalid class constructions.
ClosedPublic

Authored by hokein on Jun 3 2020, 6:02 AM.

Diff Detail

Event Timeline

hokein created this revision.Jun 3 2020, 6:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2020, 6:02 AM
hokein updated this revision to Diff 268180.Jun 3 2020, 7:02 AM

Avoid creating a recovery-expr when typo-correction fails, which will lead to
a typoexpr being corrected twice and crashes.

hokein added a comment.Jun 3 2020, 7:05 AM

Tested with turning on -frecovery-ast, 3 failures, all of them are diagnostic improvements!

FAIL: Clang :: SemaCXX/constant-expression-cxx11.cpp (10868 of 18440)
******************** TEST 'Clang :: SemaCXX/constant-expression-cxx11.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   /workspace/llvm-project/build/bin/clang -cc1 -internal-isystem /workspace/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic /workspace/llvm-project/clang/test/SemaCXX/constant-expression-cxx11.cpp -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
--
Exit Code: 1

Command Output (stderr):
--
error: 'warning' diagnostics expected but not seen: 
  File /workspace/llvm-project/clang/test/SemaCXX/constant-expression-cxx11.cpp Line 2050: initialize all members
error: 'note' diagnostics expected but not seen: 
  File /workspace/llvm-project/clang/test/SemaCXX/constant-expression-cxx11.cpp Line 2053: not initialized
2 errors generated.

--

********************
FAIL: Clang :: SemaCXX/cxx0x-initializer-constructor.cpp (10884 of 18440)
******************** TEST 'Clang :: SemaCXX/cxx0x-initializer-constructor.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   /workspace/llvm-project/build/bin/clang -cc1 -internal-isystem /workspace/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -std=c++0x -fsyntax-only -fexceptions -verify /workspace/llvm-project/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
--
Exit Code: 1

Command Output (stderr):
--
error: 'error' diagnostics seen but not expected: 
  File /workspace/llvm-project/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp Line 166: expected ';' after expression
1 error generated.

--

********************
FAIL: Clang :: SemaCXX/cxx1z-copy-omission.cpp (10915 of 18440)
******************** TEST 'Clang :: SemaCXX/cxx1z-copy-omission.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   /workspace/llvm-project/build/bin/clang -cc1 -internal-isystem /workspace/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -std=c++1z -verify -Wno-unused /workspace/llvm-project/clang/test/SemaCXX/cxx1z-copy-omission.cpp
--
Exit Code: 1

Command Output (stderr):
--
error: 'error' diagnostics seen but not expected: 
  File /workspace/llvm-project/clang/test/SemaCXX/cxx1z-copy-omission.cpp Line 109: you need to include <typeinfo> before using the 'typeid' operator
1 error generated.

--

********************
********************
Failing Tests (3):
  Clang :: SemaCXX/constant-expression-cxx11.cpp
  Clang :: SemaCXX/cxx0x-initializer-constructor.cpp
  Clang :: SemaCXX/cxx1z-copy-omission.cpp
sammccall accepted this revision.Jun 3 2020, 7:37 AM

Awesome!

/workspace/llvm-project/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp Line 166: expected ';' after expression

This is just a previously-uncaught typo in the test, you may want to fix that either now or when flipping the flag.

This revision is now accepted and ready to land.Jun 3 2020, 7:37 AM
hokein updated this revision to Diff 270402.Jun 12 2020, 7:47 AM

rebase to master and adjust the diagnostic tests after "-frecovery-ast" is flipped on.

This revision was automatically updated to reflect the committed changes.