This is an archive of the discontinued LLVM Phabricator instance.

Remove some template instantiations to reduce the number of symbols.
AbandonedPublic

Authored by sbenza on Aug 26 2014, 1:03 PM.

Details

Reviewers
klimek
Summary

Remove some template instantiations to reduce the number of symbols.
Registry.cpp instantiates all the matchers and it fails to build under MSVC in debug mode.

Diff Detail

Event Timeline

sbenza updated this revision to Diff 12961.Aug 26 2014, 1:03 PM
sbenza retitled this revision from to Remove some template instantiations to reduce the number of symbols..
sbenza updated this object.
sbenza edited the test plan for this revision. (Show Details)
sbenza added a reviewer: klimek.
sbenza added a subscriber: Unknown Object (MLST).
klimek edited edge metadata.Aug 28 2014, 3:19 AM

/me wonders whether that's really worth it...

This is not the first time we see this.
Maybe someone can decide that /bigobj is required for MSVC in debug mode and we don't have to do this anymore.

rnk added a subscriber: rnk.Aug 28 2014, 10:02 AM

MinGW doesn't support anything like /bigobj, so I think we need this or something like it.
http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections

I wonder if putting LLVM_ATTRIBUTE_ALWAYS_INLINE on all IntrusiveRefCntPtr methods would also help reduce the section count.

In D5072#7, @rnk wrote:

MinGW doesn't support anything like /bigobj, so I think we need this or something like it.
http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections

I wonder if putting LLVM_ATTRIBUTE_ALWAYS_INLINE on all IntrusiveRefCntPtr methods would also help reduce the section count.

That would only work if the macro was defined for and used by MinGW.

rnk added a comment.Aug 28 2014, 10:53 AM

The always inline macro should be defined pretty on MinGW and pretty much everywhere. It was introduced in gcc 4.0 and we already require gcc 4.7 at a minimum.

BTW, I think the ASTMatchersInternal.h change is a solid compile time win at very low cost. Using always_inline there would still cause us to perform instantiation, so I like this change better.

The unique_ptr change is more questionable, because now the ownership is unmanaged and you would have to implement reset manually in the future. Also consider that the definition of unique_ptr::reset is something like:

void reset(T *New) {
  T *Tmp = Out;
  Out = New;
  delete Tmp;
}

Please take a look at D5124, which makes this one more or less obsolete.

sbenza abandoned this revision.Sep 5 2014, 6:07 AM

This was resolved with a different CL.