mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-26 05:18:46 +00:00
[GlobPattern] Update invalid glob pattern diagnostic for unmatched '['
Update this diagnostic to mention the reason (unmatched '['), matching the other diagnostic about stray '\'. The original pattern is omitted, as some users may mention the original pattern in another position, not repeating it.
This commit is contained in:
parent
132bb5cc5f
commit
ebb0a21099
@ -14,4 +14,4 @@ int i = M;
|
||||
// CHECK-NOT: - Callback: EndOfMainFile
|
||||
// CHECK: ...
|
||||
|
||||
// INVALID: error: invalid glob pattern: [
|
||||
// INVALID: error: invalid glob pattern, unmatched '['
|
||||
|
@ -27,7 +27,7 @@ SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
|
||||
} else {
|
||||
Expected<GlobPattern> Glob = GlobPattern::create(Pattern);
|
||||
if (!Glob) {
|
||||
error(toString(Glob.takeError()));
|
||||
error(toString(Glob.takeError()) + ": " + Pattern);
|
||||
return;
|
||||
}
|
||||
ExactMatch = false;
|
||||
|
@ -1114,7 +1114,7 @@ static bool remapInputs(StringRef line, const Twine &location) {
|
||||
else if (Expected<GlobPattern> pat = GlobPattern::create(fields[0]))
|
||||
config->remapInputsWildcards.emplace_back(std::move(*pat), fields[1]);
|
||||
else {
|
||||
error(location + ": " + toString(pat.takeError()));
|
||||
error(location + ": " + toString(pat.takeError()) + ": " + fields[0]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1415,7 +1415,7 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
else if (Expected<GlobPattern> pat = GlobPattern::create(kv.first))
|
||||
config->shuffleSections.emplace_back(std::move(*pat), uint32_t(v));
|
||||
else
|
||||
error(errPrefix + toString(pat.takeError()));
|
||||
error(errPrefix + toString(pat.takeError()) + ": " + kv.first);
|
||||
}
|
||||
|
||||
auto reports = {std::make_pair("bti-report", &config->zBtiReport),
|
||||
@ -1453,7 +1453,7 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
else if (Expected<GlobPattern> pat = GlobPattern::create(kv.first))
|
||||
config->deadRelocInNonAlloc.emplace_back(std::move(*pat), v);
|
||||
else
|
||||
error(errPrefix + toString(pat.takeError()));
|
||||
error(errPrefix + toString(pat.takeError()) + ": " + kv.first);
|
||||
}
|
||||
|
||||
cl::ResetAllOptionOccurrences();
|
||||
@ -1610,7 +1610,8 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
if (Expected<GlobPattern> pat = GlobPattern::create(pattern))
|
||||
config->warnBackrefsExclude.push_back(std::move(*pat));
|
||||
else
|
||||
error(arg->getSpelling() + ": " + toString(pat.takeError()));
|
||||
error(arg->getSpelling() + ": " + toString(pat.takeError()) + ": " +
|
||||
pattern);
|
||||
}
|
||||
|
||||
// For -no-pie and -pie, --export-dynamic-symbol specifies defined symbols
|
||||
@ -1968,7 +1969,7 @@ static void handleUndefined(Symbol *sym, const char *option) {
|
||||
static void handleUndefinedGlob(StringRef arg) {
|
||||
Expected<GlobPattern> pat = GlobPattern::create(arg);
|
||||
if (!pat) {
|
||||
error("--undefined-glob: " + toString(pat.takeError()));
|
||||
error("--undefined-glob: " + toString(pat.takeError()) + ": " + arg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
# RUN: not ld.lld -z dead-reloc-in-nonalloc='['=0 2>&1 | FileCheck %s --check-prefix=INVALID
|
||||
|
||||
# INVALID: error: -z dead-reloc-in-nonalloc=: invalid glob pattern: [
|
||||
# INVALID: error: -z dead-reloc-in-nonalloc=: invalid glob pattern, unmatched '[': [
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
# RUN: not ld.lld --remap-inputs-file=err2.map aa.o -o /dev/null 2>&1 | \
|
||||
# RUN: FileCheck %s --check-prefix=ERR2 --implicit-check-not=error:
|
||||
# ERR2: error: err2.map:1: invalid glob pattern: aa.[o
|
||||
# ERR2: error: err2.map:1: invalid glob pattern, unmatched '[': aa.[o
|
||||
# ERR2-NEXT: error: cannot open aa.o: {{.*}}
|
||||
|
||||
# RUN: not ld.lld --remap-inputs=aa.o aa.o -o /dev/null 2>&1 | \
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
# RUN: not ld.lld --shuffle-sections='['=0 2>&1 | FileCheck %s --check-prefix=INVALID
|
||||
|
||||
# INVALID: error: --shuffle-sections=: invalid glob pattern: [
|
||||
# INVALID: error: --shuffle-sections=: invalid glob pattern, unmatched '[': [
|
||||
|
||||
## .text has an alignment of 4.
|
||||
.global _start
|
||||
|
@ -52,7 +52,7 @@
|
||||
# RUN: not ld.lld -o /dev/null %t.o %t.a --undefined-glob '[' 2>&1 | \
|
||||
# RUN: FileCheck -check-prefix=BAD-PATTERN %s
|
||||
|
||||
# BAD-PATTERN: --undefined-glob: invalid glob pattern: [
|
||||
# BAD-PATTERN: --undefined-glob: invalid glob pattern, unmatched '[': [
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
@ -48,7 +48,7 @@
|
||||
# RUN: echo "FOO { global: extern \"C++\" { a[; }; };" > %t9.script
|
||||
# RUN: not ld.lld --version-script %t9.script -shared %t.o -o /dev/null 2>&1 \
|
||||
# RUN: | FileCheck %s --check-prefix=ERROR
|
||||
# ERROR: invalid glob pattern: a[
|
||||
# ERROR: invalid glob pattern, unmatched '[': a[
|
||||
|
||||
.text
|
||||
.globl _Z3abbi
|
||||
|
@ -101,7 +101,7 @@
|
||||
# RUN: ld.lld --fatal-warnings --warn-backrefs -u foo %t2.a %t1.o -o /dev/null
|
||||
|
||||
# RUN: not ld.lld --warn-backrefs-exclude='[' 2>&1 | FileCheck --check-prefix=INVALID %s
|
||||
# INVALID: error: --warn-backrefs-exclude: invalid glob pattern: [
|
||||
# INVALID: error: --warn-backrefs-exclude: invalid glob pattern, unmatched '[': [
|
||||
|
||||
.globl _start, foo
|
||||
_start:
|
||||
|
@ -62,7 +62,6 @@ Expected<GlobPattern> GlobPattern::create(StringRef S) {
|
||||
Pat.Prefix = S.substr(0, PrefixSize);
|
||||
if (PrefixSize == std::string::npos)
|
||||
return Pat;
|
||||
StringRef Original = S;
|
||||
S = S.substr(PrefixSize);
|
||||
|
||||
// Parse brackets.
|
||||
@ -74,7 +73,7 @@ Expected<GlobPattern> GlobPattern::create(StringRef S) {
|
||||
++I;
|
||||
size_t J = S.find(']', I + 1);
|
||||
if (J == StringRef::npos)
|
||||
return make_error<StringError>("invalid glob pattern: " + Original,
|
||||
return make_error<StringError>("invalid glob pattern, unmatched '['",
|
||||
errc::invalid_argument);
|
||||
StringRef Chars = S.substr(I, J - I);
|
||||
bool Invert = S[I] == '^' || S[I] == '!';
|
||||
|
@ -11,7 +11,7 @@
|
||||
# RUN: not llvm-ifs --input-format=IFS --output-ifs=- --exclude='[' %s 2>&1 | \
|
||||
# RUN: FileCheck %s --check-prefix=BAD-GLOB
|
||||
|
||||
# BAD-GLOB: error: invalid glob pattern: [
|
||||
# BAD-GLOB: error: invalid glob pattern, unmatched '['
|
||||
|
||||
--- !ifs-v1
|
||||
SoName: somelib.so
|
||||
|
@ -131,7 +131,7 @@ Sections:
|
||||
Type: SHT_PROGBITS
|
||||
Symbols: []
|
||||
|
||||
# WARN: warning: invalid glob pattern: ][]
|
||||
# WARN: warning: invalid glob pattern, unmatched '['
|
||||
|
||||
# CHECK: LoadName:
|
||||
# CHECK: Name: (0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user