This is an archive of the discontinued LLVM Phabricator instance.

Improve Type::GetTypeScopeAndBasenameHelper and add unit tests
ClosedPublic

Authored by tberghammer on Jan 9 2017, 4:47 AM.

Details

Summary

Improve Type::GetTypeScopeAndBasenameHelper and add unit tests

Previously it failed to handle nested types inside templated classes
making it impossible to look up these types using the fully qualified
name.

Diff Detail

Repository
rL LLVM

Event Timeline

tberghammer updated this revision to Diff 83611.Jan 9 2017, 4:47 AM
tberghammer retitled this revision from to Improve Type::GetTypeScopeAndBasenameHelper and add unit tests.
tberghammer updated this object.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.
clayborg requested changes to this revision.Jan 9 2017, 10:30 AM
clayborg edited edge metadata.

Switch over to using llvm::StringRef in the functions where mentioned.

source/Symbol/Type.cpp
623 ↗(On Diff #83611)

We should probably switch over to using "llvm::StringRef &name" here.

629 ↗(On Diff #83611)

use name.empty() from llvm::StringRef

632 ↗(On Diff #83611)

Remove and just use "llvm::StringRef &name" variable.

633–634 ↗(On Diff #83611)

Change to use llvm::StringRef::consume_front and remove the "name_cstr += 7":

if (name.consume_front("struct ")) {
  type_class = eTypeClassStruct;
} else if (...) {
636 ↗(On Diff #83611)

ditto

639 ↗(On Diff #83611)

ditto

642 ↗(On Diff #83611)

ditto

645 ↗(On Diff #83611)

ditto

650–651 ↗(On Diff #83611)

Use llvm::StringRef and its member functions instead of strstr and starchy below.

This revision now requires changes to proceed.Jan 9 2017, 10:30 AM
tberghammer edited edge metadata.
tberghammer marked 9 inline comments as done.
clayborg accepted this revision.Jan 9 2017, 1:52 PM
clayborg edited edge metadata.

Fix the consume_front mentioned in the inlined comment and this is good to go.

source/Core/Module.cpp
1010–1011 ↗(On Diff #83669)

Use consume_front here:

if (type_scope.consume_front("::"))
  exact_match = true;
This revision is now accepted and ready to land.Jan 9 2017, 1:52 PM
This revision was automatically updated to reflect the committed changes.