mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Made common a project
This commit is contained in:
@@ -148,9 +148,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="inc\Lexer.h" />
|
||||
<ClInclude Include="inc\LLVM.h" />
|
||||
<ClInclude Include="inc\Parser.h" />
|
||||
<ClInclude Include="inc\Util.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -19,14 +19,8 @@
|
||||
<ClInclude Include="inc\Lexer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\LLVM.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\Parser.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\Util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Helper file for including all neccesarry parts of LLVM //
|
||||
#ifdef _MSC_VER
|
||||
|
||||
// Disables all warnings as LLVM files have a lot of Data-loss casts that won't cause issues //
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4244)
|
||||
#pragma warning(disable : 4267)
|
||||
#pragma warning(disable : 4624)
|
||||
#pragma warning(disable : 4800)
|
||||
|
||||
// Includes the LLVM files //
|
||||
|
||||
#include <llvm/IR/IRBuilder.h>
|
||||
#include <llvm/IR/LLVMContext.h>
|
||||
#include <llvm/IR/Module.h>
|
||||
#include <llvm/IR/Verifier.h>
|
||||
|
||||
// Re-enables all warnings //
|
||||
#pragma warning(pop)
|
||||
|
||||
#else
|
||||
#error This code is only designed to work with MSVC due to the use of vcpkg and other aspects
|
||||
#endif // _MSC_VER
|
||||
@@ -1,22 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Error.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Foward declarations of STD classes to minimise includes //
|
||||
namespace std
|
||||
{
|
||||
template<typename T1>
|
||||
struct char_traits;
|
||||
|
||||
template<typename T1, typename T2>
|
||||
class basic_ofstream;
|
||||
|
||||
using ofstream = basic_ofstream<char, char_traits<char>>;
|
||||
}
|
||||
#include <LX-Common.h>
|
||||
|
||||
// This file contains everything that is exported from Lexer.lib
|
||||
// The rest of the items within the Lexer project are internal only
|
||||
|
||||
@@ -3,21 +3,7 @@
|
||||
// Lexer foward declares fstream components so we can use them here //
|
||||
#include <Lexer.h>
|
||||
|
||||
#include <Error.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
// Foward declares STD stuff that is passed around //
|
||||
namespace std::filesystem { class path; }
|
||||
|
||||
// Foward declares all items of the llvm lib that we need //
|
||||
// Done to avoid including LLVM.h to shorten compile times //
|
||||
namespace llvm
|
||||
{
|
||||
class Value;
|
||||
class AllocaInst;
|
||||
}
|
||||
#include <LX-Common.h>
|
||||
|
||||
// Foward declares the wrapper around the LLVM objects we need to pass around //
|
||||
namespace LX { struct InfoLLVM; }
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
|
||||
// Defining this is only if you are at the point where you should be using a debugger //
|
||||
#define LOG_EVERYTHING
|
||||
|
||||
namespace LX
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
// Helper function for logging //
|
||||
// Only logs the given args if the log is not null //
|
||||
inline void SafeLog(std::ofstream* log, Args... args)
|
||||
{
|
||||
if (log != nullptr) { (*log << ... << args); *log << "\n"; }
|
||||
}
|
||||
|
||||
inline void SafeFlush(std::ofstream* log)
|
||||
{
|
||||
if (log != nullptr)
|
||||
{
|
||||
log->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Gives a standard way to mark a change between different sections within the log output //
|
||||
constexpr const char* LOG_BREAK = "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
|
||||
}
|
||||
@@ -1,16 +1,7 @@
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <LX-Common.h>
|
||||
|
||||
#include <ThrowIf.h>
|
||||
#include <Console.h>
|
||||
#include <Parser.h>
|
||||
#include <Lexer.h>
|
||||
#include <Util.h>
|
||||
|
||||
#include <Error.h>
|
||||
|
||||
namespace LX
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user