-
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.
Calls to polymorphic functions in macros no longer fail an assert (#480)
* change assert to consistency fail(macro) * remove checked regions around inconsistent function calls; fix logic error * add macro check * don't add type params if they're all inconsistant * add test * remove commented code * allow existing macro type params to be valid * minor efficientcy * use more appropriate rewrite check
- Loading branch information
1 parent
a09a543
commit 04b08f0
Showing
7 changed files
with
120 additions
and
53 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
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
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,48 @@ | ||
// RUN: rm -rf %t* | ||
// RUN: 3c -base-dir=%S -addcr -alltypes %s -- | FileCheck -match-full-lines %s | ||
// RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines %s | ||
// RUN: 3c -base-dir=%S -addcr %s -- | %clang -c -fcheckedc-extension -x c -o %t1.unused - | ||
|
||
// Test for invalid type arguments from a macro, | ||
// recognized also my checked regions | ||
|
||
#define baz foo<int>(i); | ||
#define buz foo(i); | ||
#define buzzy foo(i); foo(j); | ||
|
||
_Itype_for_any(T) void foo(void *x : itype(_Ptr<T>)); | ||
|
||
void test_none() { | ||
int *i = 0; | ||
foo(i); | ||
} | ||
// CHECK: void test_none() _Checked { | ||
// CHECK: _Ptr<int> i = 0; | ||
// CHECK: foo<int>(i); | ||
|
||
void test_one_given() { | ||
int *i = 0; | ||
baz | ||
} | ||
// CHECK: void test_one_given() _Checked { | ||
// CHECK: _Ptr<int> i = 0; | ||
|
||
void test_one() { | ||
int *i = 0; | ||
buz | ||
} | ||
// CHECK: void test_one() { | ||
// CHECK: int *i = 0; | ||
// CHECK: buz | ||
|
||
void test_two() { | ||
int *i = 0; | ||
int *j = 0; | ||
buzzy | ||
} | ||
|
||
// CHECK: void test_two() { | ||
// CHECK: int *i = 0; | ||
// CHECK: int *j = 0; | ||
// CHECK: buzzy | ||
|