[PATCH] D139919: use std::optional in ClangTidyCheck

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 01:21:40 PST 2022


MaskRay added a comment.

In D139919#3991242 <https://reviews.llvm.org/D139919#3991242>, @carlosgalvezp wrote:

> AFAIK it's preferred to use the LLVM types instead of the Standard types:
>
>> When both C++ and the LLVM support libraries provide similar functionality, and there isn’t a specific reason to favor the C++ implementation, it is generally preferable to use the LLVM library
>
> https://llvm.org/docs/CodingStandards.html#c-standard-library

This should be read with a grain of salt. For example, it apparently doesn't apply to things are being deprecated. `llvm::Optional` is being actively removed and many of its functions are deprecated for eventual removal. A large portion of the other components in llvm-project have migrated. See https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716/14



================
Comment at: clang-tools-extra/clang-tidy/ClangTidyCheck.h:457
 
-
 } // namespace tidy
 } // namespace clang
----------------
drop whitespace change

use line-based clang-format to prevent updating unrelated lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139919



More information about the cfe-commits mailing list