aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-05 22:56:06 +0000
committerManuel Klimek <klimek@google.com>2013-01-05 22:56:06 +0000
commitf6fd00b12ae7d89436d32851c9bcc8dd3d046ad3 (patch)
treec8d17d46d1f754bf515acb33f861ee31fd044b56 /lib/Format/UnwrappedLineParser.h
parentc37b4d60f926bf440dfcc312bd6482fed3176e33 (diff)
Fixes parsing of hash tokens in the middle of a line.
To parse # correctly, we need to know whether it is the first token in a line - we can deduct this either from the whitespace or seeing that the token is the first in the file - we already calculate this information. This patch moves the identification of the first token into the getNextToken method and stores it inside the FormatToken, so the UnwrappedLineParser can stay independent of the SourceManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.h')
-rw-r--r--lib/Format/UnwrappedLineParser.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h
index a8e5b739bc..287143dae2 100644
--- a/lib/Format/UnwrappedLineParser.h
+++ b/lib/Format/UnwrappedLineParser.h
@@ -31,7 +31,8 @@ namespace format {
/// whitespace characters preceeding it.
struct FormatToken {
FormatToken()
- : NewlinesBefore(0), HasUnescapedNewline(false), WhiteSpaceLength(0) {
+ : NewlinesBefore(0), HasUnescapedNewline(false), WhiteSpaceLength(0),
+ IsFirst(false) {
}
/// \brief The \c Token.
@@ -56,6 +57,9 @@ struct FormatToken {
/// \brief The length in characters of the whitespace immediately preceeding
/// the \c Token.
unsigned WhiteSpaceLength;
+
+ /// \brief Indicates that this is the first token.
+ bool IsFirst;
};
/// \brief An unwrapped line is a sequence of \c Token, that we would like to