This is an archive of the discontinued LLVM Phabricator instance.

[ASTImporter] Implicitly declare parameters for imported ObjCMethodDecls
ClosedPublic

Authored by teemperor on Dec 6 2019, 4:55 AM.

Details

Summary

When Sema encounters a ObjCMethodDecl definition it declares the implicit parameters for the ObjCMethodDecl.
When importing such a method with the ASTImporter we need to do the same for the imported method
otherwise we will crash when generating code (where CodeGen expects that this was called by Sema).

Note I had to implement Objective-C[++] support in Language.cpp as this is the first test for Objective-C and this
would otherwise just hit this 'not implemented' assert when running the unit test.

Diff Detail

Event Timeline

teemperor created this revision.Dec 6 2019, 4:55 AM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

Thanks for addressing this, I just have some minor comments.

clang/unittests/AST/ASTImporterTest.cpp
5603

You could use a raw string literal for the code, that way we could get rid of the '\n's and the trailing " characters.

teemperor updated this revision to Diff 232541.Dec 6 2019, 6:04 AM
  • Put code in raw string (Thanks Gabor!)
martong added inline comments.Dec 6 2019, 6:21 AM
clang/unittests/AST/Language.cpp
47

I think, we should keep the "Not implemented yet!" message here. Perhaps you wanted "-std=objc++" to put next to -x objective-c++ in line 41?

teemperor marked an inline comment as done.Dec 6 2019, 6:23 AM
teemperor added inline comments.
clang/unittests/AST/Language.cpp
47

Whoops, yes that should have stayed "Not implemented"...

teemperor updated this revision to Diff 232547.Dec 6 2019, 6:25 AM
  • Reverted unintentional change to unreachable error message.
martong accepted this revision.Dec 6 2019, 7:13 AM
This revision is now accepted and ready to land.Dec 6 2019, 7:13 AM
This revision was automatically updated to reflect the committed changes.