[cfe-dev] Clang tutorial

Matthias Bahne matthias.bahne at cs.tu-dortmund.de
Tue Mar 9 12:14:05 PST 2010


Hi All,
 
for my diploma-thesis i'm working on a static analysis of  
c-applications in order to do a semi-automatic configuration  
of the configurable operation-system eCos.
I think clang is a good basis for the analysis.
 
I'm trying to get involved with clang using this tutorial:  
http://amnoid.de/tmp/clangtut/tut.html
 
This tutorial was mentioned 10 month before:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-May/005167.html
 
I have modified the files, so that they works with the actual  
clang version. I compiled and linked the files with the commands:
 
 g++ -I [LLVM_PATH]/llvm/tools/clang/include   \
  `[LLVM_PATH]/llvm/Debug/bin/llvm-config --cxxflags`  \
  -fno-rtti -c tut02_pp.cpp
 
 g++ -o tut02 tut02_pp.o `[LLVM_PATH]/llvm/Debug/bin/llvm-config  \
  --ldflags` -lCIndex    
 
When I try to use tut02 on an input-file it ends with:
 
 equal '='
 input01.c:5:13: warning: '/*' within block comment
 tut02: TextDiagnosticPrinter.cpp:282: void clang::TextDiagnosticPrinter::
  EmitCaretDiagnostic(clang::SourceLocation, clang::SourceRange*,  
  unsigned int, clang::SourceManager&, const clang::CodeModificationHint*,  
  unsigned int, unsigned int): Assertion `LangOpts &&  
  "Unexpected diagnostic outside source file processing"' failed.
 Aborted
 
What did I wrong?
 
Is there a better way to start with clang?
 
thank, Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: input01.c
Type: text/x-csrc
Size: 161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100309/daa2922c/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PPContext.h
Type: text/x-chdr
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100309/daa2922c/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tut01_pp.cpp
Type: text/x-c++src
Size: 235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100309/daa2922c/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tut02_pp.cpp
Type: text/x-c++src
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100309/daa2922c/attachment-0001.cpp>


More information about the cfe-dev mailing list