[lldb-dev] Help on the way to retrieve header file list

Greg Clayton gclayton at apple.com
Tue Nov 5 09:51:33 PST 2013

No. But you can take advantage of the fact that the basenames and directories returned from the SBFileSpec are uniqued C strings:

    const char *
    SBFileSpec::GetFilename() const;

    const char *
    SBFileSpec::GetDirectory() const;

So you might be able to use that to your advantage to help you unique these files into a std::set:

typedef std::set<std::pair<const char *, const char *>> PathSet;

PathSet unique_paths;

Then you can run through all files and do:

for (SBFileSpec cu_file : ...)
    unique_paths.insert(std::make_pair(cu_file.GetDirectory(), cu_file.GetFilename()));

    for (SBFileSpec support_file : ...)
	unique_paths.insert(std::make_pair(support_file.GetDirectory(), support_file.GetFilename()));


This should solve your problem for you?


On Nov 5, 2013, at 8:14 AM, Yin Ma <yin at affinic.com> wrote:

> Hi
> I am using module GetCompileUnitAtIndex to retrieve
> Compilation unit. If I directly print Compile_unit.file
> I can get all .c filenames without any .h filename.
> If I use GetSupportFileAtIndex() to retrieve all supportfiles
> And print out. I can get .h filename however, there
> Are a lot of duplication.
> Is there any better way to print all .c and .h filenames without
> Duplication?
> Thanks,
> Yin
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

More information about the lldb-dev mailing list