Git Product home page Git Product logo

bharadwajy / checkedc-clang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/checkedc-clang

0.0 0.0 0.0 265.46 MB

This repo contains a version of clang that is being modified to support Checked C. Checked C is an extension to C that adds checking to detect or prevent common programming errors such as out-of-bounds memory accesses.

License: Other

CMake 0.11% Objective-C 7.15% C++ 69.81% C 19.79% Python 0.59% Objective-C++ 2.13% MATLAB 0.07% Mercury 0.01% LLVM 0.01% Assembly 0.05% Rust 0.01% Cuda 0.23% Mathematica 0.01% Shell 0.01% M 0.01% Fortran 0.01% Limbo 0.01% RenderScript 0.01% Forth 0.01% Perl 0.03%

checkedc-clang's Introduction

The Checked C clang repo

This repo contains a version of clang that is being modified to support Checked C. Checked C is an extension to C that adds checking to detect or prevent common programming errors such as out-of-bounds memory accesses. The Checked C specification is available at the Checked C repo.

The code for the Checked C version of LLVM/clang lives in two repos: the Checked C clang repo and the Checked C LLVM repo. Each repo is licensed under the University of Illinois/NCSA license. The tests for Checked C live in the Checked C repo. These are language conformance tests, so they are placed with the specification, not the compiler. The test code is licensed under the MIT license. See the file LICENSE.TXT in each repo for complete details of licensing.

Trying out Checked C

Programmers are welcome to ``kick the tires'' on Checked C as it is being implemented. You will have to build your own copy of the compiler for now (we are working on getting a nightly compiler build going):

  • Setup and Build describes the organization of the code, how to set up a development machine to build clang, and how to build clang.
  • Testing describes how to test the compiler once you have built it.
  • The Implementation Notes describe the implementation of Checked C in LLVM\clang.

After you have built the compiler, simply add the -fcheckedc-extension flag to your command-line to enable the Checked C extension.

Compiler development status

Summary

We are implementing a subset of the Checked C extension that can be used to add bounds checking to real-world C programs. After that, we will expand the implementation to include additional Checked C features. The subset includes the new ptr, array_ptr, and checked array types. It also includes in-line bounds declarations, bounds-safe interface annotations, the new cast operators, and checked blocks. The implementation of the subset will be end-to-end within the compiler: it will include parsing, typechecking, other static semantic analysis, and code generation.

We have completed most of the parsing and typechecking work for the subset. We are working on the insertion of runtime bounds checks. We have yet to start on implementing checked blocks, the new cast operators, and checking the correctness of bounds declarations at compile time.

Details

This table summarizes the implementation status for the features of the subset. The columns are the major phases of the compiler and the rows list the language features. A '-' indicates that that a compiler phase is not applicable to the language feature.

Feature Parsing Type checking Other semantic analysis Code generation
ptr type Done Done - Done
array_ptr type Done Done - Done (excluding checks)
checked array type Done Done - Done (excluding checks)
In-line bounds declarations Done Done In-progress -
Bounds-safe interfaces Done Done Done -
Function types with bounds-safe interfaces Done Done - -
Checking of redeclarations - - Done
Expression bounds inference - - In-progress -
Insertion of bounds checks - - - In-progress
Insertion of null checks - - - Not started
Checking correctness of bounds declarations - - Not started -
Relative alignment of bounds declarations Not started _ Not started -
Checked blocks Not started - Not started -
New cast operators Not started Not started Not started -

This table describes features not in the subset, in approximate order of priority of implementation.

Feature Comments
Null-terminated arrays
Restrict taking addresses of variables used in bounds
Restrict taking addresses of members used in member bounds
Flow-sensitive bounds declarations
Where clauses
Checking correctness of where clauses
Bundled blocks
Holds/suspend state of member bounds Depends on flow-sensitive bounds declarations.
Check for undefined order of evaluation issues
Overflow checking of array_ptr pointer arithmetic
Span types Lower priority
Pointers directly to array_ptrs Design is tentative.

Contributing

We welcome contributions to the Checked C project. To get involved in the project, see Contributing to Checked C. We have a wish list of possible projects there.

For code contributions, we follow the standard Github workflow. See Contributing to Checked C for more detail. You will need to sign a contributor license agreement before contributing code.

Code of conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

checkedc-clang's People

Contributors

tkremenek avatar douggregor avatar lattner avatar ddunbar avatar zygoloid avatar akyrtzi avatar rjmccall avatar eefriedman avatar djasper avatar d0k avatar espindola avatar chapuni avatar chandlerc avatar majnemer avatar annazaks avatar jrose-apple avatar xuzhongxing avatar aaronballman avatar dwblaikie avatar rnk avatar echristo avatar nico avatar gribozavr avatar zmodem avatar topperc avatar alexey-bataev avatar atoker avatar r4nt avatar weverything avatar nlewycky avatar

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.