IntegerLiteralSeparatorFixer.h 1.2 KB

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