Skip to content

Conversation

@yronglin
Copy link
Contributor

@yronglin yronglin commented Sep 9, 2025

Depends: #107168
This patch handle @import as a preprocessing directive, and since this patch, the following import directive will be ill-formed:

@import Foo\n;

Only the last commit belongs to this patch, the other commits come from dependent patches

yronglin added 30 commits May 31, 2025 14:22
Signed-off-by: yronglin <[email protected]>
Signed-off-by: yronglin <[email protected]>
Signed-off-by: Wang, Yihan <[email protected]>
Signed-off-by: yronglin <[email protected]>
Signed-off-by: yronglin <[email protected]>
Signed-off-by: yronglin <[email protected]>
Signed-off-by: yronglin <[email protected]>
@github-actions
Copy link

github-actions bot commented Sep 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@yronglin yronglin force-pushed the at_import_as_pp_directive branch from 204dd21 to 8a77b45 Compare September 10, 2025 12:03
@yronglin yronglin changed the title [ObjC] Handle @import directive as a pp-directive [ObjC][Preprocessor] Handle @import directive as a pp-directive Sep 10, 2025
@yronglin
Copy link
Contributor Author

friendly ping~

@yronglin yronglin marked this pull request as ready for review September 17, 2025 16:19
Copy link
Contributor

@Bigcheese Bigcheese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes here look fine, but it would be good to have some more test examples. Particularly around things like:

#define M modA
@import M;

and cases that shouldn't compile, like:

#define imp @import
imp M;

auto ScEx2 = make_scope_exit(
[&]() { TheLexer.setParsingPreprocessorDirective(false); });

// FIXME: Shoule we handle @import as a preprocessing directive?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this FIXME still relevant after this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, we should remove this comments

@yronglin
Copy link
Contributor Author

The code changes here look fine, but it would be good to have some more test examples. Particularly around things like:

#define M modA
@import M;

and cases that shouldn't compile, like:

#define imp @import
imp M;

Thanks for the review, I'll add more test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants