[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

Martell Malone via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 01:24:20 PST 2017


martell added a comment.

In https://reviews.llvm.org/D39673#931861, @rnk wrote:

> We have to know the EH model before pre-processing, and that shouldn't rely on LLVM TargetOptions. We can probably reuse the `llvm::ExceptionHandling` enum instead of these various overlapping booleans, if that's the direction you want to go. However, I don't see how we can get away from the clang toolchain knowing the default EH model for each target.


I ended up folding USESjLjExceptions into a GetExceptionModel function that returns the llvm::ExceptionHandling.
Reid you are right that clang needed to know some targets beforehand, this is especially obvious for the various apple devices. watch and co.

relying on LLVM TargetOptions is much better for platforms like windows
rather then checking `T.isOSWindows() && T.getArch() == llvm::Triple::x86_64` to decide on enabling SEH I opted to do a best effort attempt to check what the default is much like how cc1as does.
the difference being if it fails we just specify the default as none giving us the following pattern.

1. set eh based no user flags passed into clang
2. if no flags passed check the toolchain defaults,
3. if no toolchain default then check llvm,
4. if we can not determine if it is a supported triple default to None.

I also addressed Martin's concern in the folding by adding `| LangOpts.DWARFExceptions` and no longer have to specifically check for mingw or netbsd.

Sorry for the noise on this, I just want to make sure we get the best functionality on this while ensuring it is future proof for other model.


Repository:
  rL LLVM

https://reviews.llvm.org/D39673





More information about the cfe-commits mailing list