[cfe-dev] Clang static analyzer: ignore library headers?

Óscar Fuentes ofv at wanadoo.es
Sun Sep 22 14:43:49 PDT 2013


Aemon Cannon <aemoncannon at gmail.com>
writes:

> To be more specific: I want to compare a file path (possibly relative), to
> a list of strings and determine if any of the strings are a prefix of the
> path.
>
>
> On Sat, Sep 21, 2013 at 11:07 PM, Aemon Cannon <aemoncannon at gmail.com>wrote:
>
>> Logistical question: does clang or llvm contain a good data-structure for
>> efficient string lookup by prefix?  I'm sketching out a blacklist patch
>> with a vector<string> at the moment.

Not by prefix, but you can insert the paths and its parents on a
StringMap ($LLVM/include/llvm/ADT/StringMap.h) then decompose your file
path and lookup the resulting prefix paths.

But there is no need for fancy data structures: your vector<string>
(sorted) should be fast enough.

Normalizing the paths first would make things easier. Also, keep in
mind the case-insensitive file systems.




More information about the cfe-dev mailing list