[cfe-commits] r99720 - in /cfe/trunk/www/analyzer: downloads/clangify2010.py visual_studio.html

Ted Kremenek kremenek at apple.com
Sat Mar 27 09:56:20 PDT 2010


Author: kremenek
Date: Sat Mar 27 11:56:20 2010
New Revision: 99720

URL: http://llvm.org/viewvc/llvm-project?rev=99720&view=rev
Log:
Remove VS information for analyzer until we have more real support.

Removed:
    cfe/trunk/www/analyzer/downloads/clangify2010.py
    cfe/trunk/www/analyzer/visual_studio.html

Removed: cfe/trunk/www/analyzer/downloads/clangify2010.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/downloads/clangify2010.py?rev=99719&view=auto
==============================================================================
--- cfe/trunk/www/analyzer/downloads/clangify2010.py (original)
+++ cfe/trunk/www/analyzer/downloads/clangify2010.py (removed)
@@ -1,148 +0,0 @@
-# clangify2010.py - Created by Clark Gaebel [ Free as in speech. ]
-#
-# Python 3.x, so don't you dare 2.6 this!
-#
-# This script is used to generate the proper clang call from a VC/VC++ 10
-# file. As an example of this, a project with files [foo.c, bar.c, baz.c] will
-# generate the command "clang --analyze foo.c bar.c baz.c" This includes C++
-# support so if we had [foo.cpp, bar.cpp, baz.cpp], it will generate the command
-# "clang++ --analyze foo.cpp bar.cpp baz.cpp.
-import sys
-import os
-from xml.dom import minidom
-
-
-###### CUSTOMIZATION #######
-
-def pre_analysis():
-    '''
-        Put any pre-analysis tasks in here. They will be performed before
-        enumeration of the project file and the actual clangification begins.
-    '''
-    return
-
-def post_anlalysis():
-    '''
-        Put any post-analysis tasks in here, such as cleaning up from your
-        pre-analysis. This will be called after the actual clangification.
-    '''
-    return
-
-##### END CUSTOMIZATION #####
-
-def die(message):
-    print("ERROR: " + message)
-    exit()
-
-# returns a list of files to clang (Oh em gee I just verbed clang).
-# To support other project file types, just implement a function with
-# the same signature and the rest is trivial.
-def parse_vs2010_project_file(filename):
-    output_list = list()
-
-    file_contents = minidom.parse(filename)
-    elements = file_contents.getElementsByTagName('ClCompile')
-
-    for current_element in elements:
-        if current_element.hasAttribute('Include'):
-            output_list.append(current_element.attributes['Include'].value)
-
-    return output_list
-
-# returns "c" for "foo.c"
-def get_file_extension(filename):
-    extension = str()
-
-    for char in reversed(filename):
-        if char == '.':
-            break;
-        else:
-            extension = char + extension
-            
-    return extension
-
-# returns the homogenous file extension if successful, "" otherwise.
-def file_extensions_are_homogenous(list_of_files):
-    if len(list_of_files) < 1:
-        return ""
-    
-    extension = get_file_extension(list_of_files[0])
-    
-    for current_file in list_of_files:
-        if get_file_extension(current_file) != extension:
-            return ""
-
-    return extension
-
-def is_in_list(lst, elem):
-    try:
-        lst.index(elem)
-    except ValueError:
-        return False
-    return True
-
-# fixes a list of files such as [foo.c, bar.c, baz.c]
-# so that they are relative to a path.
-# if this function is called as
-# "fix_paths("./a/b/c.q", ['foo.c', 'bar.c', 'baz.c'])",
-# it will return ['./a/b/foo.c', './a/b/bar.c', './a/b/baz.c']
-def fix_paths(base_filename, pathless_files):
-    fixed_paths = list()
-    for i in pathless_files:
-        fixed_paths.append(os.path.dirname(base_filename) + '/' + i)
-    return fixed_paths
-
-###### MAIN ######
-
-pre_analysis()
-
-# Handle the "I don't know how to use this thing" case.
-if len(sys.argv) != 2:
-    print(
-       """clangify.py
-
-        Usage: python clangify.py [location of .vcxproj file]
-
-        This will call clang's analysis engine on all of your C/C++ files in
-        the project. Please ensure that clang and clang++ are in your system
-        PATH. For now, this only works for VS10 project files.""")
-    project_file = ""
-else:
-    project_file = sys.argv[1]
-    
-files_to_clang = list()
-if get_file_extension(project_file) == "vcxproj":
-    files_to_clang = parse_vs2010_project_file(project_file)
-else:
-    die("Project file type not supported. clangify only works for VS2010.")
-    
-    
-file_extension = file_extensions_are_homogenous(files_to_clang)
-
-clang_command = str()
-
-# feel free to add more extension/language support here.
-c_extensions = ['c']
-cpp_extensions = ['cpp', 'cxx', 'cc']
-
-if is_in_list(c_extensions, file_extension):
-    clang_command = 'clang --analyze'
-elif is_in_list(cpp_extensions, file_extension):
-    clang_command = 'clang++ --analyze -ccc-clang-cxx'
-elif file_extension == '':
-    die(
-        "The project's file extensions are not homogenous. Are you mixing"
-        ".c and .cpp files in the same project?")
-else:
-    die(
-        "Unrecognized file extension. clangify/clang only support C and"
-        "C++ projects.")
-
-files_to_clang = fix_paths(project_file, files_to_clang)
-    
-for current_file in files_to_clang:
-    clang_command += ' ' + current_file
-    
-os.system(clang_command)
-
-post_analysis()

