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

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
622–623

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

627

use name.empty() from llvm::StringRef

627

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

628–629

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

if (name.consume_front("struct ")) {
  type_class = eTypeClassStruct;
} else if (...) {
629–668

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

631

ditto

634

ditto

637

ditto

640

ditto

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

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.