This is needed to prevent clang from crashing when we make the changes proposed in https://reviews.llvm.org/D98799.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang crashes if I remove the fake FunctionDecls as I did in https://reviews.llvm.org/D104082.
If args.push_back(Params[1] = SrcDecl); doesn't trigger a warning, this seems reasonable.
clang/lib/CodeGen/CGObjC.cpp | ||
---|---|---|
3702 | Does this compile without warnings? |
Ah - this is an alternative to D104082? OK. Yeah, looks like it'd address the thing we were discussing in D98799. But do you have some more details on why D104082 wasn't the right direction? I thought we found other places that used a default-constructed/null GlobalDecl() for StartFunction` correctly, so I'm wondering why this would be a problem in this particular case(s)?
I see assert(DC && "This decl is not contained in a translation unit!"); fail in Decl::getTranslationUnitDecl when DeclRefExpr is constructed. That's because the ImplicitParamDecl passed to DeclRefExpr's constructor doesn't have a decl context if I delete FD. So it looks like FD is needed in these cases.
clang/lib/CodeGen/CGObjC.cpp | ||
---|---|---|
3702 | Yes, clang compiles this without any warnings. I don't know whether other compilers warn. |
Hmm, OK - I think I'm following enough. I'll leave the rest to you & @aprantl - appreciate the work!
Does this compile without warnings?