Skip to content

Commit fd4aaf5

Browse files
committed
cleanups
1 parent 99d11a5 commit fd4aaf5

File tree

7 files changed

+124
-85
lines changed

7 files changed

+124
-85
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,22 +2907,27 @@ class CallExpr : public Expr {
29072907
//
29082908
// * An optional of type FPOptionsOverride.
29092909
//
2910-
// Note that we store the offset in bytes from the this pointer to the start
2911-
// of the trailing objects. It would be perfectly possible to compute it
2912-
// based on the dynamic kind of the CallExpr. However 1.) we have plenty of
2913-
// space in the bit-fields of Stmt. 2.) It was benchmarked to be faster to
2914-
// compute this once and then load the offset from the bit-fields of Stmt,
2915-
// instead of re-computing the offset each time the trailing objects are
2916-
// accessed.
2910+
// CallExpr subclasses are asssumed to be 32 bytes or less, and CallExpr
2911+
// itself is 24 bytes. To avoid having to recompute or store the offset of the
2912+
// trailing objects, we put it at 32 bytes (such that it is suitable for all
2913+
// subclasses) We use the 8 bytes gap left for instances of CallExpr to store
2914+
// the begin and end source locations. Caching the begin source location in
2915+
// particular as a significant impact on perf as getBeginLoc is assumed to be
2916+
// cheap.
2917+
// The layourt is as follow:
2918+
// CallExpr | Begin | End | Trailing Objects
2919+
// CXXMemberCallExpr | Trailing Objects
2920+
// A bit in CallExprBitfields indicates if source locations are presents.
29172921

29182922
protected:
29192923
static constexpr unsigned offsetToTrailingObjects = 32;
2920-
29212924
template <typename T>
2922-
static constexpr unsigned sizeToAllocateForCallExprSubclass(unsigned SizeOfTrailingObjects) {
2925+
static constexpr unsigned
2926+
sizeToAllocateForCallExprSubclass(unsigned SizeOfTrailingObjects) {
29232927
static_assert(sizeof(T) <= CallExpr::offsetToTrailingObjects);
29242928
return SizeOfTrailingObjects + CallExpr::offsetToTrailingObjects;
29252929
}
2930+
29262931
private:
29272932
/// Return a pointer to the start of the trailing array of "Stmt *".
29282933
Stmt **getTrailingStmts() {
@@ -2992,8 +2997,8 @@ class CallExpr : public Expr {
29922997
const FPOptionsOverride *getTrailingFPFeatures() const {
29932998
assert(hasStoredFPFeatures());
29942999
return reinterpret_cast<const FPOptionsOverride *>(
2995-
reinterpret_cast<const char *>(this) +
2996-
offsetToTrailingObjects + getSizeOfTrailingStmts());
3000+
reinterpret_cast<const char *>(this) + offsetToTrailingObjects +
3001+
getSizeOfTrailingStmts());
29973002
}
29983003

29993004
public:
@@ -3039,15 +3044,17 @@ class CallExpr : public Expr {
30393044

30403045
bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; }
30413046

3042-
bool usesMemberSyntax() const { return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax; }
3047+
bool usesMemberSyntax() const {
3048+
return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax;
3049+
}
30433050
void setUsesMemberSyntax(bool V = true) {
3044-
CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = V;
3045-
// Because the source location may be different for explicit
3046-
// member, we reset the cached values.
3047-
if(CallExprBits.HasTrailingSourceLoc) {
3048-
CallExprBits.HasTrailingSourceLoc = false;
3049-
setTrailingSourceLocs();
3050-
}
3051+
CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = V;
3052+
// Because the source location may be different for explicit
3053+
// member, we reset the cached values.
3054+
if (CallExprBits.HasTrailingSourceLocs) {
3055+
CallExprBits.HasTrailingSourceLocs = false;
3056+
updateTrailingSourceLocs();
3057+
}
30513058
}
30523059

30533060
bool isCoroElideSafe() const { return CallExprBits.IsCoroElideSafe; }
@@ -3209,24 +3216,20 @@ class CallExpr : public Expr {
32093216
SourceLocation getRParenLoc() const { return RParenLoc; }
32103217
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
32113218

3219+
template <unsigned N> SourceLocation getTrailingSourceLoc() const {
3220+
static_assert(N <= 1);
3221+
assert(CallExprBits.HasTrailingSourceLocs && "No trailing source loc");
3222+
static_assert(sizeof(CallExpr) <=
3223+
offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3224+
return *reinterpret_cast<const SourceLocation *>(
3225+
reinterpret_cast<const char *>(this) + sizeof(CallExpr) +
3226+
sizeof(SourceLocation) * N);
3227+
}
3228+
32123229
SourceLocation getBeginLoc() const {
3213-
if(CallExprBits.HasTrailingSourceLoc) {
3214-
static_assert(sizeof(CallExpr) <= offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3215-
return *reinterpret_cast<const SourceLocation*>(reinterpret_cast<const char *>(this) +
3216-
sizeof(CallExpr));
3217-
}
3230+
if (CallExprBits.HasTrailingSourceLocs)
3231+
return getTrailingSourceLoc<0>();
32183232

3219-
//if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(this))
3220-
// return OCE->getBeginLoc();
3221-
3222-
// A non-dependent call to a member function with an explicit object parameter
3223-
// is modelled with the object expression being the first argument, e.g. in
3224-
// `o.f(x)`, the callee will be just `f`, and `o` will be the first argument.
3225-
// Since the first argument is written before the callee, the expression's
3226-
// begin location should come from the first argument.
3227-
// This does not apply to dependent calls, which are modelled with `o.f`
3228-
// being the callee.
3229-
// Because this check is expennsive, we cache the result.
32303233
if (usesMemberSyntax()) {
32313234
if (auto FirstArgLoc = getArg(0)->getBeginLoc(); FirstArgLoc.isValid()) {
32323235
return FirstArgLoc;
@@ -3236,36 +3239,36 @@ class CallExpr : public Expr {
32363239
}
32373240

32383241
SourceLocation getEndLoc() const {
3239-
if(CallExprBits.HasTrailingSourceLoc) {
3240-
static_assert(sizeof(CallExpr) <= offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3241-
return *reinterpret_cast<const SourceLocation*>(reinterpret_cast<const char *>(this) +
3242-
sizeof(CallExpr) + sizeof(SourceLocation));
3243-
}
3242+
if (CallExprBits.HasTrailingSourceLocs)
3243+
return getTrailingSourceLoc<0>();
32443244

32453245
SourceLocation end = getRParenLoc();
32463246
if (end.isInvalid() && getNumArgs() > 0 && getArg(getNumArgs() - 1))
32473247
end = getArg(getNumArgs() - 1)->getEndLoc();
32483248
return end;
32493249
}
32503250

3251-
32523251
private:
3253-
friend class ASTStmtReader;
32543252
bool hasTrailingSourceLoc() const {
3255-
return CallExprBits.HasTrailingSourceLoc;
3253+
return CallExprBits.HasTrailingSourceLocs;
32563254
}
3257-
void setTrailingSourceLocs() {
3258-
assert(!CallExprBits.HasTrailingSourceLoc);
3259-
static_assert(sizeof(CallExpr) <= offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3260-
SourceLocation* Locs = reinterpret_cast<SourceLocation*>(reinterpret_cast<char *>(this) +
3261-
sizeof(CallExpr));
3262-
new (Locs) SourceLocation(getBeginLoc());
3263-
new (Locs+1) SourceLocation(getEndLoc());
3264-
CallExprBits.HasTrailingSourceLoc = true;
3255+
3256+
void updateTrailingSourceLocs() {
3257+
assert(!CallExprBits.HasTrailingSourceLocs &&
3258+
"Trailing source loc already set?");
3259+
assert(getStmtClass() == CallExprClass &&
3260+
"Calling setTrailingSourceLocs on a subclass of CallExpr");
3261+
static_assert(sizeof(CallExpr) <=
3262+
offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3263+
3264+
SourceLocation *Locs = reinterpret_cast<SourceLocation *>(
3265+
reinterpret_cast<char *>(this) + sizeof(CallExpr));
3266+
new (Locs) SourceLocation(getBeginLoc());
3267+
new (Locs + 1) SourceLocation(getEndLoc());
3268+
CallExprBits.HasTrailingSourceLocs = true;
32653269
}
32663270

32673271
public:
3268-
32693272
/// Return true if this is a call to __assume() or __builtin_assume() with
32703273
/// a non-value-dependent constant parameter evaluating as false.
32713274
bool isBuiltinAssumeFalse(const ASTContext &Ctx) const;

clang/include/clang/AST/NestedNameSpecifier.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,7 @@ class NestedNameSpecifierLoc {
309309

310310
/// Retrieve the location of the end of this
311311
/// nested-name-specifier.
312-
SourceLocation getEndLoc() const {
313-
return getLocalSourceRange().getEnd();
314-
}
312+
SourceLocation getEndLoc() const { return getLocalSourceRange().getEnd(); }
315313

316314
/// Retrieve the location of the beginning of this
317315
/// component of the nested-name-specifier.

clang/include/clang/AST/Stmt.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,15 @@ class alignas(void *) Stmt {
566566
LLVM_PREFERRED_TYPE(bool)
567567
unsigned IsCoroElideSafe : 1;
568568

569+
/// Tracks When CallExpr is used to represent an explicit object
570+
/// member function, in order to adjust the begin location.
569571
LLVM_PREFERRED_TYPE(bool)
570572
unsigned ExplicitObjectMemFunUsingMemberSyntax : 1;
571573

574+
/// Indicates that SourceLocations are cached as
575+
/// Trailing objects. See the definition of CallExpr.
572576
LLVM_PREFERRED_TYPE(bool)
573-
unsigned HasTrailingSourceLoc : 1;
577+
unsigned HasTrailingSourceLocs : 1;
574578
};
575579

576580
enum { NumCallExprBits = 25 };

clang/lib/AST/Expr.cpp

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,23 @@ OverloadedOperatorKind UnaryOperator::getOverloadedOperator(Opcode Opc) {
14501450
// Postfix Operators.
14511451
//===----------------------------------------------------------------------===//
14521452

1453+
static unsigned SizeOfCallExprInstance(Expr::StmtClass SC) {
1454+
switch (SC) {
1455+
case Expr::CallExprClass:
1456+
return sizeof(CallExpr);
1457+
case Expr::CXXOperatorCallExprClass:
1458+
return sizeof(CXXOperatorCallExpr);
1459+
case Expr::CXXMemberCallExprClass:
1460+
return sizeof(CXXMemberCallExpr);
1461+
case Expr::UserDefinedLiteralClass:
1462+
return sizeof(UserDefinedLiteral);
1463+
case Expr::CUDAKernelCallExprClass:
1464+
return sizeof(CUDAKernelCallExpr);
1465+
default:
1466+
llvm_unreachable("unexpected class deriving from CallExpr!");
1467+
}
1468+
}
1469+
14531470
CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
14541471
ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK,
14551472
SourceLocation RParenLoc, FPOptionsOverride FPFeatures,
@@ -1459,6 +1476,8 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
14591476
unsigned NumPreArgs = PreArgs.size();
14601477
CallExprBits.NumPreArgs = NumPreArgs;
14611478
assert((NumPreArgs == getNumPreArgs()) && "NumPreArgs overflow!");
1479+
assert(SizeOfCallExprInstance(SC) <= offsetToTrailingObjects &&
1480+
"This CallExpr subclass is too big or unsupported");
14621481

14631482
CallExprBits.UsesADL = static_cast<bool>(UsesADL);
14641483

@@ -1475,7 +1494,7 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
14751494
CallExprBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
14761495
CallExprBits.IsCoroElideSafe = false;
14771496
CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = false;
1478-
CallExprBits.HasTrailingSourceLoc = false;
1497+
CallExprBits.HasTrailingSourceLocs = false;
14791498

14801499
if (hasStoredFPFeatures())
14811500
setStoredFPFeatures(FPFeatures);
@@ -1489,8 +1508,7 @@ CallExpr::CallExpr(StmtClass SC, unsigned NumPreArgs, unsigned NumArgs,
14891508
CallExprBits.HasFPFeatures = HasFPFeatures;
14901509
CallExprBits.IsCoroElideSafe = false;
14911510
CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = false;
1492-
CallExprBits.HasTrailingSourceLoc = false;
1493-
1511+
CallExprBits.HasTrailingSourceLocs = false;
14941512
}
14951513

14961514
CallExpr *CallExpr::Create(const ASTContext &Ctx, Expr *Fn,
@@ -1501,21 +1519,23 @@ CallExpr *CallExpr::Create(const ASTContext &Ctx, Expr *Fn,
15011519
unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
15021520
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
15031521
/*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage());
1504-
void *Mem =
1505-
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CallExpr>(SizeOfTrailingObjects),
1506-
alignof(CallExpr));
1507-
CallExpr* E = new (Mem) CallExpr(CallExprClass, Fn, /*PreArgs=*/{}, Args, Ty, VK,
1508-
RParenLoc, FPFeatures, MinNumArgs, UsesADL);
1509-
E->setTrailingSourceLocs();
1522+
void *Mem = Ctx.Allocate(
1523+
sizeToAllocateForCallExprSubclass<CallExpr>(SizeOfTrailingObjects),
1524+
alignof(CallExpr));
1525+
CallExpr *E =
1526+
new (Mem) CallExpr(CallExprClass, Fn, /*PreArgs=*/{}, Args, Ty, VK,
1527+
RParenLoc, FPFeatures, MinNumArgs, UsesADL);
1528+
E->updateTrailingSourceLocs();
15101529
return E;
15111530
}
15121531

15131532
CallExpr *CallExpr::CreateEmpty(const ASTContext &Ctx, unsigned NumArgs,
15141533
bool HasFPFeatures, EmptyShell Empty) {
15151534
unsigned SizeOfTrailingObjects =
15161535
CallExpr::sizeOfTrailingObjects(/*NumPreArgs=*/0, NumArgs, HasFPFeatures);
1517-
void *Mem =
1518-
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CallExpr>(SizeOfTrailingObjects), alignof(CallExpr));
1536+
void *Mem = Ctx.Allocate(
1537+
sizeToAllocateForCallExprSubclass<CallExpr>(SizeOfTrailingObjects),
1538+
alignof(CallExpr));
15191539
return new (Mem)
15201540
CallExpr(CallExprClass, /*NumPreArgs=*/0, NumArgs, HasFPFeatures, Empty);
15211541
}
@@ -1627,7 +1647,6 @@ CallExpr::getUnusedResultAttr(const ASTContext &Ctx) const {
16271647
return {nullptr, nullptr};
16281648
}
16291649

1630-
16311650
OffsetOfExpr *OffsetOfExpr::Create(const ASTContext &C, QualType type,
16321651
SourceLocation OperatorLoc,
16331652
TypeSourceInfo *tsi,

clang/lib/AST/ExprCXX.cpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,10 @@ CXXOperatorCallExpr::Create(const ASTContext &Ctx,
619619
unsigned NumArgs = Args.size();
620620
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
621621
/*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage());
622-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXOperatorCallExpr>(SizeOfTrailingObjects),
623-
alignof(CXXOperatorCallExpr));
622+
void *Mem =
623+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXOperatorCallExpr>(
624+
SizeOfTrailingObjects),
625+
alignof(CXXOperatorCallExpr));
624626
return new (Mem) CXXOperatorCallExpr(OpKind, Fn, Args, Ty, VK, OperatorLoc,
625627
FPFeatures, UsesADL);
626628
}
@@ -632,8 +634,10 @@ CXXOperatorCallExpr *CXXOperatorCallExpr::CreateEmpty(const ASTContext &Ctx,
632634
// Allocate storage for the trailing objects of CallExpr.
633635
unsigned SizeOfTrailingObjects =
634636
CallExpr::sizeOfTrailingObjects(/*NumPreArgs=*/0, NumArgs, HasFPFeatures);
635-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXOperatorCallExpr>(SizeOfTrailingObjects),
636-
alignof(CXXOperatorCallExpr));
637+
void *Mem =
638+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXOperatorCallExpr>(
639+
SizeOfTrailingObjects),
640+
alignof(CXXOperatorCallExpr));
637641
return new (Mem) CXXOperatorCallExpr(NumArgs, HasFPFeatures, Empty);
638642
}
639643

@@ -684,7 +688,8 @@ CXXMemberCallExpr *CXXMemberCallExpr::Create(const ASTContext &Ctx, Expr *Fn,
684688
unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
685689
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
686690
/*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage());
687-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXMemberCallExpr>(SizeOfTrailingObjects),
691+
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXMemberCallExpr>(
692+
SizeOfTrailingObjects),
688693
alignof(CXXMemberCallExpr));
689694
return new (Mem)
690695
CXXMemberCallExpr(Fn, Args, Ty, VK, RP, FPFeatures, MinNumArgs);
@@ -697,7 +702,8 @@ CXXMemberCallExpr *CXXMemberCallExpr::CreateEmpty(const ASTContext &Ctx,
697702
// Allocate storage for the trailing objects of CallExpr.
698703
unsigned SizeOfTrailingObjects =
699704
CallExpr::sizeOfTrailingObjects(/*NumPreArgs=*/0, NumArgs, HasFPFeatures);
700-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXMemberCallExpr>(SizeOfTrailingObjects),
705+
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CXXMemberCallExpr>(
706+
SizeOfTrailingObjects),
701707
alignof(CXXMemberCallExpr));
702708
return new (Mem) CXXMemberCallExpr(NumArgs, HasFPFeatures, Empty);
703709
}
@@ -958,8 +964,10 @@ UserDefinedLiteral *UserDefinedLiteral::Create(const ASTContext &Ctx, Expr *Fn,
958964
unsigned NumArgs = Args.size();
959965
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
960966
/*NumPreArgs=*/0, NumArgs, FPFeatures.requiresTrailingStorage());
961-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<UserDefinedLiteral>(SizeOfTrailingObjects),
962-
alignof(UserDefinedLiteral));
967+
void *Mem =
968+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<UserDefinedLiteral>(
969+
SizeOfTrailingObjects),
970+
alignof(UserDefinedLiteral));
963971
return new (Mem)
964972
UserDefinedLiteral(Fn, Args, Ty, VK, LitEndLoc, SuffixLoc, FPFeatures);
965973
}
@@ -971,8 +979,10 @@ UserDefinedLiteral *UserDefinedLiteral::CreateEmpty(const ASTContext &Ctx,
971979
// Allocate storage for the trailing objects of CallExpr.
972980
unsigned SizeOfTrailingObjects =
973981
CallExpr::sizeOfTrailingObjects(/*NumPreArgs=*/0, NumArgs, HasFPOptions);
974-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<UserDefinedLiteral>(SizeOfTrailingObjects),
975-
alignof(UserDefinedLiteral));
982+
void *Mem =
983+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<UserDefinedLiteral>(
984+
SizeOfTrailingObjects),
985+
alignof(UserDefinedLiteral));
976986
return new (Mem) UserDefinedLiteral(NumArgs, HasFPOptions, Empty);
977987
}
978988

@@ -1946,8 +1956,10 @@ CUDAKernelCallExpr::Create(const ASTContext &Ctx, Expr *Fn, CallExpr *Config,
19461956
unsigned NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
19471957
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
19481958
/*NumPreArgs=*/END_PREARG, NumArgs, FPFeatures.requiresTrailingStorage());
1949-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CUDAKernelCallExpr>(SizeOfTrailingObjects),
1950-
alignof(CUDAKernelCallExpr));
1959+
void *Mem =
1960+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CUDAKernelCallExpr>(
1961+
SizeOfTrailingObjects),
1962+
alignof(CUDAKernelCallExpr));
19511963
return new (Mem)
19521964
CUDAKernelCallExpr(Fn, Config, Args, Ty, VK, RP, FPFeatures, MinNumArgs);
19531965
}
@@ -1959,8 +1971,10 @@ CUDAKernelCallExpr *CUDAKernelCallExpr::CreateEmpty(const ASTContext &Ctx,
19591971
// Allocate storage for the trailing objects of CallExpr.
19601972
unsigned SizeOfTrailingObjects = CallExpr::sizeOfTrailingObjects(
19611973
/*NumPreArgs=*/END_PREARG, NumArgs, HasFPFeatures);
1962-
void *Mem = Ctx.Allocate(sizeToAllocateForCallExprSubclass<CUDAKernelCallExpr>(SizeOfTrailingObjects),
1963-
alignof(CUDAKernelCallExpr));
1974+
void *Mem =
1975+
Ctx.Allocate(sizeToAllocateForCallExprSubclass<CUDAKernelCallExpr>(
1976+
SizeOfTrailingObjects),
1977+
alignof(CUDAKernelCallExpr));
19641978
return new (Mem) CUDAKernelCallExpr(NumArgs, HasFPFeatures, Empty);
19651979
}
19661980

clang/lib/Sema/SemaOpenCL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ bool SemaOpenCL::checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call) {
542542
auto RT = Call->getArg(0)->getType();
543543
if (!RT->isPointerType() ||
544544
RT->getPointeeType().getAddressSpace() == LangAS::opencl_constant) {
545-
Diag(Call->getArg(0)->getBeginLoc(), diag::err_opencl_builtin_to_addr_invalid_arg)
545+
Diag(Call->getArg(0)->getBeginLoc(),
546+
diag::err_opencl_builtin_to_addr_invalid_arg)
546547
<< Call->getArg(0) << Call->getDirectCallee() << Call->getSourceRange();
547548
return true;
548549
}

0 commit comments

Comments
 (0)