Skip to content

Commit 19c5057

Browse files
committed
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.
1 parent 39d6b6c commit 19c5057

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn,
13571357
std::string typeName;
13581358
if (isPipe)
13591359
typeName = ty.getCanonicalType()
1360-
->getAs<PipeType>()
1360+
->castAs<PipeType>()
13611361
->getElementType()
13621362
.getAsString(Policy);
13631363
else
@@ -1371,7 +1371,7 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn,
13711371
std::string baseTypeName;
13721372
if (isPipe)
13731373
baseTypeName = ty.getCanonicalType()
1374-
->getAs<PipeType>()
1374+
->castAs<PipeType>()
13751375
->getElementType()
13761376
.getCanonicalType()
13771377
.getAsString(Policy);

0 commit comments

Comments
 (0)