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

Yin Ma yin at affinic.com
Tue Nov 5 11:21:47 PST 2013


Hi Greg,

Thank you for the quick answer. I will go ahead to 
implement a pass to remove the redundancy in the list.

Thanks,

Yin 


-----Original Message-----
From: Greg Clayton [mailto:gclayton at apple.com] 
Sent: Tuesday, November 05, 2013 9:52 AM
To: Yin Ma
Cc: lldb-dev
Subject: Re: [lldb-dev] Help on the way to retrieve header file list

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?

Greg



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