clang 23.0.0git
YAMLSourceEditFormat.cpp
Go to the documentation of this file.
1//===- YAMLSourceEditFormat.cpp -------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "llvm/Support/Error.h"
12#include "llvm/Support/FileSystem.h"
13#include "llvm/Support/YAMLTraits.h"
14#include "llvm/Support/raw_ostream.h"
15
16using namespace clang;
17using namespace ssaf;
18
21 llvm::StringRef Path) {
22 std::error_code EC;
23 llvm::raw_fd_ostream OS(Path, EC, llvm::sys::fs::OF_None);
24 if (EC)
25 return llvm::createStringError(EC, "failed to open '" + Path + "'");
26
27 // llvm::yaml::Output's stream operator binds to a non-const reference.
29 llvm::yaml::Output YAMLOut(OS);
30 YAMLOut << Mutable;
31
32 return llvm::Error::success();
33}
This file defines the structure of a YAML document for serializing replacements.
llvm::Error writeYAMLSourceEdits(const clang::tooling::TranslationUnitReplacements &Doc, llvm::StringRef Path)
Writes Doc to Path as a YAML document compatible with clang-apply-replacements.
The JSON file list parser is used to communicate input to InstallAPI.
Collection of Replacements generated from a single translation unit.