Giter Site home page Giter Site logo

packtpublishing / learn-llvm-12 Goto Github PK

View Code? Open in Web Editor NEW
471.0 12.0 101.0 629 KB

Learn LLVM 12, published by Packt

License: MIT License

CMake 3.36% C++ 91.02% C 0.22% Lex 0.31% Yacc 0.35% Modula-2 0.27% LLVM 0.11% HTML 2.05% CSS 0.16% JavaScript 2.15%

learn-llvm-12's People

Contributors

afshaank avatar gaurav-packt avatar packt-itservice avatar packtutkarshr avatar redstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn-llvm-12's Issues

errors building llvm from sources using ninja

Hello, dear friends!
I am trying to build from sources and install llvm on windows 10.
Installed all the prerequisites first.
Then: git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake –G Ninja -DLLVM_ENABLE_PROJECTS=clang ../llvm
ninja
The output of the last command is as follows:

[1/4233] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj C:\MinGW\bin\c++.exe -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -IC:/llvm-project/llvm/lib/Support -Iinclude -IC:/llvm-project/llvm/include -isystem "C:/Program Files (x86)/GnuWin32/include" -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -g -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CachePruning.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj -c C:/llvm-project/llvm/lib/Support/CachePruning.cpp In file included from C:/llvm-project/llvm/lib/Support/CachePruning.cpp:16:0: C:/llvm-project/llvm/include/llvm/Support/Errc.h:65:23: error: 'not_supported' is not a member of 'std::errc' not_supported = int(std::errc::not_supported), ^~~ [2/4233] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.obj FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.obj C:\MinGW\bin\c++.exe -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -IC:/llvm-project/llvm/lib/Support -Iinclude -IC:/llvm-project/llvm/include -isystem "C:/Program Files (x86)/GnuWin32/include" -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -g -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\ARMAttributeParser.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.obj -c C:/llvm-project/llvm/lib/Support/ARMAttributeParser.cpp In file included from C:/llvm-project/llvm/lib/Support/ARMAttributeParser.cpp:12:0: C:/llvm-project/llvm/include/llvm/Support/Errc.h:65:23: error: 'not_supported' is not a member of 'std::errc' not_supported = int(std::errc::not_supported), ^~~ [3/4233] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj C:\MinGW\bin\c++.exe -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -IC:/llvm-project/llvm/lib/Support -Iinclude -IC:/llvm-project/llvm/include -isystem "C:/Program Files (x86)/GnuWin32/include" -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -g -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CodeGenCoverage.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -c C:/llvm-project/llvm/lib/Support/CodeGenCoverage.cpp In file included from C:/llvm-project/llvm/lib/Support/CodeGenCoverage.cpp:17:0: C:/llvm-project/llvm/include/llvm/Support/Mutex.h:29:12: error: 'recursive_mutex' in namespace 'std' does not name a type std::recursive_mutex impl; ^~~~~~~~~~~~~~~ C:/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::lock()': C:/llvm-project/llvm/include/llvm/Support/Mutex.h:35:11: error: 'impl' was not declared in this scope impl.lock(); ^~~~ C:/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::unlock()': C:/llvm-project/llvm/include/llvm/Support/Mutex.h:48:11: error: 'impl' was not declared in this scope impl.unlock(); ^~~~ C:/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::try_lock()': C:/llvm-project/llvm/include/llvm/Support/Mutex.h:62:18: error: 'impl' was not declared in this scope return impl.try_lock(); ^~~~ ninja: build stopped: subcommand failed.
Could you please help me?
Thanks in advance!

Error in Driver compilation for Chapter 5

