[cfe-dev] Clang ASTVisitor Extern Variable usage

Sunny Billava via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 12 05:54:32 PST 2016


Hello All,
For a clang tool based on RecursiveASTVisitor, would like to detect the definition of an extern variable.
For the below code file samples, while traversing the Main.c, can we detect the "var" is defined & initialized in test.c


Below are the file definition

<<<<Main.c>>>>
#include "h1.h"
int main()
{
        var = 10;
}

<<<<h1.h>>>>
extern int var;

<<<<test.c>>>>
#include "h1.h"
int var = 11;

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161212/821e9fd8/attachment.html>


More information about the cfe-dev mailing list