diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-18 21:57:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-18 21:57:20 +0000 |
commit | 0edfab68d463201ac2933cf88243701dbc3ba5ab (patch) | |
tree | fcae3eee80edd1d4433c2630e2a35a7932ec4616 /lib/Lex/Lexer.cpp | |
parent | cd99d9eac20ed2c9d671312996b3a3ce45505b86 (diff) |
remove unneeded scopes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 490a0b5304..acdefe55e4 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -427,31 +427,29 @@ Slash: if (!isWhitespace(Ptr[0])) return '\\'; // See if we have optional whitespace characters followed by a newline. - { - unsigned SizeTmp = 0; - do { - ++SizeTmp; - if (Ptr[SizeTmp-1] == '\n' || Ptr[SizeTmp-1] == '\r') { - // Remember that this token needs to be cleaned. - if (Tok) Tok->setFlag(Token::NeedsCleaning); - - // Warn if there was whitespace between the backslash and newline. - if (SizeTmp != 1 && Tok && !isLexingRawMode()) - Diag(Ptr, diag::backslash_newline_space); - - // If this is a \r\n or \n\r, skip the newlines. - if ((Ptr[SizeTmp] == '\r' || Ptr[SizeTmp] == '\n') && - Ptr[SizeTmp-1] != Ptr[SizeTmp]) - ++SizeTmp; - - // Found backslash<whitespace><newline>. Parse the char after it. - Size += SizeTmp; - Ptr += SizeTmp; - // Use slow version to accumulate a correct size field. - return getCharAndSizeSlow(Ptr, Size, Tok); - } - } while (isWhitespace(Ptr[SizeTmp])); - } + unsigned SizeTmp = 0; + do { + ++SizeTmp; + if (Ptr[SizeTmp-1] == '\n' || Ptr[SizeTmp-1] == '\r') { + // Remember that this token needs to be cleaned. + if (Tok) Tok->setFlag(Token::NeedsCleaning); + + // Warn if there was whitespace between the backslash and newline. + if (SizeTmp != 1 && Tok && !isLexingRawMode()) + Diag(Ptr, diag::backslash_newline_space); + + // If this is a \r\n or \n\r, skip the newlines. + if ((Ptr[SizeTmp] == '\r' || Ptr[SizeTmp] == '\n') && + Ptr[SizeTmp-1] != Ptr[SizeTmp]) + ++SizeTmp; + + // Found backslash<whitespace><newline>. Parse the char after it. + Size += SizeTmp; + Ptr += SizeTmp; + // Use slow version to accumulate a correct size field. + return getCharAndSizeSlow(Ptr, Size, Tok); + } + } while (isWhitespace(Ptr[SizeTmp])); // Otherwise, this is not an escaped newline, just return the slash. return '\\'; @@ -495,26 +493,24 @@ Slash: if (!isWhitespace(Ptr[0])) return '\\'; // See if we have optional whitespace characters followed by a newline. - { - unsigned SizeTmp = 0; - do { - ++SizeTmp; - if (Ptr[SizeTmp-1] == '\n' || Ptr[SizeTmp-1] == '\r') { - - // If this is a \r\n or \n\r, skip the newlines. - if ((Ptr[SizeTmp] == '\r' || Ptr[SizeTmp] == '\n') && - Ptr[SizeTmp-1] != Ptr[SizeTmp]) - ++SizeTmp; - - // Found backslash<whitespace><newline>. Parse the char after it. - Size += SizeTmp; - Ptr += SizeTmp; - - // Use slow version to accumulate a correct size field. - return getCharAndSizeSlowNoWarn(Ptr, Size, Features); - } - } while (isWhitespace(Ptr[SizeTmp])); - } + unsigned SizeTmp = 0; + do { + ++SizeTmp; + if (Ptr[SizeTmp-1] == '\n' || Ptr[SizeTmp-1] == '\r') { + + // If this is a \r\n or \n\r, skip the newlines. + if ((Ptr[SizeTmp] == '\r' || Ptr[SizeTmp] == '\n') && + Ptr[SizeTmp-1] != Ptr[SizeTmp]) + ++SizeTmp; + + // Found backslash<whitespace><newline>. Parse the char after it. + Size += SizeTmp; + Ptr += SizeTmp; + + // Use slow version to accumulate a correct size field. + return getCharAndSizeSlowNoWarn(Ptr, Size, Features); + } + } while (isWhitespace(Ptr[SizeTmp])); // Otherwise, this is not an escaped newline, just return the slash. return '\\'; |