[PATCH] D71526: [AST] Use a reference in a range-based for

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 15 12:19:12 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG29e78ec67988: [AST] Use a reference in a range-based for (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71526/new/

https://reviews.llvm.org/D71526

Files:
  clang/lib/AST/ASTContext.cpp


Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -2462,7 +2462,7 @@
       return llvm::None;
 
     SmallVector<std::pair<QualType, int64_t>, 4> Bases;
-    for (const auto Base : ClassDecl->bases()) {
+    for (const auto &Base : ClassDecl->bases()) {
       // Empty types can be inherited from, and non-empty types can potentially
       // have tail padding, so just make sure there isn't an error.
       if (!isStructEmpty(Base.getType())) {
@@ -2480,7 +2480,7 @@
              Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
     });
 
-    for (const auto Base : Bases) {
+    for (const auto &Base : Bases) {
       int64_t BaseOffset = Context.toBits(
           Layout.getBaseClassOffset(Base.first->getAsCXXRecordDecl()));
       int64_t BaseSize = Base.second;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71526.233981.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191215/989603ae/attachment.bin>


More information about the cfe-commits mailing list