[PATCH] D77503: [ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 12:31:08 PDT 2020
njames93 updated this revision to Diff 255440.
njames93 added a comment.
- Added support for giving suggestions on invalid inputs
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77503/new/
https://reviews.llvm.org/D77503
Files:
clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.h
Index: clang/lib/ASTMatchers/Dynamic/Marshallers.h
===================================================================
--- clang/lib/ASTMatchers/Dynamic/Marshallers.h
+++ clang/lib/ASTMatchers/Dynamic/Marshallers.h
@@ -170,7 +170,7 @@
private:
static Optional<CastKind> getCastKind(llvm::StringRef AttrKind) {
return llvm::StringSwitch<Optional<CastKind>>(AttrKind)
-#define CAST_OPERATION(Name) .Case( #Name, CK_##Name)
+#define CAST_OPERATION(Name) .Case("CK_" #Name, CK_##Name)
#include "clang/AST/OperationKinds.def"
.Default(llvm::None);
}
Index: clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
===================================================================
--- clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
+++ clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
@@ -67,11 +67,12 @@
clang::ast_matchers::dynamic::internal::ArgTypeTraits<
clang::CastKind>::getBestGuess(const VariantValue &Value) {
static constexpr llvm::StringRef Allowed[] = {
-#define CAST_OPERATION(Name) #Name,
+#define CAST_OPERATION(Name) "CK_" #Name,
#include "clang/AST/OperationKinds.def"
};
if (Value.isString())
- return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed));
+ return ::getBestGuess(Value.getString(), llvm::makeArrayRef(Allowed),
+ "CK_");
return llvm::None;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77503.255440.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200406/7bfd9b27/attachment.bin>
More information about the cfe-commits
mailing list