1. Dec 14, 2019
  2. Dec 13, 2019
    • Sam McCall's avatar
      [clangd] Fall back to selecting token-before-cursor if token-after-cursor fails. · b60896fa
      Sam McCall authored
      Summary:
      The problem:
      
      LSP specifies that Positions are between characters. Therefore when a position
      (or an empty range) is used to target elements of the source code, there is an
      ambiguity - should we look left or right of the cursor?
      
      Until now, SelectionTree resolved this to the right except in trivial cases
      (where there's whitespace, semicolon, or eof on the right).
      This meant that it's unable to e.g. out-line `int foo^()` today.
      
      Complicating this, LSP notwithstanding the cursor is *on* a character in many
      editors (mostly terminal-based). In these cases there's no ambiguity - we must
      "look right" - but there's also no way to tell in LSP.
      
      (Several features currently resolve this by using getBeginningOfIdentifier,
      which tries to rewind and supports end-of-identifier. But this relies on
      raw lexing and is limited and buggy).
      
      Precedent: well - most other languages aren't so full of densely packed symbols
      that we might want to target. Bias-towards-identifier works well enough.
      MS C++ for vscode seems to mostly use bias-toward-identifier too.
      The problem with this solution is it doesn't provide any way to target some
      things such as the constructor call in Foo^(bar());
      
      Presented solution:
      
      When an ambiguous selection is found, we generate *both* possible selection
      trees. We try to run the feature on the rightward tree first, and then on the
      leftward tree if it fails.
      
      This is basically do-what-I-mean, the main downside is the need to do this on
      a feature-by-feature basis (because each feature knows what "fail" means).
      The most complicated instance of this is Tweaks, where the preferred selection
      may vary tweak-by-tweak.
      
      Wrinkles:
      
      While production behavior is pretty consistent, this introduces some
      inconsistency in testing, depending whether the interface we're testing is
      inside or outside the "retry" wrapper.
      
      In particular, for many features like Hover, the unit tests will show production
      behavior, while for Tweaks the harness would have to run the loop itself if
      we want this.
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71345
      b60896fa
    • Sam McCall's avatar
      [Tooling/Syntax] Helpers to find spelled tokens touching a location. · 22f81250
      Sam McCall authored
      Summary: Useful when positions are used to target nodes, with before/after ambiguity.
      
      Reviewers: ilya-biryukov, kbobyrev
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71356
      22f81250
    • Mark Murray's avatar
      [ARM][MVE][Intrinsics] remove extraneous intrinsics. · 0eb09927
      Mark Murray authored
      Summary:
      I overstepped my reach and generated too many intrinsics; these never
      made it into the tests.
      
      Remove these extras. Some needed to be signed-olny, and there were some
      possible but unrequired _x variants that needed an extra argument to
      IntrinsicMX to allow [de-]selection at compile-time.
      
      Reviewers: simon_tatham
      
      Subscribers: kristof.beyls, dmgreen, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71466
      0eb09927
    • Sam Parker's avatar
      [ARM][MVE] Make VPT invalid for tail predication · 84593f05
      Sam Parker authored
      We've been marking VPT incompatible instructions as invalid for tail
      predication too, though this may not strictly be true. VPT are
      incompatible and, unless its the first predicate def in a loop,
      they shouldn't be compatible for tail predication either.
      
      Differential Revision: https://reviews.llvm.org/D71410
      84593f05