Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeclPrinter] Fix two cases that crash clang -ast-print.
Both are related to handling anonymous structures. * clang didn't handle () around an anonymous struct variable. * clang also crashed on syntax errors that could lead to other syntactic constructs following the declaration of an anonymous struct. While the code is invalid, that's not a good reason to panic compiler. Differential Revision: https://reviews.llvm.org/D41788 llvm-svn: 322742
- Loading branch information
Showing
3 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: not %clang_cc1 -triple %ms_abi_triple -ast-print %s -std=gnu++11 \ | ||
// RUN: | FileCheck %s | ||
|
||
// The test compiles a file with a syntax error which used to cause a crash with | ||
// -ast-print. Compilation fails due to the syntax error, but compiler should | ||
// not crash and print out whatever it manager to parse. | ||
|
||
// CHECK: struct { | ||
// CHECK-NEXT: } dont_crash_on_syntax_error; | ||
// CHECK-NEXT: decltype(nullptr) p; | ||
struct { | ||
} dont_crash_on_syntax_error /* missing ; */ decltype(nullptr) p; |