a macro context wrapper that can track APIs being invoked during expansion

/cc @duhemm