[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 22 11:29:22 PDT 2025


vitalybuka wrote:

> Hi Vitaly,
> 
> Sorry for the late reply. I am thinking about a good solution for #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.

Not sure I understand the issue.
1. Make Glob a vector added in parsing order
2. Make sections a vector added in parsing order

Scan all in reverse order - done

duplicate entries is not a problem as they should not be common

https://github.com/llvm/llvm-project/pull/140821


More information about the llvm-branch-commits mailing list