Skip to content

Commit aef2f41

Browse files
authored
[clang-tidy][NFC] Enable performance-type-promotion-in-math-fn check in the codebase (#158186)
Closes #156155.
1 parent d5aa5e3 commit aef2f41

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Checks: >
1616
performance-*,
1717
-performance-enum-size,
1818
-performance-no-int-to-ptr,
19-
-performance-type-promotion-in-math-fn,
2019
-performance-unnecessary-value-param,
2120
readability-*,
2221
-readability-avoid-nested-conditional-operator,

clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
7676
CharUnits CurrSize = Result.Context->getASTRecordLayout(Struct).getSize();
7777
CharUnits MinByteSize =
7878
CharUnits::fromQuantity(std::max<clang::CharUnits::QuantityType>(
79-
ceil(static_cast<float>(TotalBitSize) / CharSize), 1));
79+
std::ceil(static_cast<float>(TotalBitSize) / CharSize), 1));
8080
CharUnits MaxAlign = CharUnits::fromQuantity(
81-
ceil((float)Struct->getMaxAlignment() / CharSize));
81+
std::ceil((float)Struct->getMaxAlignment() / CharSize));
8282
CharUnits CurrAlign =
8383
Result.Context->getASTRecordLayout(Struct).getAlignment();
8484
CharUnits NewAlign = computeRecommendedAlignment(MinByteSize);

clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,20 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement,
208208
return true;
209209
switch (Op->getOpcode()) {
210210
case (BO_AddAssign):
211-
Iterations = ceil(float(EndValue - InitValue) / ConstantValue);
211+
Iterations = std::ceil(float(EndValue - InitValue) / ConstantValue);
212212
break;
213213
case (BO_SubAssign):
214-
Iterations = ceil(float(InitValue - EndValue) / ConstantValue);
214+
Iterations = std::ceil(float(InitValue - EndValue) / ConstantValue);
215215
break;
216216
case (BO_MulAssign):
217-
Iterations = 1 + (log((double)EndValue) - log((double)InitValue)) /
218-
log((double)ConstantValue);
217+
Iterations =
218+
1 + (std::log((double)EndValue) - std::log((double)InitValue)) /
219+
std::log((double)ConstantValue);
219220
break;
220221
case (BO_DivAssign):
221-
Iterations = 1 + (log((double)InitValue) - log((double)EndValue)) /
222-
log((double)ConstantValue);
222+
Iterations =
223+
1 + (std::log((double)InitValue) - std::log((double)EndValue)) /
224+
std::log((double)ConstantValue);
223225
break;
224226
default:
225227
// All other operators are not handled; assume large bounds.

0 commit comments

Comments
 (0)