This is an archive of the discontinued LLVM Phabricator instance.

Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC
ClosedPublic

Authored by deadalnix on Feb 24 2016, 1:07 PM.

Diff Detail

Event Timeline

deadalnix updated this revision to Diff 48970.Feb 24 2016, 1:07 PM
deadalnix retitled this revision from to Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC.
deadalnix updated this object.
deadalnix added reviewers: davidxl, reames, sanjoy, MatzeB, pete.
deadalnix added a subscriber: llvm-commits.
davidxl added inline comments.Feb 25 2016, 9:24 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
46

If this is the final override, you can probably call it with

DwarfCFIExeptionBase::endFragment();

88

nit: remove Regular

136

unnecessary code movement -- move endFunction down after endFragment

158

Move this assertion up and make it assert (F->hasPersonalityFn() && "Expect ... ");

lib/CodeGen/AsmPrinter/DwarfException.h
67

Should this and the end function be declared in DwarfCFIExceptionBase? Note that there are two overrider classes to the Base class.

deadalnix added inline comments.Feb 25 2016, 11:09 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
136

I did not move this. It always was just after beginFunction. I can reorder to keep this out of the diff.

158

P is used down the road, so I'm not sure this makes sense.

lib/CodeGen/AsmPrinter/DwarfException.h
67

There are defined as doing nothing in AsmPrinterHandler, so we are good here.

deadalnix updated this revision to Diff 49099.Feb 25 2016, 11:12 AM

Address various comments

davidxl added inline comments.Feb 25 2016, 11:27 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
158

if you do not assert F->hasPersonalityFn(), can F->getPersonalityFn() possibly return NULL -- then you will get segfault which is less desirable than asserting.

lib/CodeGen/AsmPrinter/DwarfException.h
67

./lib/CodeGen/AsmPrinter/ARMException.cpp:39:ARMException::ARMException

ARMException::ARMException(AsmPrinter *A) : DwarfCFIExceptionBase(A) { ..)

ARMException class also derives from DwarfExceptionBase. If beginFragment()/endFragment() is not pushed into the base class, this class will have inherited the empty definition which is wrong.

Correction -- only endFragment part is wrong -- endFragment is called in the base class implementation ...

deadalnix added inline comments.Feb 25 2016, 1:34 PM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
158

shouldEmitPersonality already gates this, see line 115

lib/CodeGen/AsmPrinter/DwarfException.h
67

Good catch. Let em fix this.

deadalnix updated this revision to Diff 49112.Feb 25 2016, 1:39 PM

Move endFragment to DwarfCFIExceptionBase

davidxl accepted this revision.Feb 26 2016, 11:32 AM
davidxl edited edge metadata.

looks like a good NFC clean up. LGTM

lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
56

add forceEmitPersonality field here.

This revision is now accepted and ready to land.Feb 26 2016, 11:32 AM
This revision was automatically updated to reflect the committed changes.