diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-04-20 20:49:23 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-04-20 20:49:23 +0000 |
| commit | 8f5bc9f0e10f278d4a1bd1919c169e6569932295 (patch) | |
| tree | 77ba766bc8ac8a274c728776484c0587e2038cb4 | |
| parent | fb24a3a4ec3d625981bb822e021dc89a0cf3fde1 (diff) | |
| download | bcm5719-llvm-8f5bc9f0e10f278d4a1bd1919c169e6569932295.tar.gz bcm5719-llvm-8f5bc9f0e10f278d4a1bd1919c169e6569932295.zip | |
change FullSourceLoc to have a *const* SourceManager&, eliminating
a const_cast.
llvm-svn: 101940
| -rw-r--r-- | clang/include/clang/Basic/SourceLocation.h | 11 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/TextDiagnosticPrinter.h | 2 | ||||
| -rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Frontend/TextDiagnosticPrinter.cpp | 2 |
4 files changed, 6 insertions, 14 deletions
diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index 555e6f5a919..0bbeffefc72 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -176,19 +176,14 @@ public: /// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful /// for argument passing to functions that expect both objects. class FullSourceLoc : public SourceLocation { - SourceManager* SrcMgr; + const SourceManager *SrcMgr; public: /// Creates a FullSourceLoc where isValid() returns false. - explicit FullSourceLoc() : SrcMgr((SourceManager*) 0) {} + explicit FullSourceLoc() : SrcMgr(0) {} - explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM) + explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} - SourceManager &getManager() { - assert(SrcMgr && "SourceManager is NULL."); - return *SrcMgr; - } - const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); return *SrcMgr; diff --git a/clang/include/clang/Frontend/TextDiagnosticPrinter.h b/clang/include/clang/Frontend/TextDiagnosticPrinter.h index 157876b59d3..336713661a2 100644 --- a/clang/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/clang/include/clang/Frontend/TextDiagnosticPrinter.h @@ -68,7 +68,7 @@ public: void EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, - SourceManager &SM, + const SourceManager &SM, const FixItHint *Hints, unsigned NumHints, unsigned Columns); diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 355b87a9dd7..3ecab1d8c16 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -60,7 +60,7 @@ void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B) { } const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, - const SourceManager &sm, + const SourceManager &SM, SourceLocation Loc, bool *Invalid) const { if (Invalid) @@ -68,9 +68,6 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // Lazily create the Buffer for ContentCaches that wrap files. if (!Buffer.getPointer() && Entry) { - // FIXME: - SourceManager &SM = const_cast<SourceManager &>(sm); - std::string ErrorStr; struct stat FileInfo; Buffer.setPointer(MemoryBuffer::getFile(Entry->getName(), &ErrorStr, diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index f2b16a4b386..28bb17ac3ef 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -282,7 +282,7 @@ static void SelectInterestingSourceRegion(std::string &SourceLine, void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, - SourceManager &SM, + const SourceManager &SM, const FixItHint *Hints, unsigned NumHints, unsigned Columns) { |

