aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-23 19:21:39 -0700
committerGitHub <noreply@github.com>2024-09-23 19:21:39 -0700
commit3cd3202b785654b8ac6d3bcf9ee18efcdd5171b0 (patch)
tree866188ef2f027de6ba0541ed0e35867a23406b55 /clang/lib/Frontend/FrontendAction.cpp
parent2028687ecad01ccc135cdc03eca933d7eec24df4 (diff)
downloadllvm-3cd3202b785654b8ac6d3bcf9ee18efcdd5171b0.zip
llvm-3cd3202b785654b8ac6d3bcf9ee18efcdd5171b0.tar.gz
llvm-3cd3202b785654b8ac6d3bcf9ee18efcdd5171b0.tar.bz2
[Frontend] Teach LoadFromASTFile to take FileName by StringRef (NFC) (#109583)
Without this patch, several callers of LoadFromASTFile construct an instance of std::string to be passed as FileName, only to be converted back to StringRef when LoadFromASTFile calls ReadAST. This patch changes the type of FileName to StringRef and updates the callers.
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index a9c45e5..81eea9c4 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -625,8 +625,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
StringRef InputFile = Input.getFile();
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
- std::string(InputFile), CI.getPCHContainerReader(),
- ASTUnit::LoadPreprocessorOnly, ASTDiags, CI.getFileSystemOpts(),
+ InputFile, CI.getPCHContainerReader(), ASTUnit::LoadPreprocessorOnly,
+ ASTDiags, CI.getFileSystemOpts(),
/*HeaderSearchOptions=*/nullptr);
if (!AST)
return false;
@@ -693,9 +693,9 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
StringRef InputFile = Input.getFile();
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
- std::string(InputFile), CI.getPCHContainerReader(),
- ASTUnit::LoadEverything, Diags, CI.getFileSystemOpts(),
- CI.getHeaderSearchOptsPtr(), CI.getLangOptsPtr());
+ InputFile, CI.getPCHContainerReader(), ASTUnit::LoadEverything, Diags,
+ CI.getFileSystemOpts(), CI.getHeaderSearchOptsPtr(),
+ CI.getLangOptsPtr());
if (!AST)
return false;