diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCoroutine.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 6 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 3 |
11 files changed, 15 insertions, 24 deletions
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp index 5842e7b3ff9..74c158cbd39 100644 --- a/clang/lib/CodeGen/CGCoroutine.cpp +++ b/clang/lib/CodeGen/CGCoroutine.cpp @@ -315,7 +315,7 @@ namespace { GetParamRef Visitor; Visitor.Visit(const_cast<Expr*>(InitExpr)); assert(Visitor.Expr); - auto *DREOrig = cast<DeclRefExpr>(Visitor.Expr); + DeclRefExpr *DREOrig = Visitor.Expr; auto *PD = DREOrig->getDecl(); auto it = LocalDeclMap.find(PD); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 403957214a6..4cb9b2dfd94 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3036,7 +3036,7 @@ llvm::DISubprogram *CGDebugInfo::getFunctionFwdDeclOrStub(GlobalDecl GD, !FD->isExternallyVisible(), /* isDefinition = */ false, 0, Flags, CGM.getLangOpts().Optimize, TParamsArray.get(), getFunctionDeclaration(FD)); - const auto *CanonDecl = cast<FunctionDecl>(FD->getCanonicalDecl()); + const FunctionDecl *CanonDecl = FD->getCanonicalDecl(); FwdDeclReplaceMap.emplace_back(std::piecewise_construct, std::make_tuple(CanonDecl), std::make_tuple(SP)); @@ -3576,7 +3576,7 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD, } else if (const auto *RT = dyn_cast<RecordType>(VD->getType())) { // If VD is an anonymous union then Storage represents value for // all union fields. - const auto *RD = cast<RecordDecl>(RT->getDecl()); + const RecordDecl *RD = RT->getDecl(); if (RD->isUnion() && RD->isAnonymousStructOrUnion()) { // GDB has trouble finding local variables in anonymous unions, so we emit // artifical local variables for each of the members. diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 57110467f61..5a025ce0846 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -80,8 +80,7 @@ public: if (!Function) { if (!FunctionName) return nullptr; - Function = - cast<llvm::Constant>(CGM->CreateRuntimeFunction(FTy, FunctionName)); + Function = CGM->CreateRuntimeFunction(FTy, FunctionName); } return Function; } diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index e15de224c62..a07bed64127 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -3682,9 +3682,7 @@ void CGOpenMPRuntime::loadOffloadInfoMetadata() { if (!MD) return; - for (auto I : MD->operands()) { - llvm::MDNode *MN = cast<llvm::MDNode>(I); - + for (llvm::MDNode *MN : MD->operands()) { auto getMDInt = [&](unsigned Idx) { llvm::ConstantAsMetadata *V = cast<llvm::ConstantAsMetadata>(MN->getOperand(Idx)); @@ -6788,7 +6786,7 @@ public: const ValueDecl *VD = Cap->capturesThis() ? nullptr - : cast<ValueDecl>(Cap->getCapturedVar()->getCanonicalDecl()); + : Cap->getCapturedVar()->getCanonicalDecl(); // If this declaration appears in a is_device_ptr clause we just have to // pass the pointer by value. If it is a reference to a declaration, we just diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index d794b12b3d3..7296da7d7e9 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -789,8 +789,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, } // Verify that the LLVM and AST field offsets agree. - llvm::StructType *ST = - dyn_cast<llvm::StructType>(RL->getLLVMType()); + llvm::StructType *ST = RL->getLLVMType(); const llvm::StructLayout *SL = getDataLayout().getStructLayout(ST); const ASTRecordLayout &AST_RL = getContext().getASTRecordLayout(D); diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index dec372066b8..d9b4fa83a93 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -128,11 +128,9 @@ class OMPLoopScope : public CodeGenFunction::RunCleanupsScope { }); } (void)PreCondScope.Privatize(); - if (auto *LD = dyn_cast<OMPLoopDirective>(&S)) { - if (auto *PreInits = cast_or_null<DeclStmt>(LD->getPreInits())) { - for (const auto *I : PreInits->decls()) - CGF.EmitVarDecl(cast<VarDecl>(*I)); - } + if (auto *PreInits = cast_or_null<DeclStmt>(S.getPreInits())) { + for (const auto *I : PreInits->decls()) + CGF.EmitVarDecl(cast<VarDecl>(*I)); } } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a7591b10455..38c679abf6b 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1118,8 +1118,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, // may have a static invoker function, which may call this operator with // a null 'this' pointer. if (isLambdaCallOperator(MD) && - cast<CXXRecordDecl>(MD->getParent())->getLambdaCaptureDefault() == - LCD_None) + MD->getParent()->getLambdaCaptureDefault() == LCD_None) SkippedChecks.set(SanitizerKind::Null, true); EmitTypeCheck(isa<CXXConstructorDecl>(MD) ? TCK_ConstructorCall diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 217f9639ba7..389f586443c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2814,7 +2814,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, GetAddrOfGlobalVar(D, InitType, IsForDefinition)); // Erase the old global, since it is no longer used. - cast<llvm::GlobalValue>(GV)->eraseFromParent(); + GV->eraseFromParent(); GV = NewGV; } else { GV->setInitializer(Init); diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 529a13b7adc..ccb6df9a580 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -767,7 +767,7 @@ bool CodeGenTypes::isZeroInitializable(QualType T) { // Records are non-zero-initializable if they contain any // non-zero-initializable subobjects. if (const RecordType *RT = T->getAs<RecordType>()) { - auto RD = cast<RecordDecl>(RT->getDecl()); + const RecordDecl *RD = RT->getDecl(); return isZeroInitializable(RD); } diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index df4a533d46e..3b45e5748fb 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -1693,8 +1693,7 @@ llvm::Value *ItaniumCXXABI::EmitVirtualDestructorCall( const CGFunctionInfo *FInfo = &CGM.getTypes().arrangeCXXStructorDeclaration( Dtor, getFromDtorType(DtorType)); - auto *Ty = - cast<llvm::FunctionType>(CGF.CGM.getTypes().GetFunctionType(*FInfo)); + llvm::FunctionType *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); CGCallee Callee = CGCallee::forVirtual(CE, GlobalDecl(Dtor, DtorType), This, Ty); diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index c272891565b..43c061ec8e3 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1886,8 +1886,7 @@ llvm::Value *MicrosoftCXXABI::EmitVirtualDestructorCall( GlobalDecl GD(Dtor, Dtor_Deleting); const CGFunctionInfo *FInfo = &CGM.getTypes().arrangeCXXStructorDeclaration( Dtor, StructorType::Deleting); - auto *Ty = - cast<llvm::FunctionType>(CGF.CGM.getTypes().GetFunctionType(*FInfo)); + llvm::FunctionType *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); CGCallee Callee = CGCallee::forVirtual(CE, GD, This, Ty); ASTContext &Context = getContext(); |