llvm/clang-tools-extra/clangd/support/DirectiveTree.cpp

//===--- DirectiveTree.cpp - Find and strip preprocessor directives -------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "DirectiveTree.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/TokenKinds.h"
#include "llvm/Support/FormatVariadic.h"
#include <optional>
#include <variant>

namespace clang {
namespace clangd {
namespace {

class DirectiveParser {};

struct Dumper {};
} // namespace

DirectiveTree DirectiveTree::parse(const TokenStream &Code) {}

// Define operator<< in terms of dump() functions above.
#define OSTREAM_DUMP
OSTREAM_DUMP
OSTREAM_DUMP
OSTREAM_DUMP
OSTREAM_DUMP
#undef OSTREAM_DUMP

namespace {
// Makes choices about conditional branches.
//
// Generally it tries to maximize the amount of useful code we see.
//
// Caveat: each conditional is evaluated independently. Consider this code:
//   #ifdef WINDOWS
//     bool isWindows = true;
//   #endif
//   #ifndef WINDOWS
//     bool isWindows = false;
//   #endif
// We take both branches and define isWindows twice. We could track more state
// in order to produce a consistent view, but this is complex.
class BranchChooser {};

} // namespace

void chooseConditionalBranches(DirectiveTree &Tree, const TokenStream &Code) {}

namespace {
class Preprocessor {};
} // namespace

TokenStream DirectiveTree::stripDirectives(const TokenStream &In) const {}

} // namespace clangd
} // namespace clang