[clang] fix kcfi doesn't take effect when callee function has no input parameter (PR #106677)

Sami Tolvanen via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 09:16:47 PDT 2024


================
@@ -2813,6 +2813,11 @@ void CodeGenFunction::EmitKCFIOperandBundle(
       Callee.getAbstractInfo().getCalleeFunctionProtoType();
   if (FP)
     Bundles.emplace_back("kcfi", CGM.CreateKCFITypeId(FP->desugar()));
+  else {
+    ASTContext &context = this->getContext();
+    QualType voidType = context.VoidTy;
----------------
samitolvanen wrote:

`VoidTy` doesn't seem like an appropriate type for a function even if it doesn't have a parameter type list. We still want to distinguish between different return types, right?

Also, please add a matching test when you make a change. You could probably add a test case for this to `clang/test/CodeGen/kcfi.c`.

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


More information about the cfe-commits mailing list