[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / clang / unittests / Interpreter / IncrementalCompilerBuilderTest.cpp
blobc4a40071f55cf821fd718ff6d09813d0988cd7f8
1 //=== unittests/Interpreter/IncrementalCompilerBuilderTest.cpp ------------===//
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 //===----------------------------------------------------------------------===//
9 #include "clang/Basic/TargetOptions.h"
10 #include "clang/Frontend/CompilerInstance.h"
11 #include "clang/Interpreter/Interpreter.h"
12 #include "clang/Lex/PreprocessorOptions.h"
13 #include "llvm/Support/Error.h"
14 #include "gtest/gtest.h"
16 using namespace llvm;
17 using namespace clang;
19 namespace {
21 // Usually FrontendAction takes the raw pointers and wraps them back into
22 // unique_ptrs in InitializeFileRemapping()
23 static void cleanupRemappedFileBuffers(CompilerInstance &CI) {
24 for (const auto &RB : CI.getPreprocessorOpts().RemappedFileBuffers) {
25 delete RB.second;
27 CI.getPreprocessorOpts().clearRemappedFiles();
30 TEST(IncrementalCompilerBuilder, SetCompilerArgs) {
31 std::vector<const char *> ClangArgv = {"-Xclang", "-ast-dump-all"};
32 auto CB = clang::IncrementalCompilerBuilder();
33 CB.SetCompilerArgs(ClangArgv);
34 auto CI = cantFail(CB.CreateCpp());
35 EXPECT_TRUE(CI->getFrontendOpts().ASTDumpAll);
36 cleanupRemappedFileBuffers(*CI);
39 TEST(IncrementalCompilerBuilder, SetTargetTriple) {
40 auto CB = clang::IncrementalCompilerBuilder();
41 CB.SetTargetTriple("armv6-none-eabi");
42 auto CI = cantFail(CB.CreateCpp());
43 EXPECT_EQ(CI->getTargetOpts().Triple, "armv6-unknown-none-eabi");
44 cleanupRemappedFileBuffers(*CI);
47 } // end anonymous namespace