本文整理汇总了C++中PreprocessorOptions::addMacroUndef方法的典型用法代码示例。如果您正苦于以下问题:C++ PreprocessorOptions::addMacroUndef方法的具体用法?C++ PreprocessorOptions::addMacroUndef怎么用?C++ PreprocessorOptions::addMacroUndef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreprocessorOptions
的用法示例。
在下文中一共展示了PreprocessorOptions::addMacroUndef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParsePreprocessorArgs
static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
Diagnostic &Diags) {
using namespace cc1options;
Opts.ImplicitPCHInclude = getLastArgValue(Args, OPT_include_pch);
Opts.ImplicitPTHInclude = getLastArgValue(Args, OPT_include_pth);
if (const Arg *A = Args.getLastArg(OPT_token_cache))
Opts.TokenCache = A->getValue(Args);
else
Opts.TokenCache = Opts.ImplicitPTHInclude;
Opts.UsePredefines = !Args.hasArg(OPT_undef);
// Add macros from the command line.
for (arg_iterator it = Args.filtered_begin(OPT_D, OPT_U),
ie = Args.filtered_end(); it != ie; ++it) {
if (it->getOption().matches(OPT_D))
Opts.addMacroDef(it->getValue(Args));
else
Opts.addMacroUndef(it->getValue(Args));
}
Opts.MacroIncludes = getAllArgValues(Args, OPT_imacros);
// Add the ordered list of -includes.
for (arg_iterator it = Args.filtered_begin(OPT_include, OPT_include_pch,
OPT_include_pth),
ie = Args.filtered_end(); it != ie; ++it) {
// PCH is handled specially, we need to extra the original include path.
if (it->getOption().matches(OPT_include_pch)) {
std::string OriginalFile =
PCHReader::getOriginalSourceFile(it->getValue(Args), Diags);
if (OriginalFile.empty())
continue;
Opts.Includes.push_back(OriginalFile);
} else
Opts.Includes.push_back(it->getValue(Args));
}
for (arg_iterator it = Args.filtered_begin(OPT_remap_file),
ie = Args.filtered_end(); it != ie; ++it) {
std::pair<llvm::StringRef,llvm::StringRef> Split =
llvm::StringRef(it->getValue(Args)).split(';');
if (Split.second.empty()) {
Diags.Report(diag::err_drv_invalid_remap_file) << it->getAsString(Args);
continue;
}
Opts.addRemappedFile(Split.first, Split.second);
}
}