Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
53e0679d
Commit
53e0679d
authored
13 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
various cleanups, no functionality change.
llvm-svn: 129192
parent
8872ec3f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/utils/FileCheck/FileCheck.cpp
+6
-10
6 additions, 10 deletions
llvm/utils/FileCheck/FileCheck.cpp
with
6 additions
and
10 deletions
llvm/utils/FileCheck/FileCheck.cpp
+
6
−
10
View file @
53e0679d
...
@@ -131,26 +131,26 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
...
@@ -131,26 +131,26 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
}
}
// Paren value #0 is for the fully matched string. Any new parenthesized
// Paren value #0 is for the fully matched string. Any new parenthesized
// values add from the
i
r.
// values add from ther
e
.
unsigned
CurParen
=
1
;
unsigned
CurParen
=
1
;
// Otherwise, there is at least one regex piece. Build up the regex pattern
// Otherwise, there is at least one regex piece. Build up the regex pattern
// by escaping scary characters in fixed strings, building up one big regex.
// by escaping scary characters in fixed strings, building up one big regex.
while
(
!
PatternStr
.
empty
())
{
while
(
!
PatternStr
.
empty
())
{
// RegEx matches.
// RegEx matches.
if
(
PatternStr
.
size
()
>=
2
&&
if
(
PatternStr
.
startswith
(
"{{"
))
{
PatternStr
[
0
]
==
'{'
&&
PatternStr
[
1
]
==
'{'
)
{
// Otherwise, this is the start of a regex match. Scan for the }}.
// Otherwise, this is the start of a regex match. Scan for the }}.
size_t
End
=
PatternStr
.
find
(
"}}"
);
size_t
End
=
PatternStr
.
find
(
"}}"
);
if
(
End
==
StringRef
::
npos
)
{
if
(
End
==
StringRef
::
npos
)
{
SM
.
PrintMessage
(
SMLoc
::
getFromPointer
(
PatternStr
.
data
()),
SM
.
PrintMessage
(
SMLoc
::
getFromPointer
(
PatternStr
.
data
()),
"found start of regex string with no end '}}'"
,
"error"
);
"found start of regex string with no end '}}'"
,
"error"
);
return
true
;
return
true
;
}
}
if
(
AddRegExToRegEx
(
PatternStr
.
substr
(
2
,
End
-
2
),
CurParen
,
SM
))
if
(
AddRegExToRegEx
(
PatternStr
.
substr
(
2
,
End
-
2
),
CurParen
,
SM
))
return
true
;
return
true
;
PatternStr
=
PatternStr
.
substr
(
End
+
2
);
PatternStr
=
PatternStr
.
substr
(
End
+
2
);
continue
;
continue
;
}
}
...
@@ -160,8 +160,7 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
...
@@ -160,8 +160,7 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
// second form is [[foo]] which is a reference to foo. The variable name
// second form is [[foo]] which is a reference to foo. The variable name
// itself must be of the form "[a-zA-Z_][0-9a-zA-Z_]*", otherwise we reject
// itself must be of the form "[a-zA-Z_][0-9a-zA-Z_]*", otherwise we reject
// it. This is to catch some common errors.
// it. This is to catch some common errors.
if
(
PatternStr
.
size
()
>=
2
&&
if
(
PatternStr
.
startswith
(
"[["
))
{
PatternStr
[
0
]
==
'['
&&
PatternStr
[
1
]
==
'['
)
{
// Verify that it is terminated properly.
// Verify that it is terminated properly.
size_t
End
=
PatternStr
.
find
(
"]]"
);
size_t
End
=
PatternStr
.
find
(
"]]"
);
if
(
End
==
StringRef
::
npos
)
{
if
(
End
==
StringRef
::
npos
)
{
...
@@ -185,10 +184,7 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
...
@@ -185,10 +184,7 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
// Verify that the name is well formed.
// Verify that the name is well formed.
for
(
unsigned
i
=
0
,
e
=
Name
.
size
();
i
!=
e
;
++
i
)
for
(
unsigned
i
=
0
,
e
=
Name
.
size
();
i
!=
e
;
++
i
)
if
(
Name
[
i
]
!=
'_'
&&
if
(
Name
[
i
]
!=
'_'
&&
!
isalnum
(
Name
[
i
]))
{
(
Name
[
i
]
<
'a'
||
Name
[
i
]
>
'z'
)
&&
(
Name
[
i
]
<
'A'
||
Name
[
i
]
>
'Z'
)
&&
(
Name
[
i
]
<
'0'
||
Name
[
i
]
>
'9'
))
{
SM
.
PrintMessage
(
SMLoc
::
getFromPointer
(
Name
.
data
()
+
i
),
SM
.
PrintMessage
(
SMLoc
::
getFromPointer
(
Name
.
data
()
+
i
),
"invalid name in named regex"
,
"error"
);
"invalid name in named regex"
,
"error"
);
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment