[PATCH] D77499: [ASTMatchers] Matchers that take enumerations args provide hints with invalid arguments
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 07:33:08 PDT 2020
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
Thank you for working on this, I think it's very useful functionality! I'd appreciate seeing some unit test coverage for these changes.
================
Comment at: clang/lib/ASTMatchers/Dynamic/CMakeLists.txt:17
Registry.cpp
+ Marshallers.cpp
----------------
We usually try to keep these lists in alphabetical order. Would you mind hoisting this up a bit (feel free to change VariantValue.cpp as a driveby if you want, or just leave it there)?
================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.cpp:10
+ llvm::StringRef DropPrefix = "", unsigned MaxEditDistance = 3) {
+ if (MaxEditDistance != -1u) {
+ ++MaxEditDistance;
----------------
Elide braces, and please use `~0U` instead of `-1u`.
================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.cpp:16-17
+ if (Item.equals_lower(Search)) {
+ if (Item.equals(Search))
+ return Item.str();
+ MaxEditDistance = 1;
----------------
Is this case possible to hit? I would imagine that if the search time matches anything in the allowed list, we would have not needed to call `getBestGuess()` in the first place?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77499/new/
https://reviews.llvm.org/D77499
More information about the cfe-commits
mailing list