diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java index fd2d6f4ef..5264ae8af 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java @@ -211,8 +211,9 @@ private ClangAstData parsePrivate(File sourceFile, String id, Standard standard, // Set standard to CUDA else if (isCuda) { // The LLVM 18 driver bundled with clang-dumper rejects '-std=cuda'. The .cu extension already - // selects CUDA mode, so use a C++ standard for host-side parsing. - arguments.add(standard.isCxx() ? standard.getFlag() : Standard.CXX17.getFlag()); + // selects CUDA mode, so use a C++ standard for host-side parsing. Standard.CUDA reports + // isCxx() == true, so exclude it explicitly, otherwise the flag would go back to '-std=cuda'. + arguments.add(standard.isCxx() && !standard.isCuda() ? standard.getFlag() : Standard.CXX17.getFlag()); } else { arguments.add(standard.getFlag()); } @@ -243,10 +244,26 @@ else if (isCuda) { else if (isCuda) { if (!SpecsPlatforms.isLinux()) { ClavaLog.info("We only officially support CUDA parsing in Linux, run at your own risk"); - arguments.add("-fms-compatibility"); if (SpecsPlatforms.isWindows()) { - arguments.add("-D_MSC_VER"); - arguments.add("-D_LIBCPP_MSVCRT"); + // The bundled clang-dumper ships MinGW/libc++ headers. CUDA's headers select their + // implementations from _MSC_VER: without a version >= 1800 they use legacy paths + // (int-returning isinf/isnan, glibc-style __signbitl) that conflict with clang's + // own __DEVICE__ declarations. A real MSVC version selects the modern paths. + arguments.add("-D_MSC_VER=1930"); + + // _MSC_VER alone makes clang's builtin __stddef_wchar_t.h typedef wchar_t, which is + // invalid in C++; this macro (predefined by real MSVC) keeps the header silent. + arguments.add("-D_NATIVE_WCHAR_T_DEFINED"); + + // Clang's CUDA host pass defines __ELF__ even on Windows targets, so libc++ + // misses _LIBCPP_OBJECT_FORMAT_COFF and emits an aligned_storage<..., 16384> + // specialization that exceeds clang's 8192-byte alignment cap on Windows. + arguments.add("-D_LIBCPP_OBJECT_FORMAT_COFF"); + + // CUDA's crt/host_defines.h hard-errors on libc++ + x86-64 unless this is defined. + arguments.add("-D_ALLOW_UNSUPPORTED_LIBCPP"); + } else { + arguments.add("-fms-compatibility"); } } diff --git a/Clava-JS/api/LegacyIntegrationTests - C.test.ts b/Clava-JS/api/LegacyIntegrationTests - C.test.ts index ec85066b3..2faee9a7b 100644 --- a/Clava-JS/api/LegacyIntegrationTests - C.test.ts +++ b/Clava-JS/api/LegacyIntegrationTests - C.test.ts @@ -104,11 +104,11 @@ describe("CTest", () => { await newTester().test("Detach.js", "detach.c"); }); - (isWindows ? it.skip : it)("InlineNasLu", async () => { + it.skipIf(isWindows)("InlineNasLu", async () => { await newTester() .checkExpectedOutput(false) .test("InlineNasLu.js", "inline_nas_lu.c"); - }, 10_000); + }, 60_000); it("InlineNasFt", async () => { await newTester() diff --git a/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts b/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts index 8fd880d59..7499d32d5 100644 --- a/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts +++ b/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts @@ -136,7 +136,7 @@ describe("CxxTest", () => { .test("ParamType.js", "param_type.cpp"); }); - (isWindows ? it.skip : it)("Wrap", async () => { + it.skipIf(isWindows)("Wrap", async () => { const tester = newTester().set( ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES ); @@ -218,6 +218,10 @@ describe("CxxTest", () => { tester.setResultsFile("Setters.js.macos.txt"); } + if (isWindows) { + tester.setResultsFile("Setters.js.windows.txt"); + } + await tester.test("Setters.js", "setters.cpp"); }); @@ -538,7 +542,7 @@ describe("CxxApiTest", () => { }); }); -(isWindows ? describe.skip : describe)("CudaTest", () => { +describe.skipIf(isMacOS)("CudaTest", () => { function newTester() { const cudaTester = new ClavaLegacyTester( path.resolve("../ClavaWeaver/resources/clava/test/weaver/"), @@ -556,13 +560,13 @@ describe("CxxApiTest", () => { it("Cuda", async () => { await newTester().test("Cuda.js", "atomicAdd.cu"); - }); + }, 60_000); it("CudaMatrixMul", async () => { await newTester().test("CudaMatrixMul.js", "mult_matrix.cu"); - }); + }, 60_000); it("CudaQuery", async () => { await newTester().test("CudaQuery.js", "sample.cu"); - }); + }, 60_000); }); diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.windows.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.windows.txt new file mode 100644 index 000000000..85feaca2f --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.windows.txt @@ -0,0 +1,34 @@ +Original qualified name: std::chrono::steady_clock::now +Changed qualified name 1: now +Changed qualified name 2: std::now +Changed qualified name 3: std::chrono::_V2::system_clock::now +Changed then: +if(a == 0) { + a = 3; +} +else { + a = 2; +} + +Changed else: +if(a == 0) { + a = 3; +} +else { + a = 4; +} + +Changed condition: +if(a == 3) { + a = 3; +} +else { + a = 4; +} +Changed Function: +double testFunctionType(int a) { + + return 0; +} +Changed FunctionType: +double (int) \ No newline at end of file