This is an archive of the discontinued LLVM Phabricator instance.

[SourceManager] don't check invalid param of getLocalSLocEntry()
ClosedPublic

Authored by nickdesaulniers on Jun 24 2020, 1:24 PM.

Details

Summary

Forked from D80681.

getLocalSLocEntry() has an unused parameter used to satisfy an interface
of libclang (see getInclusions() in
clang/tools/libclang/CIndexInclusionStack.cpp). It's pointless for
callers to construct/pass/check this inout parameter that can never
signify that a FileID is invalid.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2020, 1:24 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nickdesaulniers retitled this revision from [SourceManager] don't check Invalid param of getLocalSLocEntry() to [SourceManager] don't check invalid param of getLocalSLocEntry().Jun 24 2020, 1:26 PM
kadircet added inline comments.Jun 25 2020, 2:03 AM
clang/include/clang/Basic/SourceManager.h
1648

i think we should drop Invalid from the signature completely if we are going for this.

I've sent out D82532 to get rid of the libclang dependency on this, after it lands this should be possible to clear.

kadircet added inline comments.Jun 25 2020, 4:48 AM
clang/include/clang/Basic/SourceManager.h
1648

landed that patch please rebase and get rid of this parameter completely. Also please add a comment to getSLocEntryByID saying that Invalid won't be modified for local sloc entries.

  • drop Invalid param from getLocalSLocEntry
nickdesaulniers marked 2 inline comments as done.Jun 25 2020, 10:40 AM
kadircet accepted this revision.Jun 26 2020, 12:06 AM

thanks, lgtm!

This revision is now accepted and ready to land.Jun 26 2020, 12:06 AM
This revision was automatically updated to reflect the committed changes.