[PATCH] D56354: [AST] Replace asserts with if() in SourceLocation accessors
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 7 12:50:43 PST 2019
steveire marked an inline comment as done.
steveire added inline comments.
================
Comment at: include/clang/AST/DeclarationName.h:735
+ Name.getNameKind() != DeclarationName::CXXConversionFunctionName)
+ return nullptr;
return LocInfo.NamedType.TInfo;
----------------
aaron.ballman wrote:
> Did you investigate the callers of this function to see which ones need a null pointer check inserted into them? Otherwise, this change turns an assertion into harder to track down UB. (I'm less worried about the other changes because those will fail more gracefully.)
All callers in clang are fine. Here's the output of `git grep -h TypeSourceInfo`:
/// getNamedTypeInfo - Returns the source type info associated to
TypeSourceInfo *getNamedTypeInfo() const {
if (TypeSourceInfo *TSInfo = NameInfo.getNamedTypeInfo())
if (auto ToTInfoOrErr = import(From.getNamedTypeInfo()))
if (auto TypeNameInfo = Dtor->getNameInfo().getNamedTypeInfo()) {
if (TypeSourceInfo *TSInfo = NameInfo.getNamedTypeInfo())
if (TypeSourceInfo *OldTInfo = NameInfo.getNamedTypeInfo()) {
if (TypeSourceInfo *TSInfo = Name.getNamedTypeInfo())
clang-tools-extra has no uses of it. Is there anywhere else to check?
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56354/new/
https://reviews.llvm.org/D56354
More information about the cfe-commits
mailing list