[clang] a9ae2f2 - [ASTWriter] Replace `const std::string &OutputFile` with `StringRef OutputFile` in some of `ASTWriter` functions, NFC

Argyrios Kyrtzidis via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 23:02:39 PDT 2022


Author: Argyrios Kyrtzidis
Date: 2022-07-27T23:02:33-07:00
New Revision: a9ae2f2764364a2c3bfe7d81087b74b465dcb305

URL: https://github.com/llvm/llvm-project/commit/a9ae2f2764364a2c3bfe7d81087b74b465dcb305
DIFF: https://github.com/llvm/llvm-project/commit/a9ae2f2764364a2c3bfe7d81087b74b465dcb305.diff

LOG: [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.

Added: 
    

Modified: 
    clang/include/clang/Serialization/ASTWriter.h
    clang/lib/Serialization/ASTWriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index 83bc7dcdfde3b..1d4af1b20cdef 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -455,7 +455,7 @@ class ASTWriter : public ASTDeserializationListener,
 
   void WriteBlockInfoBlock();
   void WriteControlBlock(Preprocessor &PP, ASTContext &Context,
-                         StringRef isysroot, const std::string &OutputFile);
+                         StringRef isysroot, StringRef OutputFile);
 
   /// Write out the signature and diagnostic options, and return the signature.
   ASTFileSignature writeUnhashedControlBlock(Preprocessor &PP,
@@ -533,8 +533,7 @@ class ASTWriter : public ASTDeserializationListener,
   void WriteDecl(ASTContext &Context, Decl *D);
 
   ASTFileSignature WriteASTCore(Sema &SemaRef, StringRef isysroot,
-                                const std::string &OutputFile,
-                                Module *WritingModule);
+                                StringRef OutputFile, Module *WritingModule);
 
 public:
   /// Create a new precompiled header writer that outputs to
@@ -571,7 +570,7 @@ class ASTWriter : public ASTDeserializationListener,
   ///
   /// \return the module signature, which eventually will be a hash of
   /// the module but currently is merely a random 32-bit number.
-  ASTFileSignature WriteAST(Sema &SemaRef, const std::string &OutputFile,
+  ASTFileSignature WriteAST(Sema &SemaRef, StringRef OutputFile,
                             Module *WritingModule, StringRef isysroot,
                             bool hasErrors = false,
                             bool ShouldCacheASTInMemory = false);

diff  --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 0739dcc1ce600..8ca000b340845 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -1187,8 +1187,7 @@ ASTFileSignature ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
 
 /// Write the control block.
 void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
-                                  StringRef isysroot,
-                                  const std::string &OutputFile) {
+                                  StringRef isysroot, StringRef OutputFile) {
   using namespace llvm;
 
   Stream.EnterSubblock(CONTROL_BLOCK_ID, 5);
@@ -4481,8 +4480,7 @@ time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const {
   return IncludeTimestamps ? E->getModificationTime() : 0;
 }
 
-ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef,
-                                     const std::string &OutputFile,
+ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile,
                                      Module *WritingModule, StringRef isysroot,
                                      bool hasErrors,
                                      bool ShouldCacheASTInMemory) {
@@ -4528,7 +4526,7 @@ static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec,
 }
 
 ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
-                                         const std::string &OutputFile,
+                                         StringRef OutputFile,
                                          Module *WritingModule) {
   using namespace llvm;
 


        


More information about the cfe-commits mailing list