This is an archive of the discontinued LLVM Phabricator instance.

Preserve source location in namespaced base ctor initializers
ClosedPublic

Authored by shahms on Dec 11 2015, 3:35 PM.

Details

Reviewers
rsmith
Summary

Resolved a FIXME to preserve source location in qualified base initializers.

This patch preserves location information for constructs such as:

namespace ns1 {
struct Base {};
struct Derived : Base {

Derived() : ns1::Base() {}

};
}

previously, the reference to ns1 would overlap the reference to Base. With
this patch it properly spans only ns1.

Diff Detail

Event Timeline

shahms updated this revision to Diff 42594.Dec 11 2015, 3:35 PM
shahms retitled this revision from to Preserve source location in namespaced base ctor initializers.
shahms updated this object.
shahms added a subscriber: cfe-commits.
rsmith added a subscriber: rsmith.Dec 11 2015, 3:47 PM
rsmith added inline comments.
lib/Sema/SemaDeclCXX.cpp
2987

You also need to initialize the TypeLoc for the contained TypeDeclType (TL.getNamedTypeLoc()).

2988

This should be initialized to SourceLocation(), since there is no elaborated type keyword (struct/union/class/enum) in this case.

rsmith removed a subscriber: rsmith.
shahms marked 2 inline comments as done.Dec 11 2015, 4:45 PM

Thanks for taking a look at this so quickly. I've updated the test to make sure the TypeRef is correct as well, in light of the changes here.

shahms updated this revision to Diff 42608.Dec 11 2015, 4:46 PM

Address comments and add CHECK for TypeRef as well

rsmith accepted this revision.Dec 11 2015, 6:20 PM
rsmith edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 11 2015, 6:20 PM
rsmith closed this revision.Dec 11 2015, 6:21 PM

Committed as r255420. Thanks for the patch!