forked from OSchip/llvm-project
[LLParser][OpaquePtr] Support forward reference to unnamed function
With opaque pointers, we always create forward references as i8 globals, so it will not be Function here.
This commit is contained in:
parent
1c729d719a
commit
8fa45b826a
|
@ -5631,7 +5631,7 @@ bool LLParser::parseFunctionHeader(Function *&Fn, bool IsDefine) {
|
|||
// types agree.
|
||||
auto I = ForwardRefValIDs.find(NumberedVals.size());
|
||||
if (I != ForwardRefValIDs.end()) {
|
||||
FwdFn = cast<Function>(I->second.first);
|
||||
FwdFn = I->second.first;
|
||||
if (!FwdFn->getType()->isOpaque() && FwdFn->getType() != PFT)
|
||||
return error(NameLoc, "type of definition and forward reference of '@" +
|
||||
Twine(NumberedVals.size()) +
|
||||
|
|
|
@ -149,3 +149,15 @@ cleanup:
|
|||
define void @byval(ptr byval({ i32, i32 }) %0) {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @call_unnamed_fn() {
|
||||
; CHECK: call void @0()
|
||||
define void @call_unnamed_fn() {
|
||||
call void @0()
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @0() {
|
||||
define void @0() {
|
||||
ret void
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue