//===- llvm/unittest/DebugInfo/LogicalView/CompareElementsTest.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 "llvm/DebugInfo/LogicalView/Core/LVCompare.h" #include "llvm/DebugInfo/LogicalView/Core/LVLine.h" #include "llvm/DebugInfo/LogicalView/Core/LVReader.h" #include "llvm/DebugInfo/LogicalView/Core/LVScope.h" #include "llvm/DebugInfo/LogicalView/Core/LVSymbol.h" #include "llvm/DebugInfo/LogicalView/Core/LVType.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Testing/Support/Error.h" #include "gtest/gtest.h" usingnamespacellvm; usingnamespacellvm::logicalview; namespace { //===----------------------------------------------------------------------===// // Basic Reader functionality. class ReaderTestCompare : public LVReader { … }; // Helper function to add a logical element to a given scope. void ReaderTestCompare::add(LVScope *Parent, LVElement *Child) { … } // Helper function to set the initial values for a given logical element. void ReaderTestCompare::set(LVElement *Element, StringRef Name, LVOffset Offset, uint32_t LineNumber, LVElement *Type) { … } //===----------------------------------------------------------------------===// // Create the logical elements. void ReaderTestCompare::createElements() { … } // Reference Reader: Target Reader: // ---------------------- ---------------------- // Root Root // CompileUnit CompileUnit // IntegerType IntegerType // UnsignedType UnsignedType // FunctionOne FunctionOne // ParameterOne ParameterOne // LocalVariable --- // LocalType LocalType // LineOne LineOne // NestedScope NestedScope // NestedVariable NestedVariable // NestedType NestedType // LineTwo --- // InnerScope InnerScope // --- LineThree // --- FunctionTwo // --- ParameterTwo // GlobalVariable GlobalVariable // GlobalType GlobalType // Namespace Namespace // Aggregate Aggregate // ClassMember ClassMember // Enumeration Enumeration // EnumeratorOne EnumeratorOne // EnumeratorTwo EnumeratorTwo // TypeDefinitionOne --- // --- TypeDefinitionTwo // Create the logical view adding the created logical elements. void ReaderTestCompare::addElements(bool IsReference, bool IsTarget) { … } // Set initial values to logical elements. void ReaderTestCompare::initElements() { … } // Compare the logical views. void compareReadersViews(ReaderTestCompare *ReferenceReader, ReaderTestCompare *TargetReader) { … } // Compare the logical elements. void compareReadersElements(ReaderTestCompare *ReferenceReader, ReaderTestCompare *TargetReader) { … } TEST(LogicalViewTest, CompareElements) { … } } // namespace