@@ -64,6 +64,39 @@ class FormatTokenSource {
64
64
65
65
namespace {
66
66
67
+ void printLine (llvm::raw_ostream &OS, const UnwrappedLine &Line,
68
+ StringRef Prefix = " " , bool PrintText = false ) {
69
+ OS << Prefix << " Line(" << Line.Level << " , FSC=" << Line.FirstStartColumn
70
+ << " )" << (Line.InPPDirective ? " MACRO" : " " ) << " : " ;
71
+ bool NewLine = false ;
72
+ for (std::list<UnwrappedLineNode>::const_iterator I = Line.Tokens .begin (),
73
+ E = Line.Tokens .end ();
74
+ I != E; ++I) {
75
+ if (NewLine) {
76
+ OS << Prefix;
77
+ NewLine = false ;
78
+ }
79
+ OS << I->Tok ->Tok .getName () << " ["
80
+ << " T=" << (unsigned )I->Tok ->getType ()
81
+ << " , OC=" << I->Tok ->OriginalColumn << " , \" " << I->Tok ->TokenText
82
+ << " \" ] " ;
83
+ for (SmallVectorImpl<UnwrappedLine>::const_iterator
84
+ CI = I->Children .begin (),
85
+ CE = I->Children .end ();
86
+ CI != CE; ++CI) {
87
+ OS << " \n " ;
88
+ printLine (OS, *CI, (Prefix + " " ).str ());
89
+ NewLine = true ;
90
+ }
91
+ }
92
+ if (!NewLine)
93
+ OS << " \n " ;
94
+ }
95
+
96
+ LLVM_ATTRIBUTE_UNUSED static void printDebugInfo (const UnwrappedLine &Line) {
97
+ printLine (llvm::dbgs (), Line);
98
+ }
99
+
67
100
class ScopedDeclarationState {
68
101
public:
69
102
ScopedDeclarationState (UnwrappedLine &Line, llvm::BitVector &Stack,
@@ -4314,23 +4347,6 @@ void UnwrappedLineParser::parseVerilogCaseLabel() {
4314
4347
Line->Level = OrigLevel;
4315
4348
}
4316
4349
4317
- LLVM_ATTRIBUTE_UNUSED static void printDebugInfo (const UnwrappedLine &Line,
4318
- StringRef Prefix = " " ) {
4319
- llvm::dbgs () << Prefix << " Line(" << Line.Level
4320
- << " , FSC=" << Line.FirstStartColumn << " )"
4321
- << (Line.InPPDirective ? " MACRO" : " " ) << " : " ;
4322
- for (const auto &Node : Line.Tokens ) {
4323
- llvm::dbgs () << Node.Tok ->Tok .getName () << " ["
4324
- << " T=" << static_cast <unsigned >(Node.Tok ->getType ())
4325
- << " , OC=" << Node.Tok ->OriginalColumn << " ] " ;
4326
- }
4327
- for (const auto &Node : Line.Tokens )
4328
- for (const auto &ChildNode : Node.Children )
4329
- printDebugInfo (ChildNode, " \n Child: " );
4330
-
4331
- llvm::dbgs () << " \n " ;
4332
- }
4333
-
4334
4350
void UnwrappedLineParser::addUnwrappedLine (LineLevel AdjustLevel) {
4335
4351
if (Line->Tokens .empty ())
4336
4352
return ;
0 commit comments