This is an archive of the discontinued LLVM Phabricator instance.

Make Lit tests C++11 compatible - nounwind noexcept
ClosedPublic

Authored by tigerleapgorge on Feb 10 2017, 5:53 PM.

Details

Summary

I am continuing to make Lit tests C++11 compatible.
There are 3 tests in this patch (previously in D24812).
All 3 tests relate to C++11 destructors being nonthrowing by default.

CodeGenCXX/linetable-cleanup.cpp

C::~C() has an extra “nounwind” attribute in C++11.
Relaxed the CHECK pattern matching for possible existence of “ #[0-9]”.

IR:

C++98: call void @_ZN1CD1Ev(%class.C* %c), !dbg !21
C++11: call void @_ZN1CD1Ev(%class.C* %c) #2, !dbg !21
       attributes #2 = { nounwind }

CodeGenCXX/lpad-linetable.cpp

The purpose of this test is to verify landingpad line numbers when catching
any exceptions thrown by the destructors for “longs” and “shorts” as they go out of scope.
In C++11, “longs” and “short”’s destructors are nonthrowing, so no landingpad is generated.
And since the purpose of this test is to verify for landingpad line table, I have restricted this test to C++98.

C++11 IR:
   ~std::_Vector_base<long, std::allocator<long> >() noexcept
   ~std::_Vector_base<short, std::allocator<short> >() noexcept

Index/comment-cplus-decls.cpp

In C++11, ~Test() is nonthrowing.
IR:
  C++98: <Declaration>~Test()</Declaration>
  C++11: <Declaration>~Test() noexcept</Declaration>

Diff Detail

Repository
rL LLVM

Event Timeline

tigerleapgorge created this revision.Feb 10 2017, 5:53 PM
rjmccall accepted this revision.Feb 10 2017, 6:55 PM

LGTM.

This revision is now accepted and ready to land.Feb 10 2017, 6:55 PM
This revision was automatically updated to reflect the committed changes.