akyrtzi added a comment.

> That would be good. How would one go about asking Clang to generate this 
> extra information? Would a Clang Plugin be suitable for this?

That's an interesting idea that we could explore, but I don't have much 
experience with that mechanism to comment on.

> Only the lexer was needed to get the end of the token

Ok, that's interesting, not sure why Xcode is so fast to highlight, did you 
reuse same SourceManager/Lexer/buffers for occurrences from same file ? We'd 
definitely add the end-loc if we cannot come up with a mechanism to highlight 
fast enough without it.

> I think it's useful to highlight something even when the name is not there. 
> For example in "MyClass o1, o2;" it feels natural that o1 and o2 would get 
> highlighted.

To clarify, even with implicit references the start loc points to something. In 
this case the implicit references can have start locs for the o1 and o2 
identifiers and the end result for the UI will be the same (o1 and o2 get 
highlighted) even without having end-locs for all references.

> It does? I can only seem to do a textual search.

The example I tried is the following. If you could file a bug report for the 
test case that did not work as you expected it would be much appreciated!

  class Something1 {
  public:
      Something1() {}
      ~Something1() {}
      operator int() {
          return 0;
      }
  
      friend int operator <<(Something1 &p, Something1 &p2) {
          return 0;
      }
  };
  
  void foo1(Something1 p1, Something1 p2) {
      p1 << p2;
      p1 << p2;
  }



> here the "operator std::string" would be called and MyStringRef could be 
> highlighted

Even without end-loc, the start loc could point to MyStringRef and you could 
highlight it.


https://reviews.llvm.org/D39050



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

Reply via email to