This revision was automatically updated to reflect the committed changes.
Closed by commit rL262484: [clang-tidy] Fix an assertion failure of 
"SLocEntry::getExpansion()" when… (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D17805?vs=49611&id=49613#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17805

Files:
  clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
  
clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp

Index: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
@@ -8,6 +8,7 @@
 
//===----------------------------------------------------------------------===//
 
 #include "IncludeInserter.h"
+#include "clang/Lex/Token.h"
 
 namespace clang {
 namespace tidy {
@@ -19,14 +20,14 @@
   // Implements PPCallbacks::InclusionDerective(). Records the names and source
   // locations of the inclusions in the main source file being processed.
   void InclusionDirective(SourceLocation HashLocation,
-                          const Token & /*include_token*/,
+                          const Token & IncludeToken,
                           StringRef FileNameRef, bool IsAngled,
                           CharSourceRange FileNameRange,
                           const FileEntry * /*IncludedFile*/,
                           StringRef /*SearchPath*/, StringRef /*RelativePath*/,
                           const Module * /*ImportedModule*/) override {
     Inserter->AddInclude(FileNameRef, IsAngled, HashLocation,
-                         FileNameRange.getEnd());
+                         IncludeToken.getEndLoc());
   }
 
 private:
Index: 
clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
===================================================================
--- 
clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
@@ -0,0 +1,16 @@
+// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 
-isystem %S/Inputs/Headers
+
+// CHECK-FIXES: #include <utility>
+
+#define HEADER <./a.h>
+#include HEADER
+
+struct A {
+};
+
+struct B {
+  B(const A &a) : a(a) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move 
[modernize-pass-by-value]
+// CHECK-FIXES: B(A a) : a(std::move(a)) {}
+  A a;
+};


Index: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "IncludeInserter.h"
+#include "clang/Lex/Token.h"
 
 namespace clang {
 namespace tidy {
@@ -19,14 +20,14 @@
   // Implements PPCallbacks::InclusionDerective(). Records the names and source
   // locations of the inclusions in the main source file being processed.
   void InclusionDirective(SourceLocation HashLocation,
-                          const Token & /*include_token*/,
+                          const Token & IncludeToken,
                           StringRef FileNameRef, bool IsAngled,
                           CharSourceRange FileNameRange,
                           const FileEntry * /*IncludedFile*/,
                           StringRef /*SearchPath*/, StringRef /*RelativePath*/,
                           const Module * /*ImportedModule*/) override {
     Inserter->AddInclude(FileNameRef, IsAngled, HashLocation,
-                         FileNameRange.getEnd());
+                         IncludeToken.getEndLoc());
   }
 
 private:
Index: clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp
@@ -0,0 +1,16 @@
+// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 -isystem %S/Inputs/Headers
+
+// CHECK-FIXES: #include <utility>
+
+#define HEADER <./a.h>
+#include HEADER
+
+struct A {
+};
+
+struct B {
+  B(const A &a) : a(a) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move [modernize-pass-by-value]
+// CHECK-FIXES: B(A a) : a(std::move(a)) {}
+  A a;
+};
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to