@@ -2134,10 +2134,6 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
2134
2134
IRBuilder &Builder, ArrayRef<llvm::Value *> Storage, DebugTypeInfo DbgTy,
2135
2135
const SILDebugScope *DS, ValueDecl *VarDecl, StringRef Name, unsigned ArgNo,
2136
2136
IndirectionKind Indirection, ArtificialKind Artificial) {
2137
- // Self is always an artificial argument.
2138
- if (ArgNo > 0 && Name == IGM.Context .Id_self .str ())
2139
- Artificial = ArtificialValue;
2140
-
2141
2137
// FIXME: Make this an assertion.
2142
2138
// assert(DS && "variable has no scope");
2143
2139
if (!DS)
@@ -2169,10 +2165,15 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
2169
2165
assert (DITy && " could not determine debug type of variable" );
2170
2166
2171
2167
unsigned Line = Loc.Line ;
2168
+
2169
+ // Self is always an artificial argument, so are variables without location.
2170
+ if (!Line || (ArgNo > 0 && Name == IGM.Context .Id_self .str ()))
2171
+ Artificial = ArtificialValue;
2172
+
2172
2173
llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
2173
2174
if (Artificial || DITy->isArtificial () || DITy == InternalType)
2174
2175
Flags |= llvm::DINode::FlagArtificial;
2175
-
2176
+
2176
2177
// This could be Opts.Optimize if we would also unique DIVariables here.
2177
2178
bool Optimized = false ;
2178
2179
// Create the descriptor for the variable.
0 commit comments