mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-02 08:45:55 +00:00
Add a lint check for an indirectbr destination which has not
had its address taken. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
20d8e4e7aa
commit
61556e3a94
@ -521,6 +521,12 @@ void Lint::visitIndirectBrInst(IndirectBrInst &I) {
|
||||
|
||||
Assert1(I.getNumDestinations() != 0,
|
||||
"Undefined behavior: indirectbr with no destinations", &I);
|
||||
|
||||
for (unsigned i = 0, e = I.getNumDestinations(); i != e; ++i)
|
||||
Assert1(I.getDestination(i)->hasAddressTaken(),
|
||||
"Unusual: indirectbr destination has not "
|
||||
"had its address taken",
|
||||
&I);
|
||||
}
|
||||
|
||||
void Lint::visitExtractElementInst(ExtractElementInst &I) {
|
||||
|
@ -102,6 +102,7 @@ define void @not_vararg(i8* %p) nounwind {
|
||||
}
|
||||
|
||||
; CHECK: Undefined behavior: Branch to non-blockaddress
|
||||
; CHECK: Unusual: indirectbr destination has not had its address taken
|
||||
define void @use_indbr() {
|
||||
indirectbr i8* bitcast (i32()* @foo to i8*), [label %block]
|
||||
block:
|
||||
|
Loading…
x
Reference in New Issue
Block a user