[Lldb-commits] [clang] [lldb] [llvm] [llvm][TargetParser] Return StringMap from getHostCPUFeatures (PR #97824)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 9 10:32:29 PDT 2024


================
@@ -47,13 +47,12 @@ namespace sys {
   /// The particular format of the names are target dependent, and suitable for
   /// passing as -mattr to the target which matches the host.
   ///
-  /// \param Features - A string mapping feature names to either
-  /// true (if enabled) or false (if disabled). This routine makes no guarantees
-  /// about exactly which features may appear in this map, except that they are
-  /// all valid LLVM feature names.
-  ///
-  /// \return - True on success.
-  bool getHostCPUFeatures(StringMap<bool, MallocAllocator> &Features);
+  /// \return - A string map mapping feature names to either true (if enabled)
+  /// or false (if disabled). This routine makes no guarantees about exactly
+  /// which features may appear in this map, except that they are all valid LLVM
+  /// feature names. The map can be empty, for example if feature detection
+  /// fails.
+  StringMap<bool, MallocAllocator> getHostCPUFeatures();
----------------
bulbazord wrote:

While we're here, maybe the return type should be marked `const`? This is a map, and `operator[]` is notoriously easy to mess up with maps. This might save somebody a big headache down the line.

https://github.com/llvm/llvm-project/pull/97824


More information about the lldb-commits mailing list