diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-02-23 00:47:48 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-02-23 00:47:48 +0000 |
commit | 5ef04ee40c3332d31b6d1439f50d0ddb45812929 (patch) | |
tree | d282d4e96ab8c6122bbcd74db78ec9b2cc3934f5 /lib/Basic/SourceManager.cpp | |
parent | fd405efea156302c4b9d8e26e9cd3eddef5bf9b0 (diff) | |
download | clang-5ef04ee40c3332d31b6d1439f50d0ddb45812929.tar.gz |
Switch the VerifyDiagnosticsClient to use PresumedLocs now that they
exist. Cheat and do this by adding some wrappers around the PresumedLoc
machinery that directly return the line and column number.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126281 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 044c88dd2b..e2783ba6fd 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -823,6 +823,12 @@ unsigned SourceManager::getInstantiationColumnNumber(SourceLocation Loc, return getColumnNumber(LocInfo.first, LocInfo.second, Invalid); } +unsigned SourceManager::getPresumedColumnNumber(SourceLocation Loc, + bool *Invalid) const { + if (isInvalid(Loc, Invalid)) return 0; + return getPresumedLoc(Loc).getColumn(); +} + static LLVM_ATTRIBUTE_NOINLINE void ComputeLineNumbers(Diagnostic &Diag, ContentCache *FI, llvm::BumpPtrAllocator &Alloc, @@ -985,17 +991,22 @@ unsigned SourceManager::getLineNumber(FileID FID, unsigned FilePos, return LineNo; } +unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc, + bool *Invalid) const { + if (isInvalid(Loc, Invalid)) return 0; + std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc); + return getLineNumber(LocInfo.first, LocInfo.second); +} unsigned SourceManager::getInstantiationLineNumber(SourceLocation Loc, bool *Invalid) const { if (isInvalid(Loc, Invalid)) return 0; std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc); return getLineNumber(LocInfo.first, LocInfo.second); } -unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc, +unsigned SourceManager::getPresumedLineNumber(SourceLocation Loc, bool *Invalid) const { if (isInvalid(Loc, Invalid)) return 0; - std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc); - return getLineNumber(LocInfo.first, LocInfo.second); + return getPresumedLoc(Loc).getLine(); } /// getFileCharacteristic - return the file characteristic of the specified |