llvm/llvm/unittests/tools/llvm-cfi-verify/GraphBuilder.cpp

//===- llvm/unittests/llvm-cfi-verify/GraphBuilder.cpp --------------===//
//
// 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 "../tools/llvm-cfi-verify/lib/GraphBuilder.h"
#include "../tools/llvm-cfi-verify/lib/FileAnalysis.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include "llvm/BinaryFormat/ELF.h"
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"

#include <cstdlib>
#include <sstream>

Instr;
AllOf;
Each;
ElementsAre;
Eq;
Field;
IsEmpty;
Matches;
Pair;
PrintToString;
SizeIs;
UnorderedElementsAre;

namespace llvm {
namespace cfi_verify {
// Printing helpers for gtest.
std::string HexStringifyContainer(const std::vector<uint64_t> &C) {}

void PrintTo(const ConditionalBranchNode &BranchNode, ::std::ostream *os) {}

void PrintTo(const GraphResult &Result, ::std::ostream *os) {}

namespace {
class ELFx86TestFileAnalysis : public FileAnalysis {};

class BasicGraphBuilderTest : public ::testing::Test {};

MATCHER_P2(HasPath, Result, Matcher, "has path " + PrintToString(Matcher)) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphTestSinglePathFallthroughUd2) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphTestSinglePathJumpUd2) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphTestDualPathDualUd2) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphTestDualPathSingleUd2) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphFailures) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphNoXrefs) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphConditionalInfiniteLoop) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphUnconditionalInfiniteLoop) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphNoFlowsToIndirection) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphLengthExceededUpwards) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphLengthExceededDownwards) {}

// This test ensures when avoiding doing repeated work we still generate the
// paths correctly. We don't need to recalculate the flow from 0x2 -> 0x3 as it
// should only need to be generated once.
TEST_F(BasicGraphBuilderTest, BuildFlowGraphWithRepeatedWork) {}

TEST_F(BasicGraphBuilderTest, BuildFlowGraphComplexExample) {}

} // anonymous namespace
} // end namespace cfi_verify
} // end namespace llvm