diff --git a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp index 7f3c2cb9a0434c..97c20cf200fa21 100644 --- a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp @@ -191,6 +191,9 @@ bool MagicNumbersCheck::isConstant(const MatchFinder::MatchResult &Result, } bool MagicNumbersCheck::isIgnoredValue(const IntegerLiteral *Literal) const { + if (Literal->getType()->isBitIntType()) { + return true; + } const llvm::APInt IntValue = Literal->getValue(); const int64_t Value = IntValue.getZExtValue(); if (Value == 0) diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/bitint-no-crash.c b/clang-tools-extra/test/clang-tidy/checkers/readability/bitint-no-crash.c new file mode 100644 index 00000000000000..f8660924cbef5a --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/bitint-no-crash.c @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy %s readability-magic-numbers %t -- + +// Don't crash + +_BitInt(128) A = 4533629751480627964421wb; +// CHECK-MESSAGES: warning