[PATCH] D84812: [clang-tidy][NFC] Added convienence methods for getting optional options
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 29 04:04:55 PDT 2020
njames93 marked an inline comment as done.
njames93 added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp:224
+ else
+ consumeError(ValueOr.takeError());
+ return llvm::None;
----------------
gribozavr2 wrote:
> Is this specialization defined only because parsing a string option can never fail? I'd let this special case behavior fall out of the primary template if possible.
It's because the call to get that returns a `std::string` isn't a template.
So in the actual template definition of `getOptional`, trying to call `get<T>` when `T` is a `std::string` results in a compile time error.
Consuming the error makes sense knowing the it will always be a `MissingOptionError`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84812/new/
https://reviews.llvm.org/D84812
More information about the cfe-commits
mailing list