diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-16 00:06:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-16 00:06:06 +0000 |
commit | f715ca12bfc9fddfde75f98a197424434428b821 (patch) | |
tree | bd19f3ce3d9a7850942f25d25c03633954e91faa /lib/Rewrite/HTMLRewrite.cpp | |
parent | f9b0a58a103784495309543dce4469e44861b4cc (diff) |
Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/HTMLRewrite.cpp')
-rw-r--r-- | lib/Rewrite/HTMLRewrite.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index 6fe3fc07db..f325121d08 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -22,7 +22,6 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" -#include <cstdio> using namespace clang; @@ -44,15 +43,10 @@ void html::HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E, // Include the whole end token in the range. EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr(), R.getLangOpts()); - llvm::StringRef FileName; - std::string ErrorStr; - const char *BufferStart = SM.getBufferData(FID, FileName, ErrorStr).first; - if (!BufferStart) { - // FIXME: Add a diagnostic object somewhere? - fprintf(stderr, "error: cannot open file '%s': %s\n", - FileName.str().c_str(), ErrorStr.c_str()); + bool Invalid = false; + const char *BufferStart = SM.getBufferData(FID, &Invalid).first; + if (Invalid) return; - } HighlightRange(R.getEditBuffer(FID), BOffset, EOffset, BufferStart, StartTag, EndTag); |