Implement -print-prog-name. Patch by Nuno Lopes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46353 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/ccc b/utils/ccc
index 6569588..308544e 100755
--- a/utils/ccc
+++ b/utils/ccc
@@ -39,7 +39,7 @@
 def main(args):
     action = 'link'
     output = ''
-    compile_opts = ['-U__GNUC__']
+    compile_opts = []
     link_opts = []
     files = []
 
@@ -50,6 +50,8 @@
             action = 'preprocess'
         if arg == '-c':
             action = 'compile'
+        if arg.startswith('-print-prog-name'):
+            action = 'print-prog-name'
         if arg == '-o':
             output = args[i+1]
             i += 1
@@ -68,6 +70,11 @@
             files.append(arg)
         i += 1
 
+    if action == 'print-prog-name':
+        # assume we can handle everything
+        print sys.argv[0]
+        return
+
     if not files:
         error('no input files')