This is an archive of the discontinued LLVM Phabricator instance.

Switch TypeSystemClang over to CreateDeserialized() (NFC)
ClosedPublic

Authored by aprantl on Mar 5 2020, 4:03 PM.

Details

Summary

Based on a suggestion from Richard Smith, this switches TypeSystemClang over to Decl*::CreateDeserialized() which is the more appropriate API for its use-case.

Diff Detail

Event Timeline

teemperor accepted this revision.Mar 9 2020, 3:30 PM

The changes that remove the non-existent module parameter slipped in by mistake I think and the rest LGTM. I didn't verify if all the setX calls are 100% identical to what the constructor would do but *usually* Decl constructor don't any fancy logic so the new code should be equivalent. Maybe dump some module AST before and after this patch and just diff it to see if anything changed.

This revision is now accepted and ready to land.Mar 9 2020, 3:30 PM
shafik added inline comments.Mar 10 2020, 2:44 PM
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
1265

static_cast<TagDecl::TagKind>(kind)

1448

static_cast<TagDecl::TagKind>(kind)

1966

static_cast<StorageClass>(storage)

2028

static_cast<StorageClass>(storage)

A bunch of small comments but a few more serious ones as well.

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
1394

It does not look like func_decl->getLocation() get used at all.

1526

static_cast<TagDecl::TagKind>(kind)

1836

I guess clang::SC_None is the default?

7268

Where does 1 << 1 come from? What does it mean?

7999

Everywhere else we do:

if (name && name[0])

Why not for this case?

This revision was automatically updated to reflect the committed changes.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 16 2020, 6:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript