@@ -345,7 +345,7 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
345345 if (Loc.isInvalid ())
346346 return ;
347347
348- CurLoc = CGM.getContext ().getSourceManager ().getExpansionLoc (Loc);
348+ CurLoc = CGM.getContext ().getSourceManager ().getFileLoc (Loc);
349349
350350 // If we've changed files in the middle of a lexical scope go ahead
351351 // and create a new lexical scope with file node if it's different
@@ -572,7 +572,7 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
572572 FileName = TheCU->getFile ()->getFilename ();
573573 CSInfo = TheCU->getFile ()->getChecksum ();
574574 } else {
575- PresumedLoc PLoc = SM.getPresumedLoc (Loc);
575+ PresumedLoc PLoc = SM.getPresumedLoc (SM. getFileLoc ( Loc) );
576576 FileName = PLoc.getFilename ();
577577
578578 if (FileName.empty ()) {
@@ -599,7 +599,8 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
599599 if (CSKind)
600600 CSInfo.emplace (*CSKind, Checksum);
601601 }
602- return createFile (FileName, CSInfo, getSource (SM, SM.getFileID (Loc)));
602+ return createFile (FileName, CSInfo,
603+ getSource (SM, SM.getFileID (SM.getFileLoc (Loc))));
603604}
604605
605606llvm::DIFile *CGDebugInfo::createFile (
@@ -654,7 +655,7 @@ unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
654655 if (Loc.isInvalid ())
655656 return 0 ;
656657 SourceManager &SM = CGM.getContext ().getSourceManager ();
657- return SM.getPresumedLoc (Loc).getLine ();
658+ return SM.getPresumedLoc (SM. getFileLoc ( Loc) ).getLine ();
658659}
659660
660661unsigned CGDebugInfo::getColumnNumber (SourceLocation Loc, bool Force) {
@@ -666,7 +667,8 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) {
666667 if (Loc.isInvalid () && CurLoc.isInvalid ())
667668 return 0 ;
668669 SourceManager &SM = CGM.getContext ().getSourceManager ();
669- PresumedLoc PLoc = SM.getPresumedLoc (Loc.isValid () ? Loc : CurLoc);
670+ PresumedLoc PLoc =
671+ SM.getPresumedLoc (Loc.isValid () ? SM.getFileLoc (Loc) : CurLoc);
670672 return PLoc.isValid () ? PLoc.getColumn () : 0 ;
671673}
672674
@@ -5002,7 +5004,7 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) {
50025004 // Update our current location
50035005 setLocation (Loc);
50045006
5005- if (CurLoc.isInvalid () || CurLoc. isMacroID () || LexicalBlockStack.empty ())
5007+ if (CurLoc.isInvalid () || LexicalBlockStack.empty ())
50065008 return ;
50075009
50085010 llvm::MDNode *Scope = LexicalBlockStack.back ();
@@ -6278,7 +6280,8 @@ void CGDebugInfo::EmitGlobalAlias(const llvm::GlobalValue *GV,
62786280void CGDebugInfo::AddStringLiteralDebugInfo (llvm::GlobalVariable *GV,
62796281 const StringLiteral *S) {
62806282 SourceLocation Loc = S->getStrTokenLoc (0 );
6281- PresumedLoc PLoc = CGM.getContext ().getSourceManager ().getPresumedLoc (Loc);
6283+ SourceManager &SM = CGM.getContext ().getSourceManager ();
6284+ PresumedLoc PLoc = SM.getPresumedLoc (SM.getFileLoc (Loc));
62826285 if (!PLoc.isValid ())
62836286 return ;
62846287
0 commit comments