diff options
author | smanna12 <soumi.manna@intel.com> | 2024-03-26 11:48:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 11:48:37 -0500 |
commit | e75989e93063d1ac2626c3478c28ca364e04ef28 (patch) | |
tree | 85178b7b392e81e28ff2fdfc8de5feb5e3607cf0 /clang/lib/Sema/SemaChecking.cpp | |
parent | 7860f970666f46184ad740db48a69882d62e64fc (diff) | |
download | llvm-e75989e93063d1ac2626c3478c28ca364e04ef28.zip llvm-e75989e93063d1ac2626c3478c28ca364e04ef28.tar.gz llvm-e75989e93063d1ac2626c3478c28ca364e04ef28.tar.bz2 |
[NFC][Clang] Fix potential dereferencing of nullptr (#85944)
This patch replaces getAs<> with castAs<> to resolve potential static
analyzer bugs for
1. Dereferencing a pointer issue with nullptr FPT when calling
ResolveExceptionSpec() in
checkEscapingByref(clang::VarDecl *, clang::Sema &).
3. Dereferencing a pointer issue with nullptr ElementTy->getAs() when
calling getElementType() in
clang::Sema::SemaBuiltinFPClassification(clang::CallExpr *, unsigned
int).
4. Dereferencing a pointer issue with nullptr ConvType->getAs() when
calling getKeyword() in
clang::Sema::ActOnConversionDeclarator(clang::CXXConversionDecl *).
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c725ec0..b4e87b6 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -9709,7 +9709,7 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs, // vector argument can be supported in all of them. if (ElementTy->isVectorType() && IsFPClass) { VectorResultTy = GetSignedVectorType(ElementTy); - ElementTy = ElementTy->getAs<VectorType>()->getElementType(); + ElementTy = ElementTy->castAs<VectorType>()->getElementType(); } // This operation requires a non-_Complex floating-point number. |