[PATCH] D60381: FileCheck [1/12]: Move variable table in new object
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 16:14:23 PDT 2019
thopre marked an inline comment as done.
thopre added inline comments.
================
Comment at: llvm/include/llvm/Support/FileCheck.h:138
+ /// variables at the start of any given CHECK line.
+ FileCheckPatternContext *Context;
+
----------------
arsenm wrote:
> thopre wrote:
> > jhenderson wrote:
> > > Just to be clear, this is shared between all patterns?
> > Yes, updated the comment to make it clear.
> Why is this shared_ptr? For a context, there should be clear ownership. Each pattern doesn't need to have a potentially owning reference. It can live somewhere else
Hi Matt, thanks for the review!
The object is created in readCheckFile function and cease to be used in checkInput without a pointer being passed around explicitely. I used to delete the pointer taken from one of the pattern but James suggested to use a shared_ptr. It is overkill but allow the code to still work in case it is changed slightly. If the patterns hold a regular pointer I don't know in what shared_ptr to store the ownership and would need to revert to the initial approach.
Is there any other solution I've missed?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60381/new/
https://reviews.llvm.org/D60381
More information about the llvm-commits
mailing list