This is an archive of the discontinued LLVM Phabricator instance.

[Lex] For dependency directive lexing, angled includes in `__has_include` should be lexed as string literals
ClosedPublic

Authored by akyrtzi on Jan 19 2023, 10:42 AM.

Diff Detail

Event Timeline

akyrtzi created this revision.Jan 19 2023, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 10:42 AM
akyrtzi requested review of this revision.Jan 19 2023, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 10:42 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
benlangmuir added inline comments.Jan 19 2023, 11:31 AM
clang/lib/Lex/Lexer.cpp
4415

This case is missing a test I think.

4420

How do we know this will terminate?

akyrtzi added inline comments.Jan 19 2023, 12:06 PM
clang/lib/Lex/Lexer.cpp
4420

If LexAngledStringLiteral() returns tok::header_name there were valid tokens that formed a header include and it has set BufferPtr after the > token. I can't think of reason it would not terminate.

akyrtzi updated this revision to Diff 490629.Jan 19 2023, 12:19 PM

Add test case for dependency directive lexing of ill-formed include inside __has_include

akyrtzi marked an inline comment as done.Jan 19 2023, 12:20 PM
akyrtzi added inline comments.
clang/lib/Lex/Lexer.cpp
4415

Added a test case.

benlangmuir accepted this revision.Jan 19 2023, 12:59 PM
This revision is now accepted and ready to land.Jan 19 2023, 12:59 PM
This revision was landed with ongoing or failed builds.Jan 19 2023, 3:24 PM
This revision was automatically updated to reflect the committed changes.
akyrtzi marked an inline comment as done.