[llvm-dev] cross-checking external declarations / debug info for declarations

David Callahan via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 9 07:55:21 PST 2016


Hi Vendant,

Thanks for the suggestion, I had not considered that you.

A real advantage to working with debug info is that the tool could be
implemented as a linker plugin which would avoid dealing with
false-positives in a large code pass which may include multiple versions
of some libraries. But after poking into the code that determines what
debug info to emit, a small change there looks to he non-trivial.

‹david

On 12/8/16, 5:50 PM, "vsk at apple.com on behalf of Vedant Kumar"
<vsk at apple.com> wrote:

>Have you considered creating a clang-based tool?
>
>I'd approach this by creating a RecursiveASTVisitor, overriding
>VisitFuncDecl,
>and dumping out the return / param types. You can mark extern decls in
>some
>way, sort the output, and check for inconsistencies.
>
>One advantage over looking at IR is that you don't have to use the
>extern'd
>decl in a TU to have it show up.
>
>vedant
>
>> On Dec 8, 2016, at 7:43 AM, David Callahan via llvm-dev
>><llvm-dev at lists.llvm.org> wrote:
>> 
>> I am interested in putting together a tool which can verify that an
>>external declaration conforms with the actual definition.
>> 
>> A.c:
>> extern int32_t foo();
>> Int bar() { return foo(); }
>> 
>> B.c:
>> int64_t foo() {  Š }
>> 
>> I had thought that I could use the debug information but the debug
>>information in A.o does not include the type of the declaration ³foo²,
>>just the type of bar.
>> 
>> Is there a way to include declarations as well as definitions such as a
>>above? It appears there is a notion of ³retained² types, perhaps I add a
>>flag to retain declarations?
>> 
>> Perhaps a different approach?
>> 
>> Thanks
>> ‹david
>> 
>> 
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> 
>>https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2D
>>bin_mailman_listinfo_llvm-2Ddev&d=DgIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=lFyiP
>>UrFdOHdaobP7i4hoA&m=GaJ34if4WSRp77tdn87cs98gRs10AaGII68Amd-bPYc&s=NZY7CVI
>>YwcOs5kLY554eVrna2P6O-0HLV63263xaffc&e=
>



More information about the llvm-dev mailing list