Skip to content

Commit 4f32173

Browse files
committed
[Sema] Remove unneeded helper AddingCFIUncheckedCallee and simplify
1 parent 0c6f471 commit 4f32173

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,11 +2685,6 @@ class Sema final : public SemaBase {
26852685
/// function without this attribute.
26862686
bool DiscardingCFIUncheckedCallee(QualType From, QualType To) const;
26872687

2688-
/// Returns true if `From` is a function or pointer to a function without the
2689-
/// `cfi_unchecked_callee` attribute but `To` is a function or pointer to
2690-
/// function with this attribute.
2691-
bool AddingCFIUncheckedCallee(QualType From, QualType To) const;
2692-
26932688
/// This function calls Action when it determines that E designates a
26942689
/// misaligned member due to the packed attribute. This is used to emit
26952690
/// local diagnostics like in reference binding.

clang/lib/Sema/SemaChecking.cpp

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12351,14 +12351,9 @@ static void DiagnoseMixedUnicodeImplicitConversion(Sema &S, const Type *Source,
1235112351
}
1235212352
}
1235312353

12354-
enum CFIUncheckedCalleeChange {
12355-
None,
12356-
Adding,
12357-
Discarding,
12358-
};
12359-
12360-
static CFIUncheckedCalleeChange AdjustingCFIUncheckedCallee(QualType From,
12361-
QualType To) {
12354+
bool Sema::DiscardingCFIUncheckedCallee(QualType From, QualType To) const {
12355+
From = Context.getCanonicalType(From);
12356+
To = Context.getCanonicalType(To);
1236212357
QualType MaybePointee = From->getPointeeType();
1236312358
if (!MaybePointee.isNull() && MaybePointee->getAs<FunctionType>())
1236412359
From = MaybePointee;
@@ -12370,25 +12365,10 @@ static CFIUncheckedCalleeChange AdjustingCFIUncheckedCallee(QualType From,
1237012365
if (const auto *ToFn = To->getAs<FunctionType>()) {
1237112366
if (FromFn->getCFIUncheckedCalleeAttr() &&
1237212367
!ToFn->getCFIUncheckedCalleeAttr())
12373-
return Discarding;
12374-
if (!FromFn->getCFIUncheckedCalleeAttr() &&
12375-
ToFn->getCFIUncheckedCalleeAttr())
12376-
return Adding;
12368+
return true;
1237712369
}
1237812370
}
12379-
return None;
12380-
}
12381-
12382-
bool Sema::DiscardingCFIUncheckedCallee(QualType From, QualType To) const {
12383-
From = Context.getCanonicalType(From);
12384-
To = Context.getCanonicalType(To);
12385-
return ::AdjustingCFIUncheckedCallee(From, To) == Discarding;
12386-
}
12387-
12388-
bool Sema::AddingCFIUncheckedCallee(QualType From, QualType To) const {
12389-
From = Context.getCanonicalType(From);
12390-
To = Context.getCanonicalType(To);
12391-
return ::AdjustingCFIUncheckedCallee(From, To) == Adding;
12371+
return false;
1239212372
}
1239312373

1239412374
void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC,

0 commit comments

Comments
 (0)