From 3cd3202b785654b8ac6d3bcf9ee18efcdd5171b0 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 23 Sep 2024 19:21:39 -0700 Subject: [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. --- clang/lib/Frontend/FrontendAction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib/Frontend/FrontendAction.cpp') 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 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 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; -- cgit v1.1