This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2fe2b5a63bb: [clang-format] [C++20] [Module] clang-format
couldnt recognize partitions (authored by MyDeveloperDay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
MyDeveloperDay updated this revision to Diff 389682.
MyDeveloperDay marked 3 inline comments as done.
MyDeveloperDay added a comment.
Address review comments, guard against eof
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
Files:
owenpan added inline comments.
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1057
+ nextToken();
+ do {
+if (FormatTok->is(tok::colon)) {
A `while (!eof())` or `while (FormatTok->isNot(tok::eof)` would be safer here
just in case the last line is
MyDeveloperDay updated this revision to Diff 389139.
MyDeveloperDay added a comment.
Fix infinite loop
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Format/FormatToken.h
MyDeveloperDay added inline comments.
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1055-1077
+ while (FormatTok) {
+if (FormatTok->is(tok::colon)) {
+ FormatTok->setType(TT_ModulePartitionColon);
+}
+// Handle import as we would an include statement
+
MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added inline comments.
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1055-1077
+ while (FormatTok) {
+if (FormatTok->is(tok::colon)) {
+ FormatTok->setType(TT_ModulePartitionColon);
+}
+//
owenpan added inline comments.
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1055-1077
+ while (FormatTok) {
+if (FormatTok->is(tok::colon)) {
+ FormatTok->setType(TT_ModulePartitionColon);
+}
+// Handle import as we would an include statement
+else
MyDeveloperDay updated this revision to Diff 388819.
MyDeveloperDay marked 10 inline comments as done.
MyDeveloperDay added a comment.
Address review comments
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
Files:
ChuanqiXu added inline comments.
Comment at: clang/lib/Format/TokenAnnotator.cpp:3226
+// No space between module :.
+if (Left.isOneOf(Keywords.kw_module, tok::kw_export, Keywords.kw_import) &&
+Right.is(TT_ModulePartitionColon))
owenpan wrote:
>
Quuxplusone added inline comments.
Comment at: clang/lib/Format/TokenAnnotator.cpp:3235
+if (Left.is(TT_ModulePartitionColon) &&
+Right.isOneOf(tok::identifier, tok::kw_public, tok::kw_private))
+ return false;
owenpan wrote:
> Is `module
owenpan added inline comments.
Comment at: clang/lib/Format/TokenAnnotator.cpp:3226
+// No space between module :.
+if (Left.isOneOf(Keywords.kw_module, tok::kw_export, Keywords.kw_import) &&
+Right.is(TT_ModulePartitionColon))
You can remove
MyDeveloperDay updated this revision to Diff 388419.
MyDeveloperDay added a comment.
Add yet more unit tests and cover those.
Mark one test as TODO as I'm not sure if its allowed syntax
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
Files:
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
LGTM with @Quuxplusone's opinions addressed.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
___
cfe-commits mailing list
Quuxplusone added inline comments.
Comment at: clang/unittests/Format/FormatTest.cpp:22443
+ Style);
+}
+
Quuxplusone wrote:
> I'd like to see `module :private;`
> I'd like to see `import ;`
> I'd like to see `import foo...bar;`
> I'd like to see
HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.
The current goal seems to be achieved. I have no idea what are acceptable
module names or so, I've not yet looked into them.
CHANGES SINCE LAST ACTION
MyDeveloperDay added a comment.
Nasty, but let me take a look
module: private;
import ;
import foo... bar;
import..;
module foo: private;
module public : while;
they all feel all kinds of wrong!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
Quuxplusone added inline comments.
Comment at: clang/unittests/Format/FormatTest.cpp:22443
+ Style);
+}
+
I'd like to see `module :private;`
I'd like to see `import ;`
I'd like to see `import foo...bar;`
I'd like to see `import ..;`
Is
MyDeveloperDay updated this revision to Diff 388241.
MyDeveloperDay marked 3 inline comments as done.
MyDeveloperDay added a comment.
Add some more tests
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
Files:
clang/docs/ReleaseNotes.rst
ChuanqiXu added a comment.
There could be more tests in case we want support c++20 module more. This
shouldn't be a break issue for this patch since this aims to fix the space in
partitions only.
export template<...>;
export struct {
...
};
export int func() {
// ...
}
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: HazardyKnusperkeks, curdeius, owenpan,
ChuanqiXu.
MyDeveloperDay added projects: clang, clang-format.
Herald added subscribers: jrtc27, arichardson.
MyDeveloperDay requested review of this revision.
20 matches
Mail list logo