[clang-format] Fix a bug with C++ `export import <Foo/Bar>`
Fixes #57798. Differential Revision: https://reviews.llvm.org/D134700
This commit is contained in:
parent
adf4eda004
commit
2d23175fae
|
@ -1634,10 +1634,18 @@ void UnwrappedLineParser::parseStructuralElement(
|
|||
parseJavaScriptEs6ImportExport();
|
||||
return;
|
||||
}
|
||||
if (!Style.isCpp())
|
||||
break;
|
||||
// Handle C++ "(inline|export) namespace".
|
||||
[[fallthrough]];
|
||||
if (Style.isCpp()) {
|
||||
nextToken();
|
||||
if (FormatTok->is(Keywords.kw_import)) {
|
||||
parseModuleImport();
|
||||
return;
|
||||
}
|
||||
if (FormatTok->is(tok::kw_namespace)) {
|
||||
parseNamespace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case tok::kw_inline:
|
||||
nextToken();
|
||||
if (FormatTok->is(tok::kw_namespace)) {
|
||||
|
|
|
@ -25140,6 +25140,7 @@ TEST_F(FormatTest, Cpp20ModulesSupport) {
|
|||
verifyFormat("export module foo.bar;", Style);
|
||||
verifyFormat("export module foo.bar:baz;", Style);
|
||||
verifyFormat("export import <string_view>;", Style);
|
||||
verifyFormat("export import <Foo/Bar>;", Style);
|
||||
|
||||
verifyFormat("export type_name var;", Style);
|
||||
verifyFormat("template <class T> export using A = B<T>;", Style);
|
||||
|
|
Loading…
Reference in New Issue