More ways to find XCode's libclang on MacOS (#402)

diff --git a/lib/src/config_provider/spec_utils.dart b/lib/src/config_provider/spec_utils.dart
index aaa4c08..a7d6d09 100644
--- a/lib/src/config_provider/spec_utils.dart
+++ b/lib/src/config_provider/spec_utils.dart
@@ -391,6 +391,23 @@
       k = findLibclangDylib(l);
       if (k != null) return k;
     }
+    final findLibraryResult =
+        Process.runSync('xcodebuild', ['-find-library', 'libclang.dylib']);
+    if (findLibraryResult.exitCode == 0) {
+      final location = (findLibraryResult.stdout as String).split('\n').first;
+      if (File(location).existsSync()) {
+        return location;
+      }
+    }
+    final xcodePathResult = Process.runSync('xcode-select', ['-print-path']);
+    if (xcodePathResult.exitCode == 0) {
+      final xcodePath = (xcodePathResult.stdout as String).split('\n').first;
+      final location =
+          p.join(xcodePath, strings.xcodeDylibLocation, strings.dylibFileName);
+      if (File(location).existsSync()) {
+        return location;
+      }
+    }
   } else {
     throw Exception('Unsupported Platform.');
   }
diff --git a/lib/src/strings.dart b/lib/src/strings.dart
index 8186221..f2603d3 100644
--- a/lib/src/strings.dart
+++ b/lib/src/strings.dart
@@ -207,10 +207,18 @@
   r'C:\Program Files\LLVM\bin\',
 };
 const macOsDylibLocations = {
-  '/usr/local/opt/llvm/lib/',
-  '/opt/homebrew/opt/llvm/lib/',
+  // Default Xcode commandline tools installation.
   '/Library/Developer/CommandLineTools/usr/',
+  // Default path for LLVM installed with apt-get.
+  '/usr/local/opt/llvm/lib/',
+  // Default path for LLVM installed with brew.
+  '/opt/homebrew/opt/llvm/lib/',
+  // Default Xcode installation.
+  // Last because it does not include ObjectiveC headers by default.
+  // See https://github.com/dart-lang/ffigen/pull/402#issuecomment-1154348670.
+  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/',
 };
+const xcodeDylibLocation = 'Toolchains/XcodeDefault.xctoolchain/usr/lib/';
 
 // Writen doubles.
 const doubleInfinity = 'double.infinity';