summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-31 00:14:07 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-31 00:14:07 +0000
commit34866c7719f893c957d93f5918f760b6edebd6be (patch)
tree99993f8a0fe6978857272dddd3dfe01dd77f876c /clang/lib/Serialization
parent98cfa1044fdcaaa53625c16bb9a246e0b15f7653 (diff)
downloadbcm5719-llvm-34866c7719f893c957d93f5918f760b6edebd6be.tar.gz
bcm5719-llvm-34866c7719f893c957d93f5918f760b6edebd6be.zip
Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTCommon.cpp3
-rw-r--r--clang/lib/Serialization/ASTReader.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTCommon.cpp b/clang/lib/Serialization/ASTCommon.cpp
index 67f74f7d7a5..0ec03cfe1e6 100644
--- a/clang/lib/Serialization/ASTCommon.cpp
+++ b/clang/lib/Serialization/ASTCommon.cpp
@@ -60,6 +60,9 @@ serialization::TypeIdxFromBuiltin(const BuiltinType *BT) {
case BuiltinType::ObjCId: ID = PREDEF_TYPE_OBJC_ID; break;
case BuiltinType::ObjCClass: ID = PREDEF_TYPE_OBJC_CLASS; break;
case BuiltinType::ObjCSel: ID = PREDEF_TYPE_OBJC_SEL; break;
+ case BuiltinType::BuiltinFn:
+ ID = PREDEF_TYPE_BUILTIN_FN; break;
+
}
return TypeIdx(ID);
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index ff46bf0e134..478217bd038 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4466,6 +4466,10 @@ QualType ASTReader::GetType(TypeID ID) {
case PREDEF_TYPE_VA_LIST_TAG:
T = Context.getVaListTagType();
break;
+
+ case PREDEF_TYPE_BUILTIN_FN:
+ T = Context.BuiltinFnTy;
+ break;
}
assert(!T.isNull() && "Unknown predefined type");
OpenPOWER on IntegriCloud