本文整理汇总了C++中clang::CompilerInstance::createDefaultOutputFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CompilerInstance::createDefaultOutputFile方法的具体用法?C++ CompilerInstance::createDefaultOutputFile怎么用?C++ CompilerInstance::createDefaultOutputFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::CompilerInstance
的用法示例。
在下文中一共展示了CompilerInstance::createDefaultOutputFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
bool WebCLAction::initialize(clang::CompilerInstance &instance)
{
reporter_ = new WebCLReporter(instance);
if (!reporter_) {
llvm::errs() << "Internal error. Can't report errors.\n";
return false;
}
preprocessor_ = new WebCLPreprocessor(instance, extensions_, usedExtensions_);
if (!preprocessor_) {
reporter_->fatal("Internal error. Can't create preprocessor callbacks.\n");
return false;
}
clang::Preprocessor &preprocessor = instance.getPreprocessor();
preprocessor.addPPCallbacks(preprocessor_);
if (output_) {
// see clang::PrintPreprocessedAction
instance.getFrontendOpts().OutputFile = output_;
out_ = instance.createDefaultOutputFile(true, getCurrentFile());
if (!out_) {
reporter_->fatal("Internal error. Can't create output stream.");
return false;
}
}
const clang::FrontendInputFile &file = getCurrentInput();
if (file.getKind() != clang::IK_OpenCL) {
static const char *format =
"Source file '%0' isn't treated as OpenCL code. Make sure that you "
"give the '-x cl' option or that the file has a '.cl' extension.\n";
reporter_->fatal(format) << file.getFile();
return false;
}
return true;
}