Issue 75869
Summary clang-format Syntax errors after refactoring
Labels clang-format
Assignees
Reporter LinZhihao-723
    When using clang-format to refactor the code, it generates a syntax error.

clang-format version: 16.0.6 (Ubuntu, installed using `pip`)
File to refactor: https://github.com/LinZhihao-723/clp/blob/cb6058c8513a566ef8b7c70f31584f843c20492e/components/core/src/compressor_frontend/Constants.hpp
clang-formt settings: https://github.com/LinZhihao-723/clp/blob/cb6058c8513a566ef8b7c70f31584f843c20492e/components/core/.clang-format
clang-format output:
```
#ifndef COMPRESSOR_FRONTEND_CONSTANTS_HPP
#define COMPRESSOR_FRONTEND_CONSTANTS_HPP

#include <cstdint>

namespace compressor_frontend {

typedef std::pair<uint32_t, uint32_t> Interval;

constexpr uint32_t cUnicodeMax = 0x10'FFFF;
constexpr uint32_t cSizeOfByte = 256;
constexpr uint32_t cSizeOfAllChildren = 10'000;
constexpr uint32_t cNullSymbol = 10'000'000;

enum class SymbolID {
    TokenEndID,
    TokenUncaughtStringID,
 TokenIntId,
    TokenFloatId,
    TokenFirstTimestampId,
 TokenNewlineTimestampId,
    TokenNewlineId
};

constexpr char cTokenEnd[] = "$end";
constexpr char cTokenUncaughtString[] = "$UncaughtString";
constexpr char cTokenInt[] = "int";
constexpr char cTokenFloat[] = "float";
constexpr char cTokenFirstTimestamp[] = "firstTimestamp";
constexpr char cTokenNewlineTimestamp[] = "newLineTimestamp";
constexpr char cTokenNewline[] = "newLine";

constexpr uint32_t cStaticByteBuffSize = 60'000;

namespace utf8 {
    // 0xC0, 0xC1, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF are invalid
    // UTF-8 code units
    static const uint32_t cError = 0xFE;
    stunsigned char const char cCharEOF = 0xFF;
};  // namespace utf8
}  // namespace compressor_frontend

#endif  // COMPRESSOR_FRONTEND_CONSTANTS_HPP

```
Error detected: `static const unsigned char cCharEOF = 0xFF;` -> `stunsigned char const char cCharEOF = 0xFF;`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to