zturner added a comment.

In https://reviews.llvm.org/D54454#1296358, @jingham wrote:

> You were probably speaking loosely, but to be clear, the code you are 
> changing doesn't get used for expressions - i.e. the expression command - 
> unless I'm missing something.
>
> This little mini-parser is for doing things like:
>
> (lldb) frame variable foo.bar
>
> We don't use clang or the expression parser to comprehend foo.bar, we use 
> GetValuesForVariableExpressionPath instead.  But 'frame variable' 'target 
> variable' etc. which use this are fairly limited in what they need to 
> support.  They just needs to handle variable references - either local 
> variables or static variables, and references to children of those variables. 
>  No calls, no casts, no types, etc.
>
> So I don't see that the ability to handle template definition markers like 
> <int> is important.  I don't see how that would show up in a variable name or 
> the name of one of its children.


C++14 variable templates.

  template<typename T> T SomeVariable;
  
  void foo() {
    SomeVariable<int> IntVariable = x;
  }

Now in this case you can simply say `frame variable IntVariable`, and it will 
work fine.  But what about this?

  template<typename T>
  constexpr T Pi = 3.1415;

In this case you might say `target variable Pi<double>` and this will currently 
fail.

A slightly less contrived example:

  template<typename T>
  struct Foo {
    static T SomeGlobal;
  };
  
  int Foo<int>::SomeGlobal = 42;
  long double Foo<long double>::SomeGlobal = 42.0;

Now you might write `target variable "Foo<long double>::SomeGlobal"`

For a totally real world example, this came up for me when I tried to write 
`target variable std::numeric_limits<int>::is_signed`.

If `namespace::non_template_class::some_constant` works, then there's no reason 
this shouldn't also work.


https://reviews.llvm.org/D54454



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

Reply via email to