diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp b/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp index 8a32c38..69caaed 100644 --- a/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp +++ b/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp @@ -43,7 +43,7 @@ AST_POLYMORPHIC_MATCHER(isObjCManagedLifetime, AST_POLYMORPHIC_SUPPORTED_TYPES(ObjCIvarRefExpr, DeclRefExpr, MemberExpr)) { - QualType QT = Node.getType(); + const QualType QT = Node.getType(); return QT->isScalarType() && (QT->getScalarTypeKind() == Type::STK_ObjCObjectPointer || QT->getScalarTypeKind() == Type::STK_BlockPointer) && @@ -55,12 +55,12 @@ AST_POLYMORPHIC_MATCHER(isObjCManagedLifetime, static std::optional<FixItHint> fixItHintReplacementForOwnershipString(StringRef Text, CharSourceRange Range, StringRef Ownership) { - size_t Index = Text.find(Ownership); + const size_t Index = Text.find(Ownership); if (Index == StringRef::npos) return std::nullopt; - SourceLocation Begin = Range.getBegin().getLocWithOffset(Index); - SourceLocation End = Begin.getLocWithOffset(Ownership.size()); + const SourceLocation Begin = Range.getBegin().getLocWithOffset(Index); + const SourceLocation End = Begin.getLocWithOffset(Ownership.size()); return FixItHint::CreateReplacement(SourceRange(Begin, End), UnsafeUnretainedText); } @@ -76,7 +76,7 @@ fixItHintForVarDecl(const VarDecl *VD, const SourceManager &SM, // Currently there is no way to directly get the source range for the // __weak/__strong ObjC lifetime qualifiers, so it's necessary to string // search in the source code. - CharSourceRange Range = Lexer::makeFileCharRange( + const CharSourceRange Range = Lexer::makeFileCharRange( CharSourceRange::getTokenRange(VD->getSourceRange()), SM, LangOpts); if (Range.isInvalid()) { // An invalid range likely means inside a macro, in which case don't supply @@ -84,7 +84,7 @@ fixItHintForVarDecl(const VarDecl *VD, const SourceManager &SM, return std::nullopt; } - StringRef VarDeclText = Lexer::getSourceText(Range, SM, LangOpts); + const StringRef VarDeclText = Lexer::getSourceText(Range, SM, LangOpts); if (std::optional<FixItHint> Hint = fixItHintReplacementForOwnershipString(VarDeclText, Range, WeakText)) return Hint; |
