4ntoine / clang

AVR frontend for the LLVM project
http://clang.llvm.org/
Other
9 stars 1 forks source link

Bind AVR keywords to KEYAVR #6

Closed 4ntoine closed 9 years ago

4ntoine commented 10 years ago

https://github.com/4ntoine/clang/issues/5

I've added KEYAVR=0x9000 in lib/Basic/IdentifierTable.cpp and add switch case in GetKeywordStatus() KS_Enabled, but keywords can't be found:

MBA-Anton:bin asmirnov$ ./clang  -c /tmp/avr/Test1.c -I/Applications/avr.app/Contents/Resources/Java/hardware/tools/avr/avr/include -S -emit-llvm -o /tmp/avr/Test1.ll -D__AVR_ATmega168__ --target=avr -O1
/tmp/avr/Test1.c:8:1: error: unknown type name '__flash3'
__flash3 int b = 4;
^
/tmp/avr/Test1.c:8:10: error: expected identifier or '('
__flash3 int b = 4;
         ^
/tmp/avr/Test1.c:12:10: error: use of undeclared identifier 'b'
        int c = b * 57;
                ^
4ntoine commented 9 years ago

a bit hacky way but now the keywords expectedly work for AVR target and expectedly not work for others

4ntoine commented 9 years ago

-triple should be equal to "avr" strictly (to use __flashN keywords)

dylanmckay commented 9 years ago

Does this commit mean that we cannot use your fork with any other target than AVR now? I'm not sure I understand

4ntoine commented 9 years ago

flashN keywords relate to AVR target only. Now you'll get error if using them for non-AVR target which is reasonable (until that commit you could use flashN for non-AVR targets too which was useless). You can still use my fork for non-AVR targets too (edited my previous comment to remove misunderstanding)