[cfe-commits] r96648 - in /cfe/trunk: lib/AST/ASTImporter.cpp test/ASTMerge/Inputs/exprs1.c test/ASTMerge/Inputs/exprs2.c
Douglas Gregor
dgregor at apple.com
Thu Feb 18 17:32:14 PST 2010
Author: dgregor
Date: Thu Feb 18 19:32:14 2010
New Revision: 96648
URL: http://llvm.org/viewvc/llvm-project?rev=96648&view=rev
Log:
AST import for CStyleCastExpr. With this, we can import Cocoa.h into an empty context
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/Inputs/exprs1.c
cfe/trunk/test/ASTMerge/Inputs/exprs2.c
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=96648&r1=96647&r2=96648&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Thu Feb 18 19:32:14 2010
@@ -116,6 +116,7 @@
Expr *VisitBinaryOperator(BinaryOperator *E);
Expr *VisitCompoundAssignOperator(CompoundAssignOperator *E);
Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
+ Expr *VisitCStyleCastExpr(CStyleCastExpr *E);
};
}
@@ -2747,6 +2748,25 @@
E->isLvalueCast());
}
+Expr *ASTNodeImporter::VisitCStyleCastExpr(CStyleCastExpr *E) {
+ QualType T = Importer.Import(E->getType());
+ if (T.isNull())
+ return 0;
+
+ Expr *SubExpr = Importer.Import(E->getSubExpr());
+ if (!SubExpr)
+ return 0;
+
+ TypeSourceInfo *TInfo = Importer.Import(E->getTypeInfoAsWritten());
+ if (!TInfo && E->getTypeInfoAsWritten())
+ return 0;
+
+ return new (Importer.getToContext()) CStyleCastExpr(T, E->getCastKind(),
+ SubExpr, TInfo,
+ Importer.Import(E->getLParenLoc()),
+ Importer.Import(E->getRParenLoc()));
+}
+
ASTImporter::ASTImporter(Diagnostic &Diags,
ASTContext &ToContext, FileManager &ToFileManager,
ASTContext &FromContext, FileManager &FromFileManager)
Modified: cfe/trunk/test/ASTMerge/Inputs/exprs1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/Inputs/exprs1.c?rev=96648&r1=96647&r2=96648&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/Inputs/exprs1.c (original)
+++ cfe/trunk/test/ASTMerge/Inputs/exprs1.c Thu Feb 18 19:32:14 2010
@@ -4,6 +4,7 @@
E0_Val1 = (17),
E0_Val2 = (1 << 2),
E0_Val3 = E0_Val2,
- E0_Val4 = sizeof(int*)
+ E0_Val4 = sizeof(int*),
+ E0_Val5 = (unsigned int)-1
};
Modified: cfe/trunk/test/ASTMerge/Inputs/exprs2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/Inputs/exprs2.c?rev=96648&r1=96647&r2=96648&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/Inputs/exprs2.c (original)
+++ cfe/trunk/test/ASTMerge/Inputs/exprs2.c Thu Feb 18 19:32:14 2010
@@ -4,6 +4,7 @@
E0_Val1 = (17),
E0_Val2 = (1 << 2),
E0_Val3 = E0_Val2,
- E0_Val4 = sizeof(int*)
+ E0_Val4 = sizeof(int*),
+ E0_Val5 = (unsigned int)-1
};
More information about the cfe-commits
mailing list