There are some issues in the code of Driver with recent versions of LLVM (I'm using the last version of the LLVM repository), the first problem is with the next code:

sys::fs::OpenFlags OpenFlags = sys::fs::OF_None;
if (FileType == CGFT_AssemblyFile)
    OpenFlags |= sys::fs::OF_Text;

The compiler will complain, so it's necessary to add a missing header:

#include "llvm/Support/FileSystem.h"

Next is the legacy::PassManager, the compiler complains adding the result from createPrintModulePass to the PassManager, since the returned llvm::ModulePass * cannot be casted to the llvm::Pass from that PassManager, so it is possible to use a code similar to the one of the tool opt. First we add the next header:

#include "llvm/Transforms/Utils/Debugify.h"

And then we change the next code:

legacy::PassManager PM;
if (FileType == CGFT_AssemblyFile && EmitLLVM) {
PM.add(createPrintModulePass(Out->os()));
} else {
if (TM->addPassesToEmitFile(PM, Out->os(), nullptr,
FileType)) {
WithColor::error() << "No support for file type\n";
return false;
}
}
PM.run(*M);

For:

llvm::DebugifyCustomPassManager PM;

if (FileType == CGFT_AssemblyFile && EmitLLVM)
    PM.add(createPrintModulePass(Out->os()));
else
{
    if (TM->addPassesToEmitFile(PM, Out->os(), nullptr, FileType))
    {
        WithColor::error() << "No support for file type\n";
        return false;
    }
}

PM.run(*M);

Provide step-by-step commits in Chapter 12.

Hi,

Thanks for the nice book you published. It will be much friendly and much more clear if you can provide step-by-step commit, not only a single diff file of the m88k backend implementation. Just like https://github.com/lowRISC/riscv-llvm, it provides step-by-step diff files. This will provide a timeline sequence about which part of backend should be implemented first, which helps backend beginners a lot!

No default constructor in llvm::AttrBuilder for Code generation (Chapter 5)

In newer versions of LLVM (from LLVM 14), there's no default AttrBuilder constructor, it's necessary to add a LLVMContext.

Modify:

llvm::AttrBuilder Attr;
llvm::TypeSize Sz =
CGM.getModule()->getDataLayout().getTypeStoreSize(
CGM.convertType(FP->getType()));
Attr.addDereferenceableAttr(Sz);
Attr.addAttribute(llvm::Attribute::NoCapture);
Arg->addAttrs(Attr);

For:

llvm::AttrBuilder Attr(CGM.getLLVMCtx()); // add context here from CGM object
llvm::TypeSize Sz = CGM.getModule()->getDataLayout().getTypeStoreSize(CGM.convertType(FP->getType()));
Attr.addDereferenceableAttr(Sz);
Attr.addAttribute(llvm::Attribute::NoCapture);
Arg->addAttrs(Attr);

Chapter03 code doesn't build

/home/source/Learn-LLVM-12/Chapter03/calc/src/CodeGen.cpp: In member function ‘virtual void {anonymous}::ToIRVisitor::visit(WithDecl&)’:
/home/source/Learn-LLVM-12/Chapter03/calc/src/CodeGen.cpp:101:11: error: cannot convert ‘llvm::GlobalVariable*’ to ‘llvm::Type*’
101 | Str, {Int32Zero, Int32Zero}, "ptr");
| ^~~
| |
| llvm::GlobalVariable*
In file included from /home/source/Learn-LLVM-12/Chapter03/calc/src/CodeGen.cpp:3:
/usr/local/include/llvm/IR/IRBuilder.h:1775:34: note: initializing argument 1 of ‘llvm::Value* llvm::IRBuilderBase::CreateInBoundsGEP(llvm::Type*, llvm::Value*, llvm::ArrayRefllvm::Value*, const llvm::Twine&)’
1775 | Value *CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
| ~~~~~~^~
make[2]: *** [src/CMakeFiles/calc.dir/build.make:90: src/CMakeFiles/calc.dir/CodeGen.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: src/CMakeFiles/calc.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Changing the same lines to
Value *Ptr = Builder.CreateInBoundsGEP((llvm::Type *)Str, Int32Zero, Int32Zero, "ptr");
leads to a successful build.
Could you provide a better solution, the casting I have added may not be the best way to write this code.

No Ninja build files

On page 8, (PDF page 27), the recommended way to get a Ninja build is to use:

cmake –G Ninja -DLLVM_ENABLE_PROJECTS=clang ../llvm

But on my system (Ubuntu 22.04) with the default cmake (3.22.1), no build.ninja file is generated. Checking CMakeCache.txt reveals that a simple Unix Makefile Generator is used instead of the Ninja Generator.
What I found out is that the cmake arguments order needs to be changed:

cmake -DLLVM_ENABLE_PROJECTS=clang -G Ninja ../llvm

Couple of issues in Chapter 8 for compiling with LLVM 17.0

I have found a couple of issues that can be easily fixed for allow compilation in last version of LLVM, after those changes the examples compile perfectly and run without problems.

Adding the Pass to the LLVM source code tree, the next line must be added to the file llvm/lib/Passes/CMakeLists.txt:

    CountIR
)

