[clang] 4481057 - [clang] Move variable declaration closer to use

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 13:40:57 PDT 2022


Author: Nico Weber
Date: 2022-10-18T16:40:46-04:00
New Revision: 4481057d4cbe60878d16b26085d8ab90ec5f7a43

URL: https://github.com/llvm/llvm-project/commit/4481057d4cbe60878d16b26085d8ab90ec5f7a43
DIFF: https://github.com/llvm/llvm-project/commit/4481057d4cbe60878d16b26085d8ab90ec5f7a43.diff

LOG: [clang] Move variable declaration closer to use

...and add some whitespace to delimit the three logical steps done in this
function.

No behavior change.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Darwin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 443c188cc20ec..1a02d3cfbac7c 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1485,17 +1485,19 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
 /// If the macOS SDK version is the same or earlier than the system version,
 /// then the SDK version is returned. Otherwise the system version is returned.
 static std::string getSystemOrSDKMacOSVersion(StringRef MacOSSDKVersion) {
-  unsigned Major, Minor, Micro;
   llvm::Triple SystemTriple(llvm::sys::getProcessTriple());
   if (!SystemTriple.isMacOSX())
     return std::string(MacOSSDKVersion);
   VersionTuple SystemVersion;
   SystemTriple.getMacOSXVersion(SystemVersion);
+
+  unsigned Major, Minor, Micro;
   bool HadExtra;
   if (!Driver::GetReleaseVersion(MacOSSDKVersion, Major, Minor, Micro,
                                  HadExtra))
     return std::string(MacOSSDKVersion);
   VersionTuple SDKVersion(Major, Minor, Micro);
+
   if (SDKVersion > SystemVersion)
     return SystemVersion.getAsString();
   return std::string(MacOSSDKVersion);


        


More information about the cfe-commits mailing list