Code Monkey home page Code Monkey logo

bareflank / llvm-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from llvm/llvm-project

6.0 4.0 6.0 1.26 GB

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

Home Page: http://llvm.org

CMake 0.37% C++ 45.73% C# 0.01% Python 1.35% Batchfile 0.01% Emacs Lisp 0.01% C 11.01% Objective-C 0.69% Objective-C++ 0.18% HTML 0.32% LLVM 29.69% Assembly 10.33% Cuda 0.10% Rust 0.01% M 0.01% Cool 0.01% Roff 0.01% Shell 0.04% Fortran 0.15% RenderScript 0.01%

llvm-project's Introduction

The LLVM Compiler Infrastructure

This directory and its sub-directories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.

The README briefly describes how to get started with building LLVM. For more information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.

Getting Started with the LLVM System

Taken from https://llvm.org/docs/GettingStarted.html.

Overview

Welcome to the LLVM project!

The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and converts it into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer. It also contains basic regression tests.

C-like languages use the Clang front end. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.

Other components include: the libc++ C++ standard library, the LLD linker, and more.

Getting the Source Code and Building LLVM

The LLVM Getting Started documentation may be out of date. The Clang Getting Started page might have more accurate information.

This is an example work-flow and configuration to get and build the LLVM source:

  1. Checkout LLVM (including related sub-projects like Clang):

    • git clone https://github.com/llvm/llvm-project.git

    • Or, on windows, git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git

  2. Configure and build LLVM and Clang:

    • cd llvm-project

    • mkdir build

    • cd build

    • cmake -G <generator> [options] ../llvm

      Some common build system generators are:

      • Ninja --- for generating Ninja build files. Most llvm developers use Ninja.
      • Unix Makefiles --- for generating make-compatible parallel makefiles.
      • Visual Studio --- for generating Visual Studio projects and solutions.
      • Xcode --- for generating Xcode projects.

      Some Common options:

      • -DLLVM_ENABLE_PROJECTS='...' --- semicolon-separated list of the LLVM sub-projects you'd like to additionally build. Can include any of: clang, clang-tools-extra, libcxx, libcxxabi, libunwind, lldb, compiler-rt, lld, polly, or debuginfo-tests.

        For example, to build LLVM, Clang, libcxx, and libcxxabi, use -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi".

      • -DCMAKE_INSTALL_PREFIX=directory --- Specify for directory the full path name of where you want the LLVM tools and libraries to be installed (default /usr/local).

      • -DCMAKE_BUILD_TYPE=type --- Valid options for type are Debug, Release, RelWithDebInfo, and MinSizeRel. Default is Debug.

      • -DLLVM_ENABLE_ASSERTIONS=On --- Compile with assertion checks enabled (default is Yes for Debug builds, No for all other build types).

    • cmake --build . [-- [options] <target>] or your build system specified above directly.

      • The default target (i.e. ninja or make) will build all of LLVM.

      • The check-all target (i.e. ninja check-all) will run the regression tests to ensure everything is in working order.

      • CMake will generate targets for each tool and library, and most LLVM sub-projects generate their own check-<project> target.

      • Running a serial build will be slow. To improve speed, try running a parallel build. That's done by default in Ninja; for make, use the option -j NNN, where NNN is the number of parallel jobs, e.g. the number of CPUs you have.

    • For more information see CMake

Consult the Getting Started with LLVM page for detailed information on configuring and compiling LLVM. You can visit Directory Layout to learn about the layout of the source code tree.

llvm-project's People

Contributors

akyrtzi avatar arsenm avatar chandlerc avatar chapuni avatar d0k avatar ddunbar avatar douggregor avatar dwblaikie avatar echristo avatar eefriedman avatar ericwf avatar espindola avatar isanbard avatar kcc avatar labath avatar lattner avatar majnemer avatar nico avatar pcc avatar resistor avatar rjmccall avatar rksimon avatar rnk avatar rotateright avatar rui314 avatar stoklund avatar tkremenek avatar tobiasgrosser avatar topperc avatar zygoloid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

llvm-project's Issues

[BUG]: bsl-var-braced-init

