clang
23.0.0git
lib
ScalableStaticAnalysis
SourceTransformation
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
9
#include "
clang/ScalableStaticAnalysis/SourceTransformation/YAMLSourceEditFormat.h
"
10
#include "
clang/Tooling/ReplacementsYaml.h
"
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
16
using namespace
clang
;
17
using namespace
ssaf
;
18
19
llvm::Error
ssaf::writeYAMLSourceEdits
(
20
const
clang::tooling::TranslationUnitReplacements
&Doc,
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.
28
clang::tooling::TranslationUnitReplacements
Mutable = Doc;
29
llvm::yaml::Output YAMLOut(OS);
30
YAMLOut << Mutable;
31
32
return
llvm::Error::success();
33
}
ReplacementsYaml.h
This file defines the structure of a YAML document for serializing replacements.
YAMLSourceEditFormat.h
clang::ssaf
Definition
CompilerInvocation.h:56
clang::ssaf::writeYAMLSourceEdits
llvm::Error writeYAMLSourceEdits(const clang::tooling::TranslationUnitReplacements &Doc, llvm::StringRef Path)
Writes Doc to Path as a YAML document compatible with clang-apply-replacements.
Definition
YAMLSourceEditFormat.cpp:19
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition
CalledOnceCheck.h:17
clang::tooling::TranslationUnitReplacements
Collection of Replacements generated from a single translation unit.
Definition
Replacement.h:335
Generated on
for clang by
1.14.0