[PATCH] D16080: [CUDA] Add tests for compiling CUDA files with -E.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 13 10:15:10 PST 2016


tra added inline comments.

================
Comment at: test/Driver/cuda-preprocess.cu:13-16
@@ +12,6 @@
+
+// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 %s 2>&1 \
+// RUN:   | FileCheck -check-prefix NOARCH %s
+// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-host-only %s 2>&1 \
+// RUN:   | FileCheck -check-prefix NOARCH %s
+// NOARCH: clang_unittest_no_arch
----------------
Given it's a driver test you probably just want to check the list of commands generated by driver (-###)

Checking preprocessing results would probably belong to test/Preprocessor.


================
Comment at: test/Driver/cuda-preprocess.cu:17
@@ +16,3 @@
+// RUN:   | FileCheck -check-prefix NOARCH %s
+// NOARCH: clang_unittest_no_arch
+
----------------
This would succeed if we fail to preprocess as it would catch 'clang_unittest_no_arch' in the #ifndef above.

I'd add some macro which will get preprocessed away:

```
#ifndef __CUDA_ARCH__
#define PREPROCESSED_AWAY
clang_unittest_no_arch __ PREPROCESSED_AWAY
...
``` 

It may be an overkill, though. Up to you.



http://reviews.llvm.org/D16080





More information about the cfe-commits mailing list