<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Support/Regex.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>Avoid nullptr+0 in Regex (#73071)</title>
<updated>2023-12-01T19:28:42+00:00</updated>
<author>
<name>Tanmay</name>
<email>tnmysachan@gmail.com</email>
</author>
<published>2023-12-01T19:28:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=deca8055d4f590047730df4a6806e06d623ef1ff'/>
<id>deca8055d4f590047730df4a6806e06d623ef1ff</id>
<content type='text'>
A zero-length StringRef can have a null data pointer, which, if passed to the llvm_regex functions which take a pointer+length, but then convert it into a [begin, end) pointer pair can cause a nullptr+0 expression to be evaluated, which is UB. So avoid that by ensuring the data pointer is always non-null, even in the zero-length case.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A zero-length StringRef can have a null data pointer, which, if passed to the llvm_regex functions which take a pointer+length, but then convert it into a [begin, end) pointer pair can cause a nullptr+0 expression to be evaluated, which is UB. So avoid that by ensuring the data pointer is always non-null, even in the zero-length case.</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Add `\g&lt;ref&gt;` backreferences in Regex::sub() (#67220)</title>
<updated>2023-10-11T17:24:45+00:00</updated>
<author>
<name>Igor Kudrin</name>
<email>ikudrin@accesssoftek.com</email>
</author>
<published>2023-10-11T17:24:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=28b7e281d4eaea0d5d56b1a4cf7a550be746a007'/>
<id>28b7e281d4eaea0d5d56b1a4cf7a550be746a007</id>
<content type='text'>
The existing format of backreferences, `\&lt;ref&gt;`, does not allow digits
to be placed directly after the reference because they are included in
the reference number. The new format solves this problem by adding
explicit delimiters.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The existing format of backreferences, `\&lt;ref&gt;`, does not allow digits
to be placed directly after the reference because they are included in
the reference number. The new format solves this problem by adding
explicit delimiters.</pre>
</div>
</content>
</entry>
<entry>
<title>Undo include order work-around in Regex.cpp</title>
<updated>2023-05-09T07:18:10+00:00</updated>
<author>
<name>Hans Wennborg</name>
<email>hans@chromium.org</email>
</author>
<published>2023-05-08T17:15:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9d7eb6008716eec7434e6ae07a804b5f2f39a575'/>
<id>9d7eb6008716eec7434e6ae07a804b5f2f39a575</id>
<content type='text'>
r327256 / 2b8b90a7686858b1d22cae6fcfbd0904135112aa added this
include-order work-around since regex_impl.h's include guard conflicted
with macOS's xlocale.h which used the same macro.

Since b86c249691a7973a451bc6a586b39da64778d219 renamed the include
guard, that work-around is no longer needed.

Differential revision: https://reviews.llvm.org/D150127
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
r327256 / 2b8b90a7686858b1d22cae6fcfbd0904135112aa added this
include-order work-around since regex_impl.h's include guard conflicted
with macOS's xlocale.h which used the same macro.

Since b86c249691a7973a451bc6a586b39da64778d219 renamed the include
guard, that work-around is no longer needed.

Differential revision: https://reviews.llvm.org/D150127
</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Use range-based for loops (NFC)</title>
<updated>2021-12-02T17:27:47+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2021-12-02T17:27:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=262dd1e42d719d2bd3fa18233500204c6950cede'/>
<id>262dd1e42d719d2bd3fa18233500204c6950cede</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[ASTMatchers] Enhanced support for matchers taking Regex arguments</title>
<updated>2020-07-02T13:52:25+00:00</updated>
<author>
<name>Nathan James</name>
<email>n.james93@hotmail.co.uk</email>
</author>
<published>2020-07-02T13:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f51a319cacd44819b4fb9fa9f005c2445bcee984'/>
<id>f51a319cacd44819b4fb9fa9f005c2445bcee984</id>
<content type='text'>
Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a matchers that take a regular expression string and optionally regular expression flags. This lets users match against nodes while ignoring the case without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other point this addresses is in the current state, matchers that use regular expressions have to compile them for each node they try to match on, Now the regular expression is compiled once when you define the matcher and used for every node that it tries to match against. If there is an error while compiling the regular expression an error will be logged to stderr showing the bad regex string and the reason it couldn't be compiled. The old behaviour of this was down to the Matcher implementation and some would assert, whereas others just would never match. Support for this has been added to the documentation script as well. Support for this has been added to dynamic matchers ensuring functionality is the same between the 2 use cases.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D82706
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a matchers that take a regular expression string and optionally regular expression flags. This lets users match against nodes while ignoring the case without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other point this addresses is in the current state, matchers that use regular expressions have to compile them for each node they try to match on, Now the regular expression is compiled once when you define the matcher and used for every node that it tries to match against. If there is an error while compiling the regular expression an error will be logged to stderr showing the bad regex string and the reason it couldn't be compiled. The old behaviour of this was down to the Matcher implementation and some would assert, whereas others just would never match. Support for this has been added to the documentation script as well. Support for this has been added to dynamic matchers ensuring functionality is the same between the 2 use cases.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D82706
</pre>
</div>
</content>
</entry>
<entry>
<title>Explicitly include &lt;cassert&gt; when using assert</title>
<updated>2020-03-02T21:45:28+00:00</updated>
<author>
<name>Joerg Sonnenberger</name>
<email>joerg@bec.de</email>
</author>
<published>2020-03-02T17:24:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=eb812efa12fb82ca338794fa18b610ca9581aef5'/>
<id>eb812efa12fb82ca338794fa18b610ca9581aef5</id>
<content type='text'>
Depending on the OS used, a module-enabled build can fail due to the
special handling &lt;cassert&gt; gets as textual header.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Depending on the OS used, a module-enabled build can fail due to the
special handling &lt;cassert&gt; gets as textual header.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make llvm::StringRef to std::string conversions explicit.</title>
<updated>2020-01-28T22:25:25+00:00</updated>
<author>
<name>Benjamin Kramer</name>
<email>benny.kra@googlemail.com</email>
</author>
<published>2020-01-28T19:23:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=adcd02683856c30ba6f349279509acecd90063df'/>
<id>adcd02683856c30ba6f349279509acecd90063df</id>
<content type='text'>
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.
</pre>
</div>
</content>
</entry>
<entry>
<title>Regex: Make "match" and "sub" const member functions</title>
<updated>2019-09-24T14:42:36+00:00</updated>
<author>
<name>Thomas Preud'homme</name>
<email>thomasp@graphcore.ai</email>
</author>
<published>2019-09-24T14:42:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5f738940b552fe22ca0850981c55279da8e7527d'/>
<id>5f738940b552fe22ca0850981c55279da8e7527d</id>
<content type='text'>
Summary:
The Regex "match" and "sub" member functions were previously not "const"
because they wrote to the "error" member variable. This commit removes
those assignments, and instead assumes that the validity of the regex
is already known after the initial compilation of the regular
expression. As a result, these member functions were possible to make
"const". This makes it easier to do things like pre-compile Regexes
up-front, and makes "match" and "sub" thread-safe. The error status is
now returned as an optional output, which also makes the API of "match"
and "sub" more consistent with each other.

Also, some uses of Regex that could be refactored to be const were made const.

Patch by Nicolas Guillemot

Reviewers: jankratochvil, thopre

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67241

llvm-svn: 372764
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
The Regex "match" and "sub" member functions were previously not "const"
because they wrote to the "error" member variable. This commit removes
those assignments, and instead assumes that the validity of the regex
is already known after the initial compilation of the regular
expression. As a result, these member functions were possible to make
"const". This makes it easier to do things like pre-compile Regexes
up-front, and makes "match" and "sub" thread-safe. The error status is
now returned as an optional output, which also makes the API of "match"
and "sub" more consistent with each other.

Also, some uses of Regex that could be refactored to be const were made const.

Patch by Nicolas Guillemot

Reviewers: jankratochvil, thopre

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67241

llvm-svn: 372764
</pre>
</div>
</content>
</entry>
<entry>
<title>Update the file headers across all of the LLVM projects in the monorepo</title>
<updated>2019-01-19T08:50:56+00:00</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2019-01-19T08:50:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2946cd701067404b99c39fb29dc9c74bd7193eb3'/>
<id>2946cd701067404b99c39fb29dc9c74bd7193eb3</id>
<content type='text'>
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix compilation on Darwin with expensive checks.</title>
<updated>2018-03-12T11:01:05+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2018-03-12T11:01:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2b8b90a7686858b1d22cae6fcfbd0904135112aa'/>
<id>2b8b90a7686858b1d22cae6fcfbd0904135112aa</id>
<content type='text'>
After r327219 was landed, the bot with expensive checks on GreenDragon
started failing. The problem was missing symbols `regex_t` and
`regmatch_t` in `xlocale/_regex.h`. The latter was included because
after the change in r327219, `random` is needed, which transitively
includes `xlocale.h.` which in turn conditionally includes
`xlocale/_regex.h` when _REGEX_H_ is defined. Because this is the header
guard in `regex_impl.h` and because `regex_impl.h` was included before
the other LLVM includes, `xlocale/_regex.h` was included without the
necessary types being available.

This commit fixes this by moving the include of `regex_impl.h` all the
way down. I also added a comment to stress the significance of its
position.

llvm-svn: 327256
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After r327219 was landed, the bot with expensive checks on GreenDragon
started failing. The problem was missing symbols `regex_t` and
`regmatch_t` in `xlocale/_regex.h`. The latter was included because
after the change in r327219, `random` is needed, which transitively
includes `xlocale.h.` which in turn conditionally includes
`xlocale/_regex.h` when _REGEX_H_ is defined. Because this is the header
guard in `regex_impl.h` and because `regex_impl.h` was included before
the other LLVM includes, `xlocale/_regex.h` was included without the
necessary types being available.

This commit fixes this by moving the include of `regex_impl.h` all the
way down. I also added a comment to stress the significance of its
position.

llvm-svn: 327256
</pre>
</div>
</content>
</entry>
</feed>
