14 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKER_YAML_H 15 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKER_YAML_H 18 #include "llvm/Support/YAMLTraits.h" 26 template <
class T,
class Checker>
28 StringRef Option, StringRef ConfigFile) {
29 if (ConfigFile.trim().empty())
32 llvm::vfs::FileSystem *FS = llvm::vfs::getRealFileSystem().get();
33 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
34 FS->getBufferForFile(ConfigFile.str());
36 if (std::error_code ec = Buffer.getError()) {
38 "a valid filename instead of '" +
39 std::string(ConfigFile) +
"'");
43 llvm::yaml::Input Input(Buffer.get()->getBuffer());
47 if (std::error_code ec = Input.error()) {
49 "a valid yaml file: " + ec.message());
59 #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MOVE_H
llvm::Optional< T > getConfiguration(CheckerManager &Mgr, Checker *Chk, StringRef Option, StringRef ConfigFile)
Read the given file from the filesystem and parse it as a yaml file.
void reportInvalidCheckerOptionValue(const CheckerBase *C, StringRef OptionName, StringRef ExpectedValueDesc)
Emits an error through a DiagnosticsEngine about an invalid user supplied checker option value...
Dataflow Directional Tag Classes.