summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-22 10:25:39 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-22 10:25:39 +0200
commit8ad58a91a11380203c4a81fe4dc93e7734631b32 (patch)
tree33278ad442e5f20c88c2701a3cb5dcbfd7d3f589 /dev/LibCompiler/src
parentca022f27844a5475dab608bd1970c05494a67290 (diff)
refactor: Reworking the code base, for the C++Drv, and ARM64 assembler.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/src')
-rw-r--r--dev/LibCompiler/src/CCompiler64x0.cc4
-rw-r--r--dev/LibCompiler/src/CCompilerARM64.cc4
-rw-r--r--dev/LibCompiler/src/CCompilerPower64.cc4
-rw-r--r--dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc15
4 files changed, 14 insertions, 13 deletions
diff --git a/dev/LibCompiler/src/CCompiler64x0.cc b/dev/LibCompiler/src/CCompiler64x0.cc
index 17de065..55adc75 100644
--- a/dev/LibCompiler/src/CCompiler64x0.cc
+++ b/dev/LibCompiler/src/CCompiler64x0.cc
@@ -134,7 +134,7 @@ static bool kIfFound = false;
static size_t kBracesCount = 0UL;
/* @brief C compiler backend for C */
-class CompilerFrontend64x0 final : public LibCompiler::ICompilerFrontend {
+class CompilerFrontend64x0 final : public LibCompiler::CompilerFrontendInterface {
public:
explicit CompilerFrontend64x0() = default;
~CompilerFrontend64x0() override = default;
@@ -1044,7 +1044,7 @@ skip_braces_check:
/////////////////////////////////////////////////////////////////////////////////////////
-class AssemblyCCInterface final ASSEMBLY_INTERFACE {
+class AssemblyCCInterface final LC_ASSEMBLY_INTERFACE {
public:
explicit AssemblyCCInterface() = default;
~AssemblyCCInterface() override = default;
diff --git a/dev/LibCompiler/src/CCompilerARM64.cc b/dev/LibCompiler/src/CCompilerARM64.cc
index 3aaab5f..7a342ae 100644
--- a/dev/LibCompiler/src/CCompilerARM64.cc
+++ b/dev/LibCompiler/src/CCompilerARM64.cc
@@ -134,7 +134,7 @@ static bool kIfFound = false;
static size_t kBracesCount = 0UL;
/* @brief C compiler backend for C */
-class CompilerFrontendARM64 final : public LibCompiler::ICompilerFrontend {
+class CompilerFrontendARM64 final : public LibCompiler::CompilerFrontendInterface {
public:
explicit CompilerFrontendARM64() = default;
~CompilerFrontendARM64() override = default;
@@ -1042,7 +1042,7 @@ skip_braces_check:
/////////////////////////////////////////////////////////////////////////////////////////
-class AssemblyCCInterface final ASSEMBLY_INTERFACE {
+class AssemblyCCInterface final LC_ASSEMBLY_INTERFACE {
public:
explicit AssemblyCCInterface() = default;
~AssemblyCCInterface() override = default;
diff --git a/dev/LibCompiler/src/CCompilerPower64.cc b/dev/LibCompiler/src/CCompilerPower64.cc
index aa49768..91cd32f 100644
--- a/dev/LibCompiler/src/CCompilerPower64.cc
+++ b/dev/LibCompiler/src/CCompilerPower64.cc
@@ -125,7 +125,7 @@ static bool kIfFound = false;
static size_t kBracesCount = 0UL;
/* @brief C compiler backend for C */
-class CompilerFrontendPower64 final : public LibCompiler::ICompilerFrontend {
+class CompilerFrontendPower64 final : public LibCompiler::CompilerFrontendInterface {
public:
explicit CompilerFrontendPower64() = default;
~CompilerFrontendPower64() override = default;
@@ -1062,7 +1062,7 @@ skip_braces_check:
/////////////////////////////////////////////////////////////////////////////////////////
-class AssemblyMountpointCLang final ASSEMBLY_INTERFACE {
+class AssemblyMountpointCLang final LC_ASSEMBLY_INTERFACE {
public:
explicit AssemblyMountpointCLang() = default;
~AssemblyMountpointCLang() override = default;
diff --git a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
index e07029b..cc6fa67 100644
--- a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
+++ b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
@@ -123,7 +123,7 @@ static Boolean kInBraces = false;
static size_t kBracesCount = 0UL;
/* @brief C++ compiler backend for the NeKernel C++ driver */
-class CompilerFrontendCPlusPlus final : public LibCompiler::ICompilerFrontend {
+class CompilerFrontendCPlusPlus final : public LibCompiler::CompilerFrontendInterface {
public:
explicit CompilerFrontendCPlusPlus() = default;
~CompilerFrontendCPlusPlus() override = default;
@@ -710,7 +710,7 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, std::string file) {
/////////////////////////////////////////////////////////////////////////////////////////
-class AssemblyCPlusPlusInterface final ASSEMBLY_INTERFACE {
+class AssemblyCPlusPlusInterface final LC_ASSEMBLY_INTERFACE {
public:
explicit AssemblyCPlusPlusInterface() = default;
~AssemblyCPlusPlusInterface() override = default;
@@ -723,7 +723,7 @@ class AssemblyCPlusPlusInterface final ASSEMBLY_INTERFACE {
if (kCompilerFrontend == nullptr) return kExitNO;
std::string dest = src;
- dest += ".masm";
+ dest += ".pp.masm";
std::ofstream out_fp(dest);
@@ -883,11 +883,11 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) {
std::string argv_i = argv[index];
- std::vector exts = kExtListCxx;
+ std::vector<std::string> exts = kExtListCxx;
BOOL found = false;
for (std::string ext : exts) {
- if (argv_i.find(ext) != std::string::npos) {
+ if (argv_i.ends_with(ext)) {
found = true;
if (kFactory.Compile(argv_i, kMachine) != kExitOK) {
@@ -898,7 +898,7 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) {
if (!found) {
if (kVerbose) {
- Detail::print_error(argv_i + " is not a valid C++ source.\n", "cxxdrv");
+ Detail::print_error(argv_i + " is not a valid C++ source.", "cxxdrv");
}
return LIBCOMPILER_INVALID_DATA;
@@ -909,12 +909,13 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) {
delete kCompilerFrontend;
kCompilerFrontend = nullptr;
-
+
kRegisterMap.clear();
kOriginMap.clear();
return LIBCOMPILER_SUCCESS;
}
+//
// Last rev 8-1-24
//