@@ -267,7 +267,7 @@ class SILLocation {
267
267
268
268
SILLocation (ExtendedASTNodeLoc *ext, LocationKind K)
269
269
: storage(ext), kindAndFlags(K, ExtendedASTNodeKind) {
270
- assert (ext && !ext->primary . isNull () && !ext-> forDebugging .isNull ());
270
+ assert (ext && !ext->forDebugging .isNull ());
271
271
}
272
272
273
273
SILLocation (SourceLoc L, LocationKind K)
@@ -299,9 +299,9 @@ class SILLocation {
299
299
// / Artificial locations and the top-level module locations will be null.
300
300
bool isNull () const {
301
301
switch (getStorageKind ()) {
302
- case ASTNodeKind: return storage. ASTNodeLoc . isNull ();
303
- case ExtendedASTNodeKind: return false ;
304
- case FilenameAndLocationKind: return storage.filePositionLoc == nullptr ;;
302
+ case ASTNodeKind:
303
+ case ExtendedASTNodeKind: return ! getPrimaryASTNode () ;
304
+ case FilenameAndLocationKind: return storage.filePositionLoc == nullptr ;
305
305
case SourceLocKind: return storage.sourceLoc .isInvalid ();
306
306
}
307
307
llvm_unreachable (" covered switch" );
@@ -344,12 +344,13 @@ class SILLocation {
344
344
345
345
// / Returns true if the location represents an artificially generated
346
346
// / body, such as thunks or default destructors.
347
- // /
348
- // / These locations should not be included in the debug line table.
349
- // / These might also need special handling by the debugger since they might
350
- // / contain calls, which the debugger could be able to step into.
351
347
bool isAutoGenerated () const { return kindAndFlags.fields .autoGenerated ; }
352
348
349
+ // / Returns false if the location should be represented in debuginfo.
350
+ bool isHiddenFromDebugInfo () const {
351
+ return isAutoGenerated () && !hasASTNodeForDebugging ();
352
+ }
353
+
353
354
// / Returns true if the line number of this location is zero.
354
355
bool isLineZero (const SourceManager &SM) const {
355
356
return decodeForDebugging (SM).line == 0 ;
@@ -454,6 +455,7 @@ class RegularLocation : public SILLocation {
454
455
RegularLocation (Decl *D) : SILLocation(ASTNodeTy(D), RegularKind) {}
455
456
RegularLocation (Pattern *P) : SILLocation(ASTNodeTy(P), RegularKind) {}
456
457
RegularLocation (Stmt *S, Pattern *P, SILModule &Module);
458
+ RegularLocation (SILLocation ForDebuggingOnly, SILModule &Module);
457
459
RegularLocation (SourceLoc L) : SILLocation(L, RegularKind) {}
458
460
RegularLocation (FilenameAndLocation *filePos)
459
461
: SILLocation(filePos, RegularKind) {}
@@ -485,12 +487,22 @@ class RegularLocation : public SILLocation {
485
487
return AL;
486
488
}
487
489
490
+ // / Returns a location that is empty for diagnostics, and L for the debug info
491
+ // / Used for \c hop_to_executor instructions.
492
+ static RegularLocation getDebugOnlyLocation (SILLocation L, SILModule &M) {
493
+ if (L.isASTNode ())
494
+ return RegularLocation (L, M);
495
+ return getAutoGeneratedLocation (L);
496
+ }
497
+
488
498
static bool isKind (const SILLocation& L) {
489
499
return L.getKind () == RegularKind;
490
500
}
491
501
492
502
private:
493
503
RegularLocation () : SILLocation(RegularKind) {}
504
+ static SILLocation::ExtendedASTNodeLoc *
505
+ getDebugOnlyExtendedASTNodeLoc (SILLocation L, SILModule &Module);
494
506
};
495
507
496
508
// / Used to represent a return instruction in user code.
0 commit comments