The line must be included as the last on the CMakeLists.txt of LINK_COMPONENTS.

Also in the part of the section of Adding an optimization pipeline to your compiler, in the CMakeLists.txt of the Driver, we must include a DEPENDS:

add_tinylang_tool(tinylang
    Driver.cpp

    DEPENDS
    SUPPORT_PLUGINS
)

For the moment I've spotted, and fixed those issues for the last version of LLVM.

Chapter03/calc: ninja: error: unknown target 'install'

I can use 'ninja' to compile the code, but I cannot use 'ninja install'.
And there is nothing about install appear in the 'build.ninja' file.

$ninja [6/6] Linking CXX executable src/calc $ninja install ninja: error: unknown target 'install'

Unable to build tinylang with LLVM

hello,

I am trying to build the tiny tool based on Chapter 2. I followed the book and also consult the github. However, I am getting the following:


CMake Error at cmake/modules/LLVMProcessSources.cmake:114 (message):
  Found unknown source file Driver.cpp

  Please update /home/amalik/LLVM/tinylang/tools/driver/CMakeLists.txt

Call Stack (most recent call first):
  cmake/modules/LLVMProcessSources.cmake:63 (llvm_check_source_file_list)
  cmake/modules/AddLLVM.cmake:867 (llvm_process_sources)
  /home/amalik/LLVM/tinylang/cmake/modules/AddTinylang.cmake:26 (add_llvm_executable)
  /home/amalik/LLVM/tinylang/cmake/modules/AddTinylang.cmake:30 (add_tinylang_executable)
  /home/amalik/LLVM/tinylang/tools/driver/CMakeLists.txt:3 (add_tinylang_tool)


CMake Error at /home/amalik/LLVM/tinylang/cmake/modules/AddTinylang.cmake:31 (install):
  install does not recognize sub-command TARGET
Call Stack (most recent call first):
  /home/amalik/LLVM/tinylang/tools/driver/CMakeLists.txt:3 

> (add_tinylang_tool)''

I am not sure where things are going wrong. Driver.cpp is there.

Chapter12 m88k.diff file broken and will not compile m88k target specific code

Hi,

The m88k.diff file found in .../Target/M88k will not apply correctly to llvm-12 as it currently exists.

The output from the patch command is shown below.

