Update set-xcode-analyzer to work with Xcode repackaging in Xcode 4.3
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151179 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/scan-build/set-xcode-analyzer b/tools/scan-build/set-xcode-analyzer
index 133f9cc..06e1d85 100755
--- a/tools/scan-build/set-xcode-analyzer
+++ b/tools/scan-build/set-xcode-analyzer
@@ -5,6 +5,7 @@
# This one has the scripting bridge enabled.
import os
+import subprocess
import sys
import re
import tempfile
@@ -13,6 +14,7 @@
from AppKit import *
def FindClangSpecs(path):
+ print "(+) Searching for xcspec file in: ", path
for root, dirs, files in os.walk(path):
for f in files:
if f.endswith(".xcspec") and f.startswith("Clang LLVM"):
@@ -73,7 +75,13 @@
print "(+) Using the Clang bundled with Xcode"
path = options.default
- for x in FindClangSpecs('/Developer'):
+ xcode_path = subprocess.check_output(["xcode-select", "-print-path"])
+ if (re.search("Xcode.app", xcode_path)):
+ # Cut off the 'Developer' dir, as the xcspec lies in another part
+ # of the Xcode.app subtree.
+ xcode_path = os.path.dirname(xcode_path)
+
+ for x in FindClangSpecs(xcode_path):
ModifySpec(x, path)
if __name__ == '__main__':