[cfe-commits] r64894 - in /cfe/trunk: include/clang/AST/Expr.h lib/Sema/Sema.h lib/Sema/SemaChecking.cpp lib/Sema/SemaExprObjC.cpp

Chris Lattner sabre at nondot.org
Tue Feb 17 22:01:06 PST 2009


Author: lattner
Date: Wed Feb 18 00:01:06 2009
New Revision: 64894

URL: http://llvm.org/viewvc/llvm-project?rev=64894&view=rev
Log:
rename CheckBuiltinCFStringArgument -> CheckObjCString

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaChecking.cpp
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=64894&r1=64893&r2=64894&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Feb 18 00:01:06 2009
@@ -476,12 +476,14 @@
 /// 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:

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=64894&r1=64893&r2=64894&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Feb 18 00:01:06 2009
@@ -1989,7 +1989,7 @@
 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);

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=64894&r1=64893&r2=64894&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Feb 18 00:01:06 2009
@@ -37,7 +37,7 @@
   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 @@
   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()) {

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=64894&r1=64893&r2=64894&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Feb 18 00:01:06 2009
@@ -48,7 +48,8 @@
                                     AtLoc);
   }
   
-  if (CheckBuiltinCFStringArgument(S))
+  // Verify that this composite string is acceptable for ObjC strings.
+  if (CheckObjCString(S))
     return true;
   
   if (Context.getObjCConstantStringInterface().isNull()) {





More information about the cfe-commits mailing list