
Fixes #139375 Clang expects command line source locations to be provided using 1-based indexing. Currently, Clang does not reject zero as invalid argument for column or line number, which can cause Clang to crash. This commit extends validation in `ParsedSourceLocation::FromString` to only accept (unsinged) non-zero integers.
12 lines
657 B
C++
12 lines
657 B
C++
// Regression test for #139375
|
|
// Clang uses 1-based indexing for source locations given from the command-line.
|
|
// Verify that Clang rejects 0 as an invalid value for line or column number.
|
|
|
|
// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:0:1 %s -o - 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=CHECK-DIAG %s
|
|
// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:1:0 %s -o - 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=CHECK-DIAG %s
|
|
|
|
// CHECK-DIAG: error: invalid value '{{.*}}' in '-code-completion-at={{.*}}'
|
|
// CHECK-NEXT: hint: -code-completion-at=<file>:<line>:<column> requires <line> and <column> to be integers greater than zero
|