[PATCH] D26328: [ASTImporter] Added ability to import AtomicType nodes

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 07:34:26 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287763: [ASTImporter] Added ability to import AtomicType nodes (authored by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D26328?vs=76976&id=79080#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26328

Files:
  cfe/trunk/lib/AST/ASTImporter.cpp
  cfe/trunk/unittests/AST/ASTImporterTest.cpp


Index: cfe/trunk/lib/AST/ASTImporter.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp
+++ cfe/trunk/lib/AST/ASTImporter.cpp
@@ -39,6 +39,7 @@
 
     // Importing types
     QualType VisitType(const Type *T);
+    QualType VisitAtomicType(const AtomicType *T);
     QualType VisitBuiltinType(const BuiltinType *T);
     QualType VisitDecayedType(const DecayedType *T);
     QualType VisitComplexType(const ComplexType *T);
@@ -1600,6 +1601,14 @@
   return QualType();
 }
 
+QualType ASTNodeImporter::VisitAtomicType(const AtomicType *T){
+  QualType UnderlyingType = Importer.Import(T->getValueType());
+  if(UnderlyingType.isNull())
+    return QualType();
+
+  return Importer.getToContext().getAtomicType(UnderlyingType);
+}
+
 QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) {
   switch (T->getKind()) {
 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
Index: cfe/trunk/unittests/AST/ASTImporterTest.cpp
===================================================================
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp
@@ -474,5 +474,20 @@
 }
 
 
+TEST(ImportType, ImportAtomicType) {
+  MatchVerifier<Decl> Verifier;
+  EXPECT_TRUE(testImport("void declToImport() { typedef _Atomic(int) a_int; }",
+                         Lang_CXX11, "", Lang_CXX11, Verifier,
+                         functionDecl(
+                           hasBody(
+                             compoundStmt(
+                               has(
+                                 declStmt(
+                                   has(
+                                     typedefDecl(
+                                       has(atomicType()))))))))));
+}
+
+
 } // end namespace ast_matchers
 } // end namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26328.79080.patch
Type: text/x-patch
Size: 1836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161123/a41a0e0c/attachment.bin>


More information about the cfe-commits mailing list