This is part of https://reviews.llvm.org/D137381,
i've stumbled into this in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52989&q=label%3AProj-librawspeed
Look at the callee_with_clang_attr().
pure attribute implies nounwind, and we successfully manifest that at IRgen,
and calls from nounwind functions treat it as non-unwinding,
except that when generating function definition,
we'd suddenly forget that it is nounwind...
Here, everything that could go wrong, goes wrong.
CodeGenFunction::EmitStartEHSpec() looks at the AST function exception specification,
and not IR attributes, so
You'd think we can inferr the attribute in AST after the fact,
in Sema::ActOnFunctionDeclarator(), and while that is sufficient to get the diagnostics,
the function exception specification has already been computed from parsed attributes.
So we also need to adjust handleFunctionTypeAttr() (called by processTypeAttrs())
so it considers just-parsed pure as if it's nothrow...
It would somewhat less ugly if we could just infer nothrow attribute
during *attribute parsing* from pure/etc. Is that possible?
Also, OpenMP declare variant tests are showing an unexpected error,
looks like i'm missing some attribute propagation?
First, I'm not a fan of doing this in this list ast all, we shouldn't really have logic here, this is mostly just a jump table.
Second, I guess I'm not getting why IRGen cannot figure out from the AST that Pure/Const/NoAlias all imply nothrow?