llvm/llvm/lib/Support/GraphWriter.cpp

//===- GraphWriter.cpp - Implements GraphWriter support routines ----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements misc. GraphWriter support routines.
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/GraphWriter.h"

#include "DebugOptions.h"

#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/raw_ostream.h"

#ifdef __APPLE__
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#endif

#include <string>
#include <system_error>
#include <vector>

usingnamespacellvm;

#ifdef __APPLE__
namespace {
struct CreateViewBackground {
  static void *call() {
    return new cl::opt<bool>("view-background", cl::Hidden,
                             cl::desc("Execute graph viewer in the background. "
                                      "Creates tmp file litter."));
  }
};
} // namespace
static ManagedStatic<cl::opt<bool>, CreateViewBackground> ViewBackground;
void llvm::initGraphWriterOptions() { *ViewBackground; }
#else
void llvm::initGraphWriterOptions() {}
#endif

std::string llvm::DOT::EscapeString(const std::string &Label) {}

/// Get a color string for this node number. Simply round-robin selects
/// from a reasonable number of colors.
StringRef llvm::DOT::getColorString(unsigned ColorNumber) {}

static std::string replaceIllegalFilenameChars(std::string Filename,
                                               const char ReplacementChar) {}

std::string llvm::createGraphFilename(const Twine &Name, int &FD) {}

// Execute the graph viewer. Return true if there were errors.
static bool ExecGraphViewer(StringRef ExecPath, std::vector<StringRef> &args,
                            StringRef Filename, bool wait,
                            std::string &ErrMsg) {}

namespace {

struct GraphSession {};

} // end anonymous namespace

static const char *getProgramName(GraphProgram::Name program) {}

bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
                        GraphProgram::Name program) {}