[PATCH] D56753: [ASTDump] Mark null params with a tag rather than a child node
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 16 05:21:32 PST 2019
aaron.ballman added a comment.
Do we have any test coverage for this change? IIRC, this was one we couldn't figure out how to trigger?
================
Comment at: lib/AST/ASTDumper.cpp:637
+ if (!D->param_begin() && D->getNumParams())
+ OS << " <<NULL params x " << D->getNumParams() << ">>";
+
----------------
Extra whitespace at the start of the string literal, or is that intentional? Also, do we want to standardize on `<<<NULL>>>` with three brackets instead of two?
================
Comment at: lib/AST/ASTDumper.cpp:642
- if (!D->param_begin() && D->getNumParams())
- dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
- else
- for (const ParmVarDecl *Parameter : D->parameters())
+ if (D->param_begin() || !D->getNumParams())
+ for (const auto *Parameter : D->parameters())
----------------
You can drop `getNumParams()` here -- if `param_begin()` returns a non-null value, `getNumParams()` must return a non-zero value.
(`param_begin()` is implemented in terms of `parameters()`, which calls `getNumParams()` when setting up the returned `ArrayRef`.)
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56753/new/
https://reviews.llvm.org/D56753
More information about the cfe-commits
mailing list