[LLVMdev] How to compile object C with clang into llvm IR?

Charles Davis cdavis5x at gmail.com
Fri Apr 5 20:25:19 PDT 2013


On Apr 5, 2013, at 9:19 PM, Jonathan wrote:

> I got the following compile error. Did the message-arrays.m can be compiled into .bc? Or need include something for Object C language compile.
Those are warnings, not errors. They otherwise compiled just fine. You should have a bitcode file named '1.ll' from each of those commands.

Chip

> 
> Jonathan
> 
> 118-165-76-229:CodeGenObjC Jonathan$ pwd
> /Users/Jonathan/llvm/release/src/tools/clang/test/CodeGenObjC
> 118-165-76-229:CodeGenObjC Jonathan$ clang -emit-llvm -o 1.ll -c message-arrays.m 
> message-arrays.m:5:3: warning: instance method '-print:' not found (return type
>       defaults to 'id') [-Wobjc-method-access]
>   [ a print: "hello" ];
>   ^   ~~~~~
> message-arrays.m:15:1: warning: control reaches end of non-void function
>       [-Wreturn-type]
> }
> ^
> 2 warnings generated.
> 118-165-76-229:CodeGenObjC Jonathan$ clang -emit-llvm -o 1.ll -c ivars.m
> ivars.m:18:12: warning: class 'R' defined without specifying a base class
>       [-Wobjc-root-class]
> @interface R {
>            ^
> ivars.m:18:13: note: add a super class to fix this problem
> @interface R {
>             ^
> 1 warning generated.
> 
> On 2013/4/6, at 上午11:05, Tyler Hardin <tghardin1 at catamount.wcu.edu> wrote:
> 
>> Look up --emit-llvm. I think it has to be used with -c.
>> 
>> On Apr 5, 2013 10:55 PM, "Jonathan" <gamma_chen at yahoo.com.tw> wrote:
>> Following came from tools/clang/test/CodeGenObjC/message-arrays.m. But I don't know how to compile it at terminal command since no clang_cc1 executable file. Can some one help me? I am writing the llvm backend document --http://jonathan2251.github.com/lbd/index.html now. I use "clang -c hello.cpp -emit-llvm" to compile C++ but don't know how to compile Object-C.
>> 
>> // RUN: %clang_cc1 -emit-llvm -o %t %s
>> 
>> void f0(id a) {
>>  // This should have an implicit cast
>>  [ a print: "hello" ];
>> }
>> 
>> @interface A
>> -(void) m: (int) arg0, ...;
>> @end
>> 
>> int f1(A *a) {
>>  // This should also get an implicit cast (for the vararg)
>>  [a m: 1, "test"];
>> }
>> 
>> Jonathan
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130405/25b592f0/attachment.html>


More information about the llvm-dev mailing list