summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-29 04:51:27 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-29 04:51:27 +0000
commit3be4b122d38ebe00bfa585b3f5c99d146398398f (patch)
tree38bc001bafbaf8f777f658cb7f8868b1dd59d461 /clang/lib/Sema/SemaExpr.cpp
parent51ba8d063030e08dc8d9344f6c1cb0c1348dd1a4 (diff)
downloadbcm5719-llvm-3be4b122d38ebe00bfa585b3f5c99d146398398f.tar.gz
bcm5719-llvm-3be4b122d38ebe00bfa585b3f5c99d146398398f.zip
Implement the GNU __null extension
llvm-svn: 60235
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e21047e10d8..fb964692b35 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3603,6 +3603,18 @@ Sema::ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
return new VAArgExpr(BuiltinLoc, E, T.getNonReferenceType(), RPLoc);
}
+Sema::ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
+ // The type of __null will be int or long, depending on the size of
+ // pointers on the target.
+ QualType Ty;
+ if (Context.Target.getPointerWidth(0) == Context.Target.getIntWidth())
+ Ty = Context.IntTy;
+ else
+ Ty = Context.LongTy;
+
+ return new GNUNullExpr(Ty, TokenLoc);
+}
+
bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
SourceLocation Loc,
QualType DstType, QualType SrcType,
OpenPOWER on IntegriCloud