[PATCH] D128449: [clang] Introduce -Warray-parameter

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 1 07:45:14 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:3216
+           (Ty->isVariableArrayType() &&
+            cast<VariableArrayType>(Ty)->getSizeModifier() ==
+                ArrayType::ArraySizeModifier::Star);
----------------
I forgot about this gotcha -- arrays are special in that you shouldn't be using `cast<>` and friends on them, you need to ask the `ASTContext` to go from the `QualType` to the correct array type. e.g., `ASTContext::getAsConstantArrayType()` and `ASTContext::getAsVariableArrayType()` -- I think this is the cause of the failed assertions we're seeing in precommit CI.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128449/new/

https://reviews.llvm.org/D128449



More information about the cfe-commits mailing list