我如何用Clang生成未使用的声明? [英] How can I code generate unused declarations with Clang?

查看:164
本文介绍了我如何用Clang生成未使用的声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找代码从一些C ++代码生成一个llvm ::模块。具体来说,我将混合由Clang生成的代码和来自另一个源的代码。不幸的是,Clang的CodeGenModule类似乎坚持只有生成一个声明到模块中,如果有一个定义使用它。

I'm looking to code generate an llvm::Module from some C++ code. Specifically, I will be mixing code generated by Clang and code from another source. Unfortunately, Clang's CodeGenModule class appears to insist on only generating a declaration into the Module if there is a definition which uses it. How can I convince the CodeGenModule to generate these declarations anyway?

推荐答案

显然,-femit-all-decls实际上不是 EMIT ALL THE DECLS ,所以我不得不修改Clang的源代码来实际发出所有的decens。

Apparently, -femit-all-decls does not actually EMIT ALL THE DECLS, so I had to modify Clang's source code to actually emit all the decls.

这篇关于我如何用Clang生成未使用的声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