Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -10030,6 +10030,9 @@ return false; ObjCTypeParamList *typeParams = iface->getTypeParamList(); + if (!typeParams) + return std::nullopt; + for (unsigned i = 0, n = lhsArgs.size(); i != n; ++i) { if (ctx.hasSameType(lhsArgs[i], rhsArgs[i])) continue; Index: clang/lib/AST/MicrosoftMangle.cpp =================================================================== --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -2693,7 +2693,7 @@ // Copy constructor closure always takes an unqualified reference. mangleFunctionArgumentType(getASTContext().getLValueReferenceType( Proto->getParamType(0) - ->getAs() + ->castAs() ->getPointeeType(), /*SpelledAsLValue=*/true), Range); Index: clang/lib/Analysis/ThreadSafety.cpp =================================================================== --- clang/lib/Analysis/ThreadSafety.cpp +++ clang/lib/Analysis/ThreadSafety.cpp @@ -504,6 +504,8 @@ D->printName(llvm::errs()); const unsigned *i = C.lookup(D); llvm::errs() << " -> "; + if (!i) + return nullptr; dumpVarDefinitionName(*i); llvm::errs() << "\n"; } Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp =================================================================== --- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -3365,7 +3365,7 @@ if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic) return Address::invalid(); - VD = VD->getCanonicalDecl(); + VD = cast(VD->getCanonicalDecl()); auto I = FunctionGlobalizedDecls.find(CGF.CurFn); if (I == FunctionGlobalizedDecls.end()) return Address::invalid(); Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -4955,7 +4955,8 @@ }; // The matrix subscript operator ([][])is considered a single operator. // Separating the index expressions by parenthesis is not allowed. - if (base->hasPlaceholderType(BuiltinType::IncompleteMatrixIdx) && + if (base && !base->getType().isNull() && + base->hasPlaceholderType(BuiltinType::IncompleteMatrixIdx) && !isa(base)) { Diag(base->getExprLoc(), diag::err_matrix_separate_incomplete_index) << SourceRange(base->getBeginLoc(), rbLoc);