]> granicus.if.org Git - clang/commitdiff
getOriginalSourceFileName and getOriginalSourceFile can return a StringRef.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 30 Oct 2012 00:38:13 +0000 (00:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 30 Oct 2012 00:38:13 +0000 (00:38 +0000)
MaybeAddSystemRootToFilename doesn't need to return anything, it modifies
its argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166988 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/ASTUnit.h
include/clang/Serialization/ASTReader.h
lib/Serialization/ASTReader.cpp

index 065fc44805ed39c676bc59e1ff82500865861a34..fc27bb9cdfb6a3d52dacb6cb6b73253c0f52805f 100644 (file)
@@ -467,7 +467,7 @@ public:
 
   const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
 
-  const std::string &getOriginalSourceFileName() {
+  const StringRef getOriginalSourceFileName() {
     return OriginalSourceFile;
   }
 
index 36eae767282deb0f5ca0163c95cf1287d3c4de5d..c0d93c3607fc1428ae16435fece21abc9556edd9 100644 (file)
@@ -900,7 +900,7 @@ private:
   /// into account all the necessary relocations.
   const FileEntry *getFileEntry(StringRef filename);
 
-  StringRef MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename);
+  void MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename);
 
   ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type,
                             ModuleFile *ImportedBy,
@@ -1163,7 +1163,7 @@ public:
 
   /// \brief Retrieve the name of the original source file name for the primary
   /// module file.
-  const std::string &getOriginalSourceFile() { 
+  StringRef getOriginalSourceFile() {
     return ModuleMgr.getPrimaryModule().OriginalSourceFileName; 
   }
 
index 48578569d56af1bc3e2dfccb2e45ea54aa11c85b..874d2c4b1b91e6205bab7da67bca48e74247e350 100644 (file)
@@ -1679,19 +1679,19 @@ const FileEntry *ASTReader::getFileEntry(StringRef filenameStrRef) {
 /// \brief If we are loading a relocatable PCH file, and the filename is
 /// not an absolute path, add the system root to the beginning of the file
 /// name.
-StringRef ASTReader::MaybeAddSystemRootToFilename(ModuleFile &M, 
-                                                  std::string &Filename) {
+void ASTReader::MaybeAddSystemRootToFilename(ModuleFile &M,
+                                             std::string &Filename) {
   // If this is not a relocatable PCH file, there's nothing to do.
   if (!M.RelocatablePCH)
-    return Filename;
+    return;
 
   if (Filename.empty() || llvm::sys::path::is_absolute(Filename))
-    return Filename;
+    return;
 
   if (isysroot.empty()) {
     // If no system root was given, default to '/'
     Filename.insert(Filename.begin(), '/');
-    return Filename;
+    return;
   }
 
   unsigned Length = isysroot.size();
@@ -1699,7 +1699,6 @@ StringRef ASTReader::MaybeAddSystemRootToFilename(ModuleFile &M,
     Filename.insert(Filename.begin(), '/');
 
   Filename.insert(Filename.begin(), isysroot.begin(), isysroot.end());
-  return Filename;
 }
 
 ASTReader::ASTReadResult