void anchor() override;
OMPCapturedExprDecl(ASTContext &C, DeclContext *DC, IdentifierInfo *Id,
- QualType Type)
- : VarDecl(OMPCapturedExpr, C, DC, SourceLocation(), SourceLocation(), Id,
- Type, nullptr, SC_None) {
+ QualType Type, SourceLocation StartLoc)
+ : VarDecl(OMPCapturedExpr, C, DC, StartLoc, SourceLocation(), Id, Type,
+ nullptr, SC_None) {
setImplicit();
}
public:
static OMPCapturedExprDecl *Create(ASTContext &C, DeclContext *DC,
- IdentifierInfo *Id, QualType T);
+ IdentifierInfo *Id, QualType T,
+ SourceLocation StartLoc);
static OMPCapturedExprDecl *CreateDeserialized(ASTContext &C, unsigned ID);
+ SourceRange getSourceRange() const override LLVM_READONLY;
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) { return K == OMPCapturedExpr; }
void OMPCapturedExprDecl::anchor() {}
OMPCapturedExprDecl *OMPCapturedExprDecl::Create(ASTContext &C, DeclContext *DC,
- IdentifierInfo *Id,
- QualType T) {
- return new (C, DC) OMPCapturedExprDecl(C, DC, Id, T);
+ IdentifierInfo *Id, QualType T,
+ SourceLocation StartLoc) {
+ return new (C, DC) OMPCapturedExprDecl(C, DC, Id, T, StartLoc);
}
OMPCapturedExprDecl *OMPCapturedExprDecl::CreateDeserialized(ASTContext &C,
unsigned ID) {
- return new (C, ID) OMPCapturedExprDecl(C, nullptr, nullptr, QualType());
+ return new (C, ID)
+ OMPCapturedExprDecl(C, nullptr, nullptr, QualType(), SourceLocation());
}
+SourceRange OMPCapturedExprDecl::getSourceRange() const {
+ assert(hasInit());
+ return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd());
+}
}
WithInit = true;
}
- auto *CED = OMPCapturedExprDecl::Create(C, S.CurContext, Id, Ty);
+ auto *CED = OMPCapturedExprDecl::Create(C, S.CurContext, Id, Ty,
+ CaptureExpr->getLocStart());
if (!WithInit)
CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C, SourceRange()));
S.CurContext->addHiddenDecl(CED);
Scope *CurScope = DSA.getCurScope();
for (unsigned Cnt = 1; Cnt < NestedLoopCount; ++Cnt) {
if (PreCond.isUsable()) {
- PreCond = SemaRef.BuildBinOp(CurScope, SourceLocation(), BO_LAnd,
- PreCond.get(), IterSpaces[Cnt].PreCond);
+ PreCond =
+ SemaRef.BuildBinOp(CurScope, PreCond.get()->getExprLoc(), BO_LAnd,
+ PreCond.get(), IterSpaces[Cnt].PreCond);
}
auto N = IterSpaces[Cnt].NumIterations;
+ SourceLocation Loc = N->getExprLoc();
AllCountsNeedLessThan32Bits &= C.getTypeSize(N->getType()) < 32;
if (LastIteration32.isUsable())
LastIteration32 = SemaRef.BuildBinOp(
- CurScope, SourceLocation(), BO_Mul, LastIteration32.get(),
+ CurScope, Loc, BO_Mul, LastIteration32.get(),
SemaRef
.PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(),
Sema::AA_Converting,
.get());
if (LastIteration64.isUsable())
LastIteration64 = SemaRef.BuildBinOp(
- CurScope, SourceLocation(), BO_Mul, LastIteration64.get(),
+ CurScope, Loc, BO_Mul, LastIteration64.get(),
SemaRef
.PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(),
Sema::AA_Converting,
ExprResult NumIterations = LastIteration;
{
LastIteration = SemaRef.BuildBinOp(
- CurScope, SourceLocation(), BO_Sub, LastIteration.get(),
+ CurScope, LastIteration.get()->getExprLoc(), BO_Sub,
+ LastIteration.get(),
SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
if (!LastIteration.isUsable())
return 0;
// Prepare SaveRef + 1.
NumIterations = SemaRef.BuildBinOp(
- CurScope, SourceLocation(), BO_Add, SaveRef.get(),
+ CurScope, SaveRef.get()->getExprLoc(), BO_Add, SaveRef.get(),
SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
if (!NumIterations.isUsable())
return 0;
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
+// RUN: %clang_cc1 -main-file-name for_codegen.cpp %s -o - -emit-llvm -fprofile-instrument=clang -fprofile-instrument-path=for_codegen-test.profraw | FileCheck %s --check-prefix=PROF-INSTR-PATH
//
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
+// PROF-INSTR-PATH: constant [25 x i8] c"for_codegen-test.profraw\00"
+
// CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* }
// CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8*
// CHECK-DAG: [[I:@.+]] = global i8 1,