[analyzer] Add support for testing with individual preprocessed files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143786 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/analyzer/SATestAdd.py b/utils/analyzer/SATestAdd.py
old mode 100644
new mode 100755
index 9fab07b..ea3ec21
--- a/utils/analyzer/SATestAdd.py
+++ b/utils/analyzer/SATestAdd.py
@@ -26,7 +26,7 @@
 # Params:
 #   Dir is the directory where the sources are.
 #   ID is a short string used to identify a project.
-def addNewProject(ID) :
+def addNewProject(ID, IsScanBuild) :
     CurDir = os.path.abspath(os.curdir)
     Dir = SATestBuild.getProjectDir(ID)
     if not os.path.exists(Dir):
@@ -34,7 +34,7 @@
         sys.exit(-1)
         
     # Build the project.
-    SATestBuild.testProject(ID, True, Dir)
+    SATestBuild.testProject(ID, True, IsScanBuild, Dir)
 
     # Add the project ID to the project map.
     ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile)
@@ -53,7 +53,7 @@
                 sys.exit(-1)
 
         PMapWriter = csv.writer(PMapFile)
-        PMapWriter.writerow( (ID, Dir) );
+        PMapWriter.writerow( (ID, int(IsScanBuild)) );
     finally:
         PMapFile.close()
         
@@ -65,7 +65,13 @@
 if __name__ == '__main__':
     if len(sys.argv) < 2:
         print >> sys.stderr, 'Usage: ', sys.argv[0],\
-                             '[project ID]'
+                             'project_ID <mode>' \
+                             'mode - 0 for single file project; 1 for scan_build'
         sys.exit(-1)
+    
+    IsScanBuild = 1    
+    if (len(sys.argv) >= 3):
+        IsScanBuild = int(sys.argv[2])  
+    assert((IsScanBuild == 0) | (IsScanBuild == 1))
         
-    addNewProject(sys.argv[1])
+    addNewProject(sys.argv[1], IsScanBuild)