summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-09-27 21:24:36 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-09-27 21:24:36 +0000
commit867c189d891f175969164515c6cb91e4d3650ea6 (patch)
treec26abfeb321825411a52ad81f150fd4c9fcfe454 /unittests
parent36fd952bc129a6ea694cdac11a10aba407c20930 (diff)
downloadllvm-867c189d891f175969164515c6cb91e4d3650ea6.tar.gz
llvm-867c189d891f175969164515c6cb91e4d3650ea6.tar.bz2
llvm-867c189d891f175969164515c6cb91e4d3650ea6.tar.xz
SourceMgr diagnotics printing: fix a bug where printing a fixit for a source
range that includes a tab character will cause out-of-bounds access to the fixit string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191563 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/SourceMgrTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/unittests/Support/SourceMgrTest.cpp b/unittests/Support/SourceMgrTest.cpp
index 9bc0cf67b7..2b69fe9844 100644
--- a/unittests/Support/SourceMgrTest.cpp
+++ b/unittests/Support/SourceMgrTest.cpp
@@ -160,3 +160,15 @@ TEST_F(SourceMgrTest, BasicFixit) {
Output);
}
+TEST_F(SourceMgrTest, FixitForTab) {
+ setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
+ printMessage(getLoc(3), SourceMgr::DK_Error, "message", None,
+ makeArrayRef(SMFixIt(getRange(3, 1), "zzz")));
+
+ EXPECT_EQ("file.in:1:4: error: message\n"
+ "aaa bbb\n"
+ " ^^^^^\n"
+ " zzz\n",
+ Output);
+}
+