llvm/clang/unittests/Tooling/ToolingTest.cpp

//===- unittest/Tooling/ToolingTest.cpp - Tooling unit tests --------------===//
//
// 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 "clang/Tooling/Tooling.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Testing/CommandLineArgs.h"
#include "clang/Tooling/ArgumentsAdjusters.h"
#include "clang/Tooling/CompilationDatabase.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/TargetParser/Host.h"
#include "gtest/gtest.h"
#include <algorithm>
#include <string>
#include <vector>

namespace clang {
namespace tooling {

namespace {
/// Takes an ast consumer and returns it from CreateASTConsumer. This only
/// works with single translation unit compilations.
class TestAction : public clang::ASTFrontendAction {};

class FindTopLevelDeclConsumer : public clang::ASTConsumer {};
} // end namespace

TEST(runToolOnCode, FindsNoTopLevelDeclOnEmptyCode) {}

namespace {
class FindClassDeclXConsumer : public clang::ASTConsumer {};
bool FindClassDeclX(ASTUnit *AST) {}

struct TestDiagnosticConsumer : public DiagnosticConsumer {};
} // end namespace

TEST(runToolOnCode, FindsClassDecl) {}

TEST(buildASTFromCode, FindsClassDecl) {}

TEST(buildASTFromCode, ReportsErrors) {}

TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromType) {}

struct IndependentFrontendActionCreator {};

TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromFactoryType) {}

TEST(ToolInvocation, TestMapVirtualFile) {}

TEST(ToolInvocation, TestVirtualModulesCompilation) {}

TEST(ToolInvocation, DiagnosticsEngineProperlyInitializedForCC1Construction) {}

TEST(ToolInvocation, CustomDiagnosticOptionsOverwriteParsedOnes) {}

struct DiagnosticConsumerExpectingSourceManager : public DiagnosticConsumer {};

TEST(ToolInvocation, DiagConsumerExpectingSourceManager) {}

TEST(ToolInvocation, CC1Args) {}

TEST(ToolInvocation, CC1ArgsInvalid) {}

namespace {
/// Overlays the real filesystem with the given VFS and returns the result.
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>
overlayRealFS(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {}

struct CommandLineExtractorTest : public ::testing::Test {};
} // namespace

TEST_F(CommandLineExtractorTest, AcceptOffloading) {}

TEST_F(CommandLineExtractorTest, AcceptOffloadingCompile) {}

TEST_F(CommandLineExtractorTest, AcceptOffloadingSyntaxOnly) {}

TEST_F(CommandLineExtractorTest, AcceptExternalAssembler) {}

TEST_F(CommandLineExtractorTest, AcceptEmbedBitcode) {}

TEST_F(CommandLineExtractorTest, AcceptSaveTemps) {}

TEST_F(CommandLineExtractorTest, AcceptPreprocessedInputFile) {}

TEST_F(CommandLineExtractorTest, RejectMultipleArchitectures) {}

TEST_F(CommandLineExtractorTest, RejectMultipleInputFiles) {}

struct VerifyEndCallback : public SourceFileCallbacks {};

#if !defined(_WIN32)
TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) {}
#endif

struct SkipBodyConsumer : public clang::ASTConsumer {};

struct SkipBodyAction : public clang::ASTFrontendAction {};

TEST(runToolOnCode, TestSkipFunctionBody) {}

TEST(runToolOnCodeWithArgs, TestNoDepFile) {}

struct CheckColoredDiagnosticsAction : public clang::ASTFrontendAction {};

TEST(runToolOnCodeWithArgs, DiagnosticsColor) {}

TEST(ClangToolTest, ArgumentAdjusters) {}

TEST(ClangToolTest, NoDoubleSyntaxOnly) {}

TEST(ClangToolTest, NoOutputCommands) {}

TEST(ClangToolTest, BaseVirtualFileSystemUsage) {}

// Check getClangStripDependencyFileAdjuster doesn't strip args after -MD/-MMD.
TEST(ClangToolTest, StripDependencyFileAdjuster) {}

// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {}

// Check getClangStripDependencyFileAdjuster doesn't strip args when using the
// MSVC cl.exe driver
TEST(ClangToolTest, StripDependencyFileAdjusterMsvc) {}

// Check getClangStripPluginsAdjuster strips plugin related args.
TEST(ClangToolTest, StripPluginsAdjuster) {}

TEST(addTargetAndModeForProgramName, AddsTargetAndMode) {}

TEST(addTargetAndModeForProgramName, PathIgnored) {}

TEST(addTargetAndModeForProgramName, IgnoresExistingTarget) {}

TEST(addTargetAndModeForProgramName, IgnoresExistingMode) {}

#ifndef _WIN32
TEST(ClangToolTest, BuildASTs) {}

TEST(ClangToolTest, InjectDiagnosticConsumer) {}

TEST(ClangToolTest, InjectDiagnosticConsumerInBuildASTs) {}
#endif

TEST(runToolOnCode, TestResetDiagnostics) {}

} // end namespace tooling
} // end namespace clang