1bdd1243dSDimitry Andric //===--- IntegerLiteralSeparatorFixer.h -------------------------*- C++ -*-===// 2bdd1243dSDimitry Andric // 3bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6bdd1243dSDimitry Andric // 7bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 8bdd1243dSDimitry Andric /// 9bdd1243dSDimitry Andric /// \file 10bdd1243dSDimitry Andric /// This file declares IntegerLiteralSeparatorFixer that fixes C++ integer 11bdd1243dSDimitry Andric /// literal separators. 12bdd1243dSDimitry Andric /// 13bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 14bdd1243dSDimitry Andric 15bdd1243dSDimitry Andric #ifndef LLVM_CLANG_LIB_FORMAT_INTEGERLITERALSEPARATORFIXER_H 16bdd1243dSDimitry Andric #define LLVM_CLANG_LIB_FORMAT_INTEGERLITERALSEPARATORFIXER_H 17bdd1243dSDimitry Andric 18bdd1243dSDimitry Andric #include "TokenAnalyzer.h" 19bdd1243dSDimitry Andric 20bdd1243dSDimitry Andric namespace clang { 21bdd1243dSDimitry Andric namespace format { 22bdd1243dSDimitry Andric 23bdd1243dSDimitry Andric class IntegerLiteralSeparatorFixer { 24bdd1243dSDimitry Andric public: 25bdd1243dSDimitry Andric std::pair<tooling::Replacements, unsigned> process(const Environment &Env, 26bdd1243dSDimitry Andric const FormatStyle &Style); 27bdd1243dSDimitry Andric 28bdd1243dSDimitry Andric private: 29bdd1243dSDimitry Andric bool checkSeparator(const StringRef IntegerLiteral, int DigitsPerGroup) const; 30*1ac55f4cSDimitry Andric std::string format(const StringRef IntegerLiteral, int DigitsPerGroup, 31*1ac55f4cSDimitry Andric int DigitCount, bool RemoveSeparator) const; 32bdd1243dSDimitry Andric 33bdd1243dSDimitry Andric char Separator; 34bdd1243dSDimitry Andric }; 35bdd1243dSDimitry Andric 36bdd1243dSDimitry Andric } // end namespace format 37bdd1243dSDimitry Andric } // end namespace clang 38bdd1243dSDimitry Andric 39bdd1243dSDimitry Andric #endif 40