[cfe-commits] r155666 - in /cfe/trunk: lib/Frontend/TextDiagnostic.cpp test/Misc/diag-trailing-null-bytes.cpp test/Misc/wnull-character.cpp
Nico Weber
nicolasweber at gmx.de
Thu Apr 26 14:39:46 PDT 2012
Author: nico
Date: Thu Apr 26 16:39:46 2012
New Revision: 155666
URL: http://llvm.org/viewvc/llvm-project?rev=155666&view=rev
Log:
Revert r154981, because it caused PR12674.
Add a test for PR12674.
Added:
cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp (with props)
Removed:
cfe/trunk/test/Misc/wnull-character.cpp
Modified:
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=155666&r1=155665&r2=155666&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Thu Apr 26 16:39:46 2012
@@ -182,7 +182,7 @@
/// (\u3042 is represented in UTF-8 by three bytes and takes two columns to
/// display)
void byteToColumn(StringRef SourceLine, unsigned TabStop,
- SmallVectorImpl<int> &out) {
+ SmallVectorImpl<int> &out) {
out.clear();
if (SourceLine.empty()) {
@@ -840,13 +840,10 @@
// Get information about the buffer it points into.
bool Invalid = false;
- StringRef BufData = SM.getBufferData(FID, &Invalid);
+ const char *BufStart = SM.getBufferData(FID, &Invalid).data();
if (Invalid)
return;
- const char *BufStart = BufData.data();
- const char *BufEnd = BufStart + BufData.size();
-
unsigned LineNo = SM.getLineNumber(FID, FileOffset);
unsigned ColNo = SM.getColumnNumber(FID, FileOffset);
unsigned CaretEndColNo
@@ -860,7 +857,7 @@
// Compute the line end. Scan forward from the error position to the end of
// the line.
const char *LineEnd = TokPtr;
- while (*LineEnd != '\n' && *LineEnd != '\r' && LineEnd!=BufEnd)
+ while (*LineEnd != '\n' && *LineEnd != '\r' && *LineEnd != '\0')
++LineEnd;
// FIXME: This shouldn't be necessary, but the CaretEndColNo can extend past
@@ -952,8 +949,7 @@
= printableTextForNextCharacter(line, &i, DiagOpts.TabStop);
bool was_printable = res.second;
- if (DiagOpts.ShowColors
- && was_printable==print_reversed) {
+ if (DiagOpts.ShowColors && was_printable == print_reversed) {
if (print_reversed)
OS.reverseColor();
OS << to_print;
Added: cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp?rev=155666&view=auto
==============================================================================
--- cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp (added)
+++ cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp Thu Apr 26 16:39:46 2012
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s
+// CHECK: {{ERR_DNS_SERVER_REQUIRES_TCP$}}
+
+// http://llvm.org/PR12674
+#define NET_ERROR(label, value) ERR_ ## label = value,
+
+NET_ERROR(DNS_SERVER_REQUIRES_TCP, -801)
+
+#undef NET_ERROR
+
Propchange: cfe/trunk/test/Misc/diag-trailing-null-bytes.cpp
------------------------------------------------------------------------------
svn:eol-style = LF
Removed: cfe/trunk/test/Misc/wnull-character.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/wnull-character.cpp?rev=155665&view=auto
==============================================================================
Binary files cfe/trunk/test/Misc/wnull-character.cpp (original) and cfe/trunk/test/Misc/wnull-character.cpp (removed) differ
More information about the cfe-commits
mailing list