This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Correct IUnknown to support Unknwnbase.h Header.
ClosedPublic

Authored by erichkeane on Sep 26 2017, 7:57 PM.

Details

Summary

Apparently, the MSVC SDK has a strange implementation that
causes a number of implicit functions as well as a template member
function of the IUnknown type. This patch allows these as InterfaceLike
types as well.

Additionally, it corrects the behavior where extern-C++ wrapped around an
Interface-Like type would permit an interface-like type to exist in a namespace.

Diff Detail

Repository
rL LLVM

Event Timeline

erichkeane created this revision.Sep 26 2017, 7:57 PM
rnk added inline comments.Sep 27 2017, 11:30 AM
lib/AST/DeclCXX.cpp
1497–1505 ↗(On Diff #116751)

This would be nicer factored out as a static helper because it would let you early return and avoid the variable and break. You could just fold the call into the condition in the if below.

As @rnk suggested, pull my condition out into a static function.

rnk accepted this revision.Sep 29 2017, 10:37 AM

lgtm

lib/AST/DeclCXX.cpp
1473 ↗(On Diff #116876)

Lower case isDeclContext... is more inline with our style

This revision is now accepted and ready to land.Sep 29 2017, 10:37 AM
This revision was automatically updated to reflect the committed changes.
cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp
18

This is not seen for targeting *-win32.
I wonder why you checked it here.

@chapuni Thanks for the fix! That 'novtable' line is there simply because that is supposed to be a minimized replica of what happens in the UnknwnBase.h header.

I'll likely just remove the attribute and your fix, since the warning itself isn't important to the test itself otherwise.

Thanks!