Skip to content

Commit

Permalink
Append a newline if missing at end of file.
Browse files Browse the repository at this point in the history
  • Loading branch information
owenca committed Aug 8, 2018
1 parent acb1c2d commit 8f07203
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@ class AnnotatingParser {
parseHasInclude();
}
break;
case tok::eof:
if (Tok->NewlinesBefore == 0)
Tok->NewlinesBefore = 1;
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions test/MissingNewlineAtEOF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int MissingNewlineAtEOF(int n){return n*3;}

1 comment on commit 8f07203

@owenca
Copy link
Owner

@owenca owenca commented on 8f07203 Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #6.

Please sign in to comment.