Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).
Todo...still need to call the action from the parser...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40693 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index ea724ab..86378a4 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -280,6 +280,11 @@
virtual ExprResult ParseStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
SourceLocation RPLoc); // "({..})"
+
+ // __builtin_types_compatible_p(type1, type2)
+ virtual ExprResult ParseTypesCompatibleExpr(SourceLocation LPLoc,
+ TypeTy *arg1, TypeTy *arg2,
+ SourceLocation RPLoc);
/// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 1570f4a..9ef2e67 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -1565,3 +1565,15 @@
return new StmtExpr(Compound, Ty, LPLoc, RPLoc);
}
+
+Sema::ExprResult Sema::ParseTypesCompatibleExpr(SourceLocation LPLoc,
+ TypeTy *arg1, TypeTy *arg2,
+ SourceLocation RPLoc) {
+ QualType argT1 = QualType::getFromOpaquePtr(arg1);
+ QualType argT2 = QualType::getFromOpaquePtr(arg2);
+
+ assert((!argT1.isNull() && !argT2.isNull()) && "Missing type argument(s)");
+
+ return new TypesCompatibleExpr(Context.IntTy, LPLoc, argT1, argT2, RPLoc);
+}
+