1 //===-- clang-doc/ClangDocTest.h ------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANG_DOC_CLANGDOCTEST_H 10 #define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANG_DOC_CLANGDOCTEST_H 11 12 #include "ClangDocTest.h" 13 #include "Representation.h" 14 #include "clang/AST/RecursiveASTVisitor.h" 15 #include "gtest/gtest.h" 16 17 namespace clang { 18 namespace doc { 19 20 using EmittedInfoList = std::vector<std::unique_ptr<Info>>; 21 22 static const SymbolID EmptySID = SymbolID(); 23 static const SymbolID NonEmptySID = 24 SymbolID{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; 25 26 NamespaceInfo *InfoAsNamespace(Info *I); 27 RecordInfo *InfoAsRecord(Info *I); 28 FunctionInfo *InfoAsFunction(Info *I); 29 EnumInfo *InfoAsEnum(Info *I); 30 TypedefInfo *InfoAsTypedef(Info *I); 31 32 // Unlike the operator==, these functions explicitly does not check USRs, as 33 // that may change and it would be better to not rely on its implementation. 34 void CheckReference(Reference &Expected, Reference &Actual); 35 void CheckTypeInfo(TypeInfo *Expected, TypeInfo *Actual); 36 void CheckFieldTypeInfo(FieldTypeInfo *Expected, FieldTypeInfo *Actual); 37 void CheckMemberTypeInfo(MemberTypeInfo *Expected, MemberTypeInfo *Actual); 38 39 // This function explicitly does not check USRs, as that may change and it would 40 // be better to not rely on its implementation. 41 void CheckBaseInfo(Info *Expected, Info *Actual); 42 void CheckSymbolInfo(SymbolInfo *Expected, SymbolInfo *Actual); 43 void CheckFunctionInfo(FunctionInfo *Expected, FunctionInfo *Actual); 44 void CheckEnumInfo(EnumInfo *Expected, EnumInfo *Actual); 45 void CheckTypedefInfo(TypedefInfo *Expected, TypedefInfo *Actual); 46 void CheckNamespaceInfo(NamespaceInfo *Expected, NamespaceInfo *Actual); 47 void CheckRecordInfo(RecordInfo *Expected, RecordInfo *Actual); 48 void CheckBaseRecordInfo(BaseRecordInfo *Expected, BaseRecordInfo *Actual); 49 50 void CheckIndex(Index &Expected, Index &Actual); 51 52 } // namespace doc 53 } // namespace clang 54 55 #endif // LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANG_DOC_CLANGDOCTEST_H 56