Skip to content

Commit

Permalink
[CodeComplete] Remove obsolete isOutputBinary().
Browse files Browse the repository at this point in the history
Summary:
It's never set to true. Its only effect would be to set stdout to binary mode.
Hopefully we have better ways of doing this by now :-)

Reviewers: hokein

Subscribers: jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60871

llvm-svn: 358696
  • Loading branch information
sam-mccall committed Apr 18, 2019
1 parent 640f7b5 commit 3a75330
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 30 deletions.
6 changes: 2 additions & 4 deletions clang-tools-extra/clangd/CodeComplete.cpp
Expand Up @@ -701,8 +701,7 @@ static bool isBlacklistedMember(const NamedDecl &D) {
struct CompletionRecorder : public CodeCompleteConsumer {
CompletionRecorder(const CodeCompleteOptions &Opts,
llvm::unique_function<void()> ResultsCallback)
: CodeCompleteConsumer(Opts.getClangCompleteOpts(),
/*OutputIsBinary=*/false),
: CodeCompleteConsumer(Opts.getClangCompleteOpts()),
CCContext(CodeCompletionContext::CCC_Other), Opts(Opts),
CCAllocator(std::make_shared<GlobalCodeCompletionAllocator>()),
CCTUInfo(CCAllocator), ResultsCallback(std::move(ResultsCallback)) {
Expand Down Expand Up @@ -823,8 +822,7 @@ class SignatureHelpCollector final : public CodeCompleteConsumer {
public:
SignatureHelpCollector(const clang::CodeCompleteOptions &CodeCompleteOpts,
const SymbolIndex *Index, SignatureHelp &SigHelp)
: CodeCompleteConsumer(CodeCompleteOpts,
/*OutputIsBinary=*/false),
: CodeCompleteConsumer(CodeCompleteOpts),
SigHelp(SigHelp),
Allocator(std::make_shared<clang::GlobalCodeCompletionAllocator>()),
CCTUInfo(Allocator), Index(Index) {}
Expand Down
14 changes: 3 additions & 11 deletions clang/include/clang/Sema/CodeCompleteConsumer.h
Expand Up @@ -992,10 +992,6 @@ class CodeCompleteConsumer {
protected:
const CodeCompleteOptions CodeCompleteOpts;

/// Whether the output format for the code-completion consumer is
/// binary.
bool OutputIsBinary;

public:
class OverloadCandidate {
public:
Expand Down Expand Up @@ -1066,9 +1062,8 @@ class CodeCompleteConsumer {
bool IncludeBriefComments) const;
};

CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
bool OutputIsBinary)
: CodeCompleteOpts(CodeCompleteOpts), OutputIsBinary(OutputIsBinary) {}
CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts)
: CodeCompleteOpts(CodeCompleteOpts) {}

/// Whether the code-completion consumer wants to see macros.
bool includeMacros() const {
Expand Down Expand Up @@ -1106,9 +1101,6 @@ class CodeCompleteConsumer {
return CodeCompleteOpts.LoadExternal;
}

/// Determine whether the output of this consumer is binary.
bool isOutputBinary() const { return OutputIsBinary; }

/// Deregisters and destroys this code-completion consumer.
virtual ~CodeCompleteConsumer();

Expand Down Expand Up @@ -1181,7 +1173,7 @@ class PrintingCodeCompleteConsumer : public CodeCompleteConsumer {
/// results to the given raw output stream.
PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
raw_ostream &OS)
: CodeCompleteConsumer(CodeCompleteOpts, false), OS(OS),
: CodeCompleteConsumer(CodeCompleteOpts), OS(OS),
CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()) {}

/// Prints the finalized code-completion results.
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Frontend/ASTUnit.cpp
Expand Up @@ -1877,8 +1877,7 @@ namespace {
public:
AugmentedCodeCompleteConsumer(ASTUnit &AST, CodeCompleteConsumer &Next,
const CodeCompleteOptions &CodeCompleteOpts)
: CodeCompleteConsumer(CodeCompleteOpts, Next.isOutputBinary()),
AST(AST), Next(Next) {
: CodeCompleteConsumer(CodeCompleteOpts), AST(AST), Next(Next) {
// Compute the set of contexts in which we will look when we don't have
// any information about the specific context.
NormalContexts
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Frontend/CompilerInstance.cpp
Expand Up @@ -585,12 +585,6 @@ void CompilerInstance::createCodeCompletionConsumer() {
setCodeCompletionConsumer(nullptr);
return;
}

if (CompletionConsumer->isOutputBinary() &&
llvm::sys::ChangeStdoutToBinary()) {
getPreprocessor().getDiagnostics().Report(diag::err_fe_stdout_binary);
setCodeCompletionConsumer(nullptr);
}
}

void CompilerInstance::createFrontendTimer() {
Expand Down
5 changes: 2 additions & 3 deletions clang/tools/libclang/CIndexCodeCompletion.cpp
Expand Up @@ -568,9 +568,8 @@ namespace {
CaptureCompletionResults(const CodeCompleteOptions &Opts,
AllocatedCXCodeCompleteResults &Results,
CXTranslationUnit *TranslationUnit)
: CodeCompleteConsumer(Opts, false),
AllocatedResults(Results), CCTUInfo(Results.CodeCompletionAllocator),
TU(TranslationUnit) { }
: CodeCompleteConsumer(Opts), AllocatedResults(Results),
CCTUInfo(Results.CodeCompletionAllocator), TU(TranslationUnit) {}
~CaptureCompletionResults() override { Finish(); }

void ProcessCodeCompleteResults(Sema &S,
Expand Down
4 changes: 1 addition & 3 deletions clang/unittests/Sema/CodeCompleteTest.cpp
Expand Up @@ -38,9 +38,7 @@ struct CompletionContext {
class VisitedContextFinder : public CodeCompleteConsumer {
public:
VisitedContextFinder(CompletionContext &ResultCtx)
: CodeCompleteConsumer(/*CodeCompleteOpts=*/{},
/*CodeCompleteConsumer*/ false),
ResultCtx(ResultCtx),
: CodeCompleteConsumer(/*CodeCompleteOpts=*/{}), ResultCtx(ResultCtx),
CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()) {}

void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context,
Expand Down
Expand Up @@ -703,7 +703,7 @@ class CodeComplete : public CodeCompleteConsumer {
///
CodeComplete(CompletionRequest &request, clang::LangOptions ops,
std::string expr, unsigned position)
: CodeCompleteConsumer(CodeCompleteOptions(), false),
: CodeCompleteConsumer(CodeCompleteOptions()),
m_info(std::make_shared<GlobalCodeCompletionAllocator>()), m_expr(expr),
m_position(position), m_request(request), m_desc_policy(ops) {

Expand Down

0 comments on commit 3a75330

Please sign in to comment.