[cfe-commits] r48987 - /cfe/trunk/utils/ccc-analyzer

Ted Kremenek kremenek at apple.com
Mon Mar 31 11:25:05 PDT 2008


Author: kremenek
Date: Mon Mar 31 13:25:05 2008
New Revision: 48987

URL: http://llvm.org/viewvc/llvm-project?rev=48987&view=rev
Log:
The ccc-analyzer script now interrogates environment variables to determine
where to dump HTML reports.

Modified:
    cfe/trunk/utils/ccc-analyzer

Modified: cfe/trunk/utils/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc-analyzer?rev=48987&r1=48986&r2=48987&view=diff

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Mon Mar 31 13:25:05 2008
@@ -45,16 +45,16 @@
           return path
       return path[:i]
 
-def analyze(args,language,output,files):
+def analyze(args,language,output,files,verbose,htmldir):
     if language.find("c++") > 0:
       return
   
-    print >> sys.stderr, ' '.join(['\n[LOCATION]:', os.getcwd(), '\n' ])
-    
     print_args = []
     
-    i = 0
-    while i < len(args):
+    if verbose:
+      print >> sys.stderr, ' '.join(['\n[LOCATION]:', os.getcwd(), '\n' ])
+      i = 0
+      while i < len(args):
         print_args.append(''.join([ '\'', args[i], '\'' ]))
         i += 1
     
@@ -64,10 +64,14 @@
       args = command + files + target.split()      
     else:
       command = 'clang --grsimple'.split()
-      args = command + args
+      args = command + args + [ '-o', htmldir ]
+      print_args.append('-o')
+      print_args.append(htmldir)
+    
+    if verbose:  
+      print >> sys.stderr, ' '.join(command+print_args)
+      print >> sys.stderr, '\n'
       
-    print >> sys.stderr, ' '.join(command+print_args)
-    print >> sys.stderr, '\n'    
     subprocess.call(args)
 
 def link(args):
@@ -111,6 +115,16 @@
     save_temps = 0
     language = ''
     
+    verbose = 0
+    
+    if os.environ.get('CCC_ANALYZER_VERBOSE') is not None:
+      verbose =1
+    
+    htmldir = os.environ.get('CCC_ANALYZER_HTML')
+    if htmldir is None:
+      print >> sys.stderr, 'error: CCC_ANALYZER_HTML environment variable not set.'
+      sys.exit(1)
+      
     i = 0
     while i < len(args):
         arg = args[i]
@@ -208,7 +222,7 @@
             if language != 'unknown':
               analyze_args = analyze_args + [ '-x', language ]
             analyze_args = analyze_args + compile_opts
-            analyze(analyze_args,language,output,files)
+            analyze(analyze_args, language, output, files, verbose, htmldir)
         compile(args)
 
 





More information about the cfe-commits mailing list