Files
swift-mirror/include/swift/IDE/CodeCompletionResultPrinter.h
Rintaro Ishizaki 3c33debd61 [CodeCompletion] Make all result's string fields null terminated
This is convenient for clients to pass these fields values to C
functions. Introduce NullTerminatedStringRef to guarantee that.
2022-02-18 11:34:45 -08:00

56 lines
1.8 KiB
C++

//===--- CodeCompletionResultPrinter.h --------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IDE_CODECOMPLETIONRESULTPRINTER_H
#define SWIFT_IDE_CODECOMPLETIONRESULTPRINTER_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Allocator.h"
namespace swift {
class NullTerminatedStringRef;
namespace ide {
class CodeCompletionResult;
class CodeCompletionString;
void printCodeCompletionResultDescription(const CodeCompletionResult &Result,
llvm::raw_ostream &OS,
bool leadingPunctuation);
void printCodeCompletionResultDescriptionAnnotated(
const CodeCompletionResult &Result, llvm::raw_ostream &OS,
bool leadingPunctuation);
void printCodeCompletionResultTypeName(
const CodeCompletionResult &Result, llvm::raw_ostream &OS);
void printCodeCompletionResultTypeNameAnnotated(
const CodeCompletionResult &Result, llvm::raw_ostream &OS);
void printCodeCompletionResultSourceText(
const CodeCompletionResult &Result, llvm::raw_ostream &OS);
/// Print 'FilterName' from \p str into memory managed by \p Allocator and
/// return it as \c NullTerminatedStringRef .
NullTerminatedStringRef
getCodeCompletionResultFilterName(const CodeCompletionString *Str,
llvm::BumpPtrAllocator &Allocator);
} // namespace ide
} // namespace swift
#endif