patch -p1 < ../Learn-LLVM-12-master/Chapter12/m88k.diff
patching file llvm/CMakeLists.txt
Hunk #1 succeeded at 328 (offset 14 lines).
patching file llvm/include/llvm/ADT/Triple.h
Hunk #1 FAILED at 58.
Hunk #2 succeeded at 743 (offset 8 lines).
1 out of 2 hunks FAILED -- saving rejects to file llvm/include/llvm/ADT/Triple.h.rej
patching file llvm/include/llvm/BinaryFormat/ELF.h
Hunk #1 succeeded at 501 (offset 9 lines).
patching file llvm/include/llvm/BinaryFormat/ELFRelocs/M88k.def
patching file llvm/include/llvm/Object/ELFObjectFile.h
Hunk #1 succeeded at 1179 (offset 24 lines).
Hunk #2 succeeded at 1252 (offset 26 lines).
patching file llvm/lib/Object/ELF.cpp
Hunk #1 succeeded at 44 (offset 7 lines).
patching file llvm/lib/ObjectYAML/ELFYAML.cpp
Hunk #1 succeeded at 708 with fuzz 2 (offset 17 lines).
patching file llvm/lib/Support/Triple.cpp
Hunk #1 FAILED at 44.
Hunk #2 succeeded at 109 with fuzz 2 (offset 4 lines).
Hunk #3 FAILED at 284.
Hunk #4 FAILED at 422.
Hunk #5 succeeded at 1446 with fuzz 2 (offset 740 lines).
Hunk #6 FAILED at 1281.
Hunk #7 FAILED at 1365.
Hunk #8 FAILED at 1417.
Hunk #9 succeeded at 1533 (offset 13 lines).
Hunk #10 succeeded at 1566 (offset 14 lines).
Hunk #11 succeeded at 1596 (offset 14 lines).
6 out of 11 hunks FAILED -- saving rejects to file llvm/lib/Support/Triple.cpp.rej
patching file llvm/lib/Target/M88k/AsmParser/CMakeLists.txt
patching file llvm/lib/Target/M88k/AsmParser/LLVMBuild.txt
patching file llvm/lib/Target/M88k/AsmParser/M88kAsmParser.cpp
patching file llvm/lib/Target/M88k/CMakeLists.txt
patching file llvm/lib/Target/M88k/Disassembler/CMakeLists.txt
patching file llvm/lib/Target/M88k/Disassembler/M88kDisassembler.cpp
patching file llvm/lib/Target/M88k/M88k.h
patching file llvm/lib/Target/M88k/M88k.td
patching file llvm/lib/Target/M88k/M88kAsmPrinter.cpp
patching file llvm/lib/Target/M88k/M88kCallingConv.td
patching file llvm/lib/Target/M88k/M88kCondCode.h
patching file llvm/lib/Target/M88k/M88kFrameLowering.cpp
patching file llvm/lib/Target/M88k/M88kFrameLowering.h
patching file llvm/lib/Target/M88k/M88kISelDAGToDAG.cpp
patching file llvm/lib/Target/M88k/M88kISelLowering.cpp
patching file llvm/lib/Target/M88k/M88kISelLowering.h
patching file llvm/lib/Target/M88k/M88kInstrFormats.td
patching file llvm/lib/Target/M88k/M88kInstrInfo.cpp
patching file llvm/lib/Target/M88k/M88kInstrInfo.h
patching file llvm/lib/Target/M88k/M88kInstrInfo.td
patching file llvm/lib/Target/M88k/M88kMCInstLower.cpp
patching file llvm/lib/Target/M88k/M88kMCInstLower.h
patching file llvm/lib/Target/M88k/M88kRegisterInfo.cpp
patching file llvm/lib/Target/M88k/M88kRegisterInfo.h
patching file llvm/lib/Target/M88k/M88kRegisterInfo.td
patching file llvm/lib/Target/M88k/M88kSchedule.td
patching file llvm/lib/Target/M88k/M88kSubtarget.cpp
patching file llvm/lib/Target/M88k/M88kSubtarget.h
patching file llvm/lib/Target/M88k/M88kTargetMachine.cpp
patching file llvm/lib/Target/M88k/M88kTargetMachine.h
patching file llvm/lib/Target/M88k/MCTargetDesc/CMakeLists.txt
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kInstPrinter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kInstPrinter.h
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmBackend.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmInfo.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmInfo.h
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCCodeEmitter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCObjectWriter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCTargetDesc.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCTargetDesc.h
patching file llvm/lib/Target/M88k/README.txt
patching file llvm/lib/Target/M88k/TargetInfo/CMakeLists.txt
patching file llvm/lib/Target/M88k/TargetInfo/M88kTargetInfo.cpp
patching file llvm/lib/Target/M88k/TargetInfo/M88kTargetInfo.h
patching file llvm/test/CodeGen/M88k/and.ll
patching file llvm/test/CodeGen/M88k/or.ll
patching file llvm/test/CodeGen/M88k/shift.ll
patching file llvm/test/CodeGen/M88k/xor.ll
patching file llvm/test/MC/M88k/valid.s

