Skip to content

Commit 3c34d90

Browse files
committed
Address aaron's feedback
1 parent 63a8b54 commit 3c34d90

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,19 +2919,19 @@ class CallExpr : public Expr {
29192919
// A bit in CallExprBitfields indicates if source locations are presents.
29202920

29212921
protected:
2922-
static constexpr unsigned offsetToTrailingObjects = 32;
2922+
static constexpr unsigned OffsetToTrailingObjects = 32;
29232923
template <typename T>
29242924
static constexpr unsigned
29252925
sizeToAllocateForCallExprSubclass(unsigned SizeOfTrailingObjects) {
2926-
static_assert(sizeof(T) <= CallExpr::offsetToTrailingObjects);
2927-
return SizeOfTrailingObjects + CallExpr::offsetToTrailingObjects;
2926+
static_assert(sizeof(T) <= CallExpr::OffsetToTrailingObjects);
2927+
return SizeOfTrailingObjects + CallExpr::OffsetToTrailingObjects;
29282928
}
29292929

29302930
private:
29312931
/// Return a pointer to the start of the trailing array of "Stmt *".
29322932
Stmt **getTrailingStmts() {
29332933
return reinterpret_cast<Stmt **>(reinterpret_cast<char *>(this) +
2934-
offsetToTrailingObjects);
2934+
OffsetToTrailingObjects);
29352935
}
29362936
Stmt *const *getTrailingStmts() const {
29372937
return const_cast<CallExpr *>(this)->getTrailingStmts();
@@ -2943,7 +2943,7 @@ class CallExpr : public Expr {
29432943

29442944
size_t getOffsetOfTrailingFPFeatures() const {
29452945
assert(hasStoredFPFeatures());
2946-
return offsetToTrailingObjects + getSizeOfTrailingStmts();
2946+
return OffsetToTrailingObjects + getSizeOfTrailingStmts();
29472947
}
29482948

29492949
public:
@@ -2990,13 +2990,13 @@ class CallExpr : public Expr {
29902990
FPOptionsOverride *getTrailingFPFeatures() {
29912991
assert(hasStoredFPFeatures());
29922992
return reinterpret_cast<FPOptionsOverride *>(
2993-
reinterpret_cast<char *>(this) + offsetToTrailingObjects +
2993+
reinterpret_cast<char *>(this) + OffsetToTrailingObjects +
29942994
getSizeOfTrailingStmts());
29952995
}
29962996
const FPOptionsOverride *getTrailingFPFeatures() const {
29972997
assert(hasStoredFPFeatures());
29982998
return reinterpret_cast<const FPOptionsOverride *>(
2999-
reinterpret_cast<const char *>(this) + offsetToTrailingObjects +
2999+
reinterpret_cast<const char *>(this) + OffsetToTrailingObjects +
30003000
getSizeOfTrailingStmts());
30013001
}
30023002

@@ -3217,11 +3217,11 @@ class CallExpr : public Expr {
32173217

32183218
SourceLocation getBeginLoc() const {
32193219
if (CallExprBits.HasTrailingSourceLoc) {
3220-
assert(CallExprBits.HasTrailingSourceLoc && "No trailing source loc");
3221-
static_assert(sizeof(CallExpr) <=
3222-
offsetToTrailingObjects + sizeof(SourceLocation));
3223-
return *reinterpret_cast<const SourceLocation *>(
3224-
reinterpret_cast<const char *>(this) + sizeof(CallExpr));
3220+
assert(CallExprBits.HasTrailingSourceLoc && "No trailing source loc");
3221+
static_assert(sizeof(CallExpr) <=
3222+
OffsetToTrailingObjects + sizeof(SourceLocation));
3223+
return *reinterpret_cast<const SourceLocation *>(
3224+
reinterpret_cast<const char *>(this + 1));
32253225
}
32263226

32273227
if (usesMemberSyntax()) {
@@ -3232,9 +3232,7 @@ class CallExpr : public Expr {
32323232
return getCallee()->getBeginLoc();
32333233
}
32343234

3235-
SourceLocation getEndLoc() const {
3236-
return getRParenLoc();
3237-
}
3235+
SourceLocation getEndLoc() const { return getRParenLoc(); }
32383236

32393237
private:
32403238
friend class ASTStmtReader;
@@ -3248,10 +3246,10 @@ class CallExpr : public Expr {
32483246
assert(getStmtClass() == CallExprClass &&
32493247
"Calling setTrailingSourceLocs on a subclass of CallExpr");
32503248
static_assert(sizeof(CallExpr) <=
3251-
offsetToTrailingObjects + 2 * sizeof(SourceLocation));
3249+
OffsetToTrailingObjects + sizeof(SourceLocation));
32523250

3253-
SourceLocation *Locs = reinterpret_cast<SourceLocation *>(
3254-
reinterpret_cast<char *>(this) + sizeof(CallExpr));
3251+
SourceLocation *Locs =
3252+
reinterpret_cast<SourceLocation *>(reinterpret_cast<char *>(this + 1));
32553253
new (Locs) SourceLocation(getBeginLoc());
32563254
CallExprBits.HasTrailingSourceLoc = true;
32573255
}

clang/lib/AST/Expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
14761476
unsigned NumPreArgs = PreArgs.size();
14771477
CallExprBits.NumPreArgs = NumPreArgs;
14781478
assert((NumPreArgs == getNumPreArgs()) && "NumPreArgs overflow!");
1479-
assert(SizeOfCallExprInstance(SC) <= offsetToTrailingObjects &&
1479+
assert(SizeOfCallExprInstance(SC) <= OffsetToTrailingObjects &&
14801480
"This CallExpr subclass is too big or unsupported");
14811481

14821482
CallExprBits.UsesADL = static_cast<bool>(UsesADL);
@@ -1544,7 +1544,7 @@ Decl *Expr::getReferencedDeclOfCallee() {
15441544

15451545
// Optimize for the common case first
15461546
// (simple function or member function call)
1547-
// then try more exotic possibilities
1547+
// then try more exotic possibilities.
15481548
Expr *CEE = IgnoreImpCasts();
15491549

15501550
if (auto *DRE = dyn_cast<DeclRefExpr>(CEE))

0 commit comments

Comments
 (0)