Skip to content

[CMake] Make several libs depend on swift-syntax-generated-headers #11289

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

Closed
wants to merge 1 commit into from

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Aug 1, 2017

swift/Parse/Lexer.h is used by these libraries.

Fixes:

In file included from /Users/rintaro/swift-oss/swift/lib/SILGen/SILGenProfiling.cpp:18:
In file included from /Users/rintaro/swift-oss/swift/include/swift/Parse/Lexer.h:24:
In file included from /Users/rintaro/swift-oss/swift/include/swift/Syntax/TokenSyntax.h:21:
In file included from /Users/rintaro/swift-oss/swift/include/swift/Syntax/RawTokenSyntax.h:25:
/Users/rintaro/swift-oss/swift/include/swift/Syntax/RawSyntax.h:33:10: fatal error: 'swift/Syntax/SyntaxKind.h' file not found
#include "swift/Syntax/SyntaxKind.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

I don't think this is the ideal fix for this problem, but...

CC/ @harlanhaskins

@rintaro rintaro changed the title [CMake] Make several libs depends on swift-syntax-generated-headers [CMake] Make several libs depend on swift-syntax-generated-headers Aug 1, 2017
'swift/Parse/Lexer.h' is used by these libraries.
@rintaro rintaro force-pushed the cmake-deps-genheader branch from 0e8b1c6 to 1916c0c Compare August 1, 2017 17:08
@harlanhaskins
Copy link
Contributor

What if we remove the import of TokenSyntax.h from this header and instead forward-declare RawTokenSyntax?

@rintaro
Copy link
Member Author

rintaro commented Aug 1, 2017

This compiles:

--- a/include/swift/Parse/Lexer.h
+++ b/include/swift/Parse/Lexer.h
@@ -21,11 +21,17 @@
 #include "swift/Basic/SourceLoc.h"
 #include "swift/Basic/SourceManager.h"
 #include "swift/Parse/Token.h"
-#include "swift/Syntax/TokenSyntax.h"
+#include "swift/Syntax/References.h"
+#include "swift/Syntax/Trivia.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/SaveAndRestore.h"
 
 namespace swift {
+
+namespace syntax {
+  struct RawTokenSyntax;
+}
+
   /// Given a pointer to the starting byte of a UTF8 character, validate it and
   /// advance the lexer past it.  This returns the encoded character or ~0U if
   /// the encoding is invalid.

@harlanhaskins
Copy link
Contributor

That looks great! I think this is a much better fix overall. There are a couple of places that also import Syntax that could be forward-declaring it too. I’d merge that as-is though.

@rintaro
Copy link
Member Author

rintaro commented Aug 1, 2017

OK, opened another PR for that.
Closing.

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