[PATCH] D86222: Fix PR46880: Fail CHECK-NOT with undefined variable

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 01:30:11 PDT 2020


thopre marked an inline comment as done.
thopre added inline comments.


================
Comment at: llvm/test/FileCheck/dump-input-annotations.txt:626
+; SUBST-POS-NEXT:check:2'0     X~~~~~~~~~~~~~~~~~~~~~ error: match error
+; SUBST-POS-NEXT:check:2'1                            uses undefined variable: "UNDEF"
 ; SUBST-POS-NEXT:>>>>>>
----------------
jdenny wrote:
> thopre wrote:
> > jdenny wrote:
> > > This test used to cover printing of variable definitions when a positive directive fails.  It no longer does.
> > > 
> > > A separate test could be added to cover that case.  But do we need to drop that info when a variable is undefined?  It could be helpful for debugging.
> > We currently only print substitutions if there are no errors. I think if we want to print substitutions in case of undefined variable we should do it regardless of whether there are errors to be consistent. Obviously that means ignoring substitution errors in printSubstitutions
> What's an example of an error besides undefined variable for which we currently don't print substitutions but you're suggesting we would?
Overflow and underflow come to mind. There might be others.

```
% cat overflow_undef.test
BIGVAR=10000000000000000
CHECK: BIGVAR: [[#BIGVAR:0x8000000000000000+0x8000000000000000]] [[#UNDEFVAR]]
% ./bin/FileCheck --dump-input=never --input-file overflow_undef.test overflow_undef.test
overflow_undef.test:2:19: error: unable to substitute variable or numeric expression: overflow error
CHECK: BIGVAR: [[#BIGVAR:0x8000000000000000+0x8000000000000000]] [[#UNDEFVAR]]
                  ^
zsh: exit 1     ./bin/FileCheck --dump-input=never --input-file overflow_undef.test
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86222/new/

https://reviews.llvm.org/D86222



More information about the llvm-commits mailing list