This is an archive of the discontinued LLVM Phabricator instance.

[FileCheck] Record numeric variable availability
AbandonedPublic

Authored by thopre on Jul 4 2019, 4:51 PM.

Details

Summary

Change the line number information stored for a numeric variable to be
about when does the value becomes available rather than when it is
defined. This provides a more natural semantic for pseudo variables and
variables defined on the command-line that are not defined from a
variable definition in the input text.

Event Timeline

thopre created this revision.Jul 4 2019, 4:51 PM

As mentioned inline, I don't understand what you mean by "available". Perhaps you could post some basic examples for the different cases explaining what you mean, and then I can try suggesting some different terminology.

llvm/include/llvm/Support/FileCheck.h
52–53

I'm not sure it's clear to me what "available" means in this context if it doesn't mean definition.

56–66

in input -> in the input (?)

58

Not that I'm bothered really, but is there a reason to change the signature order here?

thopre updated this revision to Diff 208181.Jul 5 2019, 7:32 AM
thopre marked 4 inline comments as done.

Rebase on top of latest changes in patch series

thopre added inline comments.Jul 5 2019, 8:10 AM
llvm/include/llvm/Support/FileCheck.h
52–53

The change in naming is mostly for pseudo variables (@LINE being the only at the moment) where the definition is implicit and thus there isn't a definition line number per se. However I think it makes sense to talk about value availability (e.g. @LINE only has a value from the first line in the CHECK file, whereas other variable have their value available from after their definition).

58
  1. Consistency
  2. I usually put the most important parameters first and the name of a variable feels more essential (since that's how you refer to it). The line number is only to catch some incorrect uses
jhenderson added inline comments.Jul 8 2019, 3:04 AM
llvm/include/llvm/Support/FileCheck.h
52–53

I could spin it another way. The @LINE variable is defined anew on each line, with the value of the input line number. Alternatively, it is defined on the first line, and updated thereafter. Thus its definition line is equal to its current value, or the first time it was defined (i.e. line 1), whichever is more useful.

Thinking in C++ terms, there is no concept of variable "availability". You have scope, definition, and declaration as related words. Thus variable availability is not a concept that people necessarily will understand.

thopre abandoned this revision.Jul 10 2019, 5:51 AM