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
1210

static_cast<TagDecl::TagKind>(kind)

1392

static_cast<TagDecl::TagKind>(kind)

1900

static_cast<StorageClass>(storage)

1961

static_cast<StorageClass>(storage)

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

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

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

1467

static_cast<TagDecl::TagKind>(kind)

1771

I guess clang::SC_None is the default?

7190

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

7913

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