[clang] [clang] [C23] Fix crash with _BitInt running clang-tidy (PR #65889)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 13:16:48 PDT 2023


================
@@ -1333,7 +1333,14 @@ void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
 void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
   VisitExpr(S);
   S->getValue().Profile(ID);
-  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
+
+  QualType T = S->getType();
+  if (auto BitIntT = T->getAs<BitIntType>()) {
+    BitIntT->Profile(ID, BitIntT->isSigned(), BitIntT->getNumBits());
----------------
vabridgers wrote:

I resolved the request by using the nonstatic Profile method of the BitIntType class, but it seems it was not const qualified. I added the const qualifier to follow other similar classes. We could keep this change, or go back to the change I had. Please let me know which one the reviewers prefer. We probably need @AaronBallman and/or @erichkeane to review - seems Erich made the original BitIntType addition? Thanks

https://github.com/llvm/llvm-project/pull/65889


More information about the cfe-commits mailing list