#include "ASTPrint.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
usingnamespaceclang;
usingnamespaceast_matchers;
usingnamespacetooling;
namespace {
class PrintMatch : public MatchFinder::MatchCallback { … };
::testing::AssertionResult PrintedDeclMatches(
StringRef Code, const std::vector<std::string> &Args,
const DeclarationMatcher &NodeMatch, StringRef ExpectedPrinted,
StringRef FileName,
std::function<void(llvm::raw_ostream &, const NamedDecl *)> Print) { … }
::testing::AssertionResult
PrintedNamedDeclMatches(StringRef Code, const std::vector<std::string> &Args,
bool SuppressUnwrittenScope,
const DeclarationMatcher &NodeMatch,
StringRef ExpectedPrinted, StringRef FileName) { … }
::testing::AssertionResult
PrintedNamedDeclCXX98Matches(StringRef Code, StringRef DeclName,
StringRef ExpectedPrinted) { … }
::testing::AssertionResult
PrintedWrittenNamedDeclCXX11Matches(StringRef Code, StringRef DeclName,
StringRef ExpectedPrinted) { … }
::testing::AssertionResult
PrintedWrittenPropertyDeclObjCMatches(StringRef Code, StringRef DeclName,
StringRef ExpectedPrinted) { … }
::testing::AssertionResult
PrintedNestedNameSpecifierMatches(StringRef Code, StringRef DeclName,
StringRef ExpectedPrinted) { … }
}
TEST(NamedDeclPrinter, TestNamespace1) { … }
TEST(NamedDeclPrinter, TestNamespace2) { … }
TEST(NamedDeclPrinter, TestUnscopedUnnamedEnum) { … }
TEST(NamedDeclPrinter, TestNamedEnum) { … }
TEST(NamedDeclPrinter, TestScopedNamedEnum) { … }
TEST(NamedDeclPrinter, TestClassWithUnscopedUnnamedEnum) { … }
TEST(NamedDeclPrinter, TestClassWithUnscopedNamedEnum) { … }
TEST(NamedDeclPrinter, TestClassWithScopedNamedEnum) { … }
TEST(NamedDeclPrinter, TestLinkageInNamespace) { … }
TEST(NamedDeclPrinter, TestObjCClassExtension) { … }
TEST(NamedDeclPrinter, TestInstanceObjCClassExtension) { … }
TEST(NamedDeclPrinter, TestObjCClassExtensionWithGetter) { … }
TEST(NamedDeclPrinter, NestedNameSpecifierSimple) { … }
TEST(NamedDeclPrinter, NestedNameSpecifierTemplateArgs) { … }