@@ -267,7 +267,7 @@ class SILLocation {
267267
268268 SILLocation (ExtendedASTNodeLoc *ext, LocationKind K)
269269 : storage(ext), kindAndFlags(K, ExtendedASTNodeKind) {
270- assert (ext && !ext->primary . isNull () && !ext-> forDebugging .isNull ());
270+ assert (ext && !ext->forDebugging .isNull ());
271271 }
272272
273273 SILLocation (SourceLoc L, LocationKind K)
@@ -299,9 +299,9 @@ class SILLocation {
299299 // / Artificial locations and the top-level module locations will be null.
300300 bool isNull () const {
301301 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 ;
305305 case SourceLocKind: return storage.sourceLoc .isInvalid ();
306306 }
307307 llvm_unreachable (" covered switch" );
@@ -344,12 +344,13 @@ class SILLocation {
344344
345345 // / Returns true if the location represents an artificially generated
346346 // / 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.
351347 bool isAutoGenerated () const { return kindAndFlags.fields .autoGenerated ; }
352348
349+ // / Returns false if the location should be represented in debuginfo.
350+ bool isHiddenFromDebugInfo () const {
351+ return isAutoGenerated () && !hasASTNodeForDebugging ();
352+ }
353+
353354 // / Returns true if the line number of this location is zero.
354355 bool isLineZero (const SourceManager &SM) const {
355356 return decodeForDebugging (SM).line == 0 ;
@@ -454,6 +455,7 @@ class RegularLocation : public SILLocation {
454455 RegularLocation (Decl *D) : SILLocation(ASTNodeTy(D), RegularKind) {}
455456 RegularLocation (Pattern *P) : SILLocation(ASTNodeTy(P), RegularKind) {}
456457 RegularLocation (Stmt *S, Pattern *P, SILModule &Module);
458+ RegularLocation (SILLocation ForDebuggingOnly, SILModule &Module);
457459 RegularLocation (SourceLoc L) : SILLocation(L, RegularKind) {}
458460 RegularLocation (FilenameAndLocation *filePos)
459461 : SILLocation(filePos, RegularKind) {}
@@ -485,12 +487,22 @@ class RegularLocation : public SILLocation {
485487 return AL;
486488 }
487489
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+
488498 static bool isKind (const SILLocation& L) {
489499 return L.getKind () == RegularKind;
490500 }
491501
492502private:
493503 RegularLocation () : SILLocation(RegularKind) {}
504+ static SILLocation::ExtendedASTNodeLoc *
505+ getDebugOnlyExtendedASTNodeLoc (SILLocation L, SILModule &Module);
494506};
495507
496508// / Used to represent a return instruction in user code.
0 commit comments