Fixes #184425 When parsing an alias declaration like: ```c++ using A = X<int>>; ``` clang splits `>>` into two `>` tokens while parsing templates. In this token-split case, `Lexer::getLocForEndOfToken` was advancing past the already-correct expansion end location, which moved the fix-it insertion point too far right (at `;` instead of before the second `>`). This patch detects token-split expansion ranges and returns the expansion end location directly after `isAtEndOfMacroExpansion`, avoiding the extra token-length advance. Also adds a regression test in `clang/test/Parser/cxx-alias-decl-split-angle-fixit.cpp` that checks the fix-it insertion location is `{4:17-4:17}` for the example above. Local validation: - `tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/Lexer.cpp.o` builds successfully - full `clang` build/test still in progress
8 lines
252 B
C++
8 lines
252 B
C++
// RUN: not %clang_cc1 -fsyntax-only -std=c++11 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
|
|
|
|
template <typename> struct X {};
|
|
using A = X<int>>;
|
|
|
|
// CHECK: error: expected ';' after alias declaration
|
|
// CHECK: fix-it:"{{.*}}":{4:17-4:17}:";"
|