[PATCH] D145138: [clang-tidy] Implement FixIts for C arrays
Chris Cotter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 1 14:35:05 PDT 2023
ccotter marked 5 inline comments as done.
ccotter added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp:496
+ const Expr *SpelledExpr = E->IgnoreUnlessSpelledInSource();
+ if (dyn_cast<InitListExpr>(SpelledExpr))
+ return false;
----------------
PiotrZSL wrote:
> InitListExpr::classof(SpelledExpr)
Why `classof` vs `dyn_cast`? The codebase seems to overwhelmingly use `dyn_cst`, and I need to use the downcast type anyway..
================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp:531
+ return {};
+ // TODO: How can I get FileCheck to accept '{{}}' as a non-regex match?
+ FixIts.push_back(FixItHint::CreateInsertion(InitRange.getBegin(), "{ "));
----------------
PiotrZSL wrote:
> https://www.llvm.org/docs/CommandGuide/FileCheck.html
> "In the rare case that you want to match double braces explicitly from the input, you can use something ugly like {{[}][}]}} as your pattern."
Thanks..fixed!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145138/new/
https://reviews.llvm.org/D145138
More information about the cfe-commits
mailing list