[clang] [clang-format] Recognize Verilog export and import (PR #165595)
    via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Sun Nov  2 19:45:10 PST 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;
----------------
sstwcw wrote:
Right.  I looked at the code again.  I decided to remove the part for returning a different value.  The function `parseVerilogHierarchyHeader` does not do so.  So this function can't do so reliably.
https://github.com/llvm/llvm-project/pull/165595
    
    
More information about the cfe-commits
mailing list