Skip to content

[clang][deps] Don't treat ObjC method args as module directives #8990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Bigcheese
Copy link

import:(type)name is a method argument decl in ObjC, but the C++20 preprocessing rules say this is a preprocessing line.

Because the dependency directive scanner is not language dependent, this patch extends the C++20 rule to exclude module : (which is never a valid module decl anyway), and import : that is not followed by an identifier.

This is ok to do because in C++20 mode the compiler will later error on lines like this anyway, and the dependencies the scanner returns are still correct.

cherry-pick of llvm#97654, resolving rdar://129549885

`import:(type)name` is a method argument decl in ObjC, but the C++20
preprocessing rules say this is a preprocessing line.

Because the dependency directive scanner is not language dependent,
this patch extends the C++20 rule to exclude `module :` (which is
never a valid module decl anyway), and `import :` that is not followed
by an identifier.

This is ok to do because in C++20 mode the compiler will later error
on lines like this anyway, and the dependencies the scanner returns
are still correct.
@Bigcheese
Copy link
Author

@swift-ci please test

@cyndyishida cyndyishida requested a review from fredriss July 23, 2024 23:47
@cyndyishida
Copy link

@fredriss Can you merge this please?

@fredriss fredriss merged commit 097782e into swiftlang:swift/release/6.0 Aug 1, 2024
3 checks passed
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.

4 participants