[PATCH] D26164: [cfi] Fix missing !type annotation.

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 14:34:30 PDT 2016


pcc added inline comments.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:934
+  if (CodeGenOpts.SanitizeCfiCrossDso)
+    CreateFunctionTypeMetadata(dyn_cast<FunctionDecl>(D), F);
 }
----------------
It looks like we can get here with declarations that are not of type `FunctionDecl` (mostly via `SetInternalFunctionAttributes` -- see http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CodeGenModule.cpp/rSetInternalFunctionAttributes). I suppose that either means you would need to tolerate null pointers in `CreateFunctionTypeMetadata` or add an `isa` check here.

Please also add a test for one of those cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D26164





More information about the cfe-commits mailing list