In addition after patching the files by hand the resulting code will not compile. Relevent error messages from the build are shown below.

[ 20%] Building M88kGenAsmMatcher.inc...
Included from /home/doon/Downloads/llvm-project/llvm/lib/Target/M88k/M88k.td:30:
/home/doon/Downloads/llvm-project/llvm/lib/Target/M88k/M88kInstrInfo.td:361:11: error: Value specified for template argument 'LoadStore::OpNode' (#2) is of type PatFrag; expected type SDNode: load
defm LD : LoadStore<0b0001, "ld", load>;
^
make[2]: *** [lib/Target/M88k/CMakeFiles/M88kCommonTableGen.dir/build.make:134: lib/Target/M88k/M88kGenAsmMatcher.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:29080: lib/Target/M88k/CMakeFiles/M88kCommonTableGen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 20%] Building X86GenRegisterBank.inc...
[ 20%] Building X86GenRegisterInfo.inc...
[ 20%] Building X86GenSubtargetInfo.inc...
[ 20%] Built target X86CommonTableGen
make: *** [Makefile:171: all] Error 2

Chapter2 tinylang standalone compiled error

when i compile tinylang standalone it always failed with following message. But it success compiled when integrated with llvm. if anyone encounter and solve this problem?

platform information:

Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.5.0

compile command:

cmake -G Ninja \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DLLVM_DIR=/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm \
    -DCMAKE_INSTALL_PREFIX=../tinylang-output \
    ../tinylang/

ninja
ninja install

error message:

- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Linker detection: ld64
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:436 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_WARNINGS'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Failed
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Success
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:950 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_EH'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:951 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_RTTI'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/CMakeDependentOption.cmake:39 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_EXPORT_SYMBOLS_FOR_PLUGINS'.
Call Stack (most recent call first):
  /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:1115 (CMAKE_DEPENDENT_OPTION)
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - found
-- Performing Test macos_signposts_usable
-- Performing Test macos_signposts_usable - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/xdyang/Documents/Version/llvm-project/build-tinylang
[1/4] Building CXX object tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
FAILED: tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/xdyang/Documents/Version/llvm-project/tinylang/include -Iinclude -I/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=11.4    -fno-exceptions -fno-rtti -MD -MT tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -MF tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o.d -o tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -c /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:48:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:2: error: expected expression
[[noreturn]] void report_fatal_error(const char *reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const char *reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:2: error: expected expression
[[noreturn]] void report_fatal_error(StringRef reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(StringRef reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:2: error: expected expression
[[noreturn]] void report_fatal_error(const Twine &reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const Twine &reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:2: error: expected expression
[[noreturn]] void report_bad_alloc_error(const char *Reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:14: error: expected unqualified-id
[[noreturn]] void report_bad_alloc_error(const char *Reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:2: error: expected expression
[[noreturn]] void
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:14: error: expected unqualified-id
[[noreturn]] void
             ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:98:1: error: unknown type name 'constexpr'
constexpr bool IsBigEndianHost = false;
^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:152:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:40: error: no template named 'underlying_type_t' in namespace 'std'; did you mean 'underlying_type'?
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                  ~~~~~^~~~~~~~~~~~~~~~~
                                       underlying_type
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:4112:8: note: 'underlying_type' declared here
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
       ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:59: error: a space is required between consecutive right angle brackets (use '> >')
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                                          ^~
                                                          > >
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using UnderlyingT = std::remove_reference_t<T>;
                      ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:28: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using UnderlyingT = std::remove_reference_t<T>;
                      ~~~~~^~~~~~~~~~~~~~~~~~
                           remove_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:1298:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:44:59: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
struct add_lvalue_reference_if_not_pointer { using type = T &; };
                                                          ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
    T, std::enable_if_t<std::is_pointer<T>::value>> {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:53: error: expected expression
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                                                    ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected '>'
};
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:24: note: to match this '<'
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                       ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected a type
};
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
[2/4] Building CXX object lib/Basic/CMakeFiles/tinylangBasic.dir/Version.cpp.o
ninja: build stopped: subcommand failed.
[2/4] Building CXX object tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
FAILED: tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/xdyang/Documents/Version/llvm-project/tinylang/include -Iinclude -I/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=11.4    -fno-exceptions -fno-rtti -MD -MT tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -MF tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o.d -o tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -c /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:48:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:2: error: expected expression
[[noreturn]] void report_fatal_error(const char *reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const char *reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:2: error: expected expression
[[noreturn]] void report_fatal_error(StringRef reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(StringRef reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:2: error: expected expression
[[noreturn]] void report_fatal_error(const Twine &reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const Twine &reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:2: error: expected expression
[[noreturn]] void report_bad_alloc_error(const char *Reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:14: error: expected unqualified-id
[[noreturn]] void report_bad_alloc_error(const char *Reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:2: error: expected expression
[[noreturn]] void
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:14: error: expected unqualified-id
[[noreturn]] void
             ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:98:1: error: unknown type name 'constexpr'
constexpr bool IsBigEndianHost = false;
^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:152:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:40: error: no template named 'underlying_type_t' in namespace 'std'; did you mean 'underlying_type'?
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                  ~~~~~^~~~~~~~~~~~~~~~~
                                       underlying_type
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:4112:8: note: 'underlying_type' declared here
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
       ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:59: error: a space is required between consecutive right angle brackets (use '> >')
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                                          ^~
                                                          > >
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using UnderlyingT = std::remove_reference_t<T>;
                      ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:28: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using UnderlyingT = std::remove_reference_t<T>;
                      ~~~~~^~~~~~~~~~~~~~~~~~
                           remove_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:1298:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:44:59: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
struct add_lvalue_reference_if_not_pointer { using type = T &; };
                                                          ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
    T, std::enable_if_t<std::is_pointer<T>::value>> {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:53: error: expected expression
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                                                    ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected '>'
};
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:24: note: to match this '<'
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                       ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected a type
};
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
ninja: build stopped: subcommand failed.

[Windows] Chapter 5: can't emit object or assembler text

From last section "Emitting assembler text and object code"
`**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.5
** Copyright (c) 2021 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x64'

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang>llvm-config --version
12.0.0

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang>llvm-config --cmakedir
C:\Program Files (x86)\LLVM\lib\cmake\llvm

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang>mkdir build

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang>cd build

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang\build>cmake -G Ninja -DLLVM_DIR=C:\Program Files (x86)\LLVM\lib\cmake\llvm ..
-- The C compiler identification is MSVC 19.29.30136.0
-- The CXX compiler identification is MSVC 19.29.30136.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using Debug VC++ CRT: MDd
CMake Warning (dev) at C:/Program Files (x86)/LLVM/lib/cmake/llvm/HandleLLVMOptions.cmake:412 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'LLVM_ENABLE_WARNINGS'.
Call Stack (most recent call first):
CMakeLists.txt:11 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Using Debug VC++ CRT: MDd
CMake Warning (dev) at C:/Program Files (x86)/LLVM/lib/cmake/llvm/HandleLLVMOptions.cmake:887 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'LLVM_ENABLE_EH'.
Call Stack (most recent call first):
CMakeLists.txt:11 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files (x86)/LLVM/lib/cmake/llvm/HandleLLVMOptions.cmake:888 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'LLVM_ENABLE_RTTI'.
Call Stack (most recent call first):
CMakeLists.txt:11 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeDependentOption.cmake:52 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the
normal variable 'LLVM_EXPORT_SYMBOLS_FOR_PLUGINS'.
Call Stack (most recent call first):
C:/Program Files (x86)/LLVM/lib/cmake/llvm/HandleLLVMOptions.cmake:1051 (CMAKE_DEPENDENT_OPTION)
CMakeLists.txt:11 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Configuring done
-- Generating done
-- Build files have been written to: F:/LLVM/Learn-LLVM-12/Chapter05/tinylang/build

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang\build>ninja
[1/17] Building CXX object lib\Basic\CMakeFiles\tinylangBasic.dir\Version.cpp.obj
...
[17/17] Linking CXX executable tools\driver\tinylang.exe

F:\LLVM\Learn-LLVM-12\Chapter05\tinylang\build>tools\driver\tinylang.exe ..\examples\Gcd.mod --mtriple=x86_64-pc-windows-msvc
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: tools\driver\tinylang.exe ..\examples\Gcd.mod --mtriple=x86_64-pc-windows-msvc
#0 0x00007ff7aa5c323c std::_Verify_range(class std::_Vector_const_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>> const &, class std::_Vector_const_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>> const &) C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vector:197:0
#1 0x00007ff7aa5b819e std::_Adl_verify_range<class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>>, class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>>>(class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>> const &, class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char, struct std::char_traits, class std::allocator>>>> const &) C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility:1312:0
#2 0x00007ff7aa5ba4b3 std::any_of<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::basic_string<char,std::char_traits,std::allocator > > > >,<lambda_974eb888392fb18f969c0a6e001adf5a> > C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\algorithm:1215:0
#3 0x00007ff7aa5b64fb main F:\LLVM\Learn-LLVM-12\Chapter05\tinylang\tools\driver\Driver.cpp:142:0
#4 0x00007ff7afe202d9 invoke_main d:\a01_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#5 0x00007ff7afe201be __scrt_common_main_seh d:\a01_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#6 0x00007ff7afe2007e __scrt_common_main d:\a01_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
#7 0x00007ff7afe2036e mainCRTStartup d:\a01_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#8 0x00007fff911f54e0 (C:\WINDOWS\System32\KERNEL32.DLL+0x154e0)
#9 0x00007fff928c485b (C:\WINDOWS\SYSTEM32\ntdll.dll+0x485b)`

Can you help me out with this? Thanks in advance!

Chapter03/can't use "ninja"

When I use "ninja" after "cmake -G Ninja ..":

[6/6] Linking CXX executable src/calc FAILED: src/calc : && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifet ime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wim plicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept -type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-uns upported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions src/CMakeFiles/c alc.dir/Calc.cpp.o src/CMakeFiles/calc.dir/CodeGen.cpp.o src/CMakeFiles/calc.dir/Lexer.cpp.o src/CMakeFiles/ calc.dir/parser.cpp.o src/CMakeFiles/calc.dir/Sema.cpp.o -o src/calc -L/usr/local/lib -Wl,-rpath,/usr/local/lib /usr/local/lib/libLLVMCore.so.19.0git -Wl,-rpath-link,/usr/local/lib && : /usr/bin/ld: src/CMakeFiles/calc.dir/Calc.cpp.o: undefined reference to symbol '_ZN4llvm11raw_ostream5writeEPKcm' /usr/bin/ld: /usr/local/lib/libLLVMSupport.so.19.0git: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

Add DwarfRegNum

// General-purpose registers
foreach I = 0-31 in {
  def R#I : GRi<I, "r"#I>, DwarfRegNum<[I]>;
}

Otherwise, ./llc sum.ll -filetype=obj -march=m88k will fail.

Why `CASE('(', Token::Token::l_paren);` is used ? Is the code repeated?

#define CASE(ch, tok) \
case ch: formToken(token, BufferPtr + 1, tok); break
CASE('+', Token::plus);
CASE('-', Token::minus);
CASE('*', Token::star);
CASE('/', Token::slash);
CASE('(', Token::Token::l_paren);
CASE(')', Token::Token::r_paren);
CASE(':', Token::Token::colon);
CASE(',', Token::Token::comma);
#undef CASE

This is the code in the Lexer::next function in the lexer.cpp in Chapter 03. I want to know why Token::Token::op is used, is the code repeated?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.