[Lldb-commits] [PATCH] D53677: Fix a bug PlatformDarwin::SDKSupportsModule

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 25 08:56:54 PDT 2018


shafik added inline comments.


================
Comment at: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1405
 
-    llvm::StringRef version_part;
-
-    if (sdk_name.startswith(sdk_strings[(int)desired_type])) {
-      version_part =
-          sdk_name.drop_front(strlen(sdk_strings[(int)desired_type]));
-    } else {
+    if (!sdk_name.startswith(sdk_strings[(int)desired_type]))
       return false;
----------------
Could we avoid C-style casts, and in this case use `static_cast` although in this case it is obvious, using explicit casts avoids bugs in the long-term due to changes in type and cv-qualifiers etc... and makes your intent clear.

I personally would advocate for -Wold-style-cast being a hard error in C++ code.


================
Comment at: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1408
+    auto version_part =
+        sdk_name.drop_front(strlen(sdk_strings[(int)desired_type]));
+    version_part.consume_back(".sdk");
----------------
Same comment here.


https://reviews.llvm.org/D53677





More information about the lldb-commits mailing list