Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions libsycl/docs/CodingGuidelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
========================
Libsycl Coding Standards
========================

.. contents::
:local:

Introduction
============

In general ``libsycl`` project adopts LLVM Coding Standards.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link to LLVM Coding Standards would be helpful here I think to ease user's navigation.

Although ``libsycl`` code base has a reason to deviate from the Coding
Standards. API classes interface is defined by SYCL 2020 specification and
don't match the LLVM Coding Standards for Naming.
This document describes points of deviation from LLVM coding standards for the
``libsycl`` project.

Naming
------

Name of Types, Functions, Variables, and Enumerators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There are 2 kinds of declarations that have different rules:

* **SYCL API types** should be declared as it is stated in SYCL 2020
specification. Those declarations are in snake case (e.g.
``create_sub_devices``).
This rule can be applicable to type traits helpers that are used by SYCL API
methods (e.g. see platform::get_info) for style alignment within a
declaration. Decision to use snake case or camel case in this case remains
with a developer.

* **Other types (implementation details)** should follow LLVM Coding Standards
and should be declared in camel case.

Name of Files and Folders
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use term "directory" instead of "folder".

^^^^^^^^^^^^^^^^^^^^^^^^^

* **Folder Names** within ``libsycl`` directory should be in the snake case
(e.g. ``test_e2e``). In some case exceptions may apply: for example
``Inputs`` is usually used as default name for directories, containing helper
classes for LIT tests and that should be excluded from test descovery.

* **File Names in snake case** should be used for all C++ implementation files.
For example files in folders ``include``, ``src``, ``test``, ``utils``,
Copy link
Contributor Author

@KseniyaTikhomirova KseniyaTikhomirova Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test is an umbrella for all types of tests here. I expect test_e2e and unittests follow the same rule.

``tools`` should be named in snake case.

* **File Names in camel case** should be used for other files. For example
files in folders ``cmake/modules``, ``docs`` should be named in camel case.
Exception is extension files (in ``docs``) whose naming should be in snake
case to align with Khronos extensions style.
Loading