Removed: cfe/trunk/www/analyzer/visual_studio.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/visual_studio.html?rev=99719&view=auto
==============================================================================
--- cfe/trunk/www/analyzer/visual_studio.html (original)
+++ cfe/trunk/www/analyzer/visual_studio.html (removed)
@@ -1,87 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-          "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Using the Analyzer with Visual Studio 2010</title>
-  <link type="text/css" rel="stylesheet" href="content.css" />
-  <link type="text/css" rel="stylesheet" href="menu.css" />
-  <script type="text/javascript" src="scripts/menu.js"></script>
-  <script type="text/javascript" src="scripts/dbtree.js"></script>  
-</head>
-<body>
-
-<div id="page">
-<!--#include virtual="menu.html.incl"-->
-<div id="content">
-
-<h1>clangify2010: Using the Analyzer with Visual Studio 2010</h1>
-
-<p>The Clang Static Analyzer has only limited support right now for Visual
-Studio users. Some users might find the <tt>clangify2010.py</tt> script useful
-(described below) for analyzing their projects. It does not provide the same
-functionality as <tt>scan-build</tt> (for example, it does not actually build
-Visual Studio projects to analyze source files nor does it have a UI for viewing
-results) but some users may still find it useful.</p>
-
-<p>We <b>encourage anyone</b> who is interested in developing
-support/integration of the Clang Static Analyzer with Visual Studio to <b>get
-involved</b> in <a href="http://clang.llvm.org/">clang development</a>.</p>
-
-<h3>Important Caveats</h3>
-
-<ul>
-  <li>Clang doesn't support all Microsoft extensions implemented in Visual C/C++.</li>
-  <li>The Clang Static Analyzer currently has <b>very remedial and
-  experimental</b> support for analyzing C++ code. It will frequently
-  crash.</li>
-  <li><tt>clangify2010.py</tt> strives to be as easy to read and modify as possible. If it
-does not quite suit your needs, you can always tweak it to make it work the way
-you want it to work.</li>
-  <li><b>This script is provided as-is</b>.  Currently no technical support
-      is available until we have someone to champion the development of the static
-      analyzer on Windows.</li>
-</ul>
-
-<h3>Requirements</h3>
-
-<ul>
-<li>You have a C or C++ Visual Studio 2010 project.</li>
-<li>You have <b>Python 3.x</b> (get the latest version <a
-href="http://python.org/download/">here</a>) in your <tt>PATH</tt>.</li>
-<li>You have clang + llvm (get the latest version <a
-href="http://clang.llvm.org/get_started.html">here</a>) in your <tt>PATH</tt>.
-<li>Your project does not have automatically generated intermediate files as
-part of the build step. You can possibly work around this limitation by adding a
-custom pre_analysis function to <tt>clangify2010.py</tt>.</li>
-<li>The source files in your project all take the same compiler flags.</li>
-</ul>
-
-<h2>Usage</h2>
-
-<h3>Step 1: Download the script</h3>
-
-<p>Assuming you have met all of the above requirements, you should first
-download and copy <tt><a
-href="/downloads/clangify2010.py">clangify2010.py</a></tt> to wherever your
-project resides. Alternatively you can put the script in a global location and
-add it to your <tt>PATH</tt>.</p>
-
-<h3>Step 2: Running the script</h3>
-
-<p>Once you have obtained <tt>clangify2010.py</tt> say you have a project file
-called <tt>Foo.vcxproj</tt>, holding 300 .cpp files. To run the analyzer on all
-these files, just type the following at the Windows command prompt:</p>
-
-<pre class="code_example">
-clangify2010.py Foo.vcxproj
-</pre>
-
-<p><tt>clangify2010.py</tt> will automatically scan your project file for all
-your C++ files and hand them off to the Clang Static Analyzer for analysis..
-Additionally, you could run the script as a post-build step to your project.</p>
-
-</div>
-</div>
-</body>
-</html>
-





More information about the cfe-commits mailing list