[llvm] 3466b8e - [Support] Add const to `FileError::getFileName`

Ben Barham via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 11:45:37 PDT 2022


Author: Ben Barham
Date: 2022-03-14T11:45:29-07:00
New Revision: 3466b8e23d9c1e2604bf366e208cff887070a4ff

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

LOG: [Support] Add const to `FileError::getFileName`

`getFileName` returns a `StringRef`, there's no reason it shouldn't be
const.

Differential Revision: https://reviews.llvm.org/D121495

Added: 
    

Modified: 
    llvm/include/llvm/Support/Error.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 881049b15b0df..80a5212b8f076 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -1281,7 +1281,7 @@ class FileError final : public ErrorInfo<FileError> {
     return OS.str();
   }
 
-  StringRef getFileName() { return FileName; }
+  StringRef getFileName() const { return FileName; }
 
   Error takeError() { return Error(std::move(Err)); }
 


        


More information about the llvm-commits mailing list