[PATCH] D71227: [cuda][hip] Fix function overload resolution in the global initiailizer.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 13:53:12 PST 2020
rjmccall added inline comments.
================
Comment at: clang/include/clang/Sema/Sema.h:11444
+ return nullptr;
+ const Decl *ContextDecl = dyn_cast<FunctionDecl>(CurContext);
+ if (!ContextDecl)
----------------
You really want this to match whenever we're in a local context, right? How about structuring the function like:
```
if (CurContext->isFunctionOrMethod())
return cast<Decl>(CurContext);
if (!CurContext->isFileContext())
return nullptr;
return getCUDACurrentNonLocalVariable();
```
As a more general solution, I think Sema funnels all changes to CurContext through a small number of places, and you could make those places save and restore the currently initialized variable as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71227/new/
https://reviews.llvm.org/D71227
More information about the cfe-commits
mailing list