Skip to content

Commit 0d30020

Browse files
committed
Remove wrapper functions that added little value. (NFC)
1 parent f97b461 commit 0d30020

File tree

3 files changed

+14
-48
lines changed

3 files changed

+14
-48
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -863,26 +863,6 @@ void IRGenDebugInfo::emitTypeMetadata(IRGenFunction &IGF,
863863
DirectValue, ArtificialValue);
864864
}
865865

866-
void IRGenDebugInfo::emitStackVariableDeclaration(
867-
IRBuilder &B, ArrayRef<llvm::Value *> Storage, DebugTypeInfo DbgTy,
868-
const SILDebugScope *DS, StringRef Name, IndirectionKind Indirection) {
869-
emitVariableDeclaration(B, Storage, DbgTy, DS, Name, 0, Indirection,
870-
RealValue);
871-
}
872-
873-
void IRGenDebugInfo::emitArgVariableDeclaration(
874-
IRBuilder &Builder, ArrayRef<llvm::Value *> Storage, DebugTypeInfo DbgTy,
875-
const SILDebugScope *DS, StringRef Name, unsigned ArgNo,
876-
IndirectionKind Indirection, ArtificialKind IsArtificial) {
877-
assert(ArgNo > 0);
878-
if (Name == IGM.Context.Id_self.str())
879-
emitVariableDeclaration(Builder, Storage, DbgTy, DS, Name, ArgNo,
880-
DirectValue, ArtificialValue);
881-
else
882-
emitVariableDeclaration(Builder, Storage, DbgTy, DS, Name, ArgNo,
883-
Indirection, IsArtificial);
884-
}
885-
886866
/// Return the DIFile that is the ancestor of Scope.
887867
llvm::DIFile *IRGenDebugInfo::getFile(llvm::DIScope *Scope) {
888868
while (!isa<llvm::DIFile>(Scope)) {
@@ -985,6 +965,10 @@ void IRGenDebugInfo::emitVariableDeclaration(
985965
IRBuilder &Builder, ArrayRef<llvm::Value *> Storage, DebugTypeInfo DbgTy,
986966
const SILDebugScope *DS, StringRef Name, unsigned ArgNo,
987967
IndirectionKind Indirection, ArtificialKind Artificial) {
968+
// Self is always an artificial argument.
969+
if (ArgNo > 0 && Name == IGM.Context.Id_self.str())
970+
Artificial = ArtificialValue;
971+
988972
// FIXME: Make this an assertion.
989973
// assert(DS && "variable has no scope");
990974
if (!DS)

lib/IRGen/IRGenDebugInfo.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,6 @@ class IRGenDebugInfo {
201201
IndirectionKind = DirectValue,
202202
ArtificialKind = RealValue);
203203

204-
/// Convenience function for stack-allocated variables. Calls
205-
/// emitVariableDeclaration internally.
206-
void emitStackVariableDeclaration(IRBuilder &Builder,
207-
ArrayRef<llvm::Value *> Storage,
208-
DebugTypeInfo Ty, const SILDebugScope *DS,
209-
StringRef Name,
210-
IndirectionKind Indirection = DirectValue);
211-
212-
/// Convenience function for variables that are function arguments.
213-
void emitArgVariableDeclaration(IRBuilder &Builder,
214-
ArrayRef<llvm::Value *> Storage,
215-
DebugTypeInfo Ty, const SILDebugScope *DS,
216-
StringRef Name, unsigned ArgNo,
217-
IndirectionKind = DirectValue,
218-
ArtificialKind = RealValue);
219-
220204
/// Emit a dbg.declare or dbg.value intrinsic, depending on Storage.
221205
void emitDbgIntrinsic(llvm::BasicBlock *BB, llvm::Value *Storage,
222206
llvm::DILocalVariable *Var, llvm::DIExpression *Expr,

lib/IRGen/IRGenSIL.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,11 @@ class IRGenSILFunction :
553553
assert(IGM.DebugInfo && "debug info not enabled");
554554
if (ArgNo) {
555555
PrologueLocation AutoRestore(IGM.DebugInfo, Builder);
556-
IGM.DebugInfo->emitArgVariableDeclaration(Builder, Storage, Ty, DS, Name,
557-
ArgNo, Indirection);
556+
IGM.DebugInfo->emitVariableDeclaration(Builder, Storage, Ty, DS, Name,
557+
ArgNo, Indirection);
558558
} else
559-
IGM.DebugInfo->emitStackVariableDeclaration(Builder, Storage, Ty, DS,
560-
Name, Indirection);
559+
IGM.DebugInfo->emitVariableDeclaration(Builder, Storage, Ty, DS, Name, 0,
560+
Indirection);
561561
}
562562

563563
void emitFailBB() {
@@ -1424,10 +1424,9 @@ void IRGenSILFunction::emitFunctionArgDebugInfo(SILBasicBlock *BB) {
14241424
// other argument. It is only used for sorting.
14251425
unsigned ArgNo =
14261426
countArgs(CurSILFn->getDeclContext()) + 1 + BB->getBBArgs().size();
1427-
IGM.DebugInfo->emitArgVariableDeclaration(
1427+
IGM.DebugInfo->emitVariableDeclaration(
14281428
Builder, emitShadowCopy(ErrorResultSlot.getAddress(), Name), DTI,
1429-
getDebugScope(), Name, ArgNo,
1430-
IndirectValue, ArtificialValue);
1429+
getDebugScope(), Name, ArgNo, IndirectValue, ArtificialValue);
14311430
}
14321431
}
14331432

@@ -3431,11 +3430,10 @@ void IRGenSILFunction::visitAllocBoxInst(swift::AllocBoxInst *i) {
34313430
Decl->getType()->getKind() == TypeKind::InOut)
34323431
Indirection = DirectValue;
34333432

3434-
IGM.DebugInfo->emitStackVariableDeclaration
3435-
(Builder,
3436-
emitShadowCopy(addr.getAddress(), Name),
3437-
DebugTypeInfo(Decl, i->getElementType().getSwiftType(), type),
3438-
i->getDebugScope(), Name, Indirection);
3433+
IGM.DebugInfo->emitVariableDeclaration(
3434+
Builder, emitShadowCopy(addr.getAddress(), Name),
3435+
DebugTypeInfo(Decl, i->getElementType().getSwiftType(), type),
3436+
i->getDebugScope(), Name, 0, Indirection);
34393437
}
34403438
}
34413439

0 commit comments

Comments
 (0)