[clang] Move variable declaration closer to use
authorNico Weber <thakis@chromium.org>
Tue, 18 Oct 2022 20:39:55 +0000 (16:39 -0400)
committerNico Weber <thakis@chromium.org>
Tue, 18 Oct 2022 20:40:46 +0000 (16:40 -0400)
...and add some whitespace to delimit the three logical steps done in this
function.

No behavior change.

clang/lib/Driver/ToolChains/Darwin.cpp

index 443c188..1a02d3c 100644 (file)
@@ -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);