/home/quinnr/working/bsl/tests/basic_string_view/behavior_string_view.cpp:74:20: error: variable is not initialized via direct list initialization [bsl-var-braced-init,-warnings-as-errors]
        for (auto &e : res.data) {
                   ^
/home/quinnr/working/bsl/tests/basic_string_view/behavior_string_view.cpp:74:22: error: use of '++' is mixed with other operations [bsl-op-mixed-increment-decrement,-warnings-as-errors]
        for (auto &e : res.data) {
                     ^
/home/quinnr/working/bsl/tests/basic_string_view/behavior_string_view.cpp:74:24: error: variable is not initialized via direct list initialization [bsl-var-braced-init,-warnings-as-errors]
        for (auto &e : res.data) {

[BUG]: bsl-op-mixed-increment-decrement

/home/quinnr/working/bsl/tests/basic_string_view/behavior_string_view.cpp:74:22: error: use of '++' is mixed with other operations [bsl-op-mixed-increment-decrement,-warnings-as-errors]
        for (auto &e : res.data) {
                     ^

[BUG]: bsl-class-member-init

The implementation of ifmap_linux uses all member initializers, but this seems hung up on the use of a default constructor here.

/home/quinnr/working/bsl/cmake/interface/../../include/bsl/details/ifmap_linux.hpp:91:9: error: must use either in-class initializers for all fields or constructor initializers for all fields [bsl-class-member-init,-warnings-as-errors]
        ifmap() noexcept = default;
        ^
/home/quinnr/working/bsl/cmake/interface/../../include/bsl/details/ifmap_linux.hpp:57:26: note: found in-class initializer here
        bsl::int32 m_file{-1};

[BUG]: bsl-destructor-access-specifier

The following code:

auto test = []{ bsl::print() << "Hello World\n"; };

Produces the following error:

/home/quinnr/working/bsl/tests/add_const/overview.cpp:60:17: error: base class destructor must be public virtual, public override, or protected non-virtual. If public destructor is nonvirtual, then class must be declared final. [bsl-destructor-access-specifier,-warnings-as-errors]
    auto test = []{ bsl::print() << "Hello World\n"; };

Lambdas are actually classes that are auto-generated by the compiler. In this case, the test is picking up on the auto-generated class which has a defined destructor that does not adhere to the rules. The test needs to be modified to ignore this case.

[BUG]: bsl-literals-unsigned-suffix and bsl-literals-uppercase-suffix

The following code:

#include <bsl/aligned_storage.hpp>
#include <bsl/alignment_of.hpp>

#include <bsl/ut.hpp>

namespace
{
    template<typename T, bsl::uintmax align>
    constexpr void
    test_aligned_storage() noexcept
    {
        using namespace bsl;

        static_assert(alignment_of<aligned_storage_t<sizeof(T), align>>::value == align);
        static_assert(sizeof(aligned_storage_t<sizeof(T), align>) >= sizeof(T));
    }
}

/// <!-- description -->
///   @brief Main function for this unit test. If a call to ut_check() fails
///     the application will fast fail. If all calls to ut_check() pass, this
///     function will successfully return with bsl::exit_success.
///
/// <!-- inputs/outputs -->
///   @return Always returns bsl::exit_success.
///
bsl::exit_code
main() noexcept
{
    using namespace bsl;

    test_aligned_storage<bsl::int8, 64>();
    test_aligned_storage<bsl::int16, 64>();
    test_aligned_storage<bsl::int32, 64>();
    test_aligned_storage<bsl::int64, 64>();

    test_aligned_storage<bsl::uint8, 64>();
    test_aligned_storage<bsl::uint16, 64>();
    test_aligned_storage<bsl::uint32, 64>();
    test_aligned_storage<bsl::uint64, 64>();

    test_aligned_storage<bsl::uint8[BSL_PAGE_SIZE], BSL_PAGE_SIZE>();    // NOLINT

    return ut_success();
}

Results in:

/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:38:65: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
        static_assert(alignment_of<aligned_storage_t<sizeof(T), align>>::value == align);
                                                                ^
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:38:65: error: integer literal suffix is not uppercase [bsl-literals-uppercase-suffix,-warnings-as-errors]
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:38:83: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
        static_assert(alignment_of<aligned_storage_t<sizeof(T), align>>::value == align);
                                                                                  ^
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:38:83: error: integer literal suffix is not uppercase [bsl-literals-uppercase-suffix,-warnings-as-errors]
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:39:59: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
        static_assert(sizeof(aligned_storage_t<sizeof(T), align>) >= sizeof(T));

If I change the 64 to 64U I get the same error. Technically, it should be 64ULL, which also causes these to show up:

/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:39:59: error: integer literal suffix is not uppercase [bsl-literals-uppercase-suffix,-warnings-as-errors]
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:56:37: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
    test_aligned_storage<bsl::int8, 64ULL>();
                                    ^
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:57:38: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
    test_aligned_storage<bsl::int16, 64ULL>();
                                     ^
/home/quinnr/working/bsl/tests/aligned_storage/overview.cpp:58:38: error: unsigned decimal literal does not end with 'U' [bsl-literals-unsigned-suffix,-warnings-as-errors]
    test_aligned_storage<bsl::int32, 64ULL>();

Which is why I added both tests to this as both have bugs

[BUG]: bsl-identifier-typographically-unambiguous

The following function:

template<typename FUNC>
void
example(FUNC &&f, bsl::cstr_type const name) noexcept
{
    bsl::print() << bsl::fmt{"=<80", '='} << bsl::endl;
    bsl::print() << "example: " << name << bsl::endl;
    bsl::print() << bsl::fmt{"-<80", '-'} << bsl::endl;
    f();
    bsl::print() << bsl::endl;
}

Produces the following error:

/home/quinnr/working/bsl/examples/main.cpp:464:5: error: Identifier typographically ambiguous with identifier 'example' on line 464 [bsl-identifier-typographically-unambiguous,-warnings-as-errors]
    example(FUNC &&f, bsl::cstr_type const name) noexcept
    ^
/home/quinnr/working/bsl/examples/main.cpp:464:20: error: Identifier typographically ambiguous with identifier 'f' on line 464 [bsl-identifier-typographically-unambiguous,-warnings-as-errors]
    example(FUNC &&f, bsl::cstr_type const name) noexcept
                   ^
/home/quinnr/working/bsl/examples/main.cpp:464:44: error: Identifier typographically ambiguous with identifier 'name' on line 464 [bsl-identifier-typographically-unambiguous,-warnings-as-errors]
    example(FUNC &&f, bsl::cstr_type const name) noexcept

There are two issues with this:

  • I am pretty sure that there is no issue with this code, so I think this test is falsely idenifying an issue. I tried to verify this by changing variable/function names to some really odd ball names and it was still an issue.
  • This doesn't really tell me what that "other" definition is that it is colliding with. It should tell me both the offending line and the line that it collided with so that I know other name is.

[BUG]: bsl-unused-return-value

/home/quinnr/working/bsl/cmake/interface/../../include/bsl/basic_string_view.hpp:59:11: error: unused return value [bsl-unused-return-value,-warnings-as-errors]
    class basic_string_view final

[BUG]: bsl-op-bitwise-operands

The following cpp:

        /// <!-- description -->
        ///   @brief Returns *this <<= rhs.
        ///   @include safe_integral/example_safe_integral_assign_lshift.hpp
        ///
        /// <!-- inputs/outputs -->
        ///   @param rhs the value to shift *this by
        ///   @return Returns *this <<= rhs.
        ///
        [[maybe_unused]] constexpr auto
        operator<<=(safe_integral<value_type> const &rhs) &noexcept -> safe_integral<value_type> &
        {
            if constexpr (is_signed<value_type>::value) {
                static_assert(always_false<value_type>(), "signed shift not supported");
            }
            else {
                m_val <<= rhs.m_val;

                if (this->failure()) {
                    m_error = true;
                    return *this;
                }

                if (rhs.failure()) {
                    m_error = true;
                    return *this;
                }

                m_error = false;
                return *this;
            }
        }

Results in

/home/quinnr/working/bsl/cmake/interface/../../include/bsl/details/../safe_integral.hpp:1036:23: error: operands of bitwise operator have unequal types (m_val has type 'type-parameter-0-0', rhs.m_val has type '<dependent type>') [bsl-op-bitwise-operands,-warnings-as-errors]
                m_val <<= rhs.m_val;

[BUG]: bsl-non-pod-classdef

The following code:

    class test final
    {
        bool var{};

    public:
        static constexpr void
        func()
        {}
    };

    class test2 final
    {
    private:
        bool var{};

    public:
        static constexpr void
        func()
        {}
    };

Produces the following errors:

/home/quinnr/working/bsl/tests/add_const/overview.cpp:35:11: error: non-POD class types should have private member data [bsl-non-pod-classdef,-warnings-as-errors]
    class test final
          ^
/home/quinnr/working/bsl/tests/add_const/overview.cpp:45:11: error: non-POD class types should have private member data [bsl-non-pod-classdef,-warnings-as-errors]
    class test2 final

There are two issues with this:

  • In both cases, the member variables are private (member variables for a class are private by default).
  • The error is showing me the class, but it really should show me the member variable that is not private

[BUG]: bsl-op-forbidden-overload

The following code:

return &m_data[index.get()];

Results in:

/home/quinnr/working/bsl/cmake/interface/../../include/bsl/details/carray.hpp:107:20: error: overloaded operator& is forbidden [bsl-op-forbidden-overload,-warnings-as-errors]
            return &m_data[index.get()];

[BUG]: bsl-types-fixed-width-ints

This doesn't seem to be working with headers. It found issues with .cpp files, but it doesn't seem to be seeing issues with headers.

[BUG]: bsl-lambda-param-list

The following code:

auto test = []{ bsl::print() << "Hello World\n"; };

Produces the following error:

/home/quinnr/working/bsl/tests/add_const/overview.cpp:60:17: error: lambda expression with implicit parameter list [bsl-lambda-param-list,-warnings-as-errors]
    auto test = []{ bsl::print() << "Hello World\n"; };

The above lambda has an empty capture list, so it is not implicitly capturing anything.

[BUG]: bsl-unused-return-value

/home/quinnr/working/bsl/cmake/interface/../../include/bsl/basic_errc_type.hpp:290:18: error: unused return value [bsl-unused-return-value,-warnings-as-errors]
            case errc_success.get(): {

[BUG]: bsl-non-pod-static

The following code:

namespace
{
    constinit bsl::basic_errc_type<> const verify_constinit{};

Produces the following error:

/home/quinnr/working/bsl/tests/basic_errc_type/requirements.cpp:31:44: error: non-pod type with static storage duration [bsl-non-pod-static,-warnings-as-errors]
    constinit bsl::basic_errc_type<> const verify_constinit{};

Since this was initialized using constinit, this test should not fail.

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.