File tree 3 files changed +37
-0
lines changed 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1211,6 +1211,9 @@ void UnwrappedLineParser::parsePPDefine() {
1211
1211
return ;
1212
1212
}
1213
1213
1214
+ #ifdef SYCLomatic_CUSTOMIZATION
1215
+ bool MaybeIncludeGuard = false ;
1216
+ #endif // SYCLomatic_CUSTOMIZATION
1214
1217
if (IncludeGuard == IG_IfNdefed &&
1215
1218
IncludeGuardToken->TokenText == FormatTok->TokenText ) {
1216
1219
IncludeGuard = IG_Defined;
@@ -1221,6 +1224,9 @@ void UnwrappedLineParser::parsePPDefine() {
1221
1224
break ;
1222
1225
}
1223
1226
}
1227
+ #ifdef SYCLomatic_CUSTOMIZATION
1228
+ MaybeIncludeGuard = IncludeGuard == IG_Defined;
1229
+ #endif // SYCLomatic_CUSTOMIZATION
1224
1230
}
1225
1231
1226
1232
// In the context of a define, even keywords should be treated as normal
@@ -1231,6 +1237,13 @@ void UnwrappedLineParser::parsePPDefine() {
1231
1237
FormatTok->Tok .setKind (tok::identifier);
1232
1238
FormatTok->Tok .setIdentifierInfo (Keywords.kw_internal_ident_after_define );
1233
1239
nextToken ();
1240
+
1241
+ #ifdef SYCLomatic_CUSTOMIZATION
1242
+ // IncludeGuard can't have a non-empty macro definition.
1243
+ if (MaybeIncludeGuard && !eof ())
1244
+ IncludeGuard = IG_Rejected;
1245
+ #endif // SYCLomatic_CUSTOMIZATION
1246
+
1234
1247
if (FormatTok->Tok .getKind () == tok::l_paren &&
1235
1248
!FormatTok->hasWhitespaceBefore ()) {
1236
1249
parseParens ();
Original file line number Diff line number Diff line change
1
+ IndentPPDirectives : BeforeHash
Original file line number Diff line number Diff line change
1
+ // RUN: cd %S
2
+ // RUN: dpct --out-root %T %s --cuda-include-path="%cuda-path/include"
3
+ // RUN: FileCheck %s --match-full-lines --input-file %T/BeforeHash.dp.cpp
4
+ // RUN: %if build_lit %{icpx -c -fsycl %T/BeforeHash.dp.cpp -o %T/BeforeHash.dp.o %}
5
+
6
+ #ifndef ABCD
7
+ #define ABCD 0
8
+ #endif
9
+
10
+ // CHECK: #define DPCT_PROFILING_ENABLED
11
+ // CHECK-NEXT: #include <sycl/sycl.hpp>
12
+ // CHECK-NEXT: #include <dpct/dpct.hpp>
13
+ // CHECK-NEXT: #include <cstdio>
14
+ #include < cstdio>
15
+
16
+ // CHECK: void foo() {
17
+ // CHECK-NEXT: dpct::event_ptr start;
18
+ // CHECK-NEXT: dpct::sync_barrier(start);
19
+ // CHECK-NEXT: }
20
+ void foo () {
21
+ cudaEvent_t start;
22
+ cudaEventRecord (start);
23
+ }
You can’t perform that action at this time.
0 commit comments