================
@@ -1227,8 +1235,16 @@ class CodeGenFunction : public CodeGenTypeCache {
/// PrivateGen is the address of the generated private variable.
/// \return true if the variable is registered as private, false if it has
/// been privatized already.
- bool addPrivate(const VarDecl *LocalVD, Address Addr) {
+ bool addPrivate(const ValueDecl *LocalVD, Address Addr) {
assert(PerformCleanup && "adding private to dead scope");
+ if (const auto *BD = dyn_cast<BindingDecl>(LocalVD->getCanonicalDecl()))
{
+ auto It = CGF.OMPPrivatizedBindings.find(BD);
+ if (It != CGF.OMPPrivatizedBindings.end()) {
+ BindingChanges.emplace_back(BD, It->second);
+ } else {
+ BindingChanges.emplace_back(BD, std::nullopt);
+ }
----------------
zahiraam wrote:
I switched to A`ddress::invalid()` as you suggested, avoiding `std::optional`.
However, `lookup()` doesn't work because `Address` has no default constructor,
so
I'm using the explicit `find(`) pattern which is the standard one for
non-default-constructible map values.
https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits