cdisselkoen / llvm-ir

LLVM IR in natural Rust data structures
MIT License
550 stars 46 forks source link

terminator: The operand of an invoke is a function pointer #30

Closed langston-barrett closed 1 year ago

langston-barrett commented 1 year ago

Fixes panic on legitimate LLVM modules. See also the handling of Call, which is analogous.

To see the panic in action, compile this C++ file with Clang 14 and call Invoke.get_type() on instructions in the resulting Module:

#include <cstdio>
#include <stdexcept>

int main() {
  try {
    throw std::logic_error("hello, exceptions!");
  } catch (const std::logic_error &e) {
    printf("%p\n", (void *) &e);
  }
  return 0;
}
cdisselkoen commented 1 year ago

Looks great, can we add your example as a test?

langston-barrett commented 1 year ago

Looks great, can we add your example as a test?

Thanks for the prompt review, I've added the infrastructure for C++ tests and a test for this example in particular.

cdisselkoen commented 1 year ago

Thanks so much for this! Looks great.