[ASTImporter] Added ability to import AtomicType nodes
Patch by: Kareem Khazem Differential Revision: https://reviews.llvm.org/D26328 llvm-svn: 287763
This commit is contained in:
parent
4e9b9cbee9
commit
0866c2f5d4
|
@ -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(const Type *T) {
|
|||
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) \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue