diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp b/gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp index 89ddbc946a4..eb916ec76fd 100644 --- a/gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp +++ b/gnu/llvm/tools/clang/lib/Basic/SourceLocation.cpp @@ -1,4 +1,4 @@ -//==--- SourceLocation.cpp - Compact identifier for Source Files -*- C++ -*-==// +//===- SourceLocation.cpp - Compact identifier for Source Files -----------===// // // The LLVM Compiler Infrastructure // @@ -12,10 +12,17 @@ //===----------------------------------------------------------------------===// #include "clang/Basic/SourceLocation.h" +#include "clang/Basic/LLVM.h" #include "clang/Basic/PrettyStackTrace.h" #include "clang/Basic/SourceManager.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" -#include <cstdio> +#include <cassert> +#include <string> +#include <utility> + using namespace clang; //===----------------------------------------------------------------------===// @@ -42,7 +49,7 @@ void SourceLocation::print(raw_ostream &OS, const SourceManager &SM)const{ if (isFileID()) { PresumedLoc PLoc = SM.getPresumedLoc(*this); - + if (PLoc.isInvalid()) { OS << "<invalid>"; return; @@ -81,7 +88,6 @@ FileID FullSourceLoc::getFileID() const { return SrcMgr->getFileID(*this); } - FullSourceLoc FullSourceLoc::getExpansionLoc() const { assert(isValid()); return FullSourceLoc(SrcMgr->getExpansionLoc(*this), *SrcMgr); @@ -97,15 +103,6 @@ FullSourceLoc FullSourceLoc::getFileLoc() const { return FullSourceLoc(SrcMgr->getFileLoc(*this), *SrcMgr); } -std::pair<FullSourceLoc, FullSourceLoc> -FullSourceLoc::getImmediateExpansionRange() const { - assert(isValid()); - std::pair<SourceLocation, SourceLocation> Range = - SrcMgr->getImmediateExpansionRange(*this); - return std::make_pair(FullSourceLoc(Range.first, *SrcMgr), - FullSourceLoc(Range.second, *SrcMgr)); -} - PresumedLoc FullSourceLoc::getPresumedLoc(bool UseLineDirectives) const { if (!isValid()) return PresumedLoc(); @@ -148,15 +145,6 @@ unsigned FullSourceLoc::getColumnNumber(bool *Invalid) const { return SrcMgr->getColumnNumber(getFileID(), getFileOffset(), Invalid); } -std::pair<FullSourceLoc, FullSourceLoc> -FullSourceLoc::getExpansionRange() const { - assert(isValid()); - std::pair<SourceLocation, SourceLocation> Range = - SrcMgr->getExpansionRange(*this); - return std::make_pair(FullSourceLoc(Range.first, *SrcMgr), - FullSourceLoc(Range.second, *SrcMgr)); -} - const FileEntry *FullSourceLoc::getFileEntry() const { assert(isValid()); return SrcMgr->getFileEntryForID(getFileID()); |
