Patch by Brian Gesiak!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201762
91177308-0d34-0410-b5e6-
96231b3b80d8
import gc
import os
+import tempfile
from clang.cindex import CursorKind
from clang.cindex import Cursor
Returns the filename it was saved to.
"""
-
- # FIXME Generate a temp file path using system APIs.
- base = 'TEMP_FOR_TRANSLATIONUNIT_SAVE.c'
- path = os.path.join(kInputsDir, base)
-
- # Just in case.
- if os.path.exists(path):
- os.unlink(path)
-
+ _, path = tempfile.mkstemp()
tu.save(path)
return path