According to the comment at line 239:

    if (LoadedSuccessfully.count(*victim) == 0) {
      // Before removing the module file, check if it was validated in an
      // ancestor thread, if yes, throw a hard error instead of causing
      // use-after-free in the ancestor thread.
      bool IsSystem;
      if (FileMgr.getPCMCache()->isValidatedByAncestor((*victim)->FileName,
                                                       IsSystem))
        ValidationConflicts.push_back((*victim)->FileName);
      else
        FileMgr.invalidateCache((*victim)->File);
      FileMgr.getPCMCache()->removeFromConsistentBuffer((*victim)->FileName);
    }

that looks like it would cause a use-after-free in the parent thread.  What am 
I missing?

> On 2017-Jan-24, at 17:56, Bruno Cardoso Lopes via Phabricator 
> <revi...@reviews.llvm.org> wrote:
> 
> bruno added inline comments.
> 
> 
> ================
> Comment at: lib/Serialization/ASTReader.cpp:3692
> +                            ValidationConflicts);
> +    for (auto N : ValidationConflicts)
> +      Diag(diag::err_module_ancestor_conflict) << N;
> ----------------
> This should honor `ARR_OutOfDate`, so that the module can be rebuilt in case 
> a user module mismatch via a different diagnostics 
> (lib/Serialization/ASTReader.cpp:4076) and returns OutOfDate instead of 
> Success:
> 
>    if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
>      for (auto N : ValidationConflicts)
>        Diag(diag::err_module_ancestor_conflict) << N;
> 
> 
> https://reviews.llvm.org/D28299
> 
> 
> 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to