[PATCH] D65589: [clang] Fix mismatched args constructing AddressSpaceAttr.

Anton Bikineev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 04:15:16 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368152: [clang] Fix mismatched args constructing AddressSpaceAttr. (authored by AntonBikineev, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65589?vs=212882&id=213840#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65589

Files:
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/unittests/AST/ASTTraverserTest.cpp


Index: cfe/trunk/lib/Sema/SemaType.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -5978,9 +5978,9 @@
     }
 
     ASTContext &Ctx = S.Context;
-    auto *ASAttr = ::new (Ctx) AddressSpaceAttr(
-        Attr.getRange(), Ctx, Attr.getAttributeSpellingListIndex(),
-        static_cast<unsigned>(ASIdx));
+    auto *ASAttr = ::new (Ctx)
+        AddressSpaceAttr(Attr.getRange(), Ctx, static_cast<unsigned>(ASIdx),
+                         Attr.getAttributeSpellingListIndex());
 
     // If the expression is not value dependent (not templated), then we can
     // apply the address space qualifiers just to the equivalent type.
Index: cfe/trunk/unittests/AST/ASTTraverserTest.cpp
===================================================================
--- cfe/trunk/unittests/AST/ASTTraverserTest.cpp
+++ cfe/trunk/unittests/AST/ASTTraverserTest.cpp
@@ -139,6 +139,8 @@
 { 
 };
 
+void parmvardecl_attr(struct A __attribute__((address_space(19)))*);
+
 )cpp");
 
   const FunctionDecl *Func = getFunctionNode(AST.get(), "func");
@@ -220,5 +222,16 @@
                     R"cpp(
 TemplateArgument
 )cpp");
+
+  Func = getFunctionNode(AST.get(), "parmvardecl_attr");
+
+  const auto *Parm = Func->getParamDecl(0);
+  const auto TL = Parm->getTypeSourceInfo()->getTypeLoc();
+  ASSERT_TRUE(TL.getType()->isPointerType());
+
+  const auto ATL = TL.getNextTypeLoc().getAs<AttributedTypeLoc>();
+  const auto *AS = cast<AddressSpaceAttr>(ATL.getAttr());
+  EXPECT_EQ(toTargetAddressSpace(static_cast<LangAS>(AS->getAddressSpace())),
+            19u);
 }
 } // namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65589.213840.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190807/4d956805/attachment-0001.bin>


More information about the cfe-commits mailing list