This revision was automatically updated to reflect the committed changes.
Closed by commit rG6271b96bef47: [clang-tidy][modernize-loop-convert] Make loop
var type human readable (authored by zinovy.nis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80536/new/
https://reviews.llvm.org/D80536
Files:
clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
Index:
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
===================================================================
---
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
+++
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
@@ -40,13 +40,14 @@
};
struct T {
+ typedef int value_type;
struct iterator {
- int& operator*();
- const int& operator*()const;
+ value_type &operator*();
+ const value_type &operator*() const;
iterator& operator ++();
bool operator!=(const iterator &other);
- void insert(int);
- int X;
+ void insert(value_type);
+ value_type X;
};
iterator begin();
iterator end();
Index: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -621,6 +621,7 @@
QualType Type = Context->getAutoDeductType();
if (!Descriptor.ElemType.isNull() &&
Descriptor.ElemType->isFundamentalType())
Type = Descriptor.ElemType.getUnqualifiedType();
+ Type = Type.getDesugaredType(*Context);
// If the new variable name is from the aliased variable, then the reference
// type for the new variable should only be used if the aliased variable was
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-loop-convert/structures.h
@@ -40,13 +40,14 @@
};
struct T {
+ typedef int value_type;
struct iterator {
- int& operator*();
- const int& operator*()const;
+ value_type &operator*();
+ const value_type &operator*() const;
iterator& operator ++();
bool operator!=(const iterator &other);
- void insert(int);
- int X;
+ void insert(value_type);
+ value_type X;
};
iterator begin();
iterator end();
Index: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -621,6 +621,7 @@
QualType Type = Context->getAutoDeductType();
if (!Descriptor.ElemType.isNull() && Descriptor.ElemType->isFundamentalType())
Type = Descriptor.ElemType.getUnqualifiedType();
+ Type = Type.getDesugaredType(*Context);
// If the new variable name is from the aliased variable, then the reference
// type for the new variable should only be used if the aliased variable was
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits