[cfe-dev] New to Clang.

Sami Islam sami_islam at hotmail.com
Sun Jun 15 05:49:24 PDT 2014


Hello,
I am new to clang and need some guidance as to where to start.

What I have done so far:
1. I have retrieved LLVM and CLang.
2. I have created a VS project using Cmake
3. I have built LLVM and Clang using Visual Studio 2013 and the project
ALL_BUILD

What I would like to do:
I would like to use the CLang LibTooling library to start creating a
refactoring tool.

First try: I created a Visual Studio Project included all the header files
according to the following link:
http://kevinaboos.wordpress.com/2013/07/23/clang-tutorial-part-ii-libtooling-example/

When I try to compile I get the error "Cannot open include file:
'clang/Driver/Options.inc': No such file or directory".

I used the make file:
###################################################
CLANG_LEVEL := ../..

TOOLNAME = example  #the name of your tool's executable

SOURCES := Example.cpp  #the Clang source files you want to compile

include $(CLANG_LEVEL)/../../Makefile.config

LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option

USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \
           clangTooling.a clangParse.a clangSema.a \
           clangAnalysis.a clangRewriteFrontend.a clangRewriteCore.a \
           clangEdit.a clangAST.a clangLex.a clangBasic.a

include $(CLANG_LEVEL)/Makefile
###################################################

Second try: I copied my example.cpp file under
llvm\tools\clang\tools\example and used the GNUWin32 make.
I get the error that there is no Makefile.config in my llvm folder. I
noticed that there isn't any but there is a makefile.config.in file. I
renamed that to makefile.config.
I kept getting errors like the following:

Makefile.config:278: *** missing seperator.
When I look at the makefile on line 278 I see the following:

#################################################
# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
# into the "Release" directories. Otherwise, LLVM code is not optimized and
# output is put in the "Debug" directories.
#ENABLE_OPTIMIZED = 1
@ENABLE_OPTIMIZED@ -- Line 278
#################################################

If I uncomment line 277 it works but I get similar errors for other
following lines.

Question:

Am I missing something?

Thanks for any help you can provide.

Kind regards
Sami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140615/c6e39911/attachment.html>


More information about the cfe-dev mailing list