]> granicus.if.org Git - clang/commitdiff
ccc: Also look for .gch files when seeing if we should auto load a
authorDaniel Dunbar <daniel@zuster.org>
Thu, 19 Feb 2009 22:01:23 +0000 (22:01 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 19 Feb 2009 22:01:23 +0000 (22:01 +0000)
token-cache for clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65069 91177308-0d34-0410-b5e6-96231b3b80d8

tools/ccc/ccclib/Tools.py

index e2d0e9e41063555af98064b0bff35263820dc8b5..f08f1c7c40878ebd9d962451221e6c28b11f9fce 100644 (file)
@@ -321,12 +321,17 @@ class Clang_CompileTool(Tool):
         # FIXME: Clang isn't going to accept just anything here.
         arglist.addAllArgs(cmd_args, arglist.parser.iGroup)
 
-        # Automatically load .pth files which match -include options.
+        # Automatically load .pth or .gch files which match -include
+        # options. It's wonky, but we include looking for .gch so we
+        # can support seamless replacement into a build system already
+        # set up to be generating .gch files.
         for arg in arglist.getArgs(arglist.parser.includeOption):
-            pthPath = arglist.getValue(arg) + '.pth'
-            if os.path.exists(pthPath):
-                cmd_args.append('-token-cache')
-                cmd_args.append(pthPath)
+            for suffix in ('.pth','.gch'):
+                pthPath = arglist.getValue(arg) + suffix
+                if os.path.exists(pthPath):
+                    cmd_args.append('-token-cache')
+                    cmd_args.append(pthPath)
+                    break
 
         arglist.addAllArgs(cmd_args, arglist.parser.fblocksGroup)