[cfe-dev] Segmentation fault

Grégory Ruch gregory.ruch at heig-vd.ch
Fri Mar 18 12:34:39 PDT 2011


Hi,

I'm using LLVM and clang Release 2.8 on linux. I'm trying to use clang
to make AST transformation but I'm far far away to the goal... I don't
know how to debug my actual problem that I don't understand.

That is my very simple source code...
***************************************************
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "llvm/LLVMContext.h"

using namespace clang;

int main(int argc, char *argv[])
{
        CompilerInstance MyCI;
        MyCI.setLLVMContext(new llvm::LLVMContext );
        TextDiagnosticBuffer DiagsBuffer;
        Diagnostic Diags(&DiagsBuffer);
}
***************************************************

To build I use : g++ `llvm-config --cxxflags --ldflags` test.cpp
-lclangFrontend -lclangDriver -lclangSerialization -lclangParse
-lclangSema -lclangAnalysis  -lclangAST -lclangLex -lclangBasic -lgflags
`llvm-config --libs`


When I test it ... !

./test
Segmentation fault

thank you for your help !



More information about the cfe-dev mailing list