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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130406/743a5f00/attachment.html>
Tyler Hardin
2013-Apr-06 03:05 UTC
[LLVMdev] How to compile object C with clang into llvm IR?
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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130405/b4afd6cf/attachment.html>
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. 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130406/5fa7beb7/attachment.html>
Maybe Matching Threads
- [LLVMdev] How to compile object C with clang into llvm IR?
- [LLVMdev] How to compile object C with clang into llvm IR?
- [LLVMdev] How to compile object C with clang into llvm IR?
- [LLVMdev] Does llvm-lit support type substitution (macro)?
- [LLVMdev] LLVM documentation work help