summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2007-08-17 05:31:46 +0000
committerAnders Carlsson <andersca@mac.com>2007-08-17 05:31:46 +0000
commit98f0790fabed73dc19e16db8558c16399e16b5b2 (patch)
tree8cb1ff82a56e34a8cd4695d59e0344940e14ae7c /clang/include
parent2c4ea1e4118049472d0ed3be55e85919b13b92e5 (diff)
downloadbcm5719-llvm-98f0790fabed73dc19e16db8558c16399e16b5b2.tar.gz
bcm5719-llvm-98f0790fabed73dc19e16db8558c16399e16b5b2.zip
Add initial support for constant CFStrings.
llvm-svn: 41136
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/AST/ASTContext.h8
-rw-r--r--clang/include/clang/AST/Builtins.def6
-rw-r--r--clang/include/clang/Basic/DiagnosticKinds.def8
3 files changed, 21 insertions, 1 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 240f54689d5..d86a6ed70d8 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -36,8 +36,10 @@ class ASTContext {
llvm::FoldingSet<FunctionTypeNoProto> FunctionTypeNoProtos;
llvm::FoldingSet<FunctionTypeProto> FunctionTypeProtos;
llvm::DenseMap<const RecordDecl*, const RecordLayout*> RecordLayoutInfo;
+ RecordDecl *CFConstantStringTypeDecl;
public:
TargetInfo &Target;
+ IdentifierTable &Idents;
Builtin::Context BuiltinInfo;
// Builtin Types.
@@ -50,7 +52,8 @@ public:
QualType FloatTy, DoubleTy, LongDoubleTy;
QualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
- ASTContext(TargetInfo &t, IdentifierTable &idents) : Target(t) {
+ ASTContext(TargetInfo &t, IdentifierTable &idents) :
+ CFConstantStringTypeDecl(0), Target(t), Idents(idents) {
InitBuiltinTypes();
BuiltinInfo.InitializeBuiltins(idents, Target);
}
@@ -116,6 +119,9 @@ public:
/// defined in <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
QualType getPointerDiffType() const;
+ // getCFConstantStringType - Return the type used for constant CFStrings.
+ QualType getCFConstantStringType();
+
//===--------------------------------------------------------------------===//
// Type Sizing and Analysis
//===--------------------------------------------------------------------===//
diff --git a/clang/include/clang/AST/Builtins.def b/clang/include/clang/AST/Builtins.def
index 2a5a8c76a86..4ab98e8ad5b 100644
--- a/clang/include/clang/AST/Builtins.def
+++ b/clang/include/clang/AST/Builtins.def
@@ -29,6 +29,7 @@
// i -> int
// f -> float
// d -> double
+// F -> constant CFString
// . -> "...". This may only occur at the end of the function list.
//
// Types maybe prefixed with the following modifiers:
@@ -36,6 +37,10 @@
// LL -> long long
// S -> signed
// U -> unsigned
+//
+// Types may be postfixed with the following modifiers:
+// * -> pointer
+// C -> const
// The third value provided to the macro specifies information about attributes
// of the function. Currently we have:
@@ -50,5 +55,6 @@ BUILTIN(__builtin_fabsf, "ff" , "nc")
BUILTIN(__builtin_fabsl, "LdLd", "nc")
BUILTIN(__builtin_constant_p, "UsUs", "nc")
BUILTIN(__builtin_classify_type, "i.", "nc")
+BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")
#undef BUILTIN
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def
index e13a95bac00..4f81f6a2bca 100644
--- a/clang/include/clang/Basic/DiagnosticKinds.def
+++ b/clang/include/clang/Basic/DiagnosticKinds.def
@@ -681,6 +681,14 @@ DIAG(warn_printf_format_string_is_wide_literal, WARNING,
DIAG(warn_printf_format_string_contains_null_char, WARNING,
"format string contains '\\0' within the string body")
+// CFString checking
+DIAG(err_cfstring_literal_not_string_constant, ERROR,
+ "CFString literal is not a string constant")
+DIAG(warn_cfstring_literal_contains_non_ascii_character, WARNING,
+ "CFString literal contains non-ASCII character")
+DIAG(warn_cfstring_literal_contains_nul_character, WARNING,
+ "CFString literal contains NUL character")
+
// Statements.
DIAG(err_continue_not_in_loop, ERROR,
"'continue' statement not in loop statement")
OpenPOWER on IntegriCloud