From c192b3dcffd5e672a2b2e1730e2440febb4fb192 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 5 Jul 2015 14:23:59 +0000 Subject: Vendor import of clang trunk r241361: https://llvm.org/svn/llvm-project/cfe/trunk@241361 --- lib/CodeGen/CoverageMappingGen.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/CodeGen/CoverageMappingGen.cpp') diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 9ad5d14edfdcc..eca91590e6020 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -475,7 +475,8 @@ struct CounterCoverageMappingBuilder /// files, this adjusts our current region stack and creates the file regions /// for the exited file. void handleFileExit(SourceLocation NewLoc) { - if (SM.isWrittenInSameFile(MostRecentLocation, NewLoc)) + if (NewLoc.isInvalid() || + SM.isWrittenInSameFile(MostRecentLocation, NewLoc)) return; // If NewLoc is not in a file that contains MostRecentLocation, walk up to @@ -581,10 +582,9 @@ struct CounterCoverageMappingBuilder void VisitStmt(const Stmt *S) { if (!S->getLocStart().isInvalid()) extendRegion(S); - for (Stmt::const_child_range I = S->children(); I; ++I) { - if (*I) - this->Visit(*I); - } + for (const Stmt *Child : S->children()) + if (Child) + this->Visit(Child); handleFileExit(getEnd(S)); } @@ -931,7 +931,8 @@ void CoverageMappingModuleGen::addFunctionMappingRecord( if (!FunctionRecordTy) { llvm::Type *FunctionRecordTypes[] = {Int8PtrTy, Int32Ty, Int32Ty, Int64Ty}; FunctionRecordTy = - llvm::StructType::get(Ctx, makeArrayRef(FunctionRecordTypes)); + llvm::StructType::get(Ctx, makeArrayRef(FunctionRecordTypes), + /*isPacked=*/true); } llvm::Constant *FunctionRecordVals[] = { -- cgit v1.2.3