r287763 - [ASTImporter] Added ability to import AtomicType nodes
Gabor Horvath via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 07:24:24 PST 2016
Author: xazax
Date: Wed Nov 23 09:24:23 2016
New Revision: 287763
URL: http://llvm.org/viewvc/llvm-project?rev=287763&view=rev
Log:
[ASTImporter] Added ability to import AtomicType nodes
Patch by: Kareem Khazem
Differential Revision: https://reviews.llvm.org/D26328
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=287763&r1=287762&r2=287763&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Nov 23 09:24:23 2016
@@ -39,6 +39,7 @@ namespace clang {
// 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 @@ QualType ASTNodeImporter::VisitType(cons
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) \
Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=287763&r1=287762&r2=287763&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Wed Nov 23 09:24:23 2016
@@ -474,5 +474,20 @@ TEST(ImportExpr, ImportVAArgExpr) {
}
+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
More information about the cfe-commits
mailing list