[PATCH] Introduce support for custom wrappers for vararg functions
Peter Collingbourne
peter at pcc.me.uk
Fri Sep 19 13:57:09 PDT 2014
================
Comment at: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1360
@@ -1354,1 +1359,3 @@
+ FunctionType *FT = cast<FunctionType>(
+ CS.getCalledValue()->getType()->getPointerElementType());
----------------
Can you give this a different name to avoid shadowing by the other `FT` on line 1394?
================
Comment at: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1413
@@ -1402,2 +1412,3 @@
CallSite::arg_iterator i = CS.arg_begin();
- for (unsigned n = FT->getNumParams(); n != 0; ++i, --n) {
+ unsigned n = !FT->isVarArg() ? FT->getNumParams() : CS.arg_size();
+ for (; n != 0; ++i, --n) {
----------------
Can't you just use `CS.arg_size()` here?
================
Comment at: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1434
@@ -1422,2 +1433,3 @@
i = CS.arg_begin();
- for (unsigned n = FT->getNumParams(); n != 0; ++i, --n)
+ n = !FT->isVarArg() ? FT->getNumParams() : CS.arg_size();
+ for (; n != 0; ++i, --n)
----------------
Likewise.
http://reviews.llvm.org/D5412
More information about the llvm-commits
mailing list