This is an archive of the discontinued LLVM Phabricator instance.

[PR33394] Avoid lexing editor placeholders when running the preprocessor only
ClosedPublic

Authored by arphaman on Jun 15 2017, 4:06 PM.

Details

Summary

r300667 added support for editor placeholder to Clang. That commit didn’t take into account that users who use Clang for preprocessing only (-E) will get the “editor placeholder in source file” error when preprocessing their source (PR33394).

This commit ensures that Clang doesn't lex editor placeholders when running a preprocessor only action. It also ensures that tokens like <#> and <##> won't form valid placeholders.

rdar://32718000

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Jun 15 2017, 4:06 PM
benlangmuir edited edge metadata.Jun 15 2017, 4:21 PM

I agree with not detecting these during PP-only, but there's nothing wrong with <#>. It's either not a placeholder, or it's part of a placeholder like <#>#>, which is a placeholder containing the text ">". Similarly, <## could be the start of an empty placeholder <##>.

arphaman updated this revision to Diff 102764.Jun 15 2017, 5:38 PM

Fair enough. I removed the special checks for <#> and <##>.

benlangmuir accepted this revision.Jun 16 2017, 9:30 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 16 2017, 9:30 AM
This revision was automatically updated to reflect the committed changes.