static void mapping(llvm::yaml::IO &io, Remark<KindT> &R) { assert(io.outputting() && "input not implemented"); if (io.mapTag("!Passed", std::is_same<KindT, RemarkPassed>::value)) ; else if (io.mapTag("!Missed", std::is_same<KindT, RemarkMissed>::value)) ; else llvm_unreachable("Unknown remark type"); // The attributes are read-only for now since we're only support outputting // them. StringRef PassName = R.getPassName(); io.mapRequired("Pass", PassName); std::string Id = (Twine("sil.") + R.getIdentifier()).str(); io.mapRequired("Name", Id); SourceLoc Loc = R.getLocation(); if (!io.outputting() || Loc.isValid()) io.mapOptional("DebugLoc", Loc); std::string FN = Demangle::demangleSymbolAsString( R.getFunction()->getName(), Demangle::DemangleOptions::SimplifiedUIDemangleOptions()); io.mapRequired("Function", FN); io.mapOptional("Args", R.getArgs()); }
void oclint::option::ConfigFile::mapping(llvm::yaml::IO& inputOutput) { inputOutput.mapOptional("rules", _rules); inputOutput.mapOptional("disable-rules", _disableRules); inputOutput.mapOptional("rule-paths", _rulePaths); inputOutput.mapOptional("rule-configurations", _ruleConfigurations); inputOutput.mapOptional("output", _output); inputOutput.mapOptional("report-type", _reportType); inputOutput.mapOptional("max-priority-1", _maxP1); inputOutput.mapOptional("max-priority-2", _maxP2); inputOutput.mapOptional("max-priority-3", _maxP3); inputOutput.mapOptional("enable-clang-static-analyzer", _clangChecker); inputOutput.mapOptional("allow-duplicated-violations", _allowDuplicatedViolations); }
void oclint::option::ConfigFile::mapping(llvm::yaml::IO& inputOutput) { inputOutput.mapOptional("rules", _rules); inputOutput.mapOptional("disable-rules", _disableRules); inputOutput.mapOptional("rule-paths", _rulePaths); inputOutput.mapOptional("rule-configurations", _ruleConfigurations); inputOutput.mapOptional("output", _output); inputOutput.mapOptional("report-type", _reportType); inputOutput.mapOptional("max-priority-1", _maxP1); inputOutput.mapOptional("max-priority-2", _maxP2); inputOutput.mapOptional("max-priority-3", _maxP3); // Can't use bool here, because we need to detect the unset state. // Optional<bool> does not work, either, because it doesn't support ==. inputOutput.mapOptional("enable-clang-static-analyzer", _clangChecker, TriState::UNDEFINED); }
void oclint::option::RuleConfigurationPair::mapping(llvm::yaml::IO& inputOutput) { inputOutput.mapOptional("key", _key); inputOutput.mapOptional("value", _value); }
static void mapping(llvm::yaml::IO &IO, clang::format::FormatStyle &Style) { if (IO.outputting()) { StringRef StylesArray[] = { "LLVM", "Google", "Chromium", "Mozilla" }; ArrayRef<StringRef> Styles(StylesArray); for (size_t i = 0, e = Styles.size(); i < e; ++i) { StringRef StyleName(Styles[i]); clang::format::FormatStyle PredefinedStyle; if (clang::format::getPredefinedStyle(StyleName, &PredefinedStyle) && Style == PredefinedStyle) { IO.mapOptional("# BasedOnStyle", StyleName); break; } } } else { StringRef BasedOnStyle; IO.mapOptional("BasedOnStyle", BasedOnStyle); if (!BasedOnStyle.empty()) if (!clang::format::getPredefinedStyle(BasedOnStyle, &Style)) { IO.setError(Twine("Unknown value for BasedOnStyle: ", BasedOnStyle)); return; } } IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); IO.mapOptional("ConstructorInitializerIndentWidth", Style.ConstructorInitializerIndentWidth); IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlinesLeft); IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine", Style.AllowAllParametersOfDeclarationOnNextLine); IO.mapOptional("AllowShortIfStatementsOnASingleLine", Style.AllowShortIfStatementsOnASingleLine); IO.mapOptional("AllowShortLoopsOnASingleLine", Style.AllowShortLoopsOnASingleLine); IO.mapOptional("AlwaysBreakTemplateDeclarations", Style.AlwaysBreakTemplateDeclarations); IO.mapOptional("AlwaysBreakBeforeMultilineStrings", Style.AlwaysBreakBeforeMultilineStrings); IO.mapOptional("BreakBeforeBinaryOperators", Style.BreakBeforeBinaryOperators); IO.mapOptional("BreakConstructorInitializersBeforeComma", Style.BreakConstructorInitializersBeforeComma); IO.mapOptional("BinPackParameters", Style.BinPackParameters); IO.mapOptional("ColumnLimit", Style.ColumnLimit); IO.mapOptional("ConstructorInitializerAllOnOneLineOrOnePerLine", Style.ConstructorInitializerAllOnOneLineOrOnePerLine); IO.mapOptional("DerivePointerBinding", Style.DerivePointerBinding); IO.mapOptional("ExperimentalAutoDetectBinPacking", Style.ExperimentalAutoDetectBinPacking); IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); IO.mapOptional("ObjCSpaceBeforeProtocolList", Style.ObjCSpaceBeforeProtocolList); IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); IO.mapOptional("PenaltyBreakFirstLessLess", Style.PenaltyBreakFirstLessLess); IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); IO.mapOptional("PenaltyReturnTypeOnItsOwnLine", Style.PenaltyReturnTypeOnItsOwnLine); IO.mapOptional("PointerBindsToType", Style.PointerBindsToType); IO.mapOptional("SpacesBeforeTrailingComments", Style.SpacesBeforeTrailingComments); IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); IO.mapOptional("Standard", Style.Standard); IO.mapOptional("IndentWidth", Style.IndentWidth); IO.mapOptional("UseTab", Style.UseTab); IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); IO.mapOptional("IndentFunctionDeclarationAfterType", Style.IndentFunctionDeclarationAfterType); }