-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checked information for compound statements to AST reading/writing (
#716) * Add compound block checked information to ASTWriterStmt and ASTReaderStmt * Add tests for pch checked scope AST
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 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,37 @@ | ||
// Tests for serialization/deserialization of checked scopes. | ||
// This makes sure AST serialization/deserialization accounts for | ||
// checked scope specifiers and written checked scope specifiers. | ||
// | ||
// RUN: %clang_cc1 -fcheckedc-extension -emit-pch -o %t %S/ast-dump-pch.h | ||
// RUN: %clang_cc1 -fcheckedc-extension -ast-dump-all -include-pch %t %s | FileCheck %s | ||
|
||
// CHECK: FunctionDecl | ||
// CHECK: f1 | ||
// CHECK-NEXT: CompoundStmt | ||
// CHECK-NOT: {{_Checked|_Unchecked|checking-state}} | ||
// CHECK-NEXT: CompoundStmt | ||
// CHECK: _Checked checking-state bounds-and-types | ||
// CHECK: CompoundStmt | ||
// CHECK: _Checked _Bounds_only checking-state bounds | ||
// CHECK: CompoundStmt | ||
// CHECK: _Unchecked | ||
// CHECK: CompoundStmt | ||
// CHECK-NOT: {{_Checked|_Unchecked|checking-state}} | ||
|
||
// CHECK-NEXT: FunctionDecl | ||
// CHECK: f2 | ||
// CHECK-NEXT: CompoundStmt | ||
// CHECK: _Checked checking-state bounds-and-types | ||
|
||
// CHECK-NEXT: FunctionDecl | ||
// CHECK: f3 | ||
// CHECK-NEXT: CompoundStmt | ||
// CHECK: _Checked _Bounds_only checking-state bounds | ||
|
||
// CHECK-NEXT: FunctionDecl | ||
// CHECK: f4 | ||
// CHECK-NEXT: CompoundStmt | ||
// CHECK: _Unchecked | ||
// CHECK-NOT {{checking-state}} | ||
|
||
// TODO: GitHub issue #704: add function declarations with checked scope specifiers |
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,16 @@ | ||
// Used with the ast-dump-pch.c test | ||
|
||
void f1(void) { | ||
_Checked { int a = 0; } | ||
_Checked _Bounds_only {int b = 0; } | ||
_Unchecked {} | ||
{} | ||
} | ||
|
||
void f2(void) _Checked {} | ||
|
||
void f3(void) _Checked _Bounds_only {} | ||
|
||
void f4(void) _Unchecked {} | ||
|
||
// TODO: GitHub issue #704: add function declarations with checked scope specifiers |