[llvm] 9c28432 - [NFC] Make 'Triple&' param a 'const&' instead (#110628)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 12:16:14 PDT 2024


Author: Sirraide
Date: 2024-10-01T21:16:11+02:00
New Revision: 9c2843275e8bce09837767c0e453a68bc164116c

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

LOG: [NFC] Make 'Triple&' param a 'const&' instead (#110628)

There isn’t really a reason for it not to be a `const&` (afaict), and it
is a bit annoying because some APIs (e.g. `TargetMachine::getTargetTriple()`) 
return a `const Triple&`.

Added: 
    

Modified: 
    llvm/include/llvm/Object/Archive.h
    llvm/lib/Object/Archive.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Object/Archive.h b/llvm/include/llvm/Object/Archive.h
index a3165c3235e0ed..b2dd970b00c056 100644
--- a/llvm/include/llvm/Object/Archive.h
+++ b/llvm/include/llvm/Object/Archive.h
@@ -339,7 +339,7 @@ class Archive : public Binary {
   Kind kind() const { return (Kind)Format; }
   bool isThin() const { return IsThin; }
   static object::Archive::Kind getDefaultKind();
-  static object::Archive::Kind getDefaultKindForTriple(Triple &T);
+  static object::Archive::Kind getDefaultKindForTriple(const Triple &T);
 
   child_iterator child_begin(Error &Err, bool SkipInternal = true) const;
   child_iterator child_end() const;

diff  --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index e798bbdd16f143..9857eb0de7a80d 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -969,7 +969,7 @@ Archive::Archive(MemoryBufferRef Source, Error &Err)
   Err = Error::success();
 }
 
-object::Archive::Kind Archive::getDefaultKindForTriple(Triple &T) {
+object::Archive::Kind Archive::getDefaultKindForTriple(const Triple &T) {
   if (T.isOSDarwin())
     return object::Archive::K_DARWIN;
   if (T.isOSAIX())


        


More information about the llvm-commits mailing list