diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
| commit | bca07a4524feb4edec581062d631a13116320a24 (patch) | |
| tree | a9243275843fbeaa590afc07ee888e006b8d54ea /lib/Basic/SourceLocation.cpp | |
| parent | 998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff) | |
Notes
Diffstat (limited to 'lib/Basic/SourceLocation.cpp')
| -rw-r--r-- | lib/Basic/SourceLocation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp index 7412b955606a..5062d43f58f2 100644 --- a/lib/Basic/SourceLocation.cpp +++ b/lib/Basic/SourceLocation.cpp @@ -43,6 +43,11 @@ void SourceLocation::print(llvm::raw_ostream &OS, const SourceManager &SM)const{ if (isFileID()) { PresumedLoc PLoc = SM.getPresumedLoc(*this); + + if (PLoc.isInvalid()) { + OS << "<invalid>"; + return; + } // The instantiation and spelling pos is identical for file locs. OS << PLoc.getFilename() << ':' << PLoc.getLine() << ':' << PLoc.getColumn(); @@ -105,6 +110,11 @@ bool FullSourceLoc::isInSystemHeader() const { return SrcMgr->isInSystemHeader(*this); } +bool FullSourceLoc::isBeforeInTranslationUnitThan(SourceLocation Loc) const { + assert(isValid()); + return SrcMgr->isBeforeInTranslationUnit(*this, Loc); +} + const char *FullSourceLoc::getCharacterData(bool *Invalid) const { assert(isValid()); return SrcMgr->getCharacterData(*this, Invalid); |
