Skip to content

Commit 9d716ba

Browse files
authored
[SYCLomatic] Fix the unreduced type processing in dpct when input source code has build error on using "auto" for type (#2826)
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
1 parent dd05b19 commit 9d716ba

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
25112511
CharUnits getTypeSizeInChars(const Type *T) const;
25122512

25132513
std::optional<CharUnits> getTypeSizeInCharsIfKnown(QualType Ty) const {
2514+
#ifdef SYCLomatic_CUSTOMIZATION
2515+
if (Ty->isIncompleteType() || Ty->isDependentType() ||
2516+
Ty->isUndeducedType())
2517+
#else
25142518
if (Ty->isIncompleteType() || Ty->isDependentType())
2519+
#endif
25152520
return std::nullopt;
25162521
return getTypeSizeInChars(Ty);
25172522
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: dpct --out-root %T %s --cuda-include-path="%cuda-path/include" > %T/auto_deduce_output.txt 2>&1 || true
2+
// RUN: grep "dpct internal error" %T/auto_deduce_output.txt | wc -l > %T/wc_auto_deduce_output.txt || true
3+
// RUN: FileCheck %s --match-full-lines --input-file %T/wc_auto_deduce_output.txt
4+
// RUN: rm -rf %T
5+
6+
// CHECK: 0
7+
8+
__device__ void test_auto() {
9+
10+
auto tid = get_tid();
11+
}

0 commit comments

Comments
 (0)