Author: rafael Date: Mon Oct 29 19:38:13 2012 New Revision: 166988 URL: http://llvm.org/viewvc/llvm-project?rev=166988&view=rev Log: getOriginalSourceFileName and getOriginalSourceFile can return a StringRef. MaybeAddSystemRootToFilename doesn't need to return anything, it modifies its argument.
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/lib/Serialization/ASTReader.cpp Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=166988&r1=166987&r2=166988&view=diff ============================================================================== --- cfe/trunk/include/clang/Frontend/ASTUnit.h (original) +++ cfe/trunk/include/clang/Frontend/ASTUnit.h Mon Oct 29 19:38:13 2012 @@ -467,7 +467,7 @@ const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; } - const std::string &getOriginalSourceFileName() { + const StringRef getOriginalSourceFileName() { return OriginalSourceFile; } Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=166988&r1=166987&r2=166988&view=diff ============================================================================== --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Mon Oct 29 19:38:13 2012 @@ -900,7 +900,7 @@ /// 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 @@ /// \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; } Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=166988&r1=166987&r2=166988&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Oct 29 19:38:13 2012 @@ -1679,19 +1679,19 @@ /// \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 @@ Filename.insert(Filename.begin(), '/'); Filename.insert(Filename.begin(), isysroot.begin(), isysroot.end()); - return Filename; } ASTReader::ASTReadResult _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits