summaryrefslogtreecommitdiffstats
path: root/clang/bindings
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-02-20 07:24:03 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-02-20 07:24:03 +0000
commit4590498d05d0b9efa042504eab37ae13384d8972 (patch)
treefea9fb66d912e6aacabe723d2d082d8da2f9b7ab /clang/bindings
parent9f09b3ec173a54f2c9c3196053f57954d9f3f7da (diff)
downloadbcm5719-llvm-4590498d05d0b9efa042504eab37ae13384d8972.tar.gz
bcm5719-llvm-4590498d05d0b9efa042504eab37ae13384d8972.zip
[libclang/python] Use a Python standard library module to create a temporary file.
Patch by Brian Gesiak! llvm-svn: 201762
Diffstat (limited to 'clang/bindings')
-rw-r--r--clang/bindings/python/tests/cindex/test_translation_unit.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py
index f77998e5245..be6cd671ae0 100644
--- a/clang/bindings/python/tests/cindex/test_translation_unit.py
+++ b/clang/bindings/python/tests/cindex/test_translation_unit.py
@@ -1,5 +1,6 @@
import gc
import os
+import tempfile
from clang.cindex import CursorKind
from clang.cindex import Cursor
@@ -93,15 +94,7 @@ def save_tu(tu):
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
OpenPOWER on IntegriCloud