diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp b/clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp index f89c539..db5bc61 100644 --- a/clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp +++ b/clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp @@ -40,18 +40,18 @@ static bool containsMisleadingBidi(StringRef Buffer, // // Warn if we end up with an unclosed context. while (CurPtr < Buffer.end()) { - unsigned char C = *CurPtr; + const unsigned char C = *CurPtr; if (isASCII(C)) { ++CurPtr; - bool IsParagrapSep = + const bool IsParagrapSep = (C == 0xA || C == 0xD || (0x1C <= C && C <= 0x1E) || C == 0x85); - bool IsSegmentSep = (C == 0x9 || C == 0xB || C == 0x1F); + const bool IsSegmentSep = (C == 0x9 || C == 0xB || C == 0x1F); if (IsParagrapSep || IsSegmentSep) BidiContexts.clear(); continue; } llvm::UTF32 CodePoint = 0; - llvm::ConversionResult Result = llvm::convertUTF8Sequence( + const llvm::ConversionResult Result = llvm::convertUTF8Sequence( (const llvm::UTF8 **)&CurPtr, (const llvm::UTF8 *)Buffer.end(), &CodePoint, llvm::strictConversion); @@ -94,7 +94,7 @@ public: bool HandleComment(Preprocessor &PP, SourceRange Range) override { // FIXME: check that we are in a /* */ comment - StringRef Text = + const StringRef Text = Lexer::getSourceText(CharSourceRange::getCharRange(Range), PP.getSourceManager(), PP.getLangOpts()); @@ -124,7 +124,7 @@ void MisleadingBidirectionalCheck::registerPPCallbacks( void MisleadingBidirectionalCheck::check( const ast_matchers::MatchFinder::MatchResult &Result) { if (const auto *SL = Result.Nodes.getNodeAs<StringLiteral>("strlit")) { - StringRef Literal = SL->getBytes(); + const StringRef Literal = SL->getBytes(); if (containsMisleadingBidi(Literal, false)) diag(SL->getBeginLoc(), "string literal contains misleading " "bidirectional Unicode characters"); |
