11#include "clang/Frontend/DependencyOutputOptions.h"
12#include "clang/Frontend/FrontendOptions.h"
13#include "clang/Lex/PreprocessorOptions.h"
14#include "gmock/gmock.h"
15#include "gtest/gtest.h"
21using testing::IsEmpty;
23TEST(BuildCompilerInvocation, DropsPCH) {
25 IgnoreDiagnostics Diags;
27 TU.AdditionalFiles[
"test.h.pch"] =
"";
29 TU.ExtraArgs = {
"-include-pch",
"test.h.pch"};
31 ->getPreprocessorOpts()
36 TU.ExtraArgs = {
"-include",
"test.h"};
38 ->getPreprocessorOpts()
43 TU.AdditionalFiles[
"test.pch"] =
"";
44 TU.ExtraArgs = {
"--driver-mode=cl"};
45 TU.ExtraArgs.push_back(
"/Yutest.h");
47 ->getPreprocessorOpts()
51 ->getPreprocessorOpts()
56TEST(BuildCompilerInvocation, PragmaDebugCrash) {
61TEST(BuildCompilerInvocation, DropsShowIncludes) {
63 IgnoreDiagnostics Diags;
66 TU.ExtraArgs = {
"-Xclang",
"--show-includes"};
68 ->getDependencyOutputOpts()
70 ShowIncludesDestination::None);
72 TU.ExtraArgs = {
"/showIncludes",
"--driver-mode=cl"};
74 ->getDependencyOutputOpts()
76 ShowIncludesDestination::None);
78 TU.ExtraArgs = {
"/showIncludes:user",
"--driver-mode=cl"};
80 ->getDependencyOutputOpts()
82 ShowIncludesDestination::None);
85TEST(BuildCompilerInvocation, DropsPlugins) {
87 IgnoreDiagnostics Diags;
90 TU.ExtraArgs = {
"-Xclang",
"-load",
91 "-Xclang",
"plugins.so",
93 "-Xclang",
"my_plugin",
94 "-Xclang",
"-plugin-arg-my_plugin",
96 "-Xclang",
"-add-plugin",
97 "-Xclang",
"my_plugin2"};
99 EXPECT_THAT(Opts.Plugins, IsEmpty());
100 EXPECT_THAT(Opts.PluginArgs, IsEmpty());
101 EXPECT_THAT(Opts.AddPluginActions, IsEmpty());
102 EXPECT_EQ(Opts.ProgramAction, frontend::ActionKind::ParseSyntaxOnly);
103 EXPECT_TRUE(Opts.ActionName.empty());
106TEST(BuildCompilerInvocation, EmptyArgs) {
108 IgnoreDiagnostics Diags;
110 auto Inputs = TU.inputs(FS);
std::unique_ptr< CompilerInvocation > buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D, std::vector< std::string > *CC1Args)
Builds compiler invocation that could be used to build AST or preamble.
TEST(BackgroundQueueTest, Priority)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static TestTU withCode(llvm::StringRef Code)