[cfe-dev] Adding custom pragma to Clang

Hahnfeld, Jonas via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 23 01:26:36 PDT 2016


Hi,

 

don’t know whether this helps (or even still works), but some time ago I had some fun with the attached patch: It stops compilation until user has accepted an EULA (please don’t kill me, this was no serious work…)

I mostly copied from PragmaOnce, but you may need to do some more work to finally annotate variables and loops.

 

Cheers,

Jonas

 

From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Hongbin Zheng via cfe-dev
Sent: Tuesday, August 23, 2016 9:50 AM
To: cfe-dev at lists.llvm.org
Subject: [cfe-dev] Adding custom pragma to Clang

 

Hi,

 

I am trying to add custom pragma to clang to annotate extra infromation to variables and loops.

 

I had a look at the OpenMP pragma handling a little bit, and found that adding custom pragma like OpenMP to clang is not easy, one need to modify the lexer, introduce dedicated node to AST, etc.

 

But on the other hand, I am thinking the pragma for variable and loop annotating may not as complicated as those OpenMP pragmas. Is there any simple pragma in clang that I can look at?

 

Thanks

Hongbin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160823/afb20ded/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PragmaEula.diff
Type: application/octet-stream
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160823/afb20ded/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160823/afb20ded/attachment.bin>


More information about the cfe-dev mailing list