Skip to content

Commit 831a8b5

Browse files
committed
Add dump info for VarDecl
A VarDecl can either be a declaration, a definition, or a tentative definition. This dumps that information because it turned out to be useful for a discussion trying to understand a difference in behavior between C and C++.
1 parent 3a68751 commit 831a8b5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,13 +2461,27 @@ void TextNodeDumper::VisitVarDecl(const VarDecl *D) {
24612461
break;
24622462
case VarDecl::ParenListInit:
24632463
OS << " parenlistinit";
2464+
break;
24642465
}
24652466
}
24662467
if (D->needsDestruction(D->getASTContext()))
24672468
OS << " destroyed";
24682469
if (D->isParameterPack())
24692470
OS << " pack";
24702471

2472+
VarDecl::DefinitionKind K = D->isThisDeclarationADefinition();
2473+
switch (K) {
2474+
case VarDecl::DefinitionKind::DeclarationOnly:
2475+
OS << " declaration";
2476+
break;
2477+
case VarDecl::DefinitionKind::Definition:
2478+
OS << " definition";
2479+
break;
2480+
case VarDecl::DefinitionKind::TentativeDefinition:
2481+
OS << " tentative definition";
2482+
break;
2483+
}
2484+
24712485
if (const auto *Instance = D->getTemplateInstantiationPattern()) {
24722486
OS << " instantiated_from";
24732487
dumpPointer(Instance);

0 commit comments

Comments
 (0)