Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
if (Loc.isInvalid())
return;

CurLoc = CGM.getContext().getSourceManager().getFileLoc(Loc);
CurLoc = Loc;

// If we've changed files in the middle of a lexical scope go ahead
// and create a new lexical scope with file node if it's different
Expand Down Expand Up @@ -571,8 +571,9 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
// with an absolute path.
FileName = TheCU->getFile()->getFilename();
CSInfo = TheCU->getFile()->getChecksum();
FID = SM.getFileID(Loc);
} else {
PresumedLoc PLoc = SM.getPresumedLoc(SM.getFileLoc(Loc));
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
FileName = PLoc.getFilename();

if (FileName.empty()) {
Expand All @@ -599,8 +600,7 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
if (CSKind)
CSInfo.emplace(*CSKind, Checksum);
}
return createFile(FileName, CSInfo,
getSource(SM, SM.getFileID(SM.getFileLoc(Loc))));
return createFile(FileName, CSInfo, getSource(SM, FID));
}

llvm::DIFile *CGDebugInfo::createFile(
Expand Down Expand Up @@ -655,7 +655,7 @@ unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
if (Loc.isInvalid())
return 0;
SourceManager &SM = CGM.getContext().getSourceManager();
return SM.getPresumedLoc(SM.getFileLoc(Loc)).getLine();
return SM.getPresumedLoc(Loc).getLine();
}

unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) {
Expand All @@ -667,8 +667,7 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) {
if (Loc.isInvalid() && CurLoc.isInvalid())
return 0;
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc =
SM.getPresumedLoc(Loc.isValid() ? SM.getFileLoc(Loc) : CurLoc);
PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
return PLoc.isValid() ? PLoc.getColumn() : 0;
}

Expand Down Expand Up @@ -6291,7 +6290,7 @@ void CGDebugInfo::AddStringLiteralDebugInfo(llvm::GlobalVariable *GV,
const StringLiteral *S) {
SourceLocation Loc = S->getStrTokenLoc(0);
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(SM.getFileLoc(Loc));
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
if (!PLoc.isValid())
return;

Expand Down
Loading