aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Testing/TestAST.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-09-02 21:17:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-12-08 17:34:50 +0000
commit06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch)
tree62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/clang/lib/Testing/TestAST.cpp
parentcf037972ea8863e2bab7461d77345367d2c1e054 (diff)
parent7fa27ce4a07f19b07799a767fc29416f3b625afb (diff)
Diffstat (limited to 'contrib/llvm-project/clang/lib/Testing/TestAST.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Testing/TestAST.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/llvm-project/clang/lib/Testing/TestAST.cpp b/contrib/llvm-project/clang/lib/Testing/TestAST.cpp
index 8c79fcd7d636..3a50c2d9b5d0 100644
--- a/contrib/llvm-project/clang/lib/Testing/TestAST.cpp
+++ b/contrib/llvm-project/clang/lib/Testing/TestAST.cpp
@@ -16,6 +16,7 @@
#include "llvm/Support/VirtualFileSystem.h"
#include "gtest/gtest.h"
+#include <string>
namespace clang {
namespace {
@@ -91,7 +92,9 @@ TestAST::TestAST(const TestInputs &In) {
Argv.push_back(S.c_str());
for (const auto &S : In.ExtraArgs)
Argv.push_back(S.c_str());
- std::string Filename = getFilenameForTesting(In.Language).str();
+ std::string Filename = In.FileName;
+ if (Filename.empty())
+ Filename = getFilenameForTesting(In.Language).str();
Argv.push_back(Filename.c_str());
Clang->setInvocation(std::make_unique<CompilerInvocation>());
if (!CompilerInvocation::CreateFromArgs(Clang->getInvocation(), Argv,