mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 10:19:02 +00:00
Cpp extensions (#1451)
* Add more cpp extensions * Allow FilenameMatcher to be case insensitive --------- Co-authored-by: Darin Morrison <darinmorrison@gmail.com> Co-authored-by: silvanshade <silvanshade@users.noreply.github.com> Co-authored-by: MischaPanch
This commit is contained in:
17 files changed
+263
-18
No files matched your search
@@ -0,0 +1,7 @@
|
||||
#include "b.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = add(3, 4);
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
int add(int a, int b);
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
__global__ auto
|
||||
cuda_hello() -> void
|
||||
{
|
||||
printf("Hello World from GPU!\n");
|
||||
}
|
||||
|
||||
auto
|
||||
main() -> int
|
||||
{
|
||||
cuda_hello<<<1, 1>>>();
|
||||
cudaDeviceSynchronize();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <cstdlib>
|
||||
|
||||
import b;
|
||||
|
||||
auto
|
||||
main() noexcept -> int
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
module;
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
module b;
|
||||
|
||||
auto
|
||||
add(auto x, auto y) -> decltype(x + y)
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
|
||||
auto
|
||||
add_f32(float x, float y) -> float
|
||||
{
|
||||
return add(x, y);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
module;
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
export module b;
|
||||
|
||||
export auto
|
||||
add(auto x, auto y) -> decltype(x + y);
|
||||
|
||||
export auto
|
||||
add_f32(float x, float y) -> float;
|
||||
|
||||
auto
|
||||
add_u32(std::int32_t x, std::int32_t y) -> std::int32_t {
|
||||
return x + y;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// -*- mode: C -*-
|
||||
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
__global__
|
||||
void add_vectors(const float* A, const float* B, float* C)
|
||||
{
|
||||
auto const idx = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
C[idx] = A[idx] + B[idx];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@interface Hello
|
||||
- (void)hello;
|
||||
@end
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// -*- mode: C -*-
|
||||
|
||||
__kernel
|
||||
void add_vectors(__global const float *A, __global const float *B, __global float *C)
|
||||
{
|
||||
int idx = get_global_id(0);
|
||||
C[idx] = A[idx] + B[idx];
|
||||
}
|
||||
@@ -13,5 +13,40 @@
|
||||
"directory": ".",
|
||||
"command": "g++ -std=c++17 -I . -c diagnostics_sample.cpp",
|
||||
"file": "diagnostics_sample.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "C",
|
||||
"command": "clang -std=gnu23 -c a.c",
|
||||
"file": "a.c"
|
||||
},
|
||||
{
|
||||
"directory": "CUDA",
|
||||
"command": "nvcc -std=c++20 -c a.cu",
|
||||
"file": "a.cu"
|
||||
},
|
||||
{
|
||||
"directory": "CXX20",
|
||||
"command": "clang++ -std=gnu++20 -fmodule-file=b=b.pcm -c a.cpp",
|
||||
"file": "a.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "CXX20",
|
||||
"command": "clang++ -std=gnu++20 -fmodule-file=b=b.pcm -c b.cpp",
|
||||
"file": "b.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "CXX20",
|
||||
"command": "clang++ -std=gnu++20 -c b.cppm",
|
||||
"file": "b.cppm"
|
||||
},
|
||||
{
|
||||
"directory": "OpenCL",
|
||||
"command": "clang -std=cl3.0 -c a.cl",
|
||||
"file": "a.cl"
|
||||
},
|
||||
{
|
||||
"directory": "HIP",
|
||||
"command": "hipcc -c a.hip",
|
||||
"file": "a.hip"
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user