And fix a few corner cases in which it returns the wrong answer.
Details
Diff Detail
Event Timeline
LGTM except the duplicated comment
clang/lib/Lex/Lexer.cpp | ||
---|---|---|
493–494 | Should we remove the comment here? |
clang/lib/Lex/Lexer.cpp | ||
---|---|---|
493–494 | Other Lexer methods follow a similar pattern of having doc comments both in the header and in the implementation. I think we can leave it. |
@KyleFromKitware oups, this fell under the cracks. I think I'm happy with is as-is, do you need help landing it?
Sure. Let me know what name and email address you would like used for the patch attribution! Thanks
Kyle Edwards <kyle.edwards@kitware.com>
Is there some way I can set this in my profile settings so that this name and address is always used?
Sorry for the delayed response. I managed to miss seeing this review request.
clang/include/clang/Lex/Lexer.h | ||
---|---|---|
598–599 | ||
clang/lib/Lex/Lexer.cpp | ||
493–494 | ||
clang/unittests/Lex/LexerTest.cpp | ||
673 | I find this case interesting. I'm assuming it is intentional that an offset that corresponds to an EOL character indicates that the offset of the character following it be returned. That suggests some additional cases to test: EXPECT_EQ(FindBeginningOfLineOffset("int func1();\n\n", 12), 13); EXPECT_EQ(FindBeginningOfLineOffset("int func1();\n", 12), 13); // 13? Or perhaps invalid? My intuition is that an offset corresponding to an EOL character would result in the offset of the line containing the EOL character being returned. |
clang/unittests/Lex/LexerTest.cpp | ||
---|---|---|
673 | I did my best to preserve the existing behavior of the function while fixing a corner case that was obviously wrong. Should this be fixed as well? |
clang/unittests/Lex/LexerTest.cpp | ||
---|---|---|
673 | @KyleFromKitware Try to fix it. If it doesn't cause test failures, i think we can do it as part of this PR. It it has wider ramifications we'll see. |