[cfe-dev] how to build this program..

jignesh vasoya jigneshvasoya at gmail.com
Tue Jan 11 20:49:36 PST 2011


Hi,
This program was given as an example by Mr. Gregor under the topic "
libclang: Thinking Beyond the Compiler "

int main(int argc, char *argv[])
{
    unsigned I;
    CXIndex Index = clang_createIndex(0, 0);
    CXTranslationUnit TU = clang_parseTranslationUnit(
Index, 0,argv,
argc, 0, 0, CXTranslationUnit_None);
    CXTranslationUnit N;

    for (I = 0, N = clang_getNumDiagnostics(TU); I != N; ++I)
    {
        CXDiagnostic Diag = clang_getDiagnostic(TU, I);
        CXString String =
clang_formatDiagnostic(Diag,clang_defaultDiagnosticDisplayOptions());
        fprintf(stderr, "%s\n", clang_getCString(String));
        clang_disposeString(String);
    }

    clang_disposeTranslationUnit(TU);
    clang_disposeIndex(Index);

return 0;
}


Can somebody tell me which headers i have to include?
and how can i compile this program?

i have installed llvm and clang (2.9) on my system.

Thanks in advance.
*___________________________________________________________________________
*
-----------------------------------------------------------------------------------------------------------------------------
*Jignesh Vasoya
CSE - IIT MADRAS
9962248684*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110112/220c65b5/attachment.html>


More information about the cfe-dev mailing list