Closed zeule closed 4 days ago
Please provide the version and config of clang-format and the code snippet you used.
Oops, sorry: llvm 18.1.8
.clang-format:
---
BasedOnStyle: LLVM
Language: Cpp
TabWidth: 4
UseTab: AlignWithSpaces
IndentWidth: 4
IndentPPDirectives: AfterHash
In a fragment:
#pragma once
#ifndef HEADER_ID_H
#define HEADER_ID_H // (1)
clang-format inserts indent in (1) after the hash sign
In a fragment:
#pragma once #ifndef HEADER_ID_H #define HEADER_ID_H // (1)
clang-format inserts indent in (1) after the hash sign
Doesn't the pragma make the header guard redundant and vice versa? Anyway, clang-format checks for header guards only at the beginning of the input as it's supposed to.
When IndentPPDirectives is set to AfterHash, placing
#pragma once
at the beginning of the include file make all#include
directives indented.