[PATCH] D105457: [clang] Refactor AST printing tests to share more infrastructure

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 11 19:14:30 PDT 2021


nridge added inline comments.


================
Comment at: clang/unittests/AST/DeclPrinterTest.cpp:59
+  return PrintedNodeMatches<Decl>(Code, Args, NodeMatch, ExpectedPrinted,
+                                  FileName, PrinterType<Decl>{PrintDecl},
+                                  PolicyModifier, AllowError);
----------------
dblaikie wrote:
> Is the `PrinterType<Decl>{}` needed here, or could `PrintDecl` be passed directly/without explicitly constructing the wrapper? (functions should be implicitly convertible to the lambda type, I think?) 
> 
> Similarly for all the `PrintingPolicyAdjuster(...)` - might be able to skip that wrapping expression & rely on an implicit conversion.
Good call on both counts. (The `PrintingPolicyAdjuster(...)` stuff was left over from when the typedef was for an `Optional<function_ref>` which you correctly observed was redundant.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105457/new/

https://reviews.llvm.org/D105457



More information about the cfe-commits mailing list