summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-10-11 00:40:41 +0000
committerTed Kremenek <kremenek@apple.com>2012-10-11 00:40:41 +0000
commit8b03277b0bc18ab73be11b6067474d515fdad271 (patch)
treea99fbdcbcaff47c41ab515ba3934530ef6deb561 /tools
parentdf75b0c74b277c6b46af2f9e90e13160fbc14d6f (diff)
downloadclang-8b03277b0bc18ab73be11b6067474d515fdad271.tar.gz
clang-8b03277b0bc18ab73be11b6067474d515fdad271.tar.bz2
clang-8b03277b0bc18ab73be11b6067474d515fdad271.tar.xz
Teach set-xcode-analyzer that the new default value for ExecPath is CLANG_ANALYZER_EXEC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rwxr-xr-xtools/scan-build/set-xcode-analyzer15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/scan-build/set-xcode-analyzer b/tools/scan-build/set-xcode-analyzer
index 8ef5faad12..93824af255 100755
--- a/tools/scan-build/set-xcode-analyzer
+++ b/tools/scan-build/set-xcode-analyzer
@@ -20,10 +20,19 @@ def FindClangSpecs(path):
if f.endswith(".xcspec") and f.startswith("Clang LLVM"):
yield os.path.join(root, f)
-def ModifySpec(path, pathToChecker):
+def ModifySpec(path, isBuiltinAnalyzer, pathToChecker):
t = tempfile.NamedTemporaryFile(delete=False)
foundAnalyzer = False
with open(path) as f:
+ if isBuiltinAnalyzer:
+ # First search for CLANG_ANALYZER_EXEC. Newer
+ # versions of Xcode set EXEC_PATH to be CLANG_ANALYZER_EXEC.
+ with open(path) as f2:
+ for line in f2:
+ if line.find("CLANG_ANALYZER_EXEC") >= 0:
+ pathToChecker = "$(CLANG_ANALYZER_EXEC)"
+ break
+ # Now create a new file.
for line in f:
if not foundAnalyzer:
if line.find("Static Analyzer") >= 0:
@@ -63,6 +72,7 @@ def main():
print "(-) You must quit Xcode first before modifying its configuration files."
return
+ isBuiltinAnalyzer = False
if options.path:
# Expand tildes.
path = os.path.expanduser(options.path)
@@ -74,6 +84,7 @@ def main():
else:
print "(+) Using the Clang bundled with Xcode"
path = options.default
+ isBuiltinAnalyzer = True
try:
xcode_path = subprocess.check_output(["xcode-select", "-print-path"])
@@ -88,7 +99,7 @@ def main():
foundSpec = False
for x in FindClangSpecs(xcode_path):
foundSpec = True
- ModifySpec(x, path)
+ ModifySpec(x, isBuiltinAnalyzer, path)
if foundSpec == False:
print "(-) No compiler configuration file was found. Xcode's analyzer has not been updated."