From 19c5057e8df62e75b26e881dfc8f8f32686fe75c Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 15 Jan 2020 16:40:20 +0000 Subject: Fix "pointer is null" static analyzer warnings. NFCI. Use castAs<> instead of getAs<> since the pointer is dereferenced immediately in all cases and castAs will perform the null assertion for us. --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 038078bbe88d..feb8d000eca3 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1357,7 +1357,7 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn, std::string typeName; if (isPipe) typeName = ty.getCanonicalType() - ->getAs() + ->castAs() ->getElementType() .getAsString(Policy); else @@ -1371,7 +1371,7 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn, std::string baseTypeName; if (isPipe) baseTypeName = ty.getCanonicalType() - ->getAs() + ->castAs() ->getElementType() .getCanonicalType() .getAsString(Policy); -- cgit v1.2.3