@@ -1948,21 +1948,13 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
1948
1948
if (CGM.supportsCOMDAT ())
1949
1949
Fn->setComdat (CGM.getModule ().getOrInsertComdat (FuncName));
1950
1950
1951
- IdentifierInfo *II = &C.Idents .get (FuncName);
1952
-
1953
1951
SmallVector<QualType, 2 > ArgTys;
1954
1952
ArgTys.push_back (C.VoidPtrTy );
1955
1953
ArgTys.push_back (C.VoidPtrTy );
1956
- QualType FunctionTy = C.getFunctionType (ReturnTy, ArgTys, {});
1957
1954
1958
- FunctionDecl *FD = FunctionDecl::Create (
1959
- C, C.getTranslationUnitDecl (), SourceLocation (), SourceLocation (), II,
1960
- FunctionTy, nullptr , SC_Static, false , false );
1961
1955
setBlockHelperAttributesVisibility (blockInfo.CapturesNonExternalType , Fn, FI,
1962
1956
CGM);
1963
- // This is necessary to avoid inheriting the previous line number.
1964
- FD->setImplicit ();
1965
- StartFunction (FD, ReturnTy, Fn, FI, args);
1957
+ StartFunction (GlobalDecl (), ReturnTy, Fn, FI, args);
1966
1958
auto AL = ApplyDebugLocation::CreateArtificial (*this );
1967
1959
1968
1960
llvm::Type *structPtrTy = blockInfo.StructureType ->getPointerTo ();
@@ -2143,21 +2135,12 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
2143
2135
if (CGM.supportsCOMDAT ())
2144
2136
Fn->setComdat (CGM.getModule ().getOrInsertComdat (FuncName));
2145
2137
2146
- IdentifierInfo *II = &C.Idents .get (FuncName);
2147
-
2148
2138
SmallVector<QualType, 1 > ArgTys;
2149
2139
ArgTys.push_back (C.VoidPtrTy );
2150
- QualType FunctionTy = C.getFunctionType (ReturnTy, ArgTys, {});
2151
-
2152
- FunctionDecl *FD = FunctionDecl::Create (
2153
- C, C.getTranslationUnitDecl (), SourceLocation (), SourceLocation (), II,
2154
- FunctionTy, nullptr , SC_Static, false , false );
2155
2140
2156
2141
setBlockHelperAttributesVisibility (blockInfo.CapturesNonExternalType , Fn, FI,
2157
2142
CGM);
2158
- // This is necessary to avoid inheriting the previous line number.
2159
- FD->setImplicit ();
2160
- StartFunction (FD, ReturnTy, Fn, FI, args);
2143
+ StartFunction (GlobalDecl (), ReturnTy, Fn, FI, args);
2161
2144
markAsIgnoreThreadCheckingAtRuntime (Fn);
2162
2145
2163
2146
auto AL = ApplyDebugLocation::CreateArtificial (*this );
@@ -2395,21 +2378,13 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
2395
2378
llvm::Function::Create (LTy, llvm::GlobalValue::InternalLinkage,
2396
2379
" __Block_byref_object_copy_" , &CGF.CGM .getModule ());
2397
2380
2398
- IdentifierInfo *II
2399
- = &Context.Idents .get (" __Block_byref_object_copy_" );
2400
-
2401
2381
SmallVector<QualType, 2 > ArgTys;
2402
2382
ArgTys.push_back (Context.VoidPtrTy );
2403
2383
ArgTys.push_back (Context.VoidPtrTy );
2404
- QualType FunctionTy = Context.getFunctionType (ReturnTy, ArgTys, {});
2405
-
2406
- FunctionDecl *FD = FunctionDecl::Create (
2407
- Context, Context.getTranslationUnitDecl (), SourceLocation (),
2408
- SourceLocation (), II, FunctionTy, nullptr , SC_Static, false , false );
2409
2384
2410
2385
CGF.CGM .SetInternalFunctionAttributes (GlobalDecl (), Fn, FI);
2411
2386
2412
- CGF.StartFunction (FD , ReturnTy, Fn, FI, args);
2387
+ CGF.StartFunction (GlobalDecl () , ReturnTy, Fn, FI, args);
2413
2388
2414
2389
if (generator.needsCopy ()) {
2415
2390
llvm::Type *byrefPtrType = byrefInfo.Type ->getPointerTo (0 );
@@ -2471,20 +2446,12 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
2471
2446
" __Block_byref_object_dispose_" ,
2472
2447
&CGF.CGM .getModule ());
2473
2448
2474
- IdentifierInfo *II
2475
- = &Context.Idents .get (" __Block_byref_object_dispose_" );
2476
-
2477
2449
SmallVector<QualType, 1 > ArgTys;
2478
2450
ArgTys.push_back (Context.VoidPtrTy );
2479
- QualType FunctionTy = Context.getFunctionType (R, ArgTys, {});
2480
-
2481
- FunctionDecl *FD = FunctionDecl::Create (
2482
- Context, Context.getTranslationUnitDecl (), SourceLocation (),
2483
- SourceLocation (), II, FunctionTy, nullptr , SC_Static, false , false );
2484
2451
2485
2452
CGF.CGM .SetInternalFunctionAttributes (GlobalDecl (), Fn, FI);
2486
2453
2487
- CGF.StartFunction (FD , R, Fn, FI, args);
2454
+ CGF.StartFunction (GlobalDecl () , R, Fn, FI, args);
2488
2455
2489
2456
if (generator.needsDispose ()) {
2490
2457
Address addr = CGF.GetAddrOfLocalVar (&Src);
0 commit comments