aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-07-28 02:25:19 +0000
committerMike Stump <mrs@apple.com>2009-07-28 02:25:19 +0000
commit782fa308a765aeac2acb39c4e697c937ec21185b (patch)
tree3bd6c43f32e0d1c70fb66aed8a15c0332c86b1d1 /include/clang
parent0cfeb63f532973777f6fe75d3468c3acad4adfe3 (diff)
Make longjmp a real builtin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/ASTContext.h34
-rw-r--r--include/clang/Basic/Builtins.def10
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--include/clang/Frontend/PCHBitCodes.h6
4 files changed, 48 insertions, 4 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 7768ba49d5..c7faefc17f 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -130,6 +130,12 @@ class ASTContext {
/// \brief The type for the C FILE type.
TypeDecl *FILEDecl;
+ /// \brief The type for the C FILE type.
+ TypeDecl *jmp_bufDecl;
+
+ /// \brief The type for the C FILE type.
+ TypeDecl *sigjmp_bufDecl;
+
/// \brief Keeps track of all declaration attributes.
///
/// Since so few decls have attrs, we keep them in a hash map instead of
@@ -499,6 +505,28 @@ public:
return getTypeDeclType(FILEDecl);
return QualType();
}
+
+ /// \brief Set the type for the C jmp_buf type.
+ void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
+ { this->jmp_bufDecl = jmp_bufDecl; }
+
+ /// \brief Retrieve the C jmp_buf type.
+ QualType getjmp_bufType() {
+ if (jmp_bufDecl)
+ return getTypeDeclType(jmp_bufDecl);
+ return QualType();
+ }
+
+ /// \brief Set the type for the C sigjmp_buf type.
+ void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl)
+ { this->sigjmp_bufDecl = sigjmp_bufDecl; }
+
+ /// \brief Retrieve the C sigjmp_buf type.
+ QualType getsigjmp_bufType() {
+ if (sigjmp_bufDecl)
+ return getTypeDeclType(sigjmp_bufDecl);
+ return QualType();
+ }
/// getObjCEncodingForType - Emit the ObjC type encoding for the
/// given type into \arg S. If \arg NameFields is specified then
@@ -558,8 +586,10 @@ public:
const IdentifierInfo *Name);
enum GetBuiltinTypeError {
- GE_None, //< No error
- GE_Missing_FILE //< Missing the FILE type from <stdio.h>
+ GE_None, //< No error
+ GE_Missing_FILE, //< Missing the FILE type from <stdio.h>
+ GE_Missing_jmp_buf, //< Missing the jmp_buf type from <setjmp.h>
+ GE_Missing_sigjmp_buf //< Missing the sigjmp_buf type from <setjmp.h>
};
/// GetBuiltinType - Return the type for the specified builtin.
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index b2d31f2215..0ac2fab8a0 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -36,6 +36,8 @@
// A -> "reference" to __builtin_va_list
// V -> Vector, following num elements and a base type.
// P -> FILE
+// J -> jmp_buf
+// SJ -> sigjmp_buf
// . -> "...". This may only occur at the end of the function list.
//
// Types maybe prefixed with the following modifiers:
@@ -338,7 +340,6 @@ BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n")
LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h")
LIBBUILTIN(exit, "vi", "fr", "stdlib.h")
LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h")
-LIBBUILTIN(_exit, "vi", "fr", "unistd.h")
LIBBUILTIN(malloc, "v*z", "f", "stdlib.h")
LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h")
// C99 string.h
@@ -369,6 +370,8 @@ LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h")
LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h")
LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h")
LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h")
+// C99
+LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h")
// Non-C library functions
// FIXME: Non-C-standard stuff shouldn't be builtins in non-GNU mode!
@@ -381,6 +384,11 @@ LIBBUILTIN(strndup, "c*cC*z", "f", "string.h")
// POSIX strings.h
LIBBUILTIN(index, "c*cC*i", "f", "strings.h")
LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h")
+// POSIX unistd.h
+LIBBUILTIN(_exit, "vi", "fr", "unistd.h")
+// POSIX setjmp.h
+LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h")
+LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h")
// FIXME: This type isn't very correct, it should be
// id objc_msgSend(id, SEL)
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 03d552dd43..b7e940457f 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -120,6 +120,8 @@ def note_please_include_header : Note<
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
def err_implicit_decl_requires_stdio : Error<
"implicit declaration of '%0' requires inclusion of the header <stdio.h>">;
+def err_implicit_decl_requires_setjmp : Error<
+ "implicit declaration of '%0' requires inclusion of the header <setjmp.h>">;
def warn_redecl_library_builtin : Warning<
"incompatible redeclaration of library function %0">;
def err_builtin_definition : Error<"definition of builtin function %0">;
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index 926ba224f4..15f5518210 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -423,7 +423,11 @@ namespace clang {
/// \brief Objective-C fast enumeration state type
SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
/// \brief C FILE typedef type
- SPECIAL_TYPE_FILE = 7
+ SPECIAL_TYPE_FILE = 7,
+ /// \brief C jmp_buf typedef type
+ SPECIAL_TYPE_jmp_buf = 8,
+ /// \brief C sigjmp_buf typedef type
+ SPECIAL_TYPE_sigjmp_buf = 9
};
/// \brief Record codes for each kind of declaration.