blob: 1cc0223465c8fa8b8c8cd11c92b783b8039c5ca4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//=== unittests/Interpreter/IncrementalCompilerBuilderTest.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 "clang/Basic/TargetOptions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Interpreter/Interpreter.h"
#include "llvm/Support/Error.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace clang;
namespace {
TEST(IncrementalCompilerBuilder, SetCompilerArgs) {
std::vector<const char *> ClangArgv = {"-Xclang", "-ast-dump-all"};
auto CB = clang::IncrementalCompilerBuilder();
CB.SetCompilerArgs(ClangArgv);
auto CI = cantFail(CB.CreateCpp());
EXPECT_TRUE(CI->getFrontendOpts().ASTDumpAll);
}
TEST(IncrementalCompilerBuilder, SetTargetTriple) {
auto CB = clang::IncrementalCompilerBuilder();
CB.SetTargetTriple("armv6-none-eabi");
auto CI = cantFail(CB.CreateCpp());
EXPECT_EQ(CI->getTargetOpts().Triple, "armv6-none-unknown-eabi");
}
} // end anonymous namespace
|