Siddharth Shankar Swain via llvm-dev
2018-May-01 17:38 UTC
[llvm-dev] Disabling Exception in LLVM
Hi Chris, Thanks for answering, Can u clarify on this comment mentioned in https://github.com/Z3Prover/z3/issues/861 . cplusplus no exception support · Issue #861 · Z3Prover/z3 · GitHub - LLVM's *source code* does not use exceptions for performance reasons and so is compiled by default with -fno-exceptions. When using LLVM's libraries via it's C++ interface it is important to match how LLVM was built (i.e. do not mix code built with and without exception support). - The Clang compiler which is built on top of LLVM is also compiled without exceptions by default. However the built Clang can compile C++ code with or without exceptions (using the -fno-exceptions). flag. Said another way Clang's implementation doesn't use exceptions but Clang itself can compile C++ code with or without exception support. Can anyone clarify on this comment ? Thanks, Siddharth On Tue, May 1, 2018 at 11:02 PM, Chris Bieneman <chris.bieneman at me.com> wrote:> Siddharth, > > I'm not sure what coding standards you refer to when you say "some C++ > coding standard". This question is answered in the LLVM Coding Standards > document here: > > https://www.llvm.org/docs/CodingStandards.html#do-not- > use-rtti-or-exceptions > > As such LLVM's coding standards prohibit the use of exceptions and RTTI. > > -Chris > > On May 1, 2018, at 10:02 AM, Siddharth Shankar Swain via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hi all, > Can anyone explain why exceptions are disabled in LLVM, even if some C++ > coding standard tells to use exceptions ? > Thanks, > Siddharth > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180501/be88b48c/attachment.html>
LLVM does not allow the use of exceptions in our code. We do not allow throwing or catching them. That does not mean you cannot compile the code with exceptions enabled, it just means we don't use them. Clang is a full C++ compiler. Even though LLVM & Clang do not use exceptions in their implementation, Clang does support compiling C++ code that uses exceptions. Does this answer your question? -Chris> On May 1, 2018, at 10:38 AM, Siddharth Shankar Swain <h2015096 at pilani.bits-pilani.ac.in> wrote: > > Hi Chris, > Thanks for answering, Can u clarify on this comment mentioned in https://github.com/Z3Prover/z3/issues/861 <https://github.com/Z3Prover/z3/issues/861> . > > cplusplus no exception support · Issue #861 · Z3Prover/z3 · GitHub > LLVM's source code does not use exceptions for performance reasons and so is compiled by default with -fno-exceptions. When using LLVM's libraries via it's C++ interface it is important to match how LLVM was built (i.e. do not mix code built with and without exception support). > The Clang compiler which is built on top of LLVM is also compiled without exceptions by default. However the built Clang can compile C++ code with or without exceptions (using the -fno-exceptions). flag. Said another way Clang's implementation doesn't use exceptions but Clang itself can compile C++ code with or without exception support. > > Can anyone clarify on this comment ? > > Thanks, > Siddharth > > On Tue, May 1, 2018 at 11:02 PM, Chris Bieneman <chris.bieneman at me.com <mailto:chris.bieneman at me.com>> wrote: > Siddharth, > > I'm not sure what coding standards you refer to when you say "some C++ coding standard". This question is answered in the LLVM Coding Standards document here: > > https://www.llvm.org/docs/CodingStandards.html#do-not-use-rtti-or-exceptions <https://www.llvm.org/docs/CodingStandards.html#do-not-use-rtti-or-exceptions> > > As such LLVM's coding standards prohibit the use of exceptions and RTTI. > > -Chris > >> On May 1, 2018, at 10:02 AM, Siddharth Shankar Swain via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hi all, >> Can anyone explain why exceptions are disabled in LLVM, even if some C++ coding standard tells to use exceptions ? >> Thanks, >> Siddharth >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180501/04e8f840/attachment.html>
Siddharth Shankar Swain via llvm-dev
2018-May-01 17:49 UTC
[llvm-dev] Disabling Exception in LLVM
Yes mostly, Thanks for the quick answer. On Tue, May 1, 2018 at 11:16 PM, Chris Bieneman <chris.bieneman at me.com> wrote:> LLVM does not allow the use of exceptions in our code. We do not allow > throwing or catching them. That does not mean you cannot compile the code > with exceptions enabled, it just means we don't use them. > > Clang is a full C++ compiler. Even though LLVM & Clang do not use > exceptions in their implementation, Clang does support compiling C++ code > that uses exceptions. > > Does this answer your question? > -Chris > > > On May 1, 2018, at 10:38 AM, Siddharth Shankar Swain < > h2015096 at pilani.bits-pilani.ac.in> wrote: > > Hi Chris, > Thanks for answering, Can u clarify on this comment mentioned in > https://github.com/Z3Prover/z3/issues/861 . > > cplusplus no exception support · Issue #861 · Z3Prover/z3 · GitHub > > - LLVM's *source code* does not use exceptions for performance reasons > and so is compiled by default with -fno-exceptions. When using LLVM's > libraries via it's C++ interface it is important to match how LLVM was > built (i.e. do not mix code built with and without exception support). > - The Clang compiler which is built on top of LLVM is also compiled > without exceptions by default. However the built Clang can compile C++ code > with or without exceptions (using the -fno-exceptions). flag. Said > another way Clang's implementation doesn't use exceptions but Clang itself > can compile C++ code with or without exception support. > > > Can anyone clarify on this comment ? > > Thanks, > Siddharth > > On Tue, May 1, 2018 at 11:02 PM, Chris Bieneman <chris.bieneman at me.com> > wrote: > >> Siddharth, >> >> I'm not sure what coding standards you refer to when you say "some C++ >> coding standard". This question is answered in the LLVM Coding Standards >> document here: >> >> https://www.llvm.org/docs/CodingStandards.html#do-not-use- >> rtti-or-exceptions >> >> As such LLVM's coding standards prohibit the use of exceptions and RTTI. >> >> -Chris >> >> On May 1, 2018, at 10:02 AM, Siddharth Shankar Swain via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >> Hi all, >> Can anyone explain why exceptions are disabled in LLVM, even if some C++ >> coding standard tells to use exceptions ? >> Thanks, >> Siddharth >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180501/5b375390/attachment.html>