I am working on a program that outputs a C++ AST to a form that can be injested by the Rocq theorem prover. For many things, this works well, but Clang seems to compute some information lazily and this turns out to be problematic because I need the information even if Clang does not technically need it in order to compile the program.
One particular bit of information that seems to be computed lazily is the exception specification. When I look at the exception specification via:
decl.getExceptionSpecType())
this often returns EST_Unevaluated or EST_Uninstantiated. When I try to use the Sema object to evaluate these specifications, e.g. using
sema.ResolveExceptionSpec(
decl.getLocation(),
decl.getFunctionType()->getAs<FunctionProtoType>());
I sometimes get compilation errors which seem like they might be due to not evaluating these in the correct order.
Is there an easy way to get clang to compute all of this information for me up front? Obviously, you can not get the information for non-instantiated template code, but I do need the information for template instantiations.