[clang-tools-extra] r249258 - SourceRanges are small and trivially copyable, don't them by reference. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 3 21:53:37 PDT 2015


Author: ctopper
Date: Sat Oct  3 23:53:37 2015
New Revision: 249258

URL: http://llvm.org/viewvc/llvm-project?rev=249258&view=rev
Log:
SourceRanges are small and trivially copyable, don't them by reference. NFC

Modified:
    clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
    clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp

Modified: clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp?rev=249258&r1=249257&r2=249258&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp Sat Oct  3 23:53:37 2015
@@ -811,7 +811,7 @@ void LoopFixer::doConversion(ASTContext
     AliasVarIsRef = AliasVar->getType()->isReferenceType();
 
     // We keep along the entire DeclStmt to keep the correct range here.
-    const SourceRange &ReplaceRange = AliasDecl->getSourceRange();
+    SourceRange ReplaceRange = AliasDecl->getSourceRange();
 
     std::string ReplacementText;
     if (AliasUseRequired)

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp?rev=249258&r1=249257&r2=249258&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp Sat Oct  3 23:53:37 2015
@@ -243,11 +243,11 @@ std::vector<FixItHint> IncludeSorter::Ge
   std::string CurrentText;
   std::vector<FixItHint> Fixes;
   for (const auto &LineEdit : Edits) {
-    const SourceRange &EditRange = LineEdit.second.first;
     // If the current edit is on the next line after the previous edit, add it
     // to the current block edit.
     if (LineEdit.first == CurrentEndLine + 1 &&
         CurrentRange.getBegin() != CurrentRange.getEnd()) {
+      SourceRange EditRange = LineEdit.second.first;
       if (EditRange.getBegin() != EditRange.getEnd()) {
         ++CurrentEndLine;
         CurrentRange.setEnd(EditRange.getEnd());
@@ -260,7 +260,7 @@ std::vector<FixItHint> IncludeSorter::Ge
       }
 
       CurrentEndLine = LineEdit.first;
-      CurrentRange = EditRange;
+      CurrentRange = LineEdit.second.first;
       CurrentText = LineEdit.second.second;
     }
   }




More information about the cfe-commits mailing list