[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
Qinkun Bao via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 22 11:23:18 PDT 2025
qinkunbao wrote:
Hi Vitaly,
Sorry for the late reply. I am thinking about a good solution for https://github.com/llvm/llvm-project/pull/139772 in the past two days.
At the moment, I am thinking only the order of `Globs` and `RegExes` (Or `Pattern`) matters. The order of `Section`, `Prefix` and `Category` does not matter.
Without this PR, considering the following example.
```
[sec1]
src:a.txt
src:b.txt
[sec1]
src:b.txt
[sec1]
src:b.txt
```
We have to iterate the all the sections (all entry) to know if a.txt should be matched or not.
This pull request (or by reverting[ https://github.com/llvm/llvm-project/pull/140127](https://github.com/llvm/llvm-project/pull/140127)) simplifies the process to finding the last matching Pattern for a given Prefix and Category by jumping to sec1 and performing a reverse walk. Each matched pattern provides a line number and a file number. Entries with higher line numbers take precedence over those with lower line numbers. I'm interested in your feedback and we can discuss this further in our meeting.
https://github.com/llvm/llvm-project/pull/140821
More information about the llvm-branch-commits
mailing list