aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTestUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTestUtils.h')
-rw-r--r--unittests/Format/FormatTestUtils.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/unittests/Format/FormatTestUtils.h b/unittests/Format/FormatTestUtils.h
index bd340e5b0e60..d82d84ebedef 100644
--- a/unittests/Format/FormatTestUtils.h
+++ b/unittests/Format/FormatTestUtils.h
@@ -30,7 +30,8 @@ inline std::string messUp(llvm::StringRef Code) {
if (JustReplacedNewline)
MessedUp[i - 1] = '\n';
InComment = true;
- } else if (MessedUp[i] == '#' && (JustReplacedNewline || i == 0)) {
+ } else if (MessedUp[i] == '#' &&
+ (JustReplacedNewline || i == 0 || MessedUp[i - 1] == '\n')) {
if (i != 0)
MessedUp[i - 1] = '\n';
InPreprocessorDirective = true;