[clang] [clang-format] Recognize Verilog export and import (PR #165595)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 29 14:00:41 PDT 2025
================
@@ -4555,6 +4559,26 @@ void UnwrappedLineParser::parseVerilogCaseLabel() {
Line->Level = OrigLevel;
}
+bool UnwrappedLineParser::tryToParseVerilogExtern() {
+ assert(
+ FormatTok->isOneOf(tok::kw_extern, tok::kw_export, Keywords.kw_import));
+ nextToken();
+ // "DPI-C"
+ if (FormatTok->is(tok::string_literal))
+ nextToken();
+ if (FormatTok->isOneOf(Keywords.kw_context, Keywords.kw_pure))
+ nextToken();
+ if (Keywords.isVerilogIdentifier(*FormatTok))
+ nextToken();
+ if (FormatTok->is(tok::equal))
+ nextToken();
+ if (Keywords.isVerilogHierarchy(*FormatTok)) {
+ parseVerilogHierarchyHeader();
+ return true;
+ }
+ return false;
----------------
HazardyKnusperkeks wrote:
I assume when we land here we have incomplete or invalid code and don't really care about the remaining formatting?
https://github.com/llvm/llvm-project/pull/165595
More information about the cfe-commits
mailing list