This is an archive of the discontinued LLVM Phabricator instance.

Fix for stringized function-macro args continued across lines
ClosedPublic

Authored by kousikk on Sep 16 2019, 2:24 PM.

Details

Summary

In case of certain #define'd macros, there's a space just before line continuation
that the minimized-source lexer was missing to include, resulting in invalid stringize.
For example:

#define foo(x) x+7
#define bar(a,b) \
    #x \
    foo(b)

should result in "#x foo(b)", but actually results in "#xfoo(b)" (which is invalid).

Fixing it by keeping last but one space. I am confident that keeping the space is the right fix,
although I'm not sure if I've done it in the right way :)

Event Timeline

kousikk created this revision.Sep 16 2019, 2:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 2:24 PM
kousikk edited the summary of this revision. (Show Details)Sep 16 2019, 4:37 PM
kousikk edited the summary of this revision. (Show Details)Sep 16 2019, 4:41 PM

Ping on the review for this :)

arphaman accepted this revision.Sep 19 2019, 10:59 AM

LGTM, thanks!

This revision is now accepted and ready to land.Sep 19 2019, 10:59 AM

Thanks! I will need you to merge this one too!

Thanks! I will need you to merge this one too!

Sure, I will commit it today.

I think you should obtain commit access for your future patches/commits. You can follow the instructions here: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2019, 3:37 PM

I think you should obtain commit access for your future patches/commits. You can follow the instructions here: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

Thanks, I've done that!