本文整理汇总了C++中Transforms::createSelectedTransforms方法的典型用法代码示例。如果您正苦于以下问题:C++ Transforms::createSelectedTransforms方法的具体用法?C++ Transforms::createSelectedTransforms怎么用?C++ Transforms::createSelectedTransforms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transforms
的用法示例。
在下文中一共展示了Transforms::createSelectedTransforms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
Transforms TransformManager;
ReplacementHandling ReplacementHandler;
TransformManager.registerTransforms();
// Hide all options we don't define ourselves. Move pre-defined 'help',
// 'help-list', and 'version' to our general category.
llvm::StringMap<cl::Option*> Options;
cl::getRegisteredOptions(Options);
const cl::OptionCategory **CategoryEnd =
VisibleCategories + llvm::array_lengthof(VisibleCategories);
for (llvm::StringMap<cl::Option *>::iterator I = Options.begin(),
E = Options.end();
I != E; ++I) {
if (I->first() == "help" || I->first() == "version" ||
I->first() == "help-list")
I->second->setCategory(GeneralCategory);
else if (std::find(VisibleCategories, CategoryEnd, I->second->Category) ==
CategoryEnd)
I->second->setHiddenFlag(cl::ReallyHidden);
}
cl::SetVersionPrinter(&printVersion);
// Parse options and generate compilations.
std::unique_ptr<CompilationDatabase> Compilations(
FixedCompilationDatabase::loadFromCommandLine(argc, argv));
cl::ParseCommandLineOptions(argc, argv);
// Populate the ModifiableFiles structure.
GlobalOptions.ModifiableFiles.readListFromString(IncludePaths, ExcludePaths);
GlobalOptions.ModifiableFiles.readListFromFile(IncludeFromFile,
ExcludeFromFile);
if (!Compilations) {
std::string ErrorMessage;
Compilations.reset(autoDetectCompilations(ErrorMessage));
if (!Compilations) {
llvm::errs() << llvm::sys::path::filename(argv[0]) << ": " << ErrorMessage
<< "\n";
return 1;
}
}
// Populate source files.
std::vector<std::string> Sources;
if (!SourcePaths.empty()) {
// Use only files that are not explicitly excluded.
std::remove_copy_if(SourcePaths.begin(), SourcePaths.end(),
std::back_inserter(Sources),
isFileExplicitlyExcludedPredicate);
} else {
if (GlobalOptions.ModifiableFiles.isIncludeListEmpty()) {
llvm::errs() << llvm::sys::path::filename(argv[0])
<< ": Use -include to indicate which files of "
<< "the compilatiion database to transform.\n";
return 1;
}
// Use source paths from the compilation database.
// We only transform files that are explicitly included.
Sources = Compilations->getAllFiles();
std::vector<std::string>::iterator E = std::remove_if(
Sources.begin(), Sources.end(), isFileNotIncludedPredicate);
Sources.erase(E, Sources.end());
}
// check if line ranges are just applyed to single files
if ( !LineRanges.empty() && Sources.size() > 1 ){
llvm::errs() << "error: -line can only be used for single file.\n";
return 1;
}
// add the line ranges to the sources
if ( !LineRanges.empty() ){
}
if (Sources.empty()) {
llvm::errs() << llvm::sys::path::filename(argv[0])
<< ": Could not determine sources to transform.\n";
return 1;
}
// Enable timming.
GlobalOptions.EnableTiming = TimingDirectoryName.getNumOccurrences() > 0;
bool CmdSwitchError = false;
CompilerVersions RequiredVersions =
handleSupportedCompilers(argv[0], CmdSwitchError);
if (CmdSwitchError)
return 1;
TransformManager.createSelectedTransforms(GlobalOptions, RequiredVersions);
if (TransformManager.begin() == TransformManager.end()) {
if (SupportedCompilers.empty())
llvm::errs() << llvm::sys::path::filename(argv[0])
<< ": no selected transforms\n";
else
llvm::errs() << llvm::sys::path::filename(argv[0])
//.........这里部分代码省略.........