[cfe-dev] Adding new language keywords
Jeff Heckey
jheckey at gmail.com
Thu Nov 1 11:38:48 PDT 2012
I've been trying to add new keywords (e.g., module) to Clang for a project,
but I want to only add the support for my language extensions (because I
want to keep the merges to a minimum and modify as few things as possible).
I did this by adding an enum type to the IndentifierTable.cpp namespace:
namespace {
enum {
KEYC99 = 0x1,
KEYCXX = 0x2,
KEYCXX0X = 0x4,
KEYGNU = 0x8,
KEYMS = 0x10,
BOOLSUPPORT = 0x20,
KEYALTIVEC = 0x40,
KEYNOCXX = 0x80,
KEYBORLAND = 0x100,
KEYOPENCL = 0x200,
KEYC11 = 0x400,
KEYARC = 0x800,
KEYSCAF = 0x1000, // Scaffold enum
KEYALL = 0x1fff
};
}
And adding the type to the check in AddKeyword().
I then added the desired keywords to the TokenFeatures:
//Scaffold added keywords
KEYWORD(qreg , KEYSCAF)
KEYWORD(qint , KEYSCAF)
KEYWORD(module , KEYSCAF)
KEYWORD(c2qg , KEYSCAF)
However, once compiled, the keywords are still treated as identifiers, not
types or keywords.
What am I missing?
-Thanks,
-Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121101/938a40ec/attachment.html>
More information about the cfe-dev
mailing list