diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-18 06:01:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-18 06:01:06 +0000 |
commit | 690398188ea5b428f06aa13c7d4ce6eb741ad4f9 (patch) | |
tree | 22d3b87c71820a67f39bb778031da0aec5c44571 | |
parent | 97cf6eb380016db868866faf27a086cd55a316d4 (diff) |
rename CheckBuiltinCFStringArgument -> CheckObjCString
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64894 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Expr.h | 6 | ||||
-rw-r--r-- | lib/Sema/Sema.h | 2 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 3 |
4 files changed, 10 insertions, 8 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 8bd0c9d759..8130f4f631 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -476,12 +476,14 @@ public: /// is NOT null-terminated, and the length of the string is determined by /// calling getByteLength(). The C type for a string is always a /// ConstantArrayType. +/// +/// Note that strings in C can be formed by concatenation of multiple string +/// literal pptokens in trnaslation phase #6. This keeps track of the locations +/// of each of these pieces. class StringLiteral : public Expr { const char *StrData; unsigned ByteLength; bool IsWide; - // If the StringLiteral was composed using token pasting, both locations - // are needed. If not (the common case), firstTokLoc == lastTokLoc. unsigned NumConcatenated; SourceLocation TokLocs[1]; public: diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 1bc469235a..fd59bf0691 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1989,7 +1989,7 @@ public: private: Action::OwningExprResult CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall); - bool CheckBuiltinCFStringArgument(Expr* Arg); + bool CheckObjCString(Expr *Arg); bool SemaBuiltinVAStart(CallExpr *TheCall); bool SemaBuiltinUnorderedCompare(CallExpr *TheCall); bool SemaBuiltinStackAddress(CallExpr *TheCall); diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index e2ec2676c7..db622f6648 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -37,7 +37,7 @@ Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall) { case Builtin::BI__builtin___CFStringMakeConstantString: assert(TheCall->getNumArgs() == 1 && "Wrong # arguments to builtin CFStringMakeConstantString"); - if (CheckBuiltinCFStringArgument(TheCall->getArg(0))) + if (CheckObjCString(TheCall->getArg(0))) return ExprError(); return move(TheCallResult); case Builtin::BI__builtin_stdarg_start: @@ -91,11 +91,10 @@ Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall) { return move(TheCallResult); } -/// CheckBuiltinCFStringArgument - Checks that the argument to the builtin +/// CheckObjCString - Checks that the argument to the builtin /// CFString constructor is correct -bool Sema::CheckBuiltinCFStringArgument(Expr* Arg) { +bool Sema::CheckObjCString(Expr *Arg) { Arg = Arg->IgnoreParenCasts(); - StringLiteral *Literal = dyn_cast<StringLiteral>(Arg); if (!Literal || Literal->isWide()) { diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index b0b5367790..1da74b9c32 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -48,7 +48,8 @@ Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, AtLoc); } - if (CheckBuiltinCFStringArgument(S)) + // Verify that this composite string is acceptable for ObjC strings. + if (CheckObjCString(S)) return true; if (Context.getObjCConstantStringInterface().isNull()) { |