[clang-tools-extra] r331156 - Fix up after clang r331155.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 29 22:26:08 PDT 2018


Author: rsmith
Date: Sun Apr 29 22:26:07 2018
New Revision: 331156

URL: http://llvm.org/viewvc/llvm-project?rev=331156&view=rev
Log:
Fix up after clang r331155.

Modified:
    clang-tools-extra/trunk/clang-move/ClangMove.cpp
    clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
    clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
    clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
    clang-tools-extra/trunk/clangd/AST.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Sun Apr 29 22:26:07 2018
@@ -280,7 +280,10 @@ SourceLocation
 getLocForEndOfDecl(const clang::Decl *D,
                    const LangOptions &LangOpts = clang::LangOptions()) {
   const auto &SM = D->getASTContext().getSourceManager();
-  auto EndExpansionLoc = SM.getExpansionRange(D->getLocEnd()).second;
+  // If the expansion range is a character range, this is the location of
+  // the first character past the end. Otherwise it's the location of the
+  // first character in the final token in the range.
+  auto EndExpansionLoc = SM.getExpansionRange(D->getLocEnd()).getEnd();
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(EndExpansionLoc);
   // Try to load the file buffer.
   bool InvalidTemp = false;

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp Sun Apr 29 22:26:07 2018
@@ -374,7 +374,7 @@ static bool LineIsMarkedWithNOLINTinMacr
       return true;
     if (!Loc.isMacroID())
       return false;
-    Loc = SM.getImmediateExpansionRange(Loc).first;
+    Loc = SM.getImmediateExpansionRange(Loc).getBegin();
   }
   return false;
 }

Modified: clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp Sun Apr 29 22:26:07 2018
@@ -81,7 +81,7 @@ void LambdaFunctionNameCheck::check(cons
   if (E->getLocation().isMacroID()) {
     auto ER =
         Result.SourceManager->getImmediateExpansionRange(E->getLocation());
-    if (SuppressMacroExpansions.find(SourceRange(ER.first, ER.second)) !=
+    if (SuppressMacroExpansions.find(ER.getAsRange()) !=
         SuppressMacroExpansions.end()) {
       // This is a macro expansion for which we should not warn.
       return;

Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp Sun Apr 29 22:26:07 2018
@@ -38,7 +38,7 @@ const Stmt *nextStmt(const MatchFinder::
   return nextStmt(Result, Parent);
 }
 
-using ExpansionRanges = std::vector<std::pair<SourceLocation, SourceLocation>>;
+using ExpansionRanges = std::vector<SourceRange>;
 
 /// \bried Get all the macro expansion ranges related to `Loc`.
 ///
@@ -47,8 +47,9 @@ ExpansionRanges getExpansionRanges(Sourc
                                    const MatchFinder::MatchResult &Result) {
   ExpansionRanges Locs;
   while (Loc.isMacroID()) {
-    Locs.push_back(Result.SourceManager->getImmediateExpansionRange(Loc));
-    Loc = Locs.back().first;
+    Locs.push_back(
+        Result.SourceManager->getImmediateExpansionRange(Loc).getAsRange());
+    Loc = Locs.back().getBegin();
   }
   return Locs;
 }
@@ -96,9 +97,9 @@ void MultipleStatementMacroCheck::check(
       InnerRanges.back() != NextRanges.back())
     return;
 
-  diag(InnerRanges.back().first, "multiple statement macro used without "
-                                 "braces; some statements will be "
-                                 "unconditionally executed");
+  diag(InnerRanges.back().getBegin(), "multiple statement macro used without "
+                                      "braces; some statements will be "
+                                      "unconditionally executed");
 }
 
 } // namespace bugprone

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Sun Apr 29 22:26:07 2018
@@ -332,7 +332,7 @@ private:
                NullMacros.end();
       }
 
-      MacroLoc = SM.getExpansionRange(ArgLoc).first;
+      MacroLoc = SM.getExpansionRange(ArgLoc).getBegin();
 
       ArgLoc = Expansion.getSpellingLoc().getLocWithOffset(LocInfo.second);
       if (ArgLoc.isFileID())
@@ -387,7 +387,7 @@ private:
         continue;
       }
 
-      MacroLoc = SM.getImmediateExpansionRange(Loc).first;
+      MacroLoc = SM.getImmediateExpansionRange(Loc).getBegin();
       if (MacroLoc.isFileID() && MacroLoc == TestMacroLoc) {
         // Match made.
         return true;

Modified: clang-tools-extra/trunk/clangd/AST.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/AST.cpp?rev=331156&r1=331155&r2=331156&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/AST.cpp (original)
+++ clang-tools-extra/trunk/clangd/AST.cpp Sun Apr 29 22:26:07 2018
@@ -32,7 +32,7 @@ SourceLocation findNameLoc(const clang::
       //     be "<scratch space>"
       //   * symbols controlled and defined by a compile command-line option
       //     `-DName=foo`, the spelling location will be "<command line>".
-      SpellingLoc = SM.getExpansionRange(D->getLocation()).first;
+      SpellingLoc = SM.getExpansionRange(D->getLocation()).getBegin();
     }
   }
   return SpellingLoc;




More information about the cfe-commits mailing list