aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSeth Cantrell <seth.cantrell@gmail.com>2012-04-17 20:06:03 +0000
committerSeth Cantrell <seth.cantrell@gmail.com>2012-04-17 20:06:03 +0000
commite9a3b76ba589a8a884e978273beaed0d97cf9861 (patch)
tree8f799617cda9007a9fd144549cff86f5cb769445 /include
parent54881cb78e2c9054188c002c012b72175429e79b (diff)
Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then displayed with reversed colors if possible. Unprintable characters are displayed as <U+NNNN> while bytes that do not represent valid characters are shown as <XX>. Column adjustments to diagnostic carets, highlighted ranges, and fixups are made both for characters escaped as above and for characters which are printable but take up more than a single column. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/ConvertUTF.h2
-rw-r--r--include/clang/Frontend/TextDiagnostic.h11
2 files changed, 8 insertions, 5 deletions
diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h
index ec6b973e6a..7fb5874027 100644
--- a/include/clang/Basic/ConvertUTF.h
+++ b/include/clang/Basic/ConvertUTF.h
@@ -151,9 +151,9 @@ ConversionResult ConvertUTF16toUTF32 (
ConversionResult ConvertUTF32toUTF16 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+#endif
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
-#endif
Boolean isLegalUTF8String(const UTF8 *source, const UTF8 *sourceEnd);
diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h
index 519d3b61ce..314003bce2 100644
--- a/include/clang/Frontend/TextDiagnostic.h
+++ b/include/clang/Frontend/TextDiagnostic.h
@@ -18,6 +18,8 @@
#include "clang/Frontend/DiagnosticRenderer.h"
+struct SourceColumnMap;
+
namespace clang {
/// \brief Class to encapsulate the logic for formatting and printing a textual
@@ -103,15 +105,16 @@ private:
SmallVectorImpl<CharSourceRange>& Ranges,
ArrayRef<FixItHint> Hints);
+ void emitSnippet(StringRef SourceLine);
+
void highlightRange(const CharSourceRange &R,
unsigned LineNo, FileID FID,
- const std::string &SourceLine,
+ const SourceColumnMap &map,
std::string &CaretLine);
+
std::string buildFixItInsertionLine(unsigned LineNo,
- const char *LineStart,
- const char *LineEnd,
+ const SourceColumnMap &map,
ArrayRef<FixItHint> Hints);
- void expandTabs(std::string &SourceLine, std::string &CaretLine);
void emitParseableFixits(ArrayRef<FixItHint> Hints);
};