Skip to content

Commit a9ae2f2

Browse files
committed
[ASTWriter] Replace const std::string &OutputFile with StringRef OutputFile in some of ASTWriter functions, NFC
This is to make it consistent with LLVM's string parameter passing convention.
1 parent 726d9f8 commit a9ae2f2

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

clang/include/clang/Serialization/ASTWriter.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ class ASTWriter : public ASTDeserializationListener,
455455

456456
void WriteBlockInfoBlock();
457457
void WriteControlBlock(Preprocessor &PP, ASTContext &Context,
458-
StringRef isysroot, const std::string &OutputFile);
458+
StringRef isysroot, StringRef OutputFile);
459459

460460
/// Write out the signature and diagnostic options, and return the signature.
461461
ASTFileSignature writeUnhashedControlBlock(Preprocessor &PP,
@@ -533,8 +533,7 @@ class ASTWriter : public ASTDeserializationListener,
533533
void WriteDecl(ASTContext &Context, Decl *D);
534534

535535
ASTFileSignature WriteASTCore(Sema &SemaRef, StringRef isysroot,
536-
const std::string &OutputFile,
537-
Module *WritingModule);
536+
StringRef OutputFile, Module *WritingModule);
538537

539538
public:
540539
/// Create a new precompiled header writer that outputs to
@@ -571,7 +570,7 @@ class ASTWriter : public ASTDeserializationListener,
571570
///
572571
/// \return the module signature, which eventually will be a hash of
573572
/// the module but currently is merely a random 32-bit number.
574-
ASTFileSignature WriteAST(Sema &SemaRef, const std::string &OutputFile,
573+
ASTFileSignature WriteAST(Sema &SemaRef, StringRef OutputFile,
575574
Module *WritingModule, StringRef isysroot,
576575
bool hasErrors = false,
577576
bool ShouldCacheASTInMemory = false);

clang/lib/Serialization/ASTWriter.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,7 @@ ASTFileSignature ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
11871187

11881188
/// Write the control block.
11891189
void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
1190-
StringRef isysroot,
1191-
const std::string &OutputFile) {
1190+
StringRef isysroot, StringRef OutputFile) {
11921191
using namespace llvm;
11931192

11941193
Stream.EnterSubblock(CONTROL_BLOCK_ID, 5);
@@ -4481,8 +4480,7 @@ time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const {
44814480
return IncludeTimestamps ? E->getModificationTime() : 0;
44824481
}
44834482

4484-
ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef,
4485-
const std::string &OutputFile,
4483+
ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile,
44864484
Module *WritingModule, StringRef isysroot,
44874485
bool hasErrors,
44884486
bool ShouldCacheASTInMemory) {
@@ -4528,7 +4526,7 @@ static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec,
45284526
}
45294527

45304528
ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
4531-
const std::string &OutputFile,
4529+
StringRef OutputFile,
45324530
Module *WritingModule) {
45334531
using namespace llvm;
45344532

0 commit comments

Comments
 (0)