[cfe-commits] r81346 [4/6] - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/ include/clang/Analysis/Analyses/ include/clang/Analysis/FlowSensitive/ include/clang/Analysis/PathSensitive/ include/clang/Analysis/Support/ include/clang/Analysis/Visitors/ include/clang/Basic/ include/clang/CodeGen/ include/clang/Driver/ include/clang/Frontend/ include/clang/Index/ include/clang/Lex/ include/clang/Parse/ include/clang/Rewrite/ include/clang/Sema/ lib/AST/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Front...

Mike Stump mrs at apple.com
Wed Sep 9 08:08:16 PDT 2009


Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Wed Sep  9 10:08:12 2009
@@ -35,14 +35,14 @@
     const LangOptions &LangOpts;
     unsigned RewriteFailedDiag;
     unsigned TryFinallyContainsReturnDiag;
-        
+
     ASTContext *Context;
     SourceManager *SM;
     TranslationUnitDecl *TUDecl;
     FileID MainFileID;
     const char *MainFileStart, *MainFileEnd;
     SourceLocation LastIncLoc;
-    
+
     llvm::SmallVector<ObjCImplementationDecl *, 8> ClassImplementation;
     llvm::SmallVector<ObjCCategoryImplDecl *, 8> CategoryImplementation;
     llvm::SmallPtrSet<ObjCInterfaceDecl*, 8> ObjCSynthesizedStructs;
@@ -53,9 +53,9 @@
     llvm::SmallVector<int, 8> ObjCBcLabelNo;
     // Remember all the @protocol(<expr>) expressions.
     llvm::SmallPtrSet<ObjCProtocolDecl *, 32> ProtocolExprDecls;
-    
+
     unsigned NumObjCStringLiterals;
-    
+
     FunctionDecl *MsgSendFunctionDecl;
     FunctionDecl *MsgSendSuperFunctionDecl;
     FunctionDecl *MsgSendStretFunctionDecl;
@@ -66,25 +66,25 @@
     FunctionDecl *SelGetUidFunctionDecl;
     FunctionDecl *CFStringFunctionDecl;
     FunctionDecl *SuperContructorFunctionDecl;
-      
+
     // ObjC string constant support.
     VarDecl *ConstantStringClassReference;
     RecordDecl *NSStringRecord;
-    
+
     // ObjC foreach break/continue generation support.
     int BcLabelCount;
-    
+
     // Needed for super.
     ObjCMethodDecl *CurMethodDef;
     RecordDecl *SuperStructDecl;
     RecordDecl *ConstantStringDecl;
-    
+
     TypeDecl *ProtocolTypeDecl;
     QualType getProtocolType();
-    
+
     // Needed for header files being rewritten
     bool IsHeader;
-    
+
     std::string InFileName;
     llvm::raw_ostream* OutFile;
 
@@ -96,7 +96,7 @@
     llvm::SmallVector<BlockExpr *, 32> Blocks;
     llvm::SmallVector<BlockDeclRefExpr *, 32> BlockDeclRefs;
     llvm::DenseMap<BlockDeclRefExpr *, CallExpr *> BlockCallExprs;
-    
+
     // Block related declarations.
     llvm::SmallPtrSet<ValueDecl *, 8> BlockByCopyDecls;
     llvm::SmallPtrSet<ValueDecl *, 8> BlockByRefDecls;
@@ -109,7 +109,7 @@
     // This maps a property to it's synthesied message expression.
     // This allows us to rewrite chained getters (e.g. o.a.b.c).
     llvm::DenseMap<ObjCPropertyRefExpr *, Stmt *> PropGetters;
-    
+
     // This maps an original source AST to it's rewritten form. This allows
     // us to avoid rewriting the same node twice (which is very uncommon).
     // This is needed to support some of the exotic property rewriting.
@@ -117,9 +117,9 @@
 
     FunctionDecl *CurFunctionDef;
     VarDecl *GlobalVarDecl;
-    
+
     bool DisableReplaceStmt;
-    
+
     static const int OBJC_ABI_VERSION =7 ;
   public:
     virtual void Initialize(ASTContext &context);
@@ -136,12 +136,12 @@
                 bool silenceMacroWarn);
 
     ~RewriteObjC() {}
-    
+
     virtual void HandleTranslationUnit(ASTContext &C);
-    
+
     void ReplaceStmt(Stmt *Old, Stmt *New) {
       Stmt *ReplacingStmt = ReplacedNodes[Old];
-  
+
       if (ReplacingStmt)
         return; // We can't rewrite the same node twice.
 
@@ -191,15 +191,15 @@
                               InsertAfter) ||
           SilenceRewriteMacroWarning)
         return;
-      
+
       Diags.Report(Context->getFullLoc(Loc), RewriteFailedDiag);
     }
-    
+
     void RemoveText(SourceLocation Loc, unsigned StrLen) {
       // If removal succeeded or warning disabled return with no warning.
       if (!Rewrite.RemoveText(Loc, StrLen) || SilenceRewriteMacroWarning)
         return;
-      
+
       Diags.Report(Context->getFullLoc(Loc), RewriteFailedDiag);
     }
 
@@ -210,10 +210,10 @@
                                llvm::StringRef(NewStr, NewLength)) ||
           SilenceRewriteMacroWarning)
         return;
-      
+
       Diags.Report(Context->getFullLoc(Start), RewriteFailedDiag);
     }
-    
+
     // Syntactic Rewriting.
     void RewritePrologue(SourceLocation Loc);
     void RewriteInclude();
@@ -238,18 +238,18 @@
     QualType getSuperStructType();
     QualType getConstantStringStructType();
     bool BufferContainsPPDirectives(const char *startBuf, const char *endBuf);
-    
+
     // Expression Rewriting.
     Stmt *RewriteFunctionBodyOrGlobalInitializer(Stmt *S);
     void CollectPropertySetters(Stmt *S);
-    
+
     Stmt *CurrentBody;
     ParentMap *PropParentMap; // created lazily.
-    
+
     Stmt *RewriteAtEncode(ObjCEncodeExpr *Exp);
     Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, SourceLocation OrigStart);
     Stmt *RewritePropertyGetter(ObjCPropertyRefExpr *PropRefExpr);
-    Stmt *RewritePropertySetter(BinaryOperator *BinOp, Expr *newStmt, 
+    Stmt *RewritePropertySetter(BinaryOperator *BinOp, Expr *newStmt,
                                 SourceRange SrcRange);
     Stmt *RewriteAtSelector(ObjCSelectorExpr *Exp);
     Stmt *RewriteMessageExpr(ObjCMessageExpr *Exp);
@@ -263,13 +263,13 @@
     Stmt *RewriteObjCThrowStmt(ObjCAtThrowStmt *S);
     Stmt *RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
                                        SourceLocation OrigEnd);
-    CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD, 
+    CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,
                                            Expr **args, unsigned nargs);
     Stmt *SynthMessageExpr(ObjCMessageExpr *Exp);
     Stmt *RewriteBreakStmt(BreakStmt *S);
     Stmt *RewriteContinueStmt(ContinueStmt *S);
     void SynthCountByEnumWithState(std::string &buf);
-    
+
     void SynthMsgSendFunctionDecl();
     void SynthMsgSendSuperFunctionDecl();
     void SynthMsgSendStretFunctionDecl();
@@ -279,14 +279,14 @@
     void SynthGetMetaClassFunctionDecl();
     void SynthSelGetUidFunctionDecl();
     void SynthSuperContructorFunctionDecl();
-      
+
     // Metadata emission.
     void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
                                   std::string &Result);
-    
+
     void RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *CDecl,
                                      std::string &Result);
-    
+
     template<typename MethodIterator>
     void RewriteObjCMethodsMetaData(MethodIterator MethodBegin,
                                     MethodIterator MethodEnd,
@@ -294,69 +294,69 @@
                                     const char *prefix,
                                     const char *ClassName,
                                     std::string &Result);
-    
+
     void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol,
                                      const char *prefix,
                                      const char *ClassName,
                                      std::string &Result);
     void RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Prots,
-                                         const char *prefix, 
+                                         const char *prefix,
                                          const char *ClassName,
                                          std::string &Result);
     void SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
                                       std::string &Result);
-    void SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl, 
-                                         ObjCIvarDecl *ivar, 
+    void SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl,
+                                         ObjCIvarDecl *ivar,
                                          std::string &Result);
     void RewriteImplementations();
     void SynthesizeMetaDataIntoBuffer(std::string &Result);
-    
+
     // Block rewriting.
-    void RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D);  
+    void RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D);
     void CheckFunctionPointerDecl(QualType dType, NamedDecl *ND);
-    
+
     void InsertBlockLiteralsWithinFunction(FunctionDecl *FD);
     void InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD);
-    
-    // Block specific rewrite rules.    
+
+    // Block specific rewrite rules.
     void RewriteBlockCall(CallExpr *Exp);
     void RewriteBlockPointerDecl(NamedDecl *VD);
     Stmt *RewriteBlockDeclRefExpr(BlockDeclRefExpr *VD);
     void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
-    
-    std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, 
+
+    std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
                                       const char *funcName, std::string Tag);
-    std::string SynthesizeBlockFunc(BlockExpr *CE, int i, 
+    std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
                                       const char *funcName, std::string Tag);
-    std::string SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, 
+    std::string SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
                                     bool hasCopyDisposeHelpers);
     Stmt *SynthesizeBlockCall(CallExpr *Exp);
     void SynthesizeBlockLiterals(SourceLocation FunLocStart,
                                    const char *FunName);
-    
+
     void CollectBlockDeclRefInfo(BlockExpr *Exp);
     void GetBlockCallExprs(Stmt *S);
     void GetBlockDeclRefExprs(Stmt *S);
-    
+
     // We avoid calling Type::isBlockPointerType(), since it operates on the
     // canonical type. We only care if the top-level type is a closure pointer.
     bool isTopLevelBlockPointerType(QualType T) {
       return isa<BlockPointerType>(T);
     }
-    
+
     // FIXME: This predicate seems like it would be useful to add to ASTContext.
     bool isObjCType(QualType T) {
       if (!LangOpts.ObjC1 && !LangOpts.ObjC2)
         return false;
-        
+
       QualType OCT = Context->getCanonicalType(T).getUnqualifiedType();
-      
+
       if (OCT == Context->getCanonicalType(Context->getObjCIdType()) ||
           OCT == Context->getCanonicalType(Context->getObjCClassType()))
         return true;
-        
+
       if (const PointerType *PT = OCT->getAs<PointerType>()) {
-        if (isa<ObjCInterfaceType>(PT->getPointeeType()) || 
+        if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||
             PT->getPointeeType()->isObjCQualifiedIdType())
           return true;
       }
@@ -366,12 +366,12 @@
     void GetExtentOfArgList(const char *Name, const char *&LParen,
                             const char *&RParen);
     void RewriteCastExpr(CStyleCastExpr *CE);
-    
+
     FunctionDecl *SynthBlockInitFunctionDecl(const char *name);
     Stmt *SynthBlockInitExpr(BlockExpr *Exp);
-    
+
     void QuoteDoublequotes(std::string &From, std::string &To) {
-      for(unsigned i = 0; i < From.length(); i++) {
+      for (unsigned i = 0; i < From.length(); i++) {
         if (From[i] == '"')
           To += "\\\"";
         else
@@ -381,10 +381,10 @@
   };
 }
 
-void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType, 
-                                                   NamedDecl *D) {    
+void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
+                                                   NamedDecl *D) {
   if (FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType)) {
-    for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(), 
+    for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(),
          E = fproto->arg_type_end(); I && (I != E); ++I)
       if (isTopLevelBlockPointerType(*I)) {
         // All the args are checked/rewritten. Don't call twice!
@@ -402,17 +402,17 @@
 
 static bool IsHeaderFile(const std::string &Filename) {
   std::string::size_type DotPos = Filename.rfind('.');
-  
+
   if (DotPos == std::string::npos) {
     // no file extension
-    return false; 
+    return false;
   }
-  
+
   std::string Ext = std::string(Filename.begin()+DotPos+1, Filename.end());
   // C header: .h
   // C++ header: .hh or .H;
   return Ext == "h" || Ext == "hh" || Ext == "H";
-}    
+}
 
 RewriteObjC::RewriteObjC(std::string inFile, llvm::raw_ostream* OS,
                          Diagnostic &D, const LangOptions &LOpts,
@@ -420,16 +420,16 @@
       : Diags(D), LangOpts(LOpts), InFileName(inFile), OutFile(OS),
         SilenceRewriteMacroWarning(silenceMacroWarn) {
   IsHeader = IsHeaderFile(inFile);
-  RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning, 
+  RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning,
                "rewriting sub-expression within a macro (may not be correct)");
-  TryFinallyContainsReturnDiag = Diags.getCustomDiagID(Diagnostic::Warning, 
+  TryFinallyContainsReturnDiag = Diags.getCustomDiagID(Diagnostic::Warning,
                "rewriter doesn't support user-specified control flow semantics "
                "for @try/@finally (code may not execute properly)");
 }
 
 ASTConsumer *clang::CreateObjCRewriter(const std::string& InFile,
                                        llvm::raw_ostream* OS,
-                                       Diagnostic &Diags, 
+                                       Diagnostic &Diags,
                                        const LangOptions &LOpts,
                                        bool SilenceRewriteMacroWarning) {
   return new RewriteObjC(InFile, OS, Diags, LOpts, SilenceRewriteMacroWarning);
@@ -462,15 +462,15 @@
   PropParentMap = 0;
   CurrentBody = 0;
   DisableReplaceStmt = false;
-  
+
   // Get the ID and start/end of the main file.
   MainFileID = SM->getMainFileID();
   const llvm::MemoryBuffer *MainBuf = SM->getBuffer(MainFileID);
   MainFileStart = MainBuf->getBufferStart();
   MainFileEnd = MainBuf->getBufferEnd();
-     
+
   Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOptions());
-  
+
   // declaring objc_selector outside the parameter list removes a silly
   // scope related warning...
   if (IsHeader)
@@ -574,7 +574,7 @@
   // if we rewrote the #include/#import.
   SourceLocation Loc = D->getLocation();
   Loc = SM->getInstantiationLoc(Loc);
-  
+
   // If this is for a builtin, ignore it.
   if (Loc.isInvalid()) return;
 
@@ -593,7 +593,7 @@
     RewriteCategoryDecl(CD);
   } else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) {
     RewriteProtocolDecl(PD);
-  } else if (ObjCForwardProtocolDecl *FP = 
+  } else if (ObjCForwardProtocolDecl *FP =
              dyn_cast<ObjCForwardProtocolDecl>(D)){
     RewriteForwardProtocolDecl(FP);
   } else if (LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(D)) {
@@ -619,7 +619,7 @@
   const char *MainBufEnd = MainBuf.second;
   size_t ImportLen = strlen("import");
   size_t IncludeLen = strlen("include");
-                             
+
   // Loop over the whole file, looking for includes.
   for (const char *BufPtr = MainBufStart; BufPtr < MainBufEnd; ++BufPtr) {
     if (*BufPtr == '#') {
@@ -630,7 +630,7 @@
           return;
       if (!strncmp(BufPtr, "import", ImportLen)) {
         // replace import with include
-        SourceLocation ImportLoc = 
+        SourceLocation ImportLoc =
           LocStart.getFileLocWithOffset(BufPtr-MainBufStart);
         ReplaceText(ImportLoc, ImportLen, "include", IncludeLen);
         BufPtr += ImportLen;
@@ -643,27 +643,27 @@
   std::pair<const char*, const char*> MainBuf = SM->getBufferData(MainFileID);
   const char *MainBufStart = MainBuf.first;
   const char *MainBufEnd = MainBuf.second;
-  
+
   // Loop over the whole file, looking for tabs.
   for (const char *BufPtr = MainBufStart; BufPtr != MainBufEnd; ++BufPtr) {
     if (*BufPtr != '\t')
       continue;
-    
+
     // Okay, we found a tab.  This tab will turn into at least one character,
     // but it depends on which 'virtual column' it is in.  Compute that now.
     unsigned VCol = 0;
     while (BufPtr-VCol != MainBufStart && BufPtr[-VCol-1] != '\t' &&
            BufPtr[-VCol-1] != '\n' && BufPtr[-VCol-1] != '\r')
       ++VCol;
-    
+
     // Okay, now that we know the virtual column, we know how many spaces to
     // insert.  We assume 8-character tab-stops.
     unsigned Spaces = 8-(VCol & 7);
-    
+
     // Get the location of the tab.
     SourceLocation TabLoc = SM->getLocForStartOfFile(MainFileID);
     TabLoc = TabLoc.getFileLocWithOffset(BufPtr-MainBufStart);
-    
+
     // Rewrite the single tab character into a sequence of spaces.
     ReplaceText(TabLoc, 1, "        ", Spaces);
   }
@@ -693,35 +693,35 @@
 
   if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
     return; // FIXME: is this correct?
-    
+
   // Generate the 'getter' function.
   ObjCPropertyDecl *PD = PID->getPropertyDecl();
   ObjCInterfaceDecl *ClassDecl = PD->getGetterMethodDecl()->getClassInterface();
   ObjCIvarDecl *OID = PID->getPropertyIvarDecl();
-  
+
   if (!OID)
     return;
-    
+
   std::string Getr;
   RewriteObjCMethodDecl(PD->getGetterMethodDecl(), Getr);
   Getr += "{ ";
   // Synthesize an explicit cast to gain access to the ivar.
-  // FIXME: deal with code generation implications for various property 
-  // attributes (copy, retain, nonatomic). 
+  // FIXME: deal with code generation implications for various property
+  // attributes (copy, retain, nonatomic).
   // See objc-act.c:objc_synthesize_new_getter() for details.
   Getr += "return " + getIvarAccessString(ClassDecl, OID);
   Getr += "; }";
   InsertText(onePastSemiLoc, Getr.c_str(), Getr.size());
   if (PD->isReadOnly())
     return;
-    
+
   // Generate the 'setter' function.
   std::string Setr;
   RewriteObjCMethodDecl(PD->getSetterMethodDecl(), Setr);
   Setr += "{ ";
   // Synthesize an explicit cast to initialize the ivar.
-  // FIXME: deal with code generation implications for various property 
-  // attributes (copy, retain, nonatomic). 
+  // FIXME: deal with code generation implications for various property
+  // attributes (copy, retain, nonatomic).
   // See objc-act.c:objc_synthesize_new_setter() for details.
   Setr += getIvarAccessString(ClassDecl, OID) + " = ";
   Setr += PD->getNameAsCString();
@@ -734,7 +734,7 @@
   SourceLocation startLoc = ClassDecl->getLocation();
   const char *startBuf = SM->getCharacterData(startLoc);
   const char *semiPtr = strchr(startBuf, ';');
-  
+
   // Translate to typedef's that forward reference structs with the same name
   // as the class. As a convenience, we include the original declaration
   // as a comment.
@@ -755,16 +755,16 @@
     typedefString += ForwardDecl->getNameAsString();
     typedefString += ";\n#endif\n";
   }
-  
+
   // Replace the @class with typedefs corresponding to the classes.
-  ReplaceText(startLoc, semiPtr-startBuf+1, 
+  ReplaceText(startLoc, semiPtr-startBuf+1,
               typedefString.c_str(), typedefString.size());
 }
 
 void RewriteObjC::RewriteMethodDeclaration(ObjCMethodDecl *Method) {
   SourceLocation LocStart = Method->getLocStart();
   SourceLocation LocEnd = Method->getLocEnd();
-    
+
   if (SM->getInstantiationLineNumber(LocEnd) >
       SM->getInstantiationLineNumber(LocStart)) {
     InsertText(LocStart, "#if 0\n", 6);
@@ -774,26 +774,25 @@
   }
 }
 
-void RewriteObjC::RewriteProperty(ObjCPropertyDecl *prop) 
-{
+void RewriteObjC::RewriteProperty(ObjCPropertyDecl *prop) {
   SourceLocation Loc = prop->getLocation();
-  
+
   ReplaceText(Loc, 0, "// ", 3);
-  
+
   // FIXME: handle properties that are declared across multiple lines.
 }
 
 void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
   SourceLocation LocStart = CatDecl->getLocStart();
-  
+
   // FIXME: handle category headers that are declared across multiple lines.
   ReplaceText(LocStart, 0, "// ", 3);
-  
-  for (ObjCCategoryDecl::instmeth_iterator 
-         I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end(); 
+
+  for (ObjCCategoryDecl::instmeth_iterator
+         I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
        I != E; ++I)
     RewriteMethodDeclaration(*I);
-  for (ObjCCategoryDecl::classmeth_iterator 
+  for (ObjCCategoryDecl::classmeth_iterator
          I = CatDecl->classmeth_begin(), E = CatDecl->classmeth_end();
        I != E; ++I)
     RewriteMethodDeclaration(*I);
@@ -804,14 +803,14 @@
 
 void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
   std::pair<const char*, const char*> MainBuf = SM->getBufferData(MainFileID);
-  
+
   SourceLocation LocStart = PDecl->getLocStart();
-  
+
   // FIXME: handle protocol headers that are declared across multiple lines.
   ReplaceText(LocStart, 0, "// ", 3);
-  
-  for (ObjCProtocolDecl::instmeth_iterator 
-         I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); 
+
+  for (ObjCProtocolDecl::instmeth_iterator
+         I = PDecl->instmeth_begin(), E = PDecl->instmeth_end();
        I != E; ++I)
     RewriteMethodDeclaration(*I);
   for (ObjCProtocolDecl::classmeth_iterator
@@ -832,14 +831,14 @@
       SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
       ReplaceText(OptionalLoc, strlen("@optional"),
                   CommentedOptional.c_str(), CommentedOptional.size());
-      
+
     }
     else if (*p == '@' && !strncmp(p+1, "required", strlen("required"))) {
       std::string CommentedRequired = "/* @required */";
       SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
       ReplaceText(OptionalLoc, strlen("@required"),
                   CommentedRequired.c_str(), CommentedRequired.size());
-      
+
     }
   }
 }
@@ -852,7 +851,7 @@
   ReplaceText(LocStart, 0, "// ", 3);
 }
 
-void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD, 
+void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
                                         std::string &ResultStr) {
   //fprintf(stderr,"In RewriteObjCMethodDecl\n");
   const FunctionType *FPRetType = 0;
@@ -876,24 +875,24 @@
   } else
     ResultStr += OMD->getResultType().getAsString();
   ResultStr += " ";
-  
+
   // Unique method name
   std::string NameStr;
-  
+
   if (OMD->isInstanceMethod())
     NameStr += "_I_";
   else
     NameStr += "_C_";
-  
+
   NameStr += OMD->getClassInterface()->getNameAsString();
   NameStr += "_";
-  
-  if (ObjCCategoryImplDecl *CID = 
+
+  if (ObjCCategoryImplDecl *CID =
       dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext())) {
     NameStr += CID->getNameAsString();
     NameStr += "_";
   }
-  // Append selector names, replacing ':' with '_' 
+  // Append selector names, replacing ':' with '_'
   {
     std::string selString = OMD->getSelector().getAsString();
     int len = selString.size();
@@ -905,10 +904,10 @@
   // Remember this name for metadata emission
   MethodInternalNames[OMD] = NameStr;
   ResultStr += NameStr;
-  
+
   // Rewrite arguments
   ResultStr += "(";
-  
+
   // invisible arguments
   if (OMD->isInstanceMethod()) {
     QualType selfTy = Context->getObjCInterfaceType(OMD->getClassInterface());
@@ -923,11 +922,11 @@
   }
   else
     ResultStr += Context->getObjCClassType().getAsString();
-  
+
   ResultStr += " self, ";
   ResultStr += Context->getObjCSelType().getAsString();
   ResultStr += " _cmd";
-  
+
   // Method arguments.
   for (ObjCMethodDecl::param_iterator PI = OMD->param_begin(),
        E = OMD->param_end(); PI != E; ++PI) {
@@ -951,10 +950,10 @@
   if (OMD->isVariadic())
     ResultStr += ", ...";
   ResultStr += ") ";
-  
+
   if (FPRetType) {
     ResultStr += ")"; // close the precedence "scope" for "*".
-    
+
     // Now, emit the argument types (if any).
     if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) {
       ResultStr += "(";
@@ -976,12 +975,12 @@
 void RewriteObjC::RewriteImplementationDecl(Decl *OID) {
   ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID);
   ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID);
-  
+
   if (IMD)
     InsertText(IMD->getLocStart(), "// ", 3);
   else
     InsertText(CID->getLocStart(), "// ", 3);
-      
+
   for (ObjCCategoryImplDecl::instmeth_iterator
        I = IMD ? IMD->instmeth_begin() : CID->instmeth_begin(),
        E = IMD ? IMD->instmeth_end() : CID->instmeth_end();
@@ -997,7 +996,7 @@
     ReplaceText(LocStart, endBuf-startBuf,
                 ResultStr.c_str(), ResultStr.size());
   }
-  
+
   for (ObjCCategoryImplDecl::classmeth_iterator
        I = IMD ? IMD->classmeth_begin() : CID->classmeth_begin(),
        E = IMD ? IMD->classmeth_end() : CID->classmeth_end();
@@ -1007,15 +1006,15 @@
     RewriteObjCMethodDecl(OMD, ResultStr);
     SourceLocation LocStart = OMD->getLocStart();
     SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();
-    
+
     const char *startBuf = SM->getCharacterData(LocStart);
     const char *endBuf = SM->getCharacterData(LocEnd);
     ReplaceText(LocStart, endBuf-startBuf,
-                ResultStr.c_str(), ResultStr.size());    
+                ResultStr.c_str(), ResultStr.size());
   }
   for (ObjCCategoryImplDecl::propimpl_iterator
        I = IMD ? IMD->propimpl_begin() : CID->propimpl_begin(),
-       E = IMD ? IMD->propimpl_end() : CID->propimpl_end(); 
+       E = IMD ? IMD->propimpl_end() : CID->propimpl_end();
        I != E; ++I) {
     RewritePropertyImplDecl(*I, IMD, CID);
   }
@@ -1023,7 +1022,7 @@
   if (IMD)
     InsertText(IMD->getLocEnd(), "// ", 3);
   else
-   InsertText(CID->getLocEnd(), "// ", 3); 
+   InsertText(CID->getLocEnd(), "// ", 3);
 }
 
 void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
@@ -1043,16 +1042,16 @@
     ObjCForwardDecls.insert(ClassDecl);
   }
   SynthesizeObjCInternalStruct(ClassDecl, ResultStr);
-    
-  for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(), 
+
+  for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
          E = ClassDecl->prop_end(); I != E; ++I)
     RewriteProperty(*I);
-  for (ObjCInterfaceDecl::instmeth_iterator 
+  for (ObjCInterfaceDecl::instmeth_iterator
          I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
        I != E; ++I)
     RewriteMethodDeclaration(*I);
-  for (ObjCInterfaceDecl::classmeth_iterator 
-         I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end(); 
+  for (ObjCInterfaceDecl::classmeth_iterator
+         I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end();
        I != E; ++I)
     RewriteMethodDeclaration(*I);
 
@@ -1069,20 +1068,20 @@
   ObjCPropertyDecl *PDecl = PropRefExpr->getProperty();
   llvm::SmallVector<Expr *, 1> ExprVec;
   ExprVec.push_back(newStmt);
-  
+
   Stmt *Receiver = PropRefExpr->getBase();
   ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(Receiver);
   if (PRE && PropGetters[PRE]) {
     // This allows us to handle chain/nested property getters.
     Receiver = PropGetters[PRE];
   }
-  MsgExpr = new (Context) ObjCMessageExpr(dyn_cast<Expr>(Receiver), 
-                                PDecl->getSetterName(), PDecl->getType(), 
-                                PDecl->getSetterMethodDecl(), 
-                                SourceLocation(), SourceLocation(), 
+  MsgExpr = new (Context) ObjCMessageExpr(dyn_cast<Expr>(Receiver),
+                                PDecl->getSetterName(), PDecl->getType(),
+                                PDecl->getSetterMethodDecl(),
+                                SourceLocation(), SourceLocation(),
                                 &ExprVec[0], 1);
   Stmt *ReplacingStmt = SynthMessageExpr(MsgExpr);
-  
+
   // Now do the actual rewrite.
   ReplaceStmtWithRange(BinOp, ReplacingStmt, SrcRange);
   //delete BinOp;
@@ -1097,18 +1096,18 @@
   // This allows us to reuse all the fun and games in SynthMessageExpr().
   ObjCMessageExpr *MsgExpr;
   ObjCPropertyDecl *PDecl = PropRefExpr->getProperty();
-  
+
   Stmt *Receiver = PropRefExpr->getBase();
-  
+
   ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(Receiver);
   if (PRE && PropGetters[PRE]) {
     // This allows us to handle chain/nested property getters.
     Receiver = PropGetters[PRE];
   }
-  MsgExpr = new (Context) ObjCMessageExpr(dyn_cast<Expr>(Receiver), 
-                                PDecl->getGetterName(), PDecl->getType(), 
-                                PDecl->getGetterMethodDecl(), 
-                                SourceLocation(), SourceLocation(), 
+  MsgExpr = new (Context) ObjCMessageExpr(dyn_cast<Expr>(Receiver),
+                                PDecl->getGetterName(), PDecl->getType(),
+                                PDecl->getGetterMethodDecl(),
+                                SourceLocation(), SourceLocation(),
                                 0, 0);
 
   Stmt *ReplacingStmt = SynthMessageExpr(MsgExpr);
@@ -1127,7 +1126,7 @@
     return PropRefExpr; // return the original...
   } else {
     ReplaceStmt(PropRefExpr, ReplacingStmt);
-    // delete PropRefExpr; elsewhere...    
+    // delete PropRefExpr; elsewhere...
     // NOTE: We don't want to call MsgExpr->Destroy(), as it holds references
     // to things that stay around.
     Context->Deallocate(MsgExpr);
@@ -1135,7 +1134,7 @@
   }
 }
 
-Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, 
+Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
                                           SourceLocation OrigStart) {
   ObjCIvarDecl *D = IV->getDecl();
   if (CurMethodDef) {
@@ -1144,10 +1143,10 @@
         dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
       // lookup which class implements the instance variable.
       ObjCInterfaceDecl *clsDeclared = 0;
-      iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(), 
+      iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
                                                    clsDeclared);
       assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
-      
+
       // Synthesize an explicit cast to gain access to the ivar.
       std::string RecName = clsDeclared->getIdentifier()->getName();
       RecName += "_IMPL";
@@ -1156,7 +1155,7 @@
                                           SourceLocation(), II);
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
-      CastExpr *castExpr = new (Context) CStyleCastExpr(castT, 
+      CastExpr *castExpr = new (Context) CStyleCastExpr(castT,
                                                         CastExpr::CK_Unknown,
                                                         IV->getBase(),
                                                         castT,SourceLocation(),
@@ -1165,7 +1164,7 @@
       ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
                                                IV->getBase()->getLocEnd(),
                                                castExpr);
-      if (IV->isFreeIvar() && 
+      if (IV->isFreeIvar() &&
           CurMethodDef->getClassInterface() == iFaceDecl->getDecl()) {
         MemberExpr *ME = new (Context) MemberExpr(PE, true, D,
                                                    IV->getLocation(),
@@ -1174,27 +1173,27 @@
         // delete IV; leak for now, see RewritePropertySetter() usage for more info.
         return ME;
       }
-       
+
       ReplaceStmt(IV->getBase(), PE);
       // Cannot delete IV->getBase(), since PE points to it.
       // Replace the old base with the cast. This is important when doing
       // embedded rewrites. For example, [newInv->_container addObject:0].
-      IV->setBase(PE); 
+      IV->setBase(PE);
       return IV;
     }
   } else { // we are outside a method.
     assert(!IV->isFreeIvar() && "Cannot have a free standing ivar outside a method");
-      
+
     // Explicit ivar refs need to have a cast inserted.
     // FIXME: consider sharing some of this code with the code above.
     if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
       ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
       // lookup which class implements the instance variable.
       ObjCInterfaceDecl *clsDeclared = 0;
-      iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(), 
+      iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
                                                    clsDeclared);
       assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
-      
+
       // Synthesize an explicit cast to gain access to the ivar.
       std::string RecName = clsDeclared->getIdentifier()->getName();
       RecName += "_IMPL";
@@ -1203,7 +1202,7 @@
                                           SourceLocation(), II);
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
-      CastExpr *castExpr = new (Context) CStyleCastExpr(castT, 
+      CastExpr *castExpr = new (Context) CStyleCastExpr(castT,
                                                         CastExpr::CK_Unknown,
                                                         IV->getBase(),
                                                         castT, SourceLocation(),
@@ -1215,7 +1214,7 @@
       // Cannot delete IV->getBase(), since PE points to it.
       // Replace the old base with the cast. This is important when doing
       // embedded rewrites. For example, [newInv->_container addObject:0].
-      IV->setBase(PE); 
+      IV->setBase(PE);
       return IV;
     }
   }
@@ -1225,10 +1224,10 @@
 /// SynthCountByEnumWithState - To print:
 /// ((unsigned int (*)
 ///  (id, SEL, struct __objcFastEnumerationState *, id *, unsigned int))
-///  (void *)objc_msgSend)((id)l_collection, 
+///  (void *)objc_msgSend)((id)l_collection,
 ///                        sel_registerName(
-///                          "countByEnumeratingWithState:objects:count:"), 
-///                        &enumState, 
+///                          "countByEnumeratingWithState:objects:count:"),
+///                        &enumState,
 ///                        (id *)items, (unsigned int)16)
 ///
 void RewriteObjC::SynthCountByEnumWithState(std::string &buf) {
@@ -1250,7 +1249,7 @@
     return S;
   // replace break with goto __break_label
   std::string buf;
-  
+
   SourceLocation startLoc = S->getLocStart();
   buf = "goto __break_label_";
   buf += utostr(ObjCBcLabelNo.back());
@@ -1267,39 +1266,39 @@
     return S;
   // replace continue with goto __continue_label
   std::string buf;
-  
+
   SourceLocation startLoc = S->getLocStart();
   buf = "goto __continue_label_";
   buf += utostr(ObjCBcLabelNo.back());
   ReplaceText(startLoc, strlen("continue"), buf.c_str(), buf.size());
-  
+
   return 0;
 }
 
 /// RewriteObjCForCollectionStmt - Rewriter for ObjC2's foreach statement.
 ///  It rewrites:
 /// for ( type elem in collection) { stmts; }
- 
+
 /// Into:
 /// {
-///   type elem; 
+///   type elem;
 ///   struct __objcFastEnumerationState enumState = { 0 };
 ///   id items[16];
 ///   id l_collection = (id)collection;
-///   unsigned long limit = [l_collection countByEnumeratingWithState:&enumState 
+///   unsigned long limit = [l_collection countByEnumeratingWithState:&enumState
 ///                                       objects:items count:16];
 /// if (limit) {
 ///   unsigned long startMutations = *enumState.mutationsPtr;
 ///   do {
 ///        unsigned long counter = 0;
 ///        do {
-///             if (startMutations != *enumState.mutationsPtr) 
+///             if (startMutations != *enumState.mutationsPtr)
 ///               objc_enumerationMutation(l_collection);
 ///             elem = (type)enumState.itemsPtr[counter++];
 ///             stmts;
 ///             __continue_label: ;
 ///        } while (counter < limit);
-///   } while (limit = [l_collection countByEnumeratingWithState:&enumState 
+///   } while (limit = [l_collection countByEnumeratingWithState:&enumState
 ///                                  objects:items count:16]);
 ///   elem = nil;
 ///   __break_label: ;
@@ -1311,11 +1310,11 @@
 Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
                                                 SourceLocation OrigEnd) {
   assert(!Stmts.empty() && "ObjCForCollectionStmt - Statement stack empty");
-  assert(isa<ObjCForCollectionStmt>(Stmts.back()) && 
+  assert(isa<ObjCForCollectionStmt>(Stmts.back()) &&
          "ObjCForCollectionStmt Statement stack mismatch");
-  assert(!ObjCBcLabelNo.empty() && 
+  assert(!ObjCBcLabelNo.empty() &&
          "ObjCForCollectionStmt - Label No stack empty");
-  
+
   SourceLocation startLoc = S->getLocStart();
   const char *startBuf = SM->getCharacterData(startLoc);
   const char *elementName;
@@ -1336,10 +1335,10 @@
   else {
     DeclRefExpr *DR = cast<DeclRefExpr>(S->getElement());
     elementName = DR->getDecl()->getNameAsCString();
-    elementTypeAsString 
+    elementTypeAsString
       = cast<ValueDecl>(DR->getDecl())->getType().getAsString();
   }
-  
+
   // struct __objcFastEnumerationState enumState = { 0 };
   buf += "struct __objcFastEnumerationState enumState = { 0 };\n\t";
   // id items[16];
@@ -1358,8 +1357,8 @@
           *(startCollectionBuf+3) != '[' && *(startCollectionBuf+3) != '('))
     startCollectionBuf++;
   startCollectionBuf += 3;
-  
-  // Replace: "for (type element in" with string constructed thus far. 
+
+  // Replace: "for (type element in" with string constructed thus far.
   ReplaceText(startLoc, startCollectionBuf - startBuf,
               buf.c_str(), buf.size());
   // Replace ')' in for '(' type elem in collection ')' with ';'
@@ -1367,17 +1366,17 @@
   const char *rparenBuf = SM->getCharacterData(rightParenLoc);
   SourceLocation lparenLoc = startLoc.getFileLocWithOffset(rparenBuf-startBuf);
   buf = ";\n\t";
-  
+
   // unsigned long limit = [l_collection countByEnumeratingWithState:&enumState
   //                                   objects:items count:16];
   // which is synthesized into:
-  // unsigned int limit = 
+  // unsigned int limit =
   // ((unsigned int (*)
   //  (id, SEL, struct __objcFastEnumerationState *, id *, unsigned int))
-  //  (void *)objc_msgSend)((id)l_collection, 
+  //  (void *)objc_msgSend)((id)l_collection,
   //                        sel_registerName(
-  //                          "countByEnumeratingWithState:objects:count:"), 
-  //                        (struct __objcFastEnumerationState *)&state, 
+  //                          "countByEnumeratingWithState:objects:count:"),
+  //                        (struct __objcFastEnumerationState *)&state,
   //                        (id *)items, (unsigned int)16);
   buf += "unsigned long limit =\n\t\t";
   SynthCountByEnumWithState(buf);
@@ -1387,7 +1386,7 @@
   ///   do {
   ///        unsigned long counter = 0;
   ///        do {
-  ///             if (startMutations != *enumState.mutationsPtr) 
+  ///             if (startMutations != *enumState.mutationsPtr)
   ///               objc_enumerationMutation(l_collection);
   ///             elem = (type)enumState.itemsPtr[counter++];
   buf += "if (limit) {\n\t";
@@ -1403,10 +1402,10 @@
   buf += ")enumState.itemsPtr[counter++];";
   // Replace ')' in for '(' type elem in collection ')' with all of these.
   ReplaceText(lparenLoc, 1, buf.c_str(), buf.size());
-  
+
   ///            __continue_label: ;
   ///        } while (counter < limit);
-  ///   } while (limit = [l_collection countByEnumeratingWithState:&enumState 
+  ///   } while (limit = [l_collection countByEnumeratingWithState:&enumState
   ///                                  objects:items count:16]);
   ///   elem = nil;
   ///   __break_label: ;
@@ -1414,7 +1413,7 @@
   ///  else
   ///       elem = nil;
   ///  }
-  /// 
+  ///
   buf = ";\n\t";
   buf += "__continue_label_";
   buf += utostr(ObjCBcLabelNo.back());
@@ -1434,7 +1433,7 @@
   buf += elementName;
   buf += " = ((id)0);\n";
   buf += "}\n";
-  
+
   // Insert all these *after* the statement body.
   // FIXME: If this should support Obj-C++, support CXXTryStmt
   if (isa<CompoundStmt>(S->getBody())) {
@@ -1459,7 +1458,7 @@
   return 0;
 }
 
-/// RewriteObjCSynchronizedStmt - 
+/// RewriteObjCSynchronizedStmt -
 /// This routine rewrites @synchronized(expr) stmt;
 /// into:
 /// objc_sync_enter(expr);
@@ -1469,16 +1468,16 @@
   // Get the start location and compute the semi location.
   SourceLocation startLoc = S->getLocStart();
   const char *startBuf = SM->getCharacterData(startLoc);
-  
+
   assert((*startBuf == '@') && "bogus @synchronized location");
-  
-  std::string buf; 
+
+  std::string buf;
   buf = "objc_sync_enter((id)";
   const char *lparenBuf = startBuf;
   while (*lparenBuf != '(') lparenBuf++;
   ReplaceText(startLoc, lparenBuf-startBuf+1, buf.c_str(), buf.size());
-  // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since 
-  // the sync expression is typically a message expression that's already 
+  // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since
+  // the sync expression is typically a message expression that's already
   // been rewritten! (which implies the SourceLocation's are invalid).
   SourceLocation endLoc = S->getSynchBody()->getLocStart();
   const char *endBuf = SM->getCharacterData(endLoc);
@@ -1495,7 +1494,7 @@
   ReplaceText(rparenLoc, 1, buf.c_str(), buf.size());
   startLoc = S->getSynchBody()->getLocEnd();
   startBuf = SM->getCharacterData(startLoc);
-  
+
   assert((*startBuf == '}') && "bogus @synchronized block");
   SourceLocation lastCurlyLoc = startLoc;
   buf = "}\nelse {\n";
@@ -1504,9 +1503,9 @@
   buf += "{ /* implicit finally clause */\n";
   buf += "  if (!_rethrow) objc_exception_try_exit(&_stack);\n";
   buf += "  objc_sync_exit(";
-  Expr *syncExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+  Expr *syncExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                                 CastExpr::CK_Unknown,
-                                                S->getSynchExpr(), 
+                                                S->getSynchExpr(),
                                                 Context->getObjCIdType(),
                                                 SourceLocation(),
                                                 SourceLocation());
@@ -1519,21 +1518,21 @@
   buf += "  if (_rethrow) objc_exception_throw(_rethrow);\n";
   buf += "}\n";
   buf += "}";
-  
+
   ReplaceText(lastCurlyLoc, 1, buf.c_str(), buf.size());
   return 0;
 }
 
-void RewriteObjC::WarnAboutReturnGotoContinueOrBreakStmts(Stmt *S) {  
+void RewriteObjC::WarnAboutReturnGotoContinueOrBreakStmts(Stmt *S) {
   // Perform a bottom up traversal of all children.
   for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
        CI != E; ++CI)
     if (*CI)
       WarnAboutReturnGotoContinueOrBreakStmts(*CI);
 
-  if (isa<ReturnStmt>(S) || isa<ContinueStmt>(S) || 
+  if (isa<ReturnStmt>(S) || isa<ContinueStmt>(S) ||
       isa<BreakStmt>(S) || isa<GotoStmt>(S)) {
-    Diags.Report(Context->getFullLoc(S->getLocStart()), 
+    Diags.Report(Context->getFullLoc(S->getLocStart()),
                  TryFinallyContainsReturnDiag);
   }
   return;
@@ -1543,7 +1542,7 @@
   // Get the start location and compute the semi location.
   SourceLocation startLoc = S->getLocStart();
   const char *startBuf = SM->getCharacterData(startLoc);
-  
+
   assert((*startBuf == '@') && "bogus @try location");
 
   std::string buf;
@@ -1556,12 +1555,12 @@
   buf += "if (!_setjmp(_stack.buf)) /* @try block continue */\n";
 
   ReplaceText(startLoc, 4, buf.c_str(), buf.size());
-  
+
   startLoc = S->getTryBody()->getLocEnd();
   startBuf = SM->getCharacterData(startLoc);
 
   assert((*startBuf == '}') && "bogus @try block");
-  
+
   SourceLocation lastCurlyLoc = startLoc;
   ObjCAtCatchStmt *catchList = S->getCatchStmts();
   if (catchList) {
@@ -1572,7 +1571,7 @@
     buf += " if (_setjmp(_stack.buf))\n";
     buf += "   _rethrow = objc_exception_extract(&_stack);\n";
     buf += " else { /* @catch continue */";
-    
+
     InsertText(startLoc, buf.c_str(), buf.size());
   } else { /* no catch list */
     buf = "}\nelse {\n";
@@ -1585,15 +1584,15 @@
   while (catchList) {
     ParmVarDecl *catchDecl = catchList->getCatchParamDecl();
 
-    if (catchList == S->getCatchStmts()) 
+    if (catchList == S->getCatchStmts())
       buf = "if ("; // we are generating code for the first catch clause
     else
       buf = "else if (";
     startLoc = catchList->getLocStart();
     startBuf = SM->getCharacterData(startLoc);
-    
+
     assert((*startBuf == '@') && "bogus @catch location");
-    
+
     const char *lParenLoc = strchr(startBuf, '(');
 
     if (catchList->hasEllipsis()) {
@@ -1604,7 +1603,7 @@
       assert(*SM->getCharacterData(catchList->getRParenLoc()) == ')' &&
              "bogus @catch paren location");
       assert((*bodyBuf == '{') && "bogus @catch body location");
-      
+
       buf += "1) { id _tmp = _caught;";
       Rewrite.ReplaceText(startLoc, bodyBuf-startBuf+1, buf);
     } else if (catchDecl) {
@@ -1613,9 +1612,9 @@
         buf += "1) { ";
         ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());
         sawIdTypedCatch = true;
-      } else if (const PointerType *pType = t->getAs<PointerType>()) { 
+      } else if (const PointerType *pType = t->getAs<PointerType>()) {
         ObjCInterfaceType *cls; // Should be a pointer to a class.
-        
+
         cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr());
         if (cls) {
           buf += "objc_exception_match((struct objc_class *)objc_getClass(\"";
@@ -1632,9 +1631,9 @@
       const char *rParenBuf = SM->getCharacterData(rParenLoc);
       assert((*rParenBuf == ')') && "bogus @catch paren location");
       assert((*bodyBuf == '{') && "bogus @catch body location");
-        
+
       buf = " = _caught;";
-      // Here we replace ") {" with "= _caught;" (which initializes and 
+      // Here we replace ") {" with "= _caught;" (which initializes and
       // declares the @catch parameter).
       ReplaceText(rParenLoc, bodyBuf-rParenBuf+1, buf.c_str(), buf.size());
     } else {
@@ -1648,7 +1647,7 @@
     SourceLocation bodyLoc = lastCatchBody->getLocEnd();
     assert(*SM->getCharacterData(bodyLoc) == '}' &&
            "bogus @catch body location");
-  
+
     // Insert the last (implicit) else clause *before* the right curly brace.
     bodyLoc = bodyLoc.getFileLocWithOffset(-1);
     buf = "} /* last catch end */\n";
@@ -1659,7 +1658,7 @@
     if (!S->getFinallyStmt())
       buf += "}\n";
     InsertText(bodyLoc, buf.c_str(), buf.size());
-    
+
     // Set lastCurlyLoc
     lastCurlyLoc = lastCatchBody->getLocEnd();
   }
@@ -1667,28 +1666,28 @@
     startLoc = finalStmt->getLocStart();
     startBuf = SM->getCharacterData(startLoc);
     assert((*startBuf == '@') && "bogus @finally start");
-    
+
     buf = "/* @finally */";
     ReplaceText(startLoc, 8, buf.c_str(), buf.size());
-    
+
     Stmt *body = finalStmt->getFinallyBody();
     SourceLocation startLoc = body->getLocStart();
     SourceLocation endLoc = body->getLocEnd();
     assert(*SM->getCharacterData(startLoc) == '{' &&
            "bogus @finally body location");
-    assert(*SM->getCharacterData(endLoc) == '}' && 
+    assert(*SM->getCharacterData(endLoc) == '}' &&
            "bogus @finally body location");
-  
+
     startLoc = startLoc.getFileLocWithOffset(1);
     buf = " if (!_rethrow) objc_exception_try_exit(&_stack);\n";
     InsertText(startLoc, buf.c_str(), buf.size());
     endLoc = endLoc.getFileLocWithOffset(-1);
     buf = " if (_rethrow) objc_exception_throw(_rethrow);\n";
     InsertText(endLoc, buf.c_str(), buf.size());
-    
+
     // Set lastCurlyLoc
     lastCurlyLoc = body->getLocEnd();
-    
+
     // Now check for any return/continue/go statements within the @try.
     WarnAboutReturnGotoContinueOrBreakStmts(S->getTryBody());
   } else { /* no finally clause - make sure we synthesize an implicit one */
@@ -1713,14 +1712,14 @@
   return 0;
 }
 
-// This can't be done with ReplaceStmt(S, ThrowExpr), since 
-// the throw expression is typically a message expression that's already 
+// This can't be done with ReplaceStmt(S, ThrowExpr), since
+// the throw expression is typically a message expression that's already
 // been rewritten! (which implies the SourceLocation's are invalid).
 Stmt *RewriteObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) {
   // Get the start location and compute the semi location.
   SourceLocation startLoc = S->getLocStart();
   const char *startBuf = SM->getCharacterData(startLoc);
-  
+
   assert((*startBuf == '@') && "bogus @throw location");
 
   std::string buf;
@@ -1729,12 +1728,12 @@
     buf = "objc_exception_throw(";
   else // add an implicit argument
     buf = "objc_exception_throw(_caught";
-  
+
   // handle "@  throw" correctly.
   const char *wBuf = strchr(startBuf, 'w');
   assert((*wBuf == 'w') && "@throw: can't find 'w'");
   ReplaceText(startLoc, wBuf-startBuf+1, buf.c_str(), buf.size());
-  
+
   const char *semiBuf = strchr(startBuf, ';');
   assert((*semiBuf == ';') && "@throw: can't find ';'");
   SourceLocation semiLoc = startLoc.getFileLocWithOffset(semiBuf-startBuf);
@@ -1752,7 +1751,7 @@
                                             StrEncoding.length(), false,StrType,
                                             SourceLocation());
   ReplaceStmt(Exp, Replacement);
-  
+
   // Replace this subexpr in the parent.
   // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
   return Replacement;
@@ -1765,7 +1764,7 @@
   // Create a call to sel_registerName("selName").
   llvm::SmallVector<Expr*, 8> SelExprs;
   QualType argType = Context->getPointerType(Context->CharTy);
-  SelExprs.push_back(StringLiteral::Create(*Context, 
+  SelExprs.push_back(StringLiteral::Create(*Context,
                                        Exp->getSelector().getAsString().c_str(),
                                        Exp->getSelector().getAsString().size(),
                                        false, argType, SourceLocation()));
@@ -1780,19 +1779,19 @@
   FunctionDecl *FD, Expr **args, unsigned nargs) {
   // Get the type, we will need to reference it in a couple spots.
   QualType msgSendType = FD->getType();
-  
+
   // Create a reference to the objc_msgSend() declaration.
   DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, msgSendType, SourceLocation());
-                                     
+
   // Now, we cast the reference to a pointer to the objc_msgSend type.
   QualType pToFunc = Context->getPointerType(msgSendType);
-  ImplicitCastExpr *ICE = new (Context) ImplicitCastExpr(pToFunc, 
+  ImplicitCastExpr *ICE = new (Context) ImplicitCastExpr(pToFunc,
                                                          CastExpr::CK_Unknown,
-                                                         DRE, 
+                                                         DRE,
                                                /*isLvalue=*/false);
-  
+
   const FunctionType *FT = msgSendType->getAsFunctionType();
-  
+
   return new (Context) CallExpr(*Context, ICE, args, nargs, FT->getResultType(),
                                 SourceLocation());
 }
@@ -1834,7 +1833,7 @@
   QualType Type = E->getType();
   if (needToScanForQualifiers(Type)) {
     SourceLocation Loc, EndLoc;
-    
+
     if (const CStyleCastExpr *ECE = dyn_cast<CStyleCastExpr>(E)) {
       Loc = ECE->getLParenLoc();
       EndLoc = ECE->getRParenLoc();
@@ -1881,10 +1880,10 @@
   }
   else
     return;
-  
+
   if (needToScanForQualifiers(Type)) {
     // Since types are unique, we need to scan the buffer.
-    
+
     const char *endBuf = SM->getCharacterData(Loc);
     const char *startBuf = endBuf;
     while (*startBuf != ';' && *startBuf != '<' && startBuf != MainFileStart)
@@ -1907,16 +1906,16 @@
   for (unsigned i = 0; i < proto->getNumArgs(); i++) {
     if (needToScanForQualifiers(proto->getArgType(i))) {
       // Since types are unique, we need to scan the buffer.
-      
+
       const char *endBuf = startBuf;
       // scan forward (from the decl location) for argument types.
       scanToNextArgument(endBuf);
       const char *startRef = 0, *endRef = 0;
       if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
         // Get the locations of the startRef, endRef.
-        SourceLocation LessLoc = 
+        SourceLocation LessLoc =
           Loc.getFileLocWithOffset(startRef-startFuncBuf);
-        SourceLocation GreaterLoc = 
+        SourceLocation GreaterLoc =
           Loc.getFileLocWithOffset(endRef-startFuncBuf+1);
         // Comment out the protocol references.
         InsertText(LessLoc, "/*", 2);
@@ -1944,7 +1943,7 @@
                                                    &ArgTys[0], ArgTys.size(),
                                                    false /*isVariadic*/, 0);
   SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                           SourceLocation(), 
+                                           SourceLocation(),
                                            SelGetUidIdent, getFuncType, 0,
                                            FunctionDecl::Extern, false);
 }
@@ -1973,7 +1972,7 @@
                                                   &ArgTys[0], ArgTys.size(),
                                                   false, 0);
   SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                         SourceLocation(), 
+                                         SourceLocation(),
                                          msgSendIdent, msgSendType, 0,
                                          FunctionDecl::Extern, false);
 }
@@ -2014,7 +2013,7 @@
                                                   &ArgTys[0], ArgTys.size(),
                                                   true /*isVariadic*/, 0);
   MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                              SourceLocation(), 
+                                              SourceLocation(),
                                               msgSendIdent, msgSendType, 0,
                                               FunctionDecl::Extern, false);
 }
@@ -2033,15 +2032,15 @@
                                                   &ArgTys[0], ArgTys.size(),
                                                   true /*isVariadic*/, 0);
   MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                         SourceLocation(), 
+                                         SourceLocation(),
                                          msgSendIdent, msgSendType, 0,
                                          FunctionDecl::Extern, false);
 }
 
-// SynthMsgSendSuperStretFunctionDecl - 
+// SynthMsgSendSuperStretFunctionDecl -
 // id objc_msgSendSuper_stret(struct objc_super *, SEL op, ...);
 void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
-  IdentifierInfo *msgSendIdent = 
+  IdentifierInfo *msgSendIdent =
     &Context->Idents.get("objc_msgSendSuper_stret");
   llvm::SmallVector<QualType, 16> ArgTys;
   RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl,
@@ -2057,7 +2056,7 @@
                                                   &ArgTys[0], ArgTys.size(),
                                                   true /*isVariadic*/, 0);
   MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                                       SourceLocation(), 
+                                                       SourceLocation(),
                                               msgSendIdent, msgSendType, 0,
                                               FunctionDecl::Extern, false);
 }
@@ -2076,7 +2075,7 @@
                                                   &ArgTys[0], ArgTys.size(),
                                                   true /*isVariadic*/, 0);
   MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                              SourceLocation(), 
+                                              SourceLocation(),
                                               msgSendIdent, msgSendType, 0,
                                               FunctionDecl::Extern, false);
 }
@@ -2091,7 +2090,7 @@
                                                    &ArgTys[0], ArgTys.size(),
                                                    false /*isVariadic*/, 0);
   GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                          SourceLocation(), 
+                                          SourceLocation(),
                                           getClassIdent, getClassType, 0,
                                           FunctionDecl::Extern, false);
 }
@@ -2106,7 +2105,7 @@
                                                    &ArgTys[0], ArgTys.size(),
                                                    false /*isVariadic*/, 0);
   GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
-                                              SourceLocation(), 
+                                              SourceLocation(),
                                               getClassIdent, getClassType, 0,
                                               FunctionDecl::Extern, false);
 }
@@ -2140,19 +2139,19 @@
   Preamble += ",";
   // The minus 2 removes the begin/end double quotes.
   Preamble += utostr(prettyBuf.str().size()-2) + "};\n";
-  
-  VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), 
-                                    &Context->Idents.get(S.c_str()), strType, 0, 
+
+  VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
+                                    &Context->Idents.get(S.c_str()), strType, 0,
                                     VarDecl::Static);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, strType, SourceLocation());
   Expr *Unop = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
-                                 Context->getPointerType(DRE->getType()), 
+                                 Context->getPointerType(DRE->getType()),
                                  SourceLocation());
   // cast to NSConstantString *
-  CastExpr *cast = new (Context) CStyleCastExpr(Exp->getType(), 
+  CastExpr *cast = new (Context) CStyleCastExpr(Exp->getType(),
                                                 CastExpr::CK_Unknown,
-                                                Unop, Exp->getType(), 
-                                                SourceLocation(), 
+                                                Unop, Exp->getType(),
+                                                SourceLocation(),
                                                 SourceLocation());
   ReplaceStmt(Exp, cast);
   // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
@@ -2162,9 +2161,9 @@
 ObjCInterfaceDecl *RewriteObjC::isSuperReceiver(Expr *recExpr) {
   // check if we are sending a message to 'super'
   if (!CurMethodDef || !CurMethodDef->isInstanceMethod()) return 0;
-  
+
   if (ObjCSuperExpr *Super = dyn_cast<ObjCSuperExpr>(recExpr)) {
-      const ObjCObjectPointerType *OPT = 
+      const ObjCObjectPointerType *OPT =
         Super->getType()->getAsObjCObjectPointerType();
       assert(OPT);
       const ObjCInterfaceType *IT = OPT->getInterfaceType();
@@ -2177,24 +2176,24 @@
 QualType RewriteObjC::getSuperStructType() {
   if (!SuperStructDecl) {
     SuperStructDecl = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl,
-                                         SourceLocation(), 
+                                         SourceLocation(),
                                          &Context->Idents.get("objc_super"));
     QualType FieldTypes[2];
-  
+
     // struct objc_object *receiver;
-    FieldTypes[0] = Context->getObjCIdType();  
+    FieldTypes[0] = Context->getObjCIdType();
     // struct objc_class *super;
-    FieldTypes[1] = Context->getObjCClassType();  
+    FieldTypes[1] = Context->getObjCClassType();
 
     // Create fields
     for (unsigned i = 0; i < 2; ++i) {
-      SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl, 
-                                                 SourceLocation(), 0, 
+      SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl,
+                                                 SourceLocation(), 0,
                                                  FieldTypes[i], 0,
                                                  /*BitWidth=*/0,
                                                  /*Mutable=*/false));
     }
-  
+
     SuperStructDecl->completeDefinition(*Context);
   }
   return Context->getTagDeclType(SuperStructDecl);
@@ -2203,23 +2202,23 @@
 QualType RewriteObjC::getConstantStringStructType() {
   if (!ConstantStringDecl) {
     ConstantStringDecl = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl,
-                                            SourceLocation(), 
+                                            SourceLocation(),
                          &Context->Idents.get("__NSConstantStringImpl"));
     QualType FieldTypes[4];
-  
+
     // struct objc_object *receiver;
-    FieldTypes[0] = Context->getObjCIdType();  
+    FieldTypes[0] = Context->getObjCIdType();
     // int flags;
-    FieldTypes[1] = Context->IntTy;  
+    FieldTypes[1] = Context->IntTy;
     // char *str;
-    FieldTypes[2] = Context->getPointerType(Context->CharTy);  
+    FieldTypes[2] = Context->getPointerType(Context->CharTy);
     // long length;
-    FieldTypes[3] = Context->LongTy;  
+    FieldTypes[3] = Context->LongTy;
 
     // Create fields
     for (unsigned i = 0; i < 4; ++i) {
-      ConstantStringDecl->addDecl(FieldDecl::Create(*Context, 
-                                                    ConstantStringDecl, 
+      ConstantStringDecl->addDecl(FieldDecl::Create(*Context,
+                                                    ConstantStringDecl,
                                                     SourceLocation(), 0,
                                                     FieldTypes[i], 0,
                                                     /*BitWidth=*/0,
@@ -2248,7 +2247,7 @@
     SynthGetClassFunctionDecl();
   if (!GetMetaClassFunctionDecl)
     SynthGetMetaClassFunctionDecl();
-  
+
   // default to objc_msgSend().
   FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
   // May need to use objc_msgSend_stret() as well.
@@ -2260,11 +2259,11 @@
     else if (resultType->isRealFloatingType())
       MsgSendFlavor = MsgSendFpretFunctionDecl;
   }
-  
+
   // Synthesize a call to objc_msgSend().
   llvm::SmallVector<Expr*, 8> MsgExprs;
   IdentifierInfo *clsName = Exp->getClassName();
-  
+
   // Derive/push the receiver/selector, 2 implicit arguments to objc_msgSend().
   if (clsName) { // class message.
     // FIXME: We need to fix Sema (and the AST for ObjCMessageExpr) to handle
@@ -2274,17 +2273,17 @@
       if (MsgSendStretFlavor)
         MsgSendStretFlavor = MsgSendSuperStretFunctionDecl;
       assert(MsgSendFlavor && "MsgSendFlavor is NULL!");
-      
-      ObjCInterfaceDecl *SuperDecl = 
+
+      ObjCInterfaceDecl *SuperDecl =
         CurMethodDef->getClassInterface()->getSuperClass();
 
       llvm::SmallVector<Expr*, 4> InitExprs;
-      
+
       // set the receiver to self, the first argument to all methods.
       InitExprs.push_back(
-        new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+        new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                      CastExpr::CK_Unknown,
-                     new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(), 
+                     new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
                                      Context->getObjCIdType(),
                                      SourceLocation()),
                      Context->getObjCIdType(),
@@ -2293,29 +2292,29 @@
       llvm::SmallVector<Expr*, 8> ClsExprs;
       QualType argType = Context->getPointerType(Context->CharTy);
       ClsExprs.push_back(StringLiteral::Create(*Context,
-                                        SuperDecl->getIdentifier()->getName(), 
+                                        SuperDecl->getIdentifier()->getName(),
                                         SuperDecl->getIdentifier()->getLength(),
                                         false, argType, SourceLocation()));
       CallExpr *Cls = SynthesizeCallToFunctionDecl(GetMetaClassFunctionDecl,
-                                                   &ClsExprs[0], 
+                                                   &ClsExprs[0],
                                                    ClsExprs.size());
       // To turn off a warning, type-cast to 'id'
       InitExprs.push_back( // set 'super class', using objc_getClass().
-        new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+        new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                      CastExpr::CK_Unknown,
                               Cls, Context->getObjCIdType(),
-                              SourceLocation(), SourceLocation())); 
+                              SourceLocation(), SourceLocation()));
       // struct objc_super
       QualType superType = getSuperStructType();
       Expr *SuperRep;
-      
+
       if (LangOpts.Microsoft) {
         SynthSuperContructorFunctionDecl();
         // Simulate a contructor call...
-        DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl, 
+        DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl,
                                            superType, SourceLocation());
         SuperRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0],
-                                          InitExprs.size(), 
+                                          InitExprs.size(),
                                           superType, SourceLocation());
         // The code for super is a little tricky to prevent collision with
         // the structure definition in the header. The rewriter has it's own
@@ -2324,22 +2323,22 @@
         // (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
         //
         SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
-                                 Context->getPointerType(SuperRep->getType()), 
+                                 Context->getPointerType(SuperRep->getType()),
                                  SourceLocation());
-        SuperRep = new (Context) CStyleCastExpr(Context->getPointerType(superType), 
-                                 CastExpr::CK_Unknown, SuperRep, 
+        SuperRep = new (Context) CStyleCastExpr(Context->getPointerType(superType),
+                                 CastExpr::CK_Unknown, SuperRep,
                                  Context->getPointerType(superType),
-                                 SourceLocation(), SourceLocation()); 
-      } else {      
+                                 SourceLocation(), SourceLocation());
+      } else {
         // (struct objc_super) { <exprs from above> }
-        InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(), 
-                                             &InitExprs[0], InitExprs.size(), 
+        InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(),
+                                             &InitExprs[0], InitExprs.size(),
                                              SourceLocation());
         SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superType, ILE,
                                            false);
         // struct objc_super *
         SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
-                                 Context->getPointerType(SuperRep->getType()), 
+                                 Context->getPointerType(SuperRep->getType()),
                                  SourceLocation());
       }
       MsgExprs.push_back(SuperRep);
@@ -2347,12 +2346,12 @@
       llvm::SmallVector<Expr*, 8> ClsExprs;
       QualType argType = Context->getPointerType(Context->CharTy);
       ClsExprs.push_back(StringLiteral::Create(*Context,
-                                               clsName->getName(), 
+                                               clsName->getName(),
                                                clsName->getLength(),
                                                false, argType,
                                                SourceLocation()));
       CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl,
-                                                   &ClsExprs[0], 
+                                                   &ClsExprs[0],
                                                    ClsExprs.size());
       MsgExprs.push_back(Cls);
     }
@@ -2364,44 +2363,44 @@
       if (MsgSendStretFlavor)
         MsgSendStretFlavor = MsgSendSuperStretFunctionDecl;
       assert(MsgSendFlavor && "MsgSendFlavor is NULL!");
-      
+
       llvm::SmallVector<Expr*, 4> InitExprs;
-      
+
       InitExprs.push_back(
-        new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+        new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                      CastExpr::CK_Unknown,
-                     new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(), 
+                     new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
                                      Context->getObjCIdType(),
                                      SourceLocation()),
                      Context->getObjCIdType(),
                      SourceLocation(), SourceLocation())); // set the 'receiver'.
-      
+
       llvm::SmallVector<Expr*, 8> ClsExprs;
       QualType argType = Context->getPointerType(Context->CharTy);
-      ClsExprs.push_back(StringLiteral::Create(*Context, 
-                                        SuperDecl->getIdentifier()->getName(), 
+      ClsExprs.push_back(StringLiteral::Create(*Context,
+                                        SuperDecl->getIdentifier()->getName(),
                                         SuperDecl->getIdentifier()->getLength(),
                                         false, argType, SourceLocation()));
       CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl,
-                                                   &ClsExprs[0], 
+                                                   &ClsExprs[0],
                                                    ClsExprs.size());
       // To turn off a warning, type-cast to 'id'
       InitExprs.push_back(
         // set 'super class', using objc_getClass().
-        new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+        new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                      CastExpr::CK_Unknown,
-        Cls, Context->getObjCIdType(), SourceLocation(), SourceLocation())); 
+        Cls, Context->getObjCIdType(), SourceLocation(), SourceLocation()));
       // struct objc_super
       QualType superType = getSuperStructType();
       Expr *SuperRep;
-      
+
       if (LangOpts.Microsoft) {
         SynthSuperContructorFunctionDecl();
         // Simulate a contructor call...
-        DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl, 
+        DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl,
                                            superType, SourceLocation());
         SuperRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0],
-                                          InitExprs.size(), 
+                                          InitExprs.size(),
                                           superType, SourceLocation());
         // The code for super is a little tricky to prevent collision with
         // the structure definition in the header. The rewriter has it's own
@@ -2410,16 +2409,16 @@
         // (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
         //
         SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
-                                 Context->getPointerType(SuperRep->getType()), 
+                                 Context->getPointerType(SuperRep->getType()),
                                  SourceLocation());
-        SuperRep = new (Context) CStyleCastExpr(Context->getPointerType(superType), 
+        SuperRep = new (Context) CStyleCastExpr(Context->getPointerType(superType),
                                  CastExpr::CK_Unknown,
                                  SuperRep, Context->getPointerType(superType),
-                                 SourceLocation(), SourceLocation()); 
+                                 SourceLocation(), SourceLocation());
       } else {
         // (struct objc_super) { <exprs from above> }
-        InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(), 
-                                             &InitExprs[0], InitExprs.size(), 
+        InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(),
+                                             &InitExprs[0], InitExprs.size(),
                                              SourceLocation());
         SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superType, ILE, false);
       }
@@ -2429,9 +2428,9 @@
       // Foo<Proto> *.
       while (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(recExpr))
         recExpr = CE->getSubExpr();
-      recExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+      recExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                       CastExpr::CK_Unknown, recExpr,
-                                      Context->getObjCIdType(), 
+                                      Context->getObjCIdType(),
                                       SourceLocation(), SourceLocation());
       MsgExprs.push_back(recExpr);
     }
@@ -2439,14 +2438,14 @@
   // Create a call to sel_registerName("selName"), it will be the 2nd argument.
   llvm::SmallVector<Expr*, 8> SelExprs;
   QualType argType = Context->getPointerType(Context->CharTy);
-  SelExprs.push_back(StringLiteral::Create(*Context, 
+  SelExprs.push_back(StringLiteral::Create(*Context,
                                        Exp->getSelector().getAsString().c_str(),
                                        Exp->getSelector().getAsString().size(),
                                        false, argType, SourceLocation()));
   CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
                                                  &SelExprs[0], SelExprs.size());
   MsgExprs.push_back(SelExp);
-  
+
   // Now push any user supplied arguments.
   for (unsigned i = 0; i < Exp->getNumArgs(); i++) {
     Expr *userExpr = Exp->getArg(i);
@@ -2457,7 +2456,7 @@
                                 ? Context->getObjCIdType()
                                 : ICE->getType();
       userExpr = new (Context) CStyleCastExpr(type, CastExpr::CK_Unknown,
-                                              userExpr, type, SourceLocation(), 
+                                              userExpr, type, SourceLocation(),
                                               SourceLocation());
     }
     // Make id<P...> cast into an 'id' cast.
@@ -2465,12 +2464,12 @@
       if (CE->getType()->isObjCQualifiedIdType()) {
         while ((CE = dyn_cast<CStyleCastExpr>(userExpr)))
           userExpr = CE->getSubExpr();
-        userExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(), 
+        userExpr = new (Context) CStyleCastExpr(Context->getObjCIdType(),
                                                 CastExpr::CK_Unknown,
-                                userExpr, Context->getObjCIdType(), 
+                                userExpr, Context->getObjCIdType(),
                                 SourceLocation(), SourceLocation());
       }
-    } 
+    }
     MsgExprs.push_back(userExpr);
     // We've transferred the ownership to MsgExprs. For now, we *don't* null
     // out the argument in the original expression (since we aren't deleting
@@ -2481,7 +2480,7 @@
   CastExpr *cast;
   llvm::SmallVector<QualType, 8> ArgTypes;
   QualType returnType;
-  
+
   // Push 'id' and 'SEL', the 2 implicit arguments.
   if (MsgSendFlavor == MsgSendSuperFunctionDecl)
     ArgTypes.push_back(Context->getPointerType(getSuperStructType()));
@@ -2493,7 +2492,7 @@
     for (ObjCMethodDecl::param_iterator PI = OMD->param_begin(),
          E = OMD->param_end(); PI != E; ++PI) {
       QualType t = (*PI)->getType()->isObjCQualifiedIdType()
-                     ? Context->getObjCIdType() 
+                     ? Context->getObjCIdType()
                      : (*PI)->getType();
       // Make sure we convert "t (^)(...)" to "t (*)(...)".
       if (isTopLevelBlockPointerType(t)) {
@@ -2509,36 +2508,36 @@
   }
   // Get the type, we will need to reference it in a couple spots.
   QualType msgSendType = MsgSendFlavor->getType();
-  
+
   // Create a reference to the objc_msgSend() declaration.
-  DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, msgSendType, 
+  DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, msgSendType,
                                      SourceLocation());
 
-  // Need to cast objc_msgSend to "void *" (to workaround a GCC bandaid). 
+  // Need to cast objc_msgSend to "void *" (to workaround a GCC bandaid).
   // If we don't do this cast, we get the following bizarre warning/note:
   // xx.m:13: warning: function called through a non-compatible type
   // xx.m:13: note: if this code is reached, the program will abort
-  cast = new (Context) CStyleCastExpr(Context->getPointerType(Context->VoidTy), 
-                                      CastExpr::CK_Unknown, DRE, 
+  cast = new (Context) CStyleCastExpr(Context->getPointerType(Context->VoidTy),
+                                      CastExpr::CK_Unknown, DRE,
                                Context->getPointerType(Context->VoidTy),
                                SourceLocation(), SourceLocation());
-    
+
   // Now do the "normal" pointer to function cast.
-  QualType castType = Context->getFunctionType(returnType, 
+  QualType castType = Context->getFunctionType(returnType,
     &ArgTypes[0], ArgTypes.size(),
     // If we don't have a method decl, force a variadic cast.
     Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true, 0);
   castType = Context->getPointerType(castType);
-  cast = new (Context) CStyleCastExpr(castType, CastExpr::CK_Unknown, cast, 
-                                      castType, SourceLocation(), 
+  cast = new (Context) CStyleCastExpr(castType, CastExpr::CK_Unknown, cast,
+                                      castType, SourceLocation(),
                                       SourceLocation());
 
   // Don't forget the parens to enforce the proper binding.
   ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast);
-  
+
   const FunctionType *FT = msgSendType->getAsFunctionType();
   CallExpr *CE = new (Context) CallExpr(*Context, PE, &MsgExprs[0],
-                                        MsgExprs.size(), 
+                                        MsgExprs.size(),
                                         FT->getResultType(), SourceLocation());
   Stmt *ReplacingStmt = CE;
   if (MsgSendStretFlavor) {
@@ -2546,33 +2545,33 @@
     // call to objc_msgSend_stret and hang both varieties on a conditional
     // expression which dictate which one to envoke depending on size of
     // method's return type.
-    
+
     // Create a reference to the objc_msgSend_stret() declaration.
-    DeclRefExpr *STDRE = new (Context) DeclRefExpr(MsgSendStretFlavor, msgSendType, 
+    DeclRefExpr *STDRE = new (Context) DeclRefExpr(MsgSendStretFlavor, msgSendType,
                                          SourceLocation());
     // Need to cast objc_msgSend_stret to "void *" (see above comment).
-    cast = new (Context) CStyleCastExpr(Context->getPointerType(Context->VoidTy), 
-                                        CastExpr::CK_Unknown, STDRE, 
+    cast = new (Context) CStyleCastExpr(Context->getPointerType(Context->VoidTy),
+                                        CastExpr::CK_Unknown, STDRE,
                                  Context->getPointerType(Context->VoidTy),
                                  SourceLocation(), SourceLocation());
     // Now do the "normal" pointer to function cast.
-    castType = Context->getFunctionType(returnType, 
+    castType = Context->getFunctionType(returnType,
       &ArgTypes[0], ArgTypes.size(),
       Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false, 0);
     castType = Context->getPointerType(castType);
     cast = new (Context) CStyleCastExpr(castType, CastExpr::CK_Unknown,
                                         cast, castType, SourceLocation(), SourceLocation());
-    
+
     // Don't forget the parens to enforce the proper binding.
     PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast);
-    
+
     FT = msgSendType->getAsFunctionType();
     CallExpr *STCE = new (Context) CallExpr(*Context, PE, &MsgExprs[0],
-                                            MsgExprs.size(), 
+                                            MsgExprs.size(),
                                             FT->getResultType(), SourceLocation());
-    
+
     // Build sizeof(returnType)
-    SizeOfAlignOfExpr *sizeofExpr = new (Context) SizeOfAlignOfExpr(true, 
+    SizeOfAlignOfExpr *sizeofExpr = new (Context) SizeOfAlignOfExpr(true,
                                       returnType,
                                       Context->getSizeType(),
                                       SourceLocation(), SourceLocation());
@@ -2580,33 +2579,33 @@
     // FIXME: Value of 8 is base on ppc32/x86 ABI for the most common cases.
     // For X86 it is more complicated and some kind of target specific routine
     // is needed to decide what to do.
-    unsigned IntSize = 
+    unsigned IntSize =
       static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
-    IntegerLiteral *limit = new (Context) IntegerLiteral(llvm::APInt(IntSize, 8), 
+    IntegerLiteral *limit = new (Context) IntegerLiteral(llvm::APInt(IntSize, 8),
                                                Context->IntTy,
                                                SourceLocation());
-    BinaryOperator *lessThanExpr = new (Context) BinaryOperator(sizeofExpr, limit, 
-                                                      BinaryOperator::LE, 
-                                                      Context->IntTy, 
+    BinaryOperator *lessThanExpr = new (Context) BinaryOperator(sizeofExpr, limit,
+                                                      BinaryOperator::LE,
+                                                      Context->IntTy,
                                                       SourceLocation());
     // (sizeof(returnType) <= 8 ? objc_msgSend(...) : objc_msgSend_stret(...))
-    ConditionalOperator *CondExpr = 
+    ConditionalOperator *CondExpr =
       new (Context) ConditionalOperator(lessThanExpr,
                                         SourceLocation(), CE,
                                         SourceLocation(), STCE, returnType);
     ReplacingStmt = new (Context) ParenExpr(SourceLocation(), SourceLocation(), CondExpr);
   }
-  // delete Exp; leak for now, see RewritePropertySetter() usage for more info. 
+  // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
   return ReplacingStmt;
 }
 
 Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) {
   Stmt *ReplacingStmt = SynthMessageExpr(Exp);
-  
+
   // Now do the actual rewrite.
   ReplaceStmt(Exp, ReplacingStmt);
-  
-  // delete Exp; leak for now, see RewritePropertySetter() usage for more info. 
+
+  // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
   return ReplacingStmt;
 }
 
@@ -2614,7 +2613,7 @@
 QualType RewriteObjC::getProtocolType() {
   if (!ProtocolTypeDecl) {
     ProtocolTypeDecl = TypedefDecl::Create(*Context, TUDecl,
-                                           SourceLocation(), 
+                                           SourceLocation(),
                                            &Context->Idents.get("Protocol"),
                                            Context->getObjCIdType());
   }
@@ -2628,24 +2627,24 @@
 Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
   std::string Name = "_OBJC_PROTOCOL_" + Exp->getProtocol()->getNameAsString();
   IdentifierInfo *ID = &Context->Idents.get(Name);
-  VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(), 
+  VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
                           ID, QualType()/*UNUSED*/, 0, VarDecl::Extern);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, getProtocolType(), SourceLocation());
   Expr *DerefExpr = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
                              Context->getPointerType(DRE->getType()),
                              SourceLocation());
-  CastExpr *castExpr = new (Context) CStyleCastExpr(DerefExpr->getType(), 
-                                                    CastExpr::CK_Unknown, 
-                                          DerefExpr, DerefExpr->getType(), 
+  CastExpr *castExpr = new (Context) CStyleCastExpr(DerefExpr->getType(),
+                                                    CastExpr::CK_Unknown,
+                                          DerefExpr, DerefExpr->getType(),
                                           SourceLocation(), SourceLocation());
   ReplaceStmt(Exp, castExpr);
   ProtocolExprDecls.insert(Exp->getProtocol());
-  // delete Exp; leak for now, see RewritePropertySetter() usage for more info. 
+  // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
   return castExpr;
-  
+
 }
 
-bool RewriteObjC::BufferContainsPPDirectives(const char *startBuf, 
+bool RewriteObjC::BufferContainsPPDirectives(const char *startBuf,
                                              const char *endBuf) {
   while (startBuf < endBuf) {
     if (*startBuf == '#') {
@@ -2676,7 +2675,7 @@
 void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
                                                std::string &Result) {
   assert(CDecl && "Class missing in SynthesizeObjCInternalStruct");
-  assert(CDecl->getNameAsCString() && 
+  assert(CDecl->getNameAsCString() &&
          "Name missing in SynthesizeObjCInternalStruct");
   // Do not synthesize more than once.
   if (ObjCSynthesizedStructs.count(CDecl))
@@ -2685,10 +2684,10 @@
   int NumIvars = CDecl->ivar_size();
   SourceLocation LocStart = CDecl->getLocStart();
   SourceLocation LocEnd = CDecl->getLocEnd();
-  
+
   const char *startBuf = SM->getCharacterData(LocStart);
   const char *endBuf = SM->getCharacterData(LocEnd);
-  
+
   // If no ivars and no root or if its root, directly or indirectly,
   // have no ivars (thus not synthesized) then no need to synthesize this class.
   if ((CDecl->isForwardDecl() || NumIvars == 0) &&
@@ -2697,8 +2696,8 @@
     ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size());
     return;
   }
-  
-  // FIXME: This has potential of causing problem. If 
+
+  // FIXME: This has potential of causing problem. If
   // SynthesizeObjCInternalStruct is ever called recursively.
   Result += "\nstruct ";
   Result += CDecl->getNameAsString();
@@ -2707,7 +2706,7 @@
 
   if (NumIvars > 0) {
     const char *cursor = strchr(startBuf, '{');
-    assert((cursor && endBuf) 
+    assert((cursor && endBuf)
            && "SynthesizeObjCInternalStruct - malformed @interface");
     // If the buffer contains preprocessor directives, we do more fine-grained
     // rewrites. This is intended to fix code that looks like (which occurs in
@@ -2725,7 +2724,7 @@
     //
     // This clause is segregated to avoid breaking the common case.
     if (BufferContainsPPDirectives(startBuf, cursor)) {
-      SourceLocation L = RCDecl ? CDecl->getSuperClassLoc() : 
+      SourceLocation L = RCDecl ? CDecl->getSuperClassLoc() :
                                   CDecl->getClassLoc();
       const char *endHeader = SM->getCharacterData(L);
       endHeader += Lexer::MeasureTokenLength(L, *SM, LangOpts);
@@ -2747,14 +2746,14 @@
       Result += "_IMPL ";
       Result += RCDecl->getNameAsString();
       Result += "_IVARS;\n";
-      
+
       // insert the super class structure definition.
       SourceLocation OnePastCurly =
         LocStart.getFileLocWithOffset(cursor-startBuf+1);
       InsertText(OnePastCurly, Result.c_str(), Result.size());
     }
     cursor++; // past '{'
-    
+
     // Now comment out any visibility specifiers.
     while (cursor < endBuf) {
       if (*cursor == '@') {
@@ -2813,7 +2812,7 @@
                                              const char *ClassName,
                                              std::string &Result) {
   if (MethodBegin == MethodEnd) return;
-  
+
   static bool objc_impl_method = false;
   if (!objc_impl_method) {
     /* struct _objc_method {
@@ -2827,12 +2826,12 @@
     Result += "\tchar *method_types;\n";
     Result += "\tvoid *_imp;\n";
     Result += "};\n";
-    
+
     objc_impl_method = true;
   }
-  
+
   // Build _objc_method_list for class's methods if needed
-  
+
   /* struct  {
    struct _objc_method_list *next_method;
    int method_count;
@@ -2895,13 +2894,13 @@
     Result += "\tstruct objc_selector *_cmd;\n";
     Result += "\tchar *method_types;\n";
     Result += "};\n";
-    
+
     objc_protocol_methods = true;
   }
   // Do not synthesize the protocol more than once.
   if (ObjCSynthesizedProtocols.count(PDecl))
     return;
-         
+
     if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
       unsigned NumMethods = std::distance(PDecl->instmeth_begin(),
                                           PDecl->instmeth_end());
@@ -2918,10 +2917,10 @@
     Result += PDecl->getNameAsString();
     Result += " __attribute__ ((used, section (\"__OBJC, __cat_inst_meth\")))= "
       "{\n\t" + utostr(NumMethods) + "\n";
-    
+
     // Output instance methods declared in this protocol.
-    for (ObjCProtocolDecl::instmeth_iterator 
-           I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); 
+    for (ObjCProtocolDecl::instmeth_iterator
+           I = PDecl->instmeth_begin(), E = PDecl->instmeth_end();
          I != E; ++I) {
       if (I == PDecl->instmeth_begin())
         Result += "\t  ,{{(struct objc_selector *)\"";
@@ -2936,7 +2935,7 @@
     }
     Result += "\t }\n};\n";
   }
-  
+
   // Output class methods declared in this protocol.
   unsigned NumMethods = std::distance(PDecl->classmeth_begin(),
                                       PDecl->classmeth_end());
@@ -2956,9 +2955,9 @@
            "{\n\t";
     Result += utostr(NumMethods);
     Result += "\n";
-    
+
     // Output instance methods declared in this protocol.
-    for (ObjCProtocolDecl::classmeth_iterator 
+    for (ObjCProtocolDecl::classmeth_iterator
            I = PDecl->classmeth_begin(), E = PDecl->classmeth_end();
          I != E; ++I) {
       if (I == PDecl->classmeth_begin())
@@ -2983,7 +2982,7 @@
    struct _objc_protocol **protocol_list;
    struct _objc_protocol_method_list *instance_methods;
    struct _objc_protocol_method_list *class_methods;
-   };  
+   };
    */
   static bool objc_protocol = false;
   if (!objc_protocol) {
@@ -2994,10 +2993,10 @@
     Result += "\tstruct _objc_protocol_method_list *instance_methods;\n";
     Result += "\tstruct _objc_protocol_method_list *class_methods;\n";
     Result += "};\n";
-    
+
     objc_protocol = true;
   }
-  
+
   Result += "\nstatic struct _objc_protocol _OBJC_PROTOCOL_";
   Result += PDecl->getNameAsString();
   Result += " __attribute__ ((used, section (\"__OBJC, __protocol\")))= "
@@ -3019,7 +3018,7 @@
   else
     Result += "0\n";
   Result += "};\n";
-  
+
   // Mark this protocol as having been generated.
   if (!ObjCSynthesizedProtocols.insert(PDecl))
     assert(false && "protocol already synthesized");
@@ -3031,7 +3030,7 @@
                                 const char *prefix, const char *ClassName,
                                 std::string &Result) {
   if (Protocols.empty()) return;
-  
+
   for (unsigned i = 0; i != Protocols.size(); i++)
     RewriteObjCProtocolMetaData(Protocols[i], prefix, ClassName, Result);
 
@@ -3055,11 +3054,11 @@
     "{\n\t0, ";
   Result += utostr(Protocols.size());
   Result += "\n";
-  
+
   Result += "\t,{&_OBJC_PROTOCOL_";
   Result += Protocols[0]->getNameAsString();
   Result += " \n";
-  
+
   for (unsigned i = 1; i != Protocols.size(); i++) {
     Result += "\t ,&_OBJC_PROTOCOL_";
     Result += Protocols[i]->getNameAsString();
@@ -3069,24 +3068,24 @@
 }
 
 
-/// RewriteObjCCategoryImplDecl - Rewrite metadata for each category 
+/// RewriteObjCCategoryImplDecl - Rewrite metadata for each category
 /// implementation.
 void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl,
                                               std::string &Result) {
   ObjCInterfaceDecl *ClassDecl = IDecl->getClassInterface();
   // Find category declaration for this implementation.
   ObjCCategoryDecl *CDecl;
-  for (CDecl = ClassDecl->getCategoryList(); CDecl; 
+  for (CDecl = ClassDecl->getCategoryList(); CDecl;
        CDecl = CDecl->getNextClassCategory())
     if (CDecl->getIdentifier() == IDecl->getIdentifier())
       break;
-  
+
   std::string FullCategoryName = ClassDecl->getNameAsString();
   FullCategoryName += '_';
   FullCategoryName += IDecl->getNameAsString();
-    
+
   // Build _objc_method_list for class's instance methods if needed
-  llvm::SmallVector<ObjCMethodDecl *, 32> 
+  llvm::SmallVector<ObjCMethodDecl *, 32>
     InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end());
 
   // If any of our property implementations have associated getters or
@@ -3111,12 +3110,12 @@
   RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(),
                              true, "CATEGORY_", FullCategoryName.c_str(),
                              Result);
-  
+
   // Build _objc_method_list for class's class methods if needed
   RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(),
                              false, "CATEGORY_", FullCategoryName.c_str(),
                              Result);
-  
+
   // Protocols referenced in class declaration?
   // Null CDecl is case of a category implementation with no category interface
   if (CDecl)
@@ -3130,11 +3129,11 @@
    struct _objc_protocol_list *protocols;
    // Objective-C 1.0 extensions
    uint32_t size;     // sizeof (struct _objc_category)
-   struct _objc_property_list *instance_properties;  // category's own 
+   struct _objc_property_list *instance_properties;  // category's own
                                                      // @property decl.
-   };   
+   };
    */
-  
+
   static bool objc_category = false;
   if (!objc_category) {
     Result += "\nstruct _objc_category {\n";
@@ -3143,7 +3142,7 @@
     Result += "\tstruct _objc_method_list *instance_methods;\n";
     Result += "\tstruct _objc_method_list *class_methods;\n";
     Result += "\tstruct _objc_protocol_list *protocols;\n";
-    Result += "\tunsigned int size;\n";   
+    Result += "\tunsigned int size;\n";
     Result += "\tstruct _objc_property_list *instance_properties;\n";
     Result += "};\n";
     objc_category = true;
@@ -3155,7 +3154,7 @@
   Result += "\"\n\t, \"";
   Result += ClassDecl->getNameAsString();
   Result += "\"\n";
-  
+
   if (IDecl->instmeth_begin() != IDecl->instmeth_end()) {
     Result += "\t, (struct _objc_method_list *)"
            "&_OBJC_CATEGORY_INSTANCE_METHODS_";
@@ -3172,9 +3171,9 @@
   }
   else
     Result += "\t, 0\n";
-  
+
   if (CDecl && CDecl->protocol_begin() != CDecl->protocol_end()) {
-    Result += "\t, (struct _objc_protocol_list *)&_OBJC_CATEGORY_PROTOCOLS_"; 
+    Result += "\t, (struct _objc_protocol_list *)&_OBJC_CATEGORY_PROTOCOLS_";
     Result += FullCategoryName;
     Result += "\n";
   }
@@ -3185,8 +3184,8 @@
 
 /// SynthesizeIvarOffsetComputation - This rutine synthesizes computation of
 /// ivar offset.
-void RewriteObjC::SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl, 
-                                                  ObjCIvarDecl *ivar, 
+void RewriteObjC::SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl,
+                                                  ObjCIvarDecl *ivar,
                                                   std::string &Result) {
   if (ivar->isBitField()) {
     // FIXME: The hack below doesn't work for bitfields. For now, we simply
@@ -3210,17 +3209,17 @@
 void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
                                            std::string &Result) {
   ObjCInterfaceDecl *CDecl = IDecl->getClassInterface();
-  
+
   // Explictly declared @interface's are already synthesized.
   if (CDecl->isImplicitInterfaceDecl()) {
-    // FIXME: Implementation of a class with no @interface (legacy) doese not 
+    // FIXME: Implementation of a class with no @interface (legacy) doese not
     // produce correct synthesis as yet.
     SynthesizeObjCInternalStruct(CDecl, Result);
   }
-  
+
   // Build _objc_ivar_list metadata for classes ivars if needed
   unsigned NumIvars = !IDecl->ivar_empty()
-                      ? IDecl->ivar_size() 
+                      ? IDecl->ivar_size()
                       : (CDecl ? CDecl->ivar_size() : 0);
   if (NumIvars > 0) {
     static bool objc_ivar = false;
@@ -3229,23 +3228,23 @@
           char *ivar_name;
           char *ivar_type;
           int ivar_offset;
-        };  
+        };
        */
       Result += "\nstruct _objc_ivar {\n";
       Result += "\tchar *ivar_name;\n";
       Result += "\tchar *ivar_type;\n";
       Result += "\tint ivar_offset;\n";
       Result += "};\n";
-      
+
       objc_ivar = true;
     }
 
     /* struct {
        int ivar_count;
        struct _objc_ivar ivar_list[nIvars];
-       };  
+       };
      */
-    Result += "\nstatic struct {\n"; 
+    Result += "\nstatic struct {\n";
     Result += "\tint ivar_count;\n";
     Result += "\tstruct _objc_ivar ivar_list[";
     Result += utostr(NumIvars);
@@ -3255,11 +3254,11 @@
       "{\n\t";
     Result += utostr(NumIvars);
     Result += "\n";
-    
+
     ObjCInterfaceDecl::ivar_iterator IVI, IVE;
     llvm::SmallVector<ObjCIvarDecl *, 8> IVars;
     if (!IDecl->ivar_empty()) {
-      for (ObjCImplementationDecl::ivar_iterator 
+      for (ObjCImplementationDecl::ivar_iterator
              IV = IDecl->ivar_begin(), IVEnd = IDecl->ivar_end();
            IV != IVEnd; ++IV)
         IVars.push_back(*IV);
@@ -3291,12 +3290,12 @@
       SynthesizeIvarOffsetComputation(IDecl, (*IVI), Result);
       Result += "}\n";
     }
-    
+
     Result += "\t }\n};\n";
   }
-  
+
   // Build _objc_method_list for class's instance methods if needed
-  llvm::SmallVector<ObjCMethodDecl *, 32> 
+  llvm::SmallVector<ObjCMethodDecl *, 32>
     InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end());
 
   // If any of our property implementations have associated getters or
@@ -3320,15 +3319,15 @@
   }
   RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(),
                              true, "", IDecl->getNameAsCString(), Result);
-  
+
   // Build _objc_method_list for class's class methods if needed
   RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(),
                              false, "", IDecl->getNameAsCString(), Result);
-    
+
   // Protocols referenced in class declaration?
   RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(),
                                   "CLASS", CDecl->getNameAsCString(), Result);
-    
+
   // Declaration of class/meta-class metadata
   /* struct _objc_class {
    struct _objc_class *isa; // or const char *root_class_name when metadata
@@ -3343,7 +3342,7 @@
    struct objc_protocol_list *protocols;
    const char *ivar_layout;
    struct _objc_class_ext  *ext;
-   };  
+   };
   */
   static bool objc_class = false;
   if (!objc_class) {
@@ -3363,7 +3362,7 @@
     Result += "};\n";
     objc_class = true;
   }
-  
+
   // Meta-class metadata generation.
   ObjCInterfaceDecl *RootClass = 0;
   ObjCInterfaceDecl *SuperClass = CDecl->getSuperClass();
@@ -3372,7 +3371,7 @@
     SuperClass = SuperClass->getSuperClass();
   }
   SuperClass = CDecl->getSuperClass();
-  
+
   Result += "\nstatic struct _objc_class _OBJC_METACLASS_";
   Result += CDecl->getNameAsString();
   Result += " __attribute__ ((used, section (\"__OBJC, __meta_class\")))= "
@@ -3398,7 +3397,7 @@
   if (IDecl->classmeth_begin() != IDecl->classmeth_end()) {
     Result += "\n\t, (struct _objc_method_list *)&_OBJC_CLASS_METHODS_";
     Result += IDecl->getNameAsString();
-    Result += "\n"; 
+    Result += "\n";
   }
   else
     Result += ", 0\n";
@@ -3410,7 +3409,7 @@
   else
     Result += "\t,0,0,0,0\n";
   Result += "};\n";
-  
+
   // class metadata generation.
   Result += "\nstatic struct _objc_class _OBJC_CLASS_";
   Result += CDecl->getNameAsString();
@@ -3451,7 +3450,7 @@
   if (IDecl->instmeth_begin() != IDecl->instmeth_end()) {
     Result += ", (struct _objc_method_list *)&_OBJC_INSTANCE_METHODS_";
     Result += CDecl->getNameAsString();
-    Result += ", 0\n\t"; 
+    Result += ", 0\n\t";
   }
   else
     Result += ",0,0";
@@ -3471,25 +3470,25 @@
 void RewriteObjC::RewriteImplementations() {
   int ClsDefCount = ClassImplementation.size();
   int CatDefCount = CategoryImplementation.size();
-  
+
   // Rewrite implemented methods
   for (int i = 0; i < ClsDefCount; i++)
     RewriteImplementationDecl(ClassImplementation[i]);
-  
+
   for (int i = 0; i < CatDefCount; i++)
     RewriteImplementationDecl(CategoryImplementation[i]);
 }
-  
+
 void RewriteObjC::SynthesizeMetaDataIntoBuffer(std::string &Result) {
   int ClsDefCount = ClassImplementation.size();
   int CatDefCount = CategoryImplementation.size();
 
   // This is needed for determining instance variable offsets.
-  Result += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)\n";   
+  Result += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)\n";
   // For each implemented class, write out all its meta data.
   for (int i = 0; i < ClsDefCount; i++)
     RewriteObjCClassMetaData(ClassImplementation[i], Result);
-  
+
   // For each implemented category, write out all its meta data.
   for (int i = 0; i < CatDefCount; i++)
     RewriteObjCCategoryImplDecl(CategoryImplementation[i], Result);
@@ -3503,9 +3502,9 @@
    short cls_def_cnt;
    short cat_def_cnt;
    void *defs[cls_def_cnt + cat_def_cnt];
-   }; 
+   };
    */
-  
+
   Result += "\nstruct _objc_symtab {\n";
   Result += "\tlong sel_ref_cnt;\n";
   Result += "\tSEL *refs;\n";
@@ -3513,17 +3512,17 @@
   Result += "\tshort cat_def_cnt;\n";
   Result += "\tvoid *defs[" + utostr(ClsDefCount + CatDefCount)+ "];\n";
   Result += "};\n\n";
-  
+
   Result += "static struct _objc_symtab "
          "_OBJC_SYMBOLS __attribute__((used, section (\"__OBJC, __symbols\")))= {\n";
-  Result += "\t0, 0, " + utostr(ClsDefCount) 
+  Result += "\t0, 0, " + utostr(ClsDefCount)
             + ", " + utostr(CatDefCount) + "\n";
   for (int i = 0; i < ClsDefCount; i++) {
     Result += "\t,&_OBJC_CLASS_";
     Result += ClassImplementation[i]->getNameAsString();
     Result += "\n";
   }
-  
+
   for (int i = 0; i < CatDefCount; i++) {
     Result += "\t,&_OBJC_CATEGORY_";
     Result += CategoryImplementation[i]->getClassInterface()->getNameAsString();
@@ -3531,11 +3530,11 @@
     Result += CategoryImplementation[i]->getNameAsString();
     Result += "\n";
   }
-  
+
   Result += "};\n\n";
-  
+
   // Write objc_module metadata
-  
+
   /*
    struct _objc_module {
     long version;
@@ -3544,7 +3543,7 @@
     struct _objc_symtab *symtab;
    }
   */
-  
+
   Result += "\nstruct _objc_module {\n";
   Result += "\tlong version;\n";
   Result += "\tlong size;\n";
@@ -3553,7 +3552,7 @@
   Result += "};\n\n";
   Result += "static struct _objc_module "
     "_OBJC_MODULES __attribute__ ((used, section (\"__OBJC, __module_info\")))= {\n";
-  Result += "\t" + utostr(OBJC_ABI_VERSION) + 
+  Result += "\t" + utostr(OBJC_ABI_VERSION) +
   ", sizeof(struct _objc_module), \"\", &_OBJC_SYMBOLS\n";
   Result += "};\n\n";
 
@@ -3561,7 +3560,7 @@
     if (ProtocolExprDecls.size()) {
       Result += "#pragma section(\".objc_protocol$B\",long,read,write)\n";
       Result += "#pragma data_seg(push, \".objc_protocol$B\")\n";
-      for (llvm::SmallPtrSet<ObjCProtocolDecl *,8>::iterator I = ProtocolExprDecls.begin(), 
+      for (llvm::SmallPtrSet<ObjCProtocolDecl *,8>::iterator I = ProtocolExprDecls.begin(),
            E = ProtocolExprDecls.end(); I != E; ++I) {
         Result += "static struct _objc_protocol *_POINTER_OBJC_PROTOCOL_";
         Result += (*I)->getNameAsString();
@@ -3589,9 +3588,9 @@
                   funcName + "_" + "block_func_" + utostr(i);
 
   BlockDecl *BD = CE->getBlockDecl();
-  
+
   if (isa<FunctionNoProtoType>(AFT)) {
-    // No user-supplied arguments. Still need to pass in a pointer to the 
+    // No user-supplied arguments. Still need to pass in a pointer to the
     // block (to reference imported block decl refs).
     S += "(" + StructRef + " *__cself)";
   } else if (BD->param_empty()) {
@@ -3617,19 +3616,19 @@
     S += ')';
   }
   S += " {\n";
-  
+
   // Create local declarations to avoid rewriting all closure decl ref exprs.
   // First, emit a declaration for all "by ref" decls.
-  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), 
+  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
        E = BlockByRefDecls.end(); I != E; ++I) {
     S += "  ";
     std::string Name = (*I)->getNameAsString();
-    Context->getPointerType((*I)->getType()).getAsStringInternal(Name, 
+    Context->getPointerType((*I)->getType()).getAsStringInternal(Name,
                                                       Context->PrintingPolicy);
     S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
-  }    
+  }
   // Next, emit a declaration for all "by copy" declarations.
-  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), 
+  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
        E = BlockByCopyDecls.end(); I != E; ++I) {
     S += "  ";
     std::string Name = (*I)->getNameAsString();
@@ -3637,7 +3636,7 @@
     //
     //   void (^myImportedClosure)(void);
     //   myImportedClosure  = ^(void) { setGlobalInt(x + y); };
-    // 
+    //
     //   void (^anotherClosure)(void);
     //   anotherClosure = ^(void) {
     //     myImportedClosure(); // import and invoke the closure
@@ -3662,13 +3661,13 @@
                                                    std::string Tag) {
   std::string StructRef = "struct " + Tag;
   std::string S = "static void __";
-  
+
   S += funcName;
   S += "_block_copy_" + utostr(i);
   S += "(" + StructRef;
   S += "*dst, " + StructRef;
   S += "*src) {";
-  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(), 
+  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
       E = ImportedBlockDecls.end(); I != E; ++I) {
     S += "_Block_object_assign((void*)&dst->";
     S += (*I)->getNameAsString();
@@ -3681,13 +3680,13 @@
   S += "_block_dispose_" + utostr(i);
   S += "(" + StructRef;
   S += "*src) {";
-  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(), 
+  for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
       E = ImportedBlockDecls.end(); I != E; ++I) {
     S += "_Block_object_dispose((void*)src->";
     S += (*I)->getNameAsString();
     S += ", 3/*BLOCK_FIELD_IS_OBJECT*/);";
   }
-  S += "}\n";  
+  S += "}\n";
   return S;
 }
 
@@ -3695,20 +3694,20 @@
                                                bool hasCopyDisposeHelpers) {
   std::string S = "\nstruct " + Tag;
   std::string Constructor = "  " + Tag;
-  
+
   S += " {\n  struct __block_impl impl;\n";
-  
+
   if (hasCopyDisposeHelpers)
     S += "  void *copy;\n  void *dispose;\n";
-    
+
   Constructor += "(void *fp";
-  
+
   if (hasCopyDisposeHelpers)
     Constructor += ", void *copyHelp, void *disposeHelp";
-    
+
   if (BlockDeclRefs.size()) {
     // Output all "by copy" declarations.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
          E = BlockByCopyDecls.end(); I != E; ++I) {
       S += "  ";
       std::string FieldName = (*I)->getNameAsString();
@@ -3717,7 +3716,7 @@
       //
       //   void (^myImportedBlock)(void);
       //   myImportedBlock  = ^(void) { setGlobalInt(x + y); };
-      // 
+      //
       //   void (^anotherBlock)(void);
       //   anotherBlock = ^(void) {
       //     myImportedBlock(); // import and invoke the closure
@@ -3734,7 +3733,7 @@
       S += FieldName + ";\n";
     }
     // Output all "by ref" declarations.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
          E = BlockByRefDecls.end(); I != E; ++I) {
       S += "  ";
       std::string FieldName = (*I)->getNameAsString();
@@ -3743,7 +3742,7 @@
       //
       //   void (^myImportedBlock)(void);
       //   myImportedBlock  = ^(void) { setGlobalInt(x + y); };
-      // 
+      //
       //   void (^anotherBlock)(void);
       //   anotherBlock = ^(void) {
       //     myImportedBlock(); // import and invoke the closure
@@ -3753,9 +3752,9 @@
         S += "struct __block_impl *";
         Constructor += ", void *" + ArgName;
       } else {
-        Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName, 
+        Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName,
                                                        Context->PrintingPolicy);
-        Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName, 
+        Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName,
                                                        Context->PrintingPolicy);
         Constructor += ", " + ArgName;
       }
@@ -3769,12 +3768,12 @@
       Constructor += "    impl.isa = &_NSConcreteStackBlock;\n";
     Constructor += "    impl.Size = sizeof(";
     Constructor += Tag + ");\n    impl.Flags = flags;\n    impl.FuncPtr = fp;\n";
-    
+
     if (hasCopyDisposeHelpers)
       Constructor += "    copy = copyHelp;\n    dispose = disposeHelp;\n";
-      
+
     // Initialize all "by copy" arguments.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
          E = BlockByCopyDecls.end(); I != E; ++I) {
       std::string Name = (*I)->getNameAsString();
       Constructor += "    ";
@@ -3785,7 +3784,7 @@
       Constructor += Name + ";\n";
     }
     // Initialize all "by ref" arguments.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
          E = BlockByRefDecls.end(); I != E; ++I) {
       std::string Name = (*I)->getNameAsString();
       Constructor += "    ";
@@ -3822,21 +3821,21 @@
     CollectBlockDeclRefInfo(Blocks[i]);
 
     std::string Tag = "__" + std::string(FunName) + "_block_impl_" + utostr(i);
-                      
-    std::string CI = SynthesizeBlockImpl(Blocks[i], Tag, 
+
+    std::string CI = SynthesizeBlockImpl(Blocks[i], Tag,
                                          ImportedBlockDecls.size() > 0);
 
     InsertText(FunLocStart, CI.c_str(), CI.size());
 
     std::string CF = SynthesizeBlockFunc(Blocks[i], i, FunName, Tag);
-    
+
     InsertText(FunLocStart, CF.c_str(), CF.size());
 
     if (ImportedBlockDecls.size()) {
       std::string HF = SynthesizeBlockHelperFuncs(Blocks[i], i, FunName, Tag);
       InsertText(FunLocStart, HF.c_str(), HF.size());
     }
-    
+
     BlockDeclRefs.clear();
     BlockByRefDecls.clear();
     BlockByCopyDecls.clear();
@@ -3850,7 +3849,7 @@
 void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
   SourceLocation FunLocStart = FD->getTypeSpecStartLoc();
   const char *FuncName = FD->getNameAsCString();
-  
+
   SynthesizeBlockLiterals(FunLocStart, FuncName);
 }
 
@@ -3864,7 +3863,7 @@
   std::string::size_type loc = 0;
   while ((loc = FuncName.find(":", loc)) != std::string::npos)
     FuncName.replace(loc, 1, "_");
-  
+
   SynthesizeBlockLiterals(FunLocStart, FuncName.c_str());
 }
 
@@ -3894,7 +3893,7 @@
       else
         GetBlockCallExprs(*CI);
     }
-      
+
   if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
     if (CE->getCallee()->getType()->isBlockPointerType()) {
       BlockCallExprs[dyn_cast<BlockDeclRefExpr>(CE->getCallee())] = CE;
@@ -3907,7 +3906,7 @@
   // Navigate to relevant type information.
   const char *closureName = 0;
   const BlockPointerType *CPT = 0;
-  
+
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
     closureName = DRE->getDecl()->getNameAsCString();
     CPT = DRE->getType()->getAs<BlockPointerType>();
@@ -3925,7 +3924,7 @@
   assert(FT && "RewriteBlockClass: Bad type");
   const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT);
   // FTP will be null for closures that don't take arguments.
-  
+
   RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl,
                                       SourceLocation(),
                                       &Context->Idents.get("__block_impl"));
@@ -3933,11 +3932,11 @@
 
   // Generate a funky cast.
   llvm::SmallVector<QualType, 8> ArgTypes;
-    
+
   // Push the block argument type.
   ArgTypes.push_back(PtrBlock);
   if (FTP) {
-    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), 
+    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
          E = FTP->arg_type_end(); I && (I != E); ++I) {
       QualType t = *I;
       // Make sure we convert "t (^)(...)" to "t (*)(...)".
@@ -3949,12 +3948,12 @@
     }
   }
   // Now do the pointer to function cast.
-  QualType PtrToFuncCastType = Context->getFunctionType(Exp->getType(), 
+  QualType PtrToFuncCastType = Context->getFunctionType(Exp->getType(),
     &ArgTypes[0], ArgTypes.size(), false/*no variadic*/, 0);
-    
+
   PtrToFuncCastType = Context->getPointerType(PtrToFuncCastType);
-  
-  CastExpr *BlkCast = new (Context) CStyleCastExpr(PtrBlock, 
+
+  CastExpr *BlkCast = new (Context) CStyleCastExpr(PtrBlock,
                                                    CastExpr::CK_Unknown,
                                                    Exp->getCallee(),
                                                    PtrBlock, SourceLocation(),
@@ -3963,25 +3962,25 @@
   ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
                                           BlkCast);
   //PE->dump();
-  
+
   FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
-                     &Context->Idents.get("FuncPtr"), Context->VoidPtrTy, 0, 
+                     &Context->Idents.get("FuncPtr"), Context->VoidPtrTy, 0,
                                     /*BitWidth=*/0, /*Mutable=*/true);
   MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
                                             FD->getType());
-  
+
   CastExpr *FunkCast = new (Context) CStyleCastExpr(PtrToFuncCastType,
                                                     CastExpr::CK_Unknown, ME,
                                                     PtrToFuncCastType,
                                                     SourceLocation(),
                                                     SourceLocation());
   PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
-  
+
   llvm::SmallVector<Expr*, 8> BlkExprs;
   // Add the implicit argument.
   BlkExprs.push_back(BlkCast);
   // Add the user arguments.
-  for (CallExpr::arg_iterator I = Exp->arg_begin(), 
+  for (CallExpr::arg_iterator I = Exp->arg_begin(),
        E = Exp->arg_end(); I != E; ++I) {
     BlkExprs.push_back(*I);
   }
@@ -4003,7 +4002,7 @@
 // int main() {
 //    __block Foo *f;
 //    __block int i;
-// 
+//
 //    void (^myblock)() = ^() {
 //        [f test]; // f is a BlockDeclRefExpr embedded in a message (which is being rewritten).
 //        i = 77;
@@ -4030,16 +4029,16 @@
   // Need to avoid trying to rewrite casts contained in macros.
   if (!Rewriter::isRewritable(LocStart) || !Rewriter::isRewritable(LocEnd))
     return;
-    
+
   const char *startBuf = SM->getCharacterData(LocStart);
   const char *endBuf = SM->getCharacterData(LocEnd);
-  
+
   // advance the location to startArgList.
   const char *argPtr = startBuf;
-  
+
   while (*argPtr++ && (argPtr < endBuf)) {
     switch (*argPtr) {
-      case '^': 
+      case '^':
         // Replace the '^' with '*'.
         LocStart = LocStart.getFileLocWithOffset(argPtr-startBuf);
         ReplaceText(LocStart, 1, "*", 1);
@@ -4052,31 +4051,31 @@
 void RewriteObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {
   SourceLocation DeclLoc = FD->getLocation();
   unsigned parenCount = 0;
-  
+
   // We have 1 or more arguments that have closure pointers.
   const char *startBuf = SM->getCharacterData(DeclLoc);
   const char *startArgList = strchr(startBuf, '(');
-  
+
   assert((*startArgList == '(') && "Rewriter fuzzy parser confused");
-  
+
   parenCount++;
   // advance the location to startArgList.
   DeclLoc = DeclLoc.getFileLocWithOffset(startArgList-startBuf);
   assert((DeclLoc.isValid()) && "Invalid DeclLoc");
-  
+
   const char *argPtr = startArgList;
-  
+
   while (*argPtr++ && parenCount) {
     switch (*argPtr) {
-      case '^': 
+      case '^':
         // Replace the '^' with '*'.
         DeclLoc = DeclLoc.getFileLocWithOffset(argPtr-startArgList);
         ReplaceText(DeclLoc, 1, "*", 1);
         break;
-      case '(': 
-        parenCount++; 
+      case '(':
+        parenCount++;
         break;
-      case ')': 
+      case ')':
         parenCount--;
         break;
     }
@@ -4095,7 +4094,7 @@
     FTP = BPT->getPointeeType()->getAsFunctionProtoType();
   }
   if (FTP) {
-    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), 
+    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
          E = FTP->arg_type_end(); I != E; ++I)
       if (isTopLevelBlockPointerType(*I))
         return true;
@@ -4107,11 +4106,11 @@
                                      const char *&RParen) {
   const char *argPtr = strchr(Name, '(');
   assert((*argPtr == '(') && "Rewriter fuzzy parser confused");
-  
+
   LParen = argPtr; // output the start.
   argPtr++; // skip past the left paren.
   unsigned parenCount = 1;
-  
+
   while (*argPtr && parenCount) {
     switch (*argPtr) {
       case '(': parenCount++; break;
@@ -4128,7 +4127,7 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
     RewriteBlockPointerFunctionArgs(FD);
     return;
-  } 
+  }
   // Handle Variables and Typedefs.
   SourceLocation DeclLoc = ND->getLocation();
   QualType DeclT;
@@ -4138,15 +4137,15 @@
     DeclT = TDD->getUnderlyingType();
   else if (FieldDecl *FD = dyn_cast<FieldDecl>(ND))
     DeclT = FD->getType();
-  else 
+  else
     assert(0 && "RewriteBlockPointerDecl(): Decl type not yet handled");
-    
+
   const char *startBuf = SM->getCharacterData(DeclLoc);
   const char *endBuf = startBuf;
   // scan backward (from the decl location) for the end of the previous decl.
   while (*startBuf != '^' && *startBuf != ';' && startBuf != MainFileStart)
     startBuf--;
-    
+
   // *startBuf != '^' if we are dealing with a pointer to function that
   // may take block argument types (which will be handled below).
   if (*startBuf == '^') {
@@ -4171,7 +4170,7 @@
   return;
 }
 
-void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) {  
+void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) {
   // Add initializers for any closure decl refs.
   GetBlockDeclRefExprs(Exp->getBody());
   if (BlockDeclRefs.size()) {
@@ -4196,7 +4195,7 @@
 FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(const char *name) {
   IdentifierInfo *ID = &Context->Idents.get(name);
   QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
-  return FunctionDecl::Create(*Context, TUDecl,SourceLocation(), 
+  return FunctionDecl::Create(*Context, TUDecl,SourceLocation(),
                               ID, FType, 0, FunctionDecl::Extern, false,
                               false);
 }
@@ -4206,7 +4205,7 @@
 
   CollectBlockDeclRefInfo(Exp);
   std::string FuncName;
-  
+
   if (CurFunctionDef)
     FuncName = CurFunctionDef->getNameAsString();
   else if (CurMethodDef) {
@@ -4217,58 +4216,58 @@
       FuncName.replace(loc, 1, "_");
   } else if (GlobalVarDecl)
     FuncName = std::string(GlobalVarDecl->getNameAsString());
-    
+
   std::string BlockNumber = utostr(Blocks.size()-1);
-  
+
   std::string Tag = "__" + FuncName + "_block_impl_" + BlockNumber;
   std::string Func = "__" + FuncName + "_block_func_" + BlockNumber;
-  
+
   // Get a pointer to the function type so we can cast appropriately.
   QualType FType = Context->getPointerType(QualType(Exp->getFunctionType(),0));
 
   FunctionDecl *FD;
   Expr *NewRep;
-  
+
   // Simulate a contructor call...
   FD = SynthBlockInitFunctionDecl(Tag.c_str());
   DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, FType, SourceLocation());
-  
+
   llvm::SmallVector<Expr*, 4> InitExprs;
-  
+
   // Initialize the block function.
   FD = SynthBlockInitFunctionDecl(Func.c_str());
   DeclRefExpr *Arg = new (Context) DeclRefExpr(FD, FD->getType(),
                                                SourceLocation());
-  CastExpr *castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy, 
-                                          CastExpr::CK_Unknown, Arg, 
+  CastExpr *castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy,
+                                          CastExpr::CK_Unknown, Arg,
                                           Context->VoidPtrTy, SourceLocation(),
                                                     SourceLocation());
-  InitExprs.push_back(castExpr); 
-  
+  InitExprs.push_back(castExpr);
+
   if (ImportedBlockDecls.size()) {
     std::string Buf = "__" + FuncName + "_block_copy_" + BlockNumber;
     FD = SynthBlockInitFunctionDecl(Buf.c_str());
     Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
-    castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy, 
-                                            CastExpr::CK_Unknown, Arg, 
+    castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy,
+                                            CastExpr::CK_Unknown, Arg,
                                   Context->VoidPtrTy, SourceLocation(),
                                             SourceLocation());
-    InitExprs.push_back(castExpr); 
-    
+    InitExprs.push_back(castExpr);
+
     Buf = "__" + FuncName + "_block_dispose_" + BlockNumber;
     FD = SynthBlockInitFunctionDecl(Buf.c_str());
     Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
-    castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy, 
-                                            CastExpr::CK_Unknown, Arg, 
+    castExpr = new (Context) CStyleCastExpr(Context->VoidPtrTy,
+                                            CastExpr::CK_Unknown, Arg,
                                   Context->VoidPtrTy, SourceLocation(),
                                             SourceLocation());
-    InitExprs.push_back(castExpr); 
+    InitExprs.push_back(castExpr);
   }
   // Add initializers for any closure decl refs.
   if (BlockDeclRefs.size()) {
     Expr *Exp;
     // Output all "by copy" declarations.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
          E = BlockByCopyDecls.end(); I != E; ++I) {
       if (isObjCType((*I)->getType())) {
         // FIXME: Conform to ABI ([[obj retain] autorelease]).
@@ -4277,34 +4276,34 @@
       } else if (isTopLevelBlockPointerType((*I)->getType())) {
         FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
         Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
-        Exp = new (Context) CStyleCastExpr(Context->VoidPtrTy, 
-                                           CastExpr::CK_Unknown, Arg, 
-                                           Context->VoidPtrTy, 
+        Exp = new (Context) CStyleCastExpr(Context->VoidPtrTy,
+                                           CastExpr::CK_Unknown, Arg,
+                                           Context->VoidPtrTy,
                                            SourceLocation(),
                                            SourceLocation());
       } else {
         FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
         Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
       }
-      InitExprs.push_back(Exp); 
+      InitExprs.push_back(Exp);
     }
     // Output all "by ref" declarations.
-    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), 
+    for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
          E = BlockByRefDecls.end(); I != E; ++I) {
       FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
       Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
       Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf,
-                              Context->getPointerType(Exp->getType()), 
+                              Context->getPointerType(Exp->getType()),
                               SourceLocation());
-      InitExprs.push_back(Exp); 
+      InitExprs.push_back(Exp);
     }
   }
   NewRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0], InitExprs.size(),
                                   FType, SourceLocation());
   NewRep = new (Context) UnaryOperator(NewRep, UnaryOperator::AddrOf,
-                             Context->getPointerType(NewRep->getType()), 
+                             Context->getPointerType(NewRep->getType()),
                              SourceLocation());
-  NewRep = new (Context) CStyleCastExpr(FType, CastExpr::CK_Unknown, NewRep, 
+  NewRep = new (Context) CStyleCastExpr(FType, CastExpr::CK_Unknown, NewRep,
                                         FType, SourceLocation(),
                                         SourceLocation());
   BlockDeclRefs.clear();
@@ -4340,33 +4339,33 @@
 }
 
 Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
-  if (isa<SwitchStmt>(S) || isa<WhileStmt>(S) || 
+  if (isa<SwitchStmt>(S) || isa<WhileStmt>(S) ||
       isa<DoStmt>(S) || isa<ForStmt>(S))
     Stmts.push_back(S);
   else if (isa<ObjCForCollectionStmt>(S)) {
     Stmts.push_back(S);
     ObjCBcLabelNo.push_back(++BcLabelCount);
   }
-  
+
   SourceRange OrigStmtRange = S->getSourceRange();
-  
+
   // Perform a bottom up rewrite of all children.
   for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
        CI != E; ++CI)
     if (*CI) {
       Stmt *newStmt = RewriteFunctionBodyOrGlobalInitializer(*CI);
-      if (newStmt) 
+      if (newStmt)
         *CI = newStmt;
     }
-  
+
   if (BlockExpr *BE = dyn_cast<BlockExpr>(S)) {
     // Rewrite the block body in place.
     RewriteFunctionBodyOrGlobalInitializer(BE->getBody());
-      
+
     // Now we snarf the rewritten text and stash it away for later use.
     std::string Str = Rewrite.getRewritenText(BE->getSourceRange());
     RewrittenBlockExprs[BE] = Str;
-    
+
     Stmt *blockTranscribed = SynthBlockInitExpr(BE);
     //blockTranscribed->dump();
     ReplaceStmt(S, blockTranscribed);
@@ -4375,7 +4374,7 @@
   // Handle specific things.
   if (ObjCEncodeExpr *AtEncode = dyn_cast<ObjCEncodeExpr>(S))
     return RewriteAtEncode(AtEncode);
-  
+
   if (ObjCIvarRefExpr *IvarRefExpr = dyn_cast<ObjCIvarRefExpr>(S))
     return RewriteObjCIvarRefExpr(IvarRefExpr, OrigStmtRange.getBegin());
 
@@ -4388,7 +4387,7 @@
       // Save the source range. Even if we disable the replacement, the
       // rewritten node will have been inserted into the tree. If the synthesized
       // node is at the 'end', the rewriter will fail. Consider this:
-      //    self.errorHandler = handler ? handler : 
+      //    self.errorHandler = handler ? handler :
       //              ^(NSURL *errorURL, NSError *error) { return (BOOL)1; };
       SourceRange SrcRange = BinOp->getSourceRange();
       Stmt *newStmt = RewriteFunctionBodyOrGlobalInitializer(BinOp->getRHS());
@@ -4422,7 +4421,7 @@
       // can be used as the setter argument. ReplaceStmt() will still 'see'
       // the original RHS (since we haven't altered BinOp).
       //
-      // This implies the Rewrite* routines can no longer delete the original 
+      // This implies the Rewrite* routines can no longer delete the original
       // node. As a result, we now leak the original AST nodes.
       //
       return RewritePropertySetter(BinOp, dyn_cast<Expr>(newStmt), SrcRange);
@@ -4432,25 +4431,25 @@
   }
   if (ObjCSelectorExpr *AtSelector = dyn_cast<ObjCSelectorExpr>(S))
     return RewriteAtSelector(AtSelector);
-    
+
   if (ObjCStringLiteral *AtString = dyn_cast<ObjCStringLiteral>(S))
     return RewriteObjCStringLiteral(AtString);
-    
+
   if (ObjCMessageExpr *MessExpr = dyn_cast<ObjCMessageExpr>(S)) {
 #if 0
     // Before we rewrite it, put the original message expression in a comment.
     SourceLocation startLoc = MessExpr->getLocStart();
     SourceLocation endLoc = MessExpr->getLocEnd();
-    
+
     const char *startBuf = SM->getCharacterData(startLoc);
     const char *endBuf = SM->getCharacterData(endLoc);
-    
+
     std::string messString;
     messString += "// ";
     messString.append(startBuf, endBuf-startBuf+1);
     messString += "\n";
-        
-    // FIXME: Missing definition of 
+
+    // FIXME: Missing definition of
     // InsertText(clang::SourceLocation, char const*, unsigned int).
     // InsertText(startLoc, messString.c_str(), messString.size());
     // Tried this, but it didn't work either...
@@ -4458,7 +4457,7 @@
 #endif
     return RewriteMessageExpr(MessExpr);
   }
-  
+
   if (ObjCAtTryStmt *StmtTry = dyn_cast<ObjCAtTryStmt>(S))
     return RewriteObjCTryStmt(StmtTry);
 
@@ -4467,13 +4466,13 @@
 
   if (ObjCAtThrowStmt *StmtThrow = dyn_cast<ObjCAtThrowStmt>(S))
     return RewriteObjCThrowStmt(StmtThrow);
-  
+
   if (ObjCProtocolExpr *ProtocolExp = dyn_cast<ObjCProtocolExpr>(S))
     return RewriteObjCProtocolExpr(ProtocolExp);
-  
-  if (ObjCForCollectionStmt *StmtForCollection = 
+
+  if (ObjCForCollectionStmt *StmtForCollection =
         dyn_cast<ObjCForCollectionStmt>(S))
-    return RewriteObjCForCollectionStmt(StmtForCollection, 
+    return RewriteObjCForCollectionStmt(StmtForCollection,
                                         OrigStmtRange.getEnd());
   if (BreakStmt *StmtBreakStmt =
       dyn_cast<BreakStmt>(S))
@@ -4481,15 +4480,15 @@
   if (ContinueStmt *StmtContinueStmt =
       dyn_cast<ContinueStmt>(S))
     return RewriteContinueStmt(StmtContinueStmt);
-	
-  // Need to check for protocol refs (id <P>, Foo <P> *) in variable decls 
+
+  // Need to check for protocol refs (id <P>, Foo <P> *) in variable decls
   // and cast exprs.
   if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
     // FIXME: What we're doing here is modifying the type-specifier that
     // precedes the first Decl.  In the future the DeclGroup should have
-    // a separate type-specifier that we can rewrite.    
+    // a separate type-specifier that we can rewrite.
     RewriteObjCQualifiedInterfaceTypes(*DS->decl_begin());
-    
+
     // Blocks rewrite rules.
     for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
          DI != DE; ++DI) {
@@ -4497,26 +4496,26 @@
       if (ValueDecl *ND = dyn_cast<ValueDecl>(SD)) {
         if (isTopLevelBlockPointerType(ND->getType()))
           RewriteBlockPointerDecl(ND);
-        else if (ND->getType()->isFunctionPointerType()) 
+        else if (ND->getType()->isFunctionPointerType())
           CheckFunctionPointerDecl(ND->getType(), ND);
       }
       if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
         if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
           RewriteBlockPointerDecl(TD);
-        else if (TD->getUnderlyingType()->isFunctionPointerType()) 
+        else if (TD->getUnderlyingType()->isFunctionPointerType())
           CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
       }
     }
   }
-  
+
   if (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(S))
     RewriteObjCQualifiedInterfaceTypes(CE);
-  
-  if (isa<SwitchStmt>(S) || isa<WhileStmt>(S) || 
+
+  if (isa<SwitchStmt>(S) || isa<WhileStmt>(S) ||
       isa<DoStmt>(S) || isa<ForStmt>(S)) {
     assert(!Stmts.empty() && "Statement stack is empty");
-    assert ((isa<SwitchStmt>(Stmts.back()) || isa<WhileStmt>(Stmts.back()) || 
-             isa<DoStmt>(Stmts.back()) || isa<ForStmt>(Stmts.back())) 
+    assert ((isa<SwitchStmt>(Stmts.back()) || isa<WhileStmt>(Stmts.back()) ||
+             isa<DoStmt>(Stmts.back()) || isa<ForStmt>(Stmts.back()))
             && "Statement stack mismatch");
     Stmts.pop_back();
   }
@@ -4560,7 +4559,7 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     if (FD->isOverloadedOperator())
       return;
-      
+
     // Since function prototypes don't have ParmDecl's, we check the function
     // prototype. This enables us to rewrite function declarations and
     // definitions using the same code.
@@ -4583,7 +4582,7 @@
       // and any copy/dispose helper functions.
       InsertBlockLiteralsWithinFunction(FD);
       CurFunctionDef = 0;
-    } 
+    }
     return;
   }
   if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
@@ -4631,7 +4630,7 @@
         delete PropParentMap;
         PropParentMap = 0;
       }
-      SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), 
+      SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(),
                               VD->getNameAsCString());
       GlobalVarDecl = 0;
 
@@ -4645,13 +4644,13 @@
   if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
     if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
       RewriteBlockPointerDecl(TD);
-    else if (TD->getUnderlyingType()->isFunctionPointerType()) 
+    else if (TD->getUnderlyingType()->isFunctionPointerType())
       CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
     return;
   }
   if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) {
     if (RD->isDefinition()) {
-      for (RecordDecl::field_iterator i = RD->field_begin(), 
+      for (RecordDecl::field_iterator i = RD->field_begin(),
              e = RD->field_end(); i != e; ++i) {
         FieldDecl *FD = *i;
         if (isTopLevelBlockPointerType(FD->getType()))
@@ -4665,29 +4664,29 @@
 
 void RewriteObjC::HandleTranslationUnit(ASTContext &C) {
   // Get the top-level buffer that this corresponds to.
-  
+
   // Rewrite tabs if we care.
   //RewriteTabs();
-  
+
   if (Diags.hasErrorOccurred())
     return;
-  
+
   RewriteInclude();
-  
+
   // Here's a great place to add any extra declarations that may be needed.
   // Write out meta data for each @protocol(<expr>).
-  for (llvm::SmallPtrSet<ObjCProtocolDecl *,8>::iterator I = ProtocolExprDecls.begin(), 
+  for (llvm::SmallPtrSet<ObjCProtocolDecl *,8>::iterator I = ProtocolExprDecls.begin(),
        E = ProtocolExprDecls.end(); I != E; ++I)
     RewriteObjCProtocolMetaData(*I, "", "", Preamble);
 
-  InsertText(SM->getLocForStartOfFile(MainFileID), 
+  InsertText(SM->getLocForStartOfFile(MainFileID),
              Preamble.c_str(), Preamble.size(), false);
   if (ClassImplementation.size() || CategoryImplementation.size())
     RewriteImplementations();
 
   // Get the buffer corresponding to MainFileID.  If we haven't changed it, then
   // we are done.
-  if (const RewriteBuffer *RewriteBuf = 
+  if (const RewriteBuffer *RewriteBuf =
       Rewrite.getRewriteBufferFor(MainFileID)) {
     //printf("Changed:\n");
     *OutFile << std::string(RewriteBuf->begin(), RewriteBuf->end());

Modified: cfe/trunk/lib/Frontend/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteTest.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/RewriteTest.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteTest.cpp Wed Sep  9 10:08:12 2009
@@ -30,8 +30,8 @@
     Rewriter.AddTokenBefore(I, "<i>");
     Rewriter.AddTokenAfter(I, "</i>");
   }
-  
-  
+
+
   // Print out the output.
   for (TokenRewriter::token_iterator I = Rewriter.token_begin(),
        E = Rewriter.token_end(); I != E; ++I)

Modified: cfe/trunk/lib/Frontend/StmtXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/StmtXML.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/StmtXML.cpp (original)
+++ cfe/trunk/lib/Frontend/StmtXML.cpp Wed Sep  9 10:08:12 2009
@@ -32,25 +32,18 @@
     //static const char *getOpcodeStr(BinaryOperator::Opcode Op);
 
 
-  void addSpecialAttribute(const char* pName, StringLiteral* Str)
-  {
+  void addSpecialAttribute(const char* pName, StringLiteral* Str) {
     Doc.addAttribute(pName, Doc.escapeString(Str->getStrData(), Str->getByteLength()));
   }
 
-  void addSpecialAttribute(const char* pName, SizeOfAlignOfExpr* S)
-  {
+  void addSpecialAttribute(const char* pName, SizeOfAlignOfExpr* S) {
     if (S->isArgumentType())
-    {
       Doc.addAttribute(pName, S->getArgumentType());
-    }
   }
 
-  void addSpecialAttribute(const char* pName, CXXTypeidExpr* S)
-  {
+  void addSpecialAttribute(const char* pName, CXXTypeidExpr* S) {
     if (S->isTypeOperand())
-    {
       Doc.addAttribute(pName, S->getTypeOperand());
-    }
   }
 
 
@@ -58,29 +51,21 @@
     StmtXML(DocumentXML& doc)
       : Doc(doc) {
     }
-    
+
     void DumpSubTree(Stmt *S) {
-      if (S) 
-      {
+      if (S) {
         Visit(S);
-        if (DeclStmt* DS = dyn_cast<DeclStmt>(S)) 
-        {
-          for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
-               DI != DE; ++DI) 
-          {
+        if (DeclStmt* DS = dyn_cast<DeclStmt>(S)) {
+          for (DeclStmt::decl_iterator DI = DS->decl_begin(),
+                 DE = DS->decl_end(); DI != DE; ++DI) {
             Doc.PrintDecl(*DI);
           }
-        } 
-        else 
-        {    
+        } else {
           if (CXXConditionDeclExpr* CCDE = dyn_cast<CXXConditionDeclExpr>(S))
-          {
             Doc.PrintDecl(CCDE->getVarDecl());
-          }
-          for (Stmt::child_iterator i = S->child_begin(), e = S->child_end(); i != e; ++i)
-          {
+          for (Stmt::child_iterator i = S->child_begin(), e = S->child_end();
+               i != e; ++i)
             DumpSubTree(*i);
-          }
         }
         Doc.toParent();
       } else {
@@ -93,12 +78,12 @@
   void Visit##CLASS(CLASS* S)            \
   {                                      \
     typedef CLASS tStmtType;             \
-    Doc.addSubNode(NAME);         
+    Doc.addSubNode(NAME);
 
-#define ATTRIBUTE_XML( FN, NAME )         Doc.addAttribute(NAME, S->FN); 
+#define ATTRIBUTE_XML( FN, NAME )         Doc.addAttribute(NAME, S->FN);
 #define TYPE_ATTRIBUTE_XML( FN )          ATTRIBUTE_XML(FN, "type")
-#define ATTRIBUTE_OPT_XML( FN, NAME )     Doc.addAttributeOptional(NAME, S->FN); 
-#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, S); 
+#define ATTRIBUTE_OPT_XML( FN, NAME )     Doc.addAttributeOptional(NAME, S->FN);
+#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, S);
 #define ATTRIBUTE_FILE_LOCATION_XML       Doc.addLocationRange(S->getSourceRange());
 
 
@@ -107,14 +92,14 @@
     const char* pAttributeName = NAME;  \
     const bool optional = false;        \
     switch (S->FN) {                    \
-      default: assert(0 && "unknown enum value"); 
+      default: assert(0 && "unknown enum value");
 
 #define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  \
   {                                         \
     const char* pAttributeName = NAME;      \
     const bool optional = true;             \
     switch (S->FN) {                        \
-      default: assert(0 && "unknown enum value"); 
+      default: assert(0 && "unknown enum value");
 
 #define ENUM_XML( VALUE, NAME )         case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
 #define END_ENUM_XML                    } }
@@ -133,7 +118,7 @@
     void VisitDeclStmt(DeclStmt *Node);
     void VisitLabelStmt(LabelStmt *Node);
     void VisitGotoStmt(GotoStmt *Node);
-    
+
     // Exprs
     void VisitExpr(Expr *Node);
     void VisitDeclRefExpr(DeclRefExpr *Node);
@@ -156,7 +141,7 @@
     void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node);
     void VisitCXXThisExpr(CXXThisExpr *Node);
     void VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node);
-    
+
     // ObjC
     void VisitObjCEncodeExpr(ObjCEncodeExpr *Node);
     void VisitObjCMessageExpr(ObjCMessageExpr* Node);
@@ -175,27 +160,22 @@
 //  Stmt printing methods.
 //===----------------------------------------------------------------------===//
 #if (0)
-void StmtXML::VisitStmt(Stmt *Node) 
-{
+void StmtXML::VisitStmt(Stmt *Node) {
   // nothing special to do
 }
 
-void StmtXML::VisitDeclStmt(DeclStmt *Node) 
-{
+void StmtXML::VisitDeclStmt(DeclStmt *Node) {
   for (DeclStmt::decl_iterator DI = Node->decl_begin(), DE = Node->decl_end();
-       DI != DE; ++DI) 
-  {
+       DI != DE; ++DI) {
     Doc.PrintDecl(*DI);
   }
 }
 
-void StmtXML::VisitLabelStmt(LabelStmt *Node) 
-{
+void StmtXML::VisitLabelStmt(LabelStmt *Node) {
   Doc.addAttribute("name", Node->getName());
 }
 
-void StmtXML::VisitGotoStmt(GotoStmt *Node) 
-{
+void StmtXML::VisitGotoStmt(GotoStmt *Node) {
   Doc.addAttribute("name", Node->getLabel()->getName());
 }
 
@@ -336,9 +316,7 @@
   Doc.addAttribute("is_sizeof", Node->isSizeOf() ? "sizeof" : "alignof");
   Doc.addAttribute("is_type", Node->isArgumentType() ? "1" : "0");
   if (Node->isArgumentType())
-  {
     DumpTypeExpr(Node->getArgumentType());
-  }
 }
 
 void StmtXML::VisitMemberExpr(MemberExpr *Node) {
@@ -415,7 +393,7 @@
   DumpExpr(Node);
   Doc.addAttribute("selector", Node->getSelector().getAsString());
   IdentifierInfo* clsName = Node->getClassName();
-  if (clsName) 
+  if (clsName)
     Doc.addAttribute("class", clsName->getName());
 }
 

Modified: cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp Wed Sep  9 10:08:12 2009
@@ -17,7 +17,7 @@
 
 /// HandleDiagnostic - Store the errors, warnings, and notes that are
 /// reported.
-/// 
+///
 void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
                                             const DiagnosticInfo &Info) {
   llvm::SmallString<100> StrC;

Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Wed Sep  9 10:08:12 2009
@@ -436,7 +436,7 @@
 /// greater than or equal to Idx or, if no such character exists,
 /// returns the end of the string.
 static unsigned skipWhitespace(unsigned Idx,
-			       const llvm::SmallVectorImpl<char> &Str,
+                               const llvm::SmallVectorImpl<char> &Str,
                                unsigned Length) {
   while (Idx < Length && isspace(Str[Idx]))
     ++Idx;
@@ -536,7 +536,7 @@
 /// \returns true if word-wrapping was required, or false if the
 /// string fit on the first line.
 static bool PrintWordWrapped(llvm::raw_ostream &OS,
-			     const llvm::SmallVectorImpl<char> &Str,
+                             const llvm::SmallVectorImpl<char> &Str,
                              unsigned Columns,
                              unsigned Column = 0,
                              unsigned Indentation = WordWrapIndentation) {

Modified: cfe/trunk/lib/Frontend/TypeXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TypeXML.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/TypeXML.cpp (original)
+++ cfe/trunk/lib/Frontend/TypeXML.cpp Wed Sep  9 10:08:12 2009
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file implements the XML document class, which provides the means to 
+// This file implements the XML document class, which provides the means to
 // dump out the AST in a XML form that exposes type details and other fields.
 //
 //===----------------------------------------------------------------------===//
@@ -21,38 +21,36 @@
   namespace XML {
     namespace {
 
-//--------------------------------------------------------- 
-class TypeWriter : public TypeVisitor<TypeWriter>
-{
+//---------------------------------------------------------
+class TypeWriter : public TypeVisitor<TypeWriter> {
   DocumentXML& Doc;
 
 public:
   TypeWriter(DocumentXML& doc) : Doc(doc) {}
 
 #define NODE_XML( CLASS, NAME )          \
-  void Visit##CLASS(CLASS* T)            \
-  {                                      \
-    Doc.addSubNode(NAME);         
+  void Visit##CLASS(CLASS* T) {          \
+    Doc.addSubNode(NAME);
 
 #define ID_ATTRIBUTE_XML                // done by the Document class itself
-#define ATTRIBUTE_XML( FN, NAME )       Doc.addAttribute(NAME, T->FN); 
+#define ATTRIBUTE_XML( FN, NAME )       Doc.addAttribute(NAME, T->FN);
 #define TYPE_ATTRIBUTE_XML( FN )        ATTRIBUTE_XML(FN, "type")
 #define CONTEXT_ATTRIBUTE_XML( FN )     ATTRIBUTE_XML(FN, "context")
-#define ATTRIBUTE_OPT_XML( FN, NAME )   Doc.addAttributeOptional(NAME, T->FN); 
+#define ATTRIBUTE_OPT_XML( FN, NAME )   Doc.addAttributeOptional(NAME, T->FN);
 
 #define ATTRIBUTE_ENUM_XML( FN, NAME )  \
   {                                     \
     const char* pAttributeName = NAME;  \
     const bool optional = false;             \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value"); 
+      default: assert(0 && "unknown enum value");
 
 #define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  \
   {                                     \
     const char* pAttributeName = NAME;  \
     const bool optional = true;              \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value"); 
+      default: assert(0 && "unknown enum value");
 
 #define ENUM_XML( VALUE, NAME )         case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
 #define END_ENUM_XML                    } }
@@ -62,22 +60,19 @@
 
 };
 
-//--------------------------------------------------------- 
+//---------------------------------------------------------
     } // anon clang
   } // NS XML
 
-//--------------------------------------------------------- 
-class DocumentXML::TypeAdder : public TypeVisitor<DocumentXML::TypeAdder>
-{
+//---------------------------------------------------------
+class DocumentXML::TypeAdder : public TypeVisitor<DocumentXML::TypeAdder> {
   DocumentXML& Doc;
 
-  void addIfType(const Type* pType)
-  {
+  void addIfType(const Type* pType) {
     Doc.addTypeRecursively(pType);
   }
 
-  void addIfType(const QualType& pType)
-  {
+  void addIfType(const QualType& pType) {
     Doc.addTypeRecursively(pType);
   }
 
@@ -88,40 +83,37 @@
 
 #define NODE_XML( CLASS, NAME )          \
   void Visit##CLASS(CLASS* T)            \
-  {                                      
+  {
 
-#define ID_ATTRIBUTE_XML                
-#define TYPE_ATTRIBUTE_XML( FN )        Doc.addTypeRecursively(T->FN); 
-#define CONTEXT_ATTRIBUTE_XML( FN )     
-#define ATTRIBUTE_XML( FN, NAME )       addIfType(T->FN); 
-#define ATTRIBUTE_OPT_XML( FN, NAME )   
-#define ATTRIBUTE_ENUM_XML( FN, NAME )  
-#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  
-#define ENUM_XML( VALUE, NAME )         
-#define END_ENUM_XML                    
+#define ID_ATTRIBUTE_XML
+#define TYPE_ATTRIBUTE_XML( FN )        Doc.addTypeRecursively(T->FN);
+#define CONTEXT_ATTRIBUTE_XML( FN )
+#define ATTRIBUTE_XML( FN, NAME )       addIfType(T->FN);
+#define ATTRIBUTE_OPT_XML( FN, NAME )
+#define ATTRIBUTE_ENUM_XML( FN, NAME )
+#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )
+#define ENUM_XML( VALUE, NAME )
+#define END_ENUM_XML
 #define END_NODE_XML                    }
 
 #include "clang/Frontend/TypeXML.def"
 };
 
-//--------------------------------------------------------- 
-void DocumentXML::addParentTypes(const Type* pType)
-{
+//---------------------------------------------------------
+void DocumentXML::addParentTypes(const Type* pType) {
   TypeAdder(*this).Visit(const_cast<Type*>(pType));
 }
 
-//--------------------------------------------------------- 
-void DocumentXML::writeTypeToXML(const Type* pType)
-{
+//---------------------------------------------------------
+void DocumentXML::writeTypeToXML(const Type* pType) {
   XML::TypeWriter(*this).Visit(const_cast<Type*>(pType));
 }
 
-//--------------------------------------------------------- 
-void DocumentXML::writeTypeToXML(const QualType& pType)
-{
+//---------------------------------------------------------
+void DocumentXML::writeTypeToXML(const QualType& pType) {
   XML::TypeWriter(*this).VisitQualType(const_cast<QualType*>(&pType));
 }
 
-//--------------------------------------------------------- 
+//---------------------------------------------------------
 } // NS clang
 

Modified: cfe/trunk/lib/Frontend/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Warnings.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/Warnings.cpp (original)
+++ cfe/trunk/lib/Frontend/Warnings.cpp Wed Sep  9 10:08:12 2009
@@ -47,7 +47,7 @@
     Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Warn);
   else
     Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore);
-  
+
   // FIXME: -Wfatal-errors / -Wfatal-errors=foo
 
   for (unsigned i = 0, e = Warnings.size(); i != e; ++i) {
@@ -55,7 +55,7 @@
     const char *OptStart = &Opt[0];
     const char *OptEnd = OptStart+Opt.size();
     assert(*OptEnd == 0 && "Expect null termination for lower-bound search");
-    
+
     // Check to see if this warning starts with "no-", if so, this is a negative
     // form of the option.
     bool isPositive = true;
@@ -74,7 +74,7 @@
       Diags.setSuppressSystemWarnings(!isPositive);
       continue;
     }
-    
+
     // -Werror/-Wno-error is a special case, not controlled by the option table.
     // It also has the "specifier" form of -Werror=foo and -Werror-foo.
     if (OptEnd-OptStart >= 5 && memcmp(OptStart, "error", 5) == 0) {
@@ -88,21 +88,21 @@
         }
         Specifier = OptStart+6;
       }
-      
+
       if (Specifier == 0) {
         Diags.setWarningsAsErrors(isPositive);
         continue;
       }
-      
+
       // -Werror=foo maps foo to Error, -Wno-error=foo maps it to Warning.
       Mapping = isPositive ? diag::MAP_ERROR : diag::MAP_WARNING_NO_WERROR;
       OptStart = Specifier;
     }
-    
+
     if (Diags.setDiagnosticGroupMapping(OptStart, Mapping))
       Diags.Report(FullSourceLoc(), diag::warn_unknown_warning_option)
         << ("-W" + Opt);
   }
-  
+
   return false;
 }

Modified: cfe/trunk/lib/Headers/stdarg.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stdarg.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/stdarg.h (original)
+++ cfe/trunk/lib/Headers/stdarg.h Wed Sep  9 10:08:12 2009
@@ -34,7 +34,7 @@
 /* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
  * or -ansi is not specified, since it was not part of C90.
  */
-#define __va_copy(d,s)	__builtin_va_copy(d,s)
+#define __va_copy(d,s) __builtin_va_copy(d,s)
 
 #if __STDC_VERSION__ >= 199900L || !defined(__STRICT_ANSI__)
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)

Modified: cfe/trunk/lib/Index/ASTLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ASTLocation.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/ASTLocation.cpp (original)
+++ cfe/trunk/lib/Index/ASTLocation.cpp Wed Sep  9 10:08:12 2009
@@ -32,7 +32,7 @@
     return getDeclFromExpr(CE->getCallee());
   if (CastExpr *CE = dyn_cast<CastExpr>(E))
     return getDeclFromExpr(CE->getSubExpr());
-  
+
   return 0;
 }
 
@@ -41,7 +41,7 @@
     return 0;
   if (isDecl())
     return getDecl();
-  
+
   assert(getStmt());
   return getDeclFromExpr(getStmt());
 }
@@ -49,17 +49,17 @@
 
 static bool isContainedInStatement(Stmt *Node, Stmt *Parent) {
   assert(Node && Parent && "Passed null Node or Parent");
-  
+
   if (Node == Parent)
     return true;
-  
+
   for (Stmt::child_iterator
          I = Parent->child_begin(), E = Parent->child_end(); I != E; ++I) {
     if (*I)
       if (isContainedInStatement(Node, *I))
         return true;
   }
-  
+
   return false;
 }
 
@@ -76,7 +76,7 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     if (!FD->isThisDeclarationADefinition())
       return 0;
-    
+
     for (DeclContext::decl_iterator
            I = FD->decls_begin(), E = FD->decls_end(); I != E; ++I) {
       Decl *Child = FindImmediateParent(*I, Node);
@@ -138,7 +138,7 @@
   OS << "[Decl: " << getDecl()->getDeclKindName() << " ";
   if (const NamedDecl *ND = dyn_cast<NamedDecl>(getDecl()))
     OS << ND->getNameAsString();
-  
+
   if (getStmt()) {
     ASTContext &Ctx = getDecl()->getASTContext();
     OS << " | Stmt: " << getStmt()->getStmtClassName() << " ";
@@ -146,7 +146,7 @@
   }
 
   OS << "] <";
-  
+
   SourceRange Range = getSourceRange();
   SourceManager &SourceMgr = getDecl()->getASTContext().getSourceManager();
   Range.getBegin().print(OS, SourceMgr);

Modified: cfe/trunk/lib/Index/Analyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/Analyzer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/Analyzer.cpp (original)
+++ cfe/trunk/lib/Index/Analyzer.cpp Wed Sep  9 10:08:12 2009
@@ -36,11 +36,11 @@
 class VISIBILITY_HIDDEN DeclEntityAnalyzer : public TranslationUnitHandler {
   Entity Ent;
   TULocationHandler &TULocHandler;
-  
+
 public:
   DeclEntityAnalyzer(Entity ent, TULocationHandler &handler)
     : Ent(ent), TULocHandler(handler) { }
-  
+
   virtual void Handle(TranslationUnit *TU) {
     assert(TU && "Passed null translation unit");
 
@@ -60,11 +60,11 @@
 class VISIBILITY_HIDDEN RefEntityAnalyzer : public TranslationUnitHandler {
   Entity Ent;
   TULocationHandler &TULocHandler;
-  
+
 public:
   RefEntityAnalyzer(Entity ent, TULocationHandler &handler)
     : Ent(ent), TULocHandler(handler) { }
-  
+
   virtual void Handle(TranslationUnit *TU) {
     assert(TU && "Passed null translation unit");
 
@@ -115,12 +115,12 @@
     IFaceEnt = Entity::get(IFD, Prog);
     GlobSel = GlobalSelector::get(MD->getSelector(), Prog);
     IsInstanceMethod = MD->isInstanceMethod();
-    
+
     for (ObjCInterfaceDecl *Cls = IFD->getSuperClass();
            Cls; Cls = Cls->getSuperClass())
       HierarchyEntities.insert(Entity::get(Cls, Prog));
   }
-  
+
   virtual void Handle(TranslationUnit *TU) {
     assert(TU && "Passed null translation unit");
 
@@ -150,7 +150,7 @@
     // FIXME: Finding @selector references should be through another Analyzer
     // method, like FindSelectors.
     if (isa<ObjCSelectorExpr>(ASTLoc.getStmt()))
-      return false;      
+      return false;
 
     ObjCInterfaceDecl *MsgD = 0;
     ObjCMessageExpr *Msg = cast<ObjCMessageExpr>(ASTLoc.getStmt());
@@ -181,7 +181,7 @@
 
       MsgD = Msg->getClassInfo().first;
       // FIXME: Case when we only have an identifier.
-      assert(MsgD && "Identifier only"); 
+      assert(MsgD && "Identifier only");
     }
 
     assert(MsgD);
@@ -233,7 +233,7 @@
   /// \brief Super classes of the ObjCInterface.
   typedef llvm::SmallSet<Entity, 16> EntitiesSetTy;
   EntitiesSetTy HierarchyEntities;
-  
+
   /// \brief The interface in the message interface hierarchy that "intercepts"
   /// the selector.
   Entity ReceiverIFaceEnt;
@@ -254,7 +254,7 @@
         CanBeClassMethod = true;
         MsgD = Msg->getClassInfo().first;
         // FIXME: Case when we only have an identifier.
-        assert(MsgD && "Identifier only"); 
+        assert(MsgD && "Identifier only");
         break;
       }
 
@@ -276,7 +276,7 @@
       CanBeInstanceMethod = true;
       break;
     }
-    
+
     assert(CanBeInstanceMethod || CanBeClassMethod);
 
     Selector sel = Msg->getSelector();
@@ -304,7 +304,7 @@
               break;
             }
         }
-        
+
         if (isReceiver) {
           ReceiverIFaceEnt = Entity::get(Cls, Prog);
           break;
@@ -312,7 +312,7 @@
       }
     }
   }
-  
+
   virtual void Handle(TranslationUnit *TU) {
     assert(TU && "Passed null translation unit");
     ASTContext &Ctx = TU->getASTContext();
@@ -406,7 +406,7 @@
   Entity Ent = Entity::get(D, Prog);
   if (Ent.isInvalid())
     return;
-  
+
   DeclEntityAnalyzer DEA(Ent, Handler);
   Idxer.GetTranslationUnitsFor(Ent, DEA);
 }
@@ -423,7 +423,7 @@
   Entity Ent = Entity::get(D, Prog);
   if (Ent.isInvalid())
     return;
-  
+
   RefEntityAnalyzer REA(Ent, Handler);
   Idxer.GetTranslationUnitsFor(Ent, REA);
 }

Modified: cfe/trunk/lib/Index/DeclReferenceMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/DeclReferenceMap.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/DeclReferenceMap.cpp (original)
+++ cfe/trunk/lib/Index/DeclReferenceMap.cpp Wed Sep  9 10:08:12 2009
@@ -63,16 +63,16 @@
 DeclReferenceMap::astlocation_iterator
 DeclReferenceMap::refs_begin(NamedDecl *D) const {
   NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl());
-  return astlocation_iterator(Map.lower_bound(Prim));  
+  return astlocation_iterator(Map.lower_bound(Prim));
 }
 
 DeclReferenceMap::astlocation_iterator
 DeclReferenceMap::refs_end(NamedDecl *D) const {
   NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl());
-  return astlocation_iterator(Map.upper_bound(Prim));  
+  return astlocation_iterator(Map.upper_bound(Prim));
 }
 
 bool DeclReferenceMap::refs_empty(NamedDecl *D) const {
   NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl());
-  return refs_begin(Prim) == refs_end(Prim);  
+  return refs_begin(Prim) == refs_end(Prim);
 }

Modified: cfe/trunk/lib/Index/Entity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/Entity.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/Entity.cpp (original)
+++ cfe/trunk/lib/Index/Entity.cpp Wed Sep  9 10:08:12 2009
@@ -41,10 +41,10 @@
 public:
   EntityGetter(Program &prog, ProgramImpl &progImpl)
     : Prog(prog), ProgImpl(progImpl) { }
-  
+
   Entity VisitNamedDecl(NamedDecl *D);
   Entity VisitVarDecl(VarDecl *D);
-  Entity VisitFunctionDecl(FunctionDecl *D); 
+  Entity VisitFunctionDecl(FunctionDecl *D);
 };
 
 }
@@ -80,12 +80,12 @@
     // Treats other DeclarationNames as internal Decls for now..
     if (LocalSel.isNull())
       return Entity(D);
-    
+
     Selector GlobSel =
         (uintptr_t)GlobalSelector::get(LocalSel, Prog).getAsOpaquePtr();
     GlobName = DeclarationName(GlobSel);
   }
-  
+
   assert(GlobName);
 
   unsigned IdNS = D->getIdentifierNamespace();
@@ -105,7 +105,7 @@
   EntityImpl *New =
       new (Buf) EntityImpl(Parent, GlobName, IdNS, isObjCInstanceMethod);
   Entities.InsertNode(New, InsertPos);
-  
+
   return Entity(New);
 }
 
@@ -113,7 +113,7 @@
   // If it's static it cannot be referred to by another translation unit.
   if (D->getStorageClass() == VarDecl::Static)
     return Entity(D);
-  
+
   return VisitNamedDecl(D);
 }
 
@@ -121,7 +121,7 @@
   // If it's static it cannot be refered to by another translation unit.
   if (D->getStorageClass() == FunctionDecl::Static)
     return Entity(D);
-  
+
   return VisitNamedDecl(D);
 }
 
@@ -188,18 +188,18 @@
 Decl *Entity::getDecl(ASTContext &AST) const {
   if (isInvalid())
     return 0;
-  
+
   if (Decl *D = Val.dyn_cast<Decl *>())
     // Check that the passed AST is actually the one that this Decl belongs to.
     return (&D->getASTContext() == &AST) ? D : 0;
-  
+
   return Val.get<EntityImpl *>()->getDecl(AST);
 }
 
 std::string Entity::getPrintableName() const {
   if (isInvalid())
     return "<< Invalid >>";
-  
+
   if (Decl *D = Val.dyn_cast<Decl *>()) {
     if (NamedDecl *ND = dyn_cast<NamedDecl>(D))
       return ND->getNameAsString();
@@ -219,7 +219,7 @@
   return EntityImpl::get(D, Prog, ProgImpl);
 }
 
-unsigned 
+unsigned
 llvm::DenseMapInfo<Entity>::getHashValue(Entity E) {
   return DenseMapInfo<void*>::getHashValue(E.getAsOpaquePtr());
 }

Modified: cfe/trunk/lib/Index/EntityImpl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/EntityImpl.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/EntityImpl.h (original)
+++ cfe/trunk/lib/Index/EntityImpl.h Wed Sep  9 10:08:12 2009
@@ -30,7 +30,7 @@
 
   /// \brief Identifier namespace.
   unsigned IdNS;
-  
+
   /// \brief If Name is a selector, this keeps track whether it's for an
   /// instance method.
   bool IsObjCInstanceMethod;
@@ -47,7 +47,7 @@
   /// \brief Get an Entity associated with the given Decl.
   /// \returns Null if an Entity cannot refer to this Decl.
   static Entity get(Decl *D, Program &Prog, ProgramImpl &ProgImpl);
-  
+
   std::string getPrintableName();
 
   void Profile(llvm::FoldingSetNodeID &ID) const {

Modified: cfe/trunk/lib/Index/GlobalSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/GlobalSelector.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/GlobalSelector.cpp (original)
+++ cfe/trunk/lib/Index/GlobalSelector.cpp Wed Sep  9 10:08:12 2009
@@ -41,7 +41,7 @@
 std::string GlobalSelector::getPrintableName() const {
   if (isInvalid())
     return "<< Invalid >>";
-  
+
   Selector GlobSel = Selector(reinterpret_cast<uintptr_t>(Val));
   return GlobSel.getAsString();
 }
@@ -67,7 +67,7 @@
   return GlobalSelector(GlobSel.getAsOpaquePtr());
 }
 
-unsigned 
+unsigned
 llvm::DenseMapInfo<GlobalSelector>::getHashValue(GlobalSelector Sel) {
   return DenseMapInfo<void*>::getHashValue(Sel.getAsOpaquePtr());
 }

Modified: cfe/trunk/lib/Index/Indexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/Indexer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/Indexer.cpp (original)
+++ cfe/trunk/lib/Index/Indexer.cpp Wed Sep  9 10:08:12 2009
@@ -25,7 +25,7 @@
 class EntityIndexer : public EntityHandler {
   TranslationUnit *TU;
   Indexer::MapTy ⤅
-  
+
 public:
   EntityIndexer(TranslationUnit *tu, Indexer::MapTy &map) : TU(tu), Map(map) { }
 
@@ -64,7 +64,7 @@
   CtxTUMap[&Ctx] = TU;
   EntityIndexer Idx(TU, Map);
   Prog.FindEntities(Ctx, Idx);
-  
+
   SelectorIndexer SelIdx(Prog, TU, SelMap);
   SelIdx.Visit(Ctx.getTranslationUnitDecl());
 }
@@ -84,7 +84,7 @@
   MapTy::iterator I = Map.find(Ent);
   if (I == Map.end())
     return;
-  
+
   TUSetTy &Set = I->second;
   for (TUSetTy::iterator I = Set.begin(), E = Set.end(); I != E; ++I)
     Handler.Handle(*I);
@@ -97,7 +97,7 @@
   SelMapTy::iterator I = SelMap.find(Sel);
   if (I == SelMap.end())
     return;
-  
+
   TUSetTy &Set = I->second;
   for (TUSetTy::iterator I = Set.begin(), E = Set.end(); I != E; ++I)
     Handler.Handle(*I);

Modified: cfe/trunk/lib/Index/ProgramImpl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ProgramImpl.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/ProgramImpl.h (original)
+++ cfe/trunk/lib/Index/ProgramImpl.h Wed Sep  9 10:08:12 2009
@@ -30,16 +30,16 @@
 private:
   EntitySetTy Entities;
   llvm::BumpPtrAllocator BumpAlloc;
-  
+
   IdentifierTable Identifiers;
   SelectorTable Selectors;
 
   ProgramImpl(const ProgramImpl&); // do not implement
   ProgramImpl &operator=(const ProgramImpl &); // do not implement
-  
+
 public:
   ProgramImpl() : Identifiers(LangOptions()) { }
-  
+
   EntitySetTy &getEntities() { return Entities; }
   IdentifierTable &getIdents() { return Identifiers; }
   SelectorTable &getSelectors() { return Selectors; }

Modified: cfe/trunk/lib/Index/ResolveLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ResolveLocation.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Index/ResolveLocation.cpp (original)
+++ cfe/trunk/lib/Index/ResolveLocation.cpp Wed Sep  9 10:08:12 2009
@@ -119,7 +119,7 @@
   Nodes.push_back(Node->getArg(0));
   Nodes.push_back(Node->getCallee());
   Nodes.push_back(Node->getArg(1));
-  
+
   for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
     RangePos RP = CheckRange(Nodes[i]);
     if (RP == AfterLoc)
@@ -201,9 +201,9 @@
     if (RP == ContainsLoc)
       return Visit(*I);
   }
-  
+
   // We didn't find the location in the parameters and we didn't get passed it.
-  
+
   if (!D->isThisDeclarationADefinition())
     return ASTLocation(D);
 
@@ -214,7 +214,7 @@
          I = D->decls_begin(), E = D->decls_end(); I != E; ++I) {
     if (isa<ParmVarDecl>(*I))
       continue; // We already searched through the parameters.
-    
+
     RangePos RP = CheckRange(*I);
     if (RP == AfterLoc)
       break;
@@ -223,7 +223,7 @@
   }
 
   // We didn't find a declaration that corresponds to the source location.
-  
+
   // Finally, search through the body of the function.
   Stmt *Body = D->getBody();
   assert(Body && "Expected definition");
@@ -325,10 +325,10 @@
                                                Ctx.getLangOptions());
   Range.setEnd(Range.getEnd().getFileLocWithOffset(TokSize-1));
 
-  SourceManager &SourceMgr = Ctx.getSourceManager(); 
+  SourceManager &SourceMgr = Ctx.getSourceManager();
   if (SourceMgr.isBeforeInTranslationUnit(Range.getEnd(), Loc))
     return BeforeLoc;
-  
+
   if (SourceMgr.isBeforeInTranslationUnit(Loc, Range.getBegin()))
     return AfterLoc;
 
@@ -367,6 +367,6 @@
 ASTLocation idx::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) {
   if (Loc.isInvalid())
     return ASTLocation();
-  
+
   return DeclLocResolver(Ctx, Loc).Visit(Ctx.getTranslationUnitDecl());
 }

Modified: cfe/trunk/lib/Lex/HeaderMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/HeaderMap.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderMap.cpp Wed Sep  9 10:08:12 2009
@@ -28,8 +28,8 @@
 enum {
   HMAP_HeaderMagicNumber = ('h' << 24) | ('m' << 16) | ('a' << 8) | 'p',
   HMAP_HeaderVersion = 1,
-  
-  HMAP_EmptyBucketKey = 0 
+
+  HMAP_EmptyBucketKey = 0
 };
 
 namespace clang {
@@ -58,7 +58,7 @@
 /// linear probing based on this function.
 static inline unsigned HashHMapKey(const char *S, const char *End) {
   unsigned Result = 0;
-  
+
   for (; S != End; S++)
     Result += tolower(*S) * 13;
   return Result;
@@ -78,27 +78,27 @@
   // If the file is too small to be a header map, ignore it.
   unsigned FileSize = FE->getSize();
   if (FileSize <= sizeof(HMapHeader)) return 0;
-  
-  llvm::OwningPtr<const llvm::MemoryBuffer> FileBuffer( 
+
+  llvm::OwningPtr<const llvm::MemoryBuffer> FileBuffer(
     llvm::MemoryBuffer::getFile(FE->getName(), 0, FE->getSize()));
   if (FileBuffer == 0) return 0;  // Unreadable file?
   const char *FileStart = FileBuffer->getBufferStart();
 
   // We know the file is at least as big as the header, check it now.
   const HMapHeader *Header = reinterpret_cast<const HMapHeader*>(FileStart);
-  
+
   // Sniff it to see if it's a headermap by checking the magic number and
   // version.
   bool NeedsByteSwap;
-  if (Header->Magic == HMAP_HeaderMagicNumber && 
+  if (Header->Magic == HMAP_HeaderMagicNumber &&
       Header->Version == HMAP_HeaderVersion)
     NeedsByteSwap = false;
   else if (Header->Magic == llvm::ByteSwap_32(HMAP_HeaderMagicNumber) &&
            Header->Version == llvm::ByteSwap_16(HMAP_HeaderVersion))
     NeedsByteSwap = true;  // Mixed endianness headermap.
-  else 
+  else
     return 0;  // Not a header map.
-  
+
   if (Header->Reserved != 0) return 0;
 
   // Okay, everything looks good, create the header map.
@@ -137,11 +137,11 @@
 HMapBucket HeaderMap::getBucket(unsigned BucketNo) const {
   HMapBucket Result;
   Result.Key = HMAP_EmptyBucketKey;
-  
-  const HMapBucket *BucketArray = 
+
+  const HMapBucket *BucketArray =
     reinterpret_cast<const HMapBucket*>(FileBuffer->getBufferStart() +
                                         sizeof(HMapHeader));
-  
+
   const HMapBucket *BucketPtr = BucketArray+BucketNo;
   if ((char*)(BucketPtr+1) > FileBuffer->getBufferEnd()) {
     Result.Prefix = 0;
@@ -161,11 +161,11 @@
 const char *HeaderMap::getString(unsigned StrTabIdx) const {
   // Add the start of the string table to the idx.
   StrTabIdx += getEndianAdjustedWord(getHeader().StringsOffset);
-  
+
   // Check for invalid index.
   if (StrTabIdx >= FileBuffer->getBufferSize())
     return 0;
-  
+
   // Otherwise, we have a valid pointer into the file.  Just return it.  We know
   // that the "string" can not overrun the end of the file, because the buffer
   // is nul terminated by virtue of being a MemoryBuffer.
@@ -191,15 +191,15 @@
 void HeaderMap::dump() const {
   const HMapHeader &Hdr = getHeader();
   unsigned NumBuckets = getEndianAdjustedWord(Hdr.NumBuckets);
-  
-  fprintf(stderr, "Header Map %s:\n  %d buckets, %d entries\n", 
+
+  fprintf(stderr, "Header Map %s:\n  %d buckets, %d entries\n",
           getFileName(), NumBuckets,
           getEndianAdjustedWord(Hdr.NumEntries));
-  
+
   for (unsigned i = 0; i != NumBuckets; ++i) {
     HMapBucket B = getBucket(i);
     if (B.Key == HMAP_EmptyBucketKey) continue;
-    
+
     const char *Key    = getString(B.Key);
     const char *Prefix = getString(B.Prefix);
     const char *Suffix = getString(B.Suffix);
@@ -219,22 +219,22 @@
   // Don't probe infinitely.
   if (NumBuckets & (NumBuckets-1))
     return 0;
-  
+
   // Linearly probe the hash table.
   for (unsigned Bucket = HashHMapKey(FilenameStart, FilenameEnd);; ++Bucket) {
     HMapBucket B = getBucket(Bucket & (NumBuckets-1));
     if (B.Key == HMAP_EmptyBucketKey) return 0; // Hash miss.
-    
+
     // See if the key matches.  If not, probe on.
     const char *Key = getString(B.Key);
     unsigned BucketKeyLen = strlen(Key);
     if (BucketKeyLen != unsigned(FilenameEnd-FilenameStart))
       continue;
-    
+
     // See if the actual strings equal.
     if (!StringsEqualWithoutCase(FilenameStart, Key, BucketKeyLen))
       continue;
-    
+
     // If so, we have a match in the hash table.  Construct the destination
     // path.
     llvm::SmallString<1024> DestPath;

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Sep  9 10:08:12 2009
@@ -35,7 +35,7 @@
 HeaderSearch::HeaderSearch(FileManager &FM) : FileMgr(FM), FrameworkMap(64) {
   SystemDirIdx = 0;
   NoCurDirSearch = false;
- 
+
   ExternalLookup = 0;
   NumIncluded = 0;
   NumMultiIncludeFileOptzn = 0;
@@ -47,7 +47,7 @@
   for (unsigned i = 0, e = HeaderMaps.size(); i != e; ++i)
     delete HeaderMaps[i].second;
 }
-                           
+
 void HeaderSearch::PrintStats() {
   fprintf(stderr, "\n*** HeaderSearch Stats:\n");
   fprintf(stderr, "%d files tracked.\n", (int)FileInfo.size());
@@ -61,11 +61,11 @@
   fprintf(stderr, "  %d #import/#pragma once files.\n", NumOnceOnlyFiles);
   fprintf(stderr, "  %d included exactly once.\n", NumSingleIncludedFiles);
   fprintf(stderr, "  %d max times a file is included.\n", MaxNumIncludes);
-  
+
   fprintf(stderr, "  %d #include/#include_next/#import.\n", NumIncluded);
   fprintf(stderr, "    %d #includes skipped due to"
           " the multi-include optimization.\n", NumMultiIncludeFileOptzn);
-  
+
   fprintf(stderr, "%d framework lookups.\n", NumFrameworkLookups);
   fprintf(stderr, "%d subframework lookups.\n", NumSubFrameworkLookups);
 }
@@ -79,15 +79,15 @@
     for (unsigned i = 0, e = HeaderMaps.size(); i != e; ++i)
       // Pointer equality comparison of FileEntries works because they are
       // already uniqued by inode.
-      if (HeaderMaps[i].first == FE) 
+      if (HeaderMaps[i].first == FE)
         return HeaderMaps[i].second;
   }
-  
+
   if (const HeaderMap *HM = HeaderMap::Create(FE)) {
     HeaderMaps.push_back(std::make_pair(FE, HM));
     return HM;
   }
-    
+
   return 0;
 }
 
@@ -121,10 +121,10 @@
     TmpDir.append(FilenameStart, FilenameEnd);
     return HS.getFileMgr().getFile(TmpDir.begin(), TmpDir.end());
   }
-  
+
   if (isFramework())
     return DoFrameworkLookup(FilenameStart, FilenameEnd, HS);
-  
+
   assert(isHeaderMap() && "Unknown directory lookup");
   return getHeaderMap()->LookupFile(FilenameStart, FilenameEnd,HS.getFileMgr());
 }
@@ -136,63 +136,63 @@
                                                     const char *FilenameEnd,
                                                     HeaderSearch &HS) const {
   FileManager &FileMgr = HS.getFileMgr();
-  
+
   // Framework names must have a '/' in the filename.
   const char *SlashPos = std::find(FilenameStart, FilenameEnd, '/');
   if (SlashPos == FilenameEnd) return 0;
-  
+
   // Find out if this is the home for the specified framework, by checking
   // HeaderSearch.  Possible answer are yes/no and unknown.
-  const DirectoryEntry *&FrameworkDirCache = 
+  const DirectoryEntry *&FrameworkDirCache =
     HS.LookupFrameworkCache(FilenameStart, SlashPos);
-  
+
   // If it is known and in some other directory, fail.
   if (FrameworkDirCache && FrameworkDirCache != getFrameworkDir())
     return 0;
-  
+
   // Otherwise, construct the path to this framework dir.
-  
+
   // FrameworkName = "/System/Library/Frameworks/"
   llvm::SmallString<1024> FrameworkName;
   FrameworkName += getFrameworkDir()->getName();
   if (FrameworkName.empty() || FrameworkName.back() != '/')
     FrameworkName.push_back('/');
-  
+
   // FrameworkName = "/System/Library/Frameworks/Cocoa"
   FrameworkName.append(FilenameStart, SlashPos);
-  
+
   // FrameworkName = "/System/Library/Frameworks/Cocoa.framework/"
   FrameworkName += ".framework/";
-  
+
   // If the cache entry is still unresolved, query to see if the cache entry is
   // still unresolved.  If so, check its existence now.
   if (FrameworkDirCache == 0) {
     HS.IncrementFrameworkLookupCount();
-    
+
     // If the framework dir doesn't exist, we fail.
     // FIXME: It's probably more efficient to query this with FileMgr.getDir.
-    if (!llvm::sys::Path(std::string(FrameworkName.begin(), 
+    if (!llvm::sys::Path(std::string(FrameworkName.begin(),
                                      FrameworkName.end())).exists())
       return 0;
-    
+
     // Otherwise, if it does, remember that this is the right direntry for this
     // framework.
     FrameworkDirCache = getFrameworkDir();
   }
-  
+
   // Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h"
   unsigned OrigSize = FrameworkName.size();
-  
+
   FrameworkName += "Headers/";
   FrameworkName.append(SlashPos+1, FilenameEnd);
   if (const FileEntry *FE = FileMgr.getFile(FrameworkName.begin(),
                                             FrameworkName.end())) {
     return FE;
   }
-  
+
   // Check "/System/Library/Frameworks/Cocoa.framework/PrivateHeaders/file.h"
   const char *Private = "Private";
-  FrameworkName.insert(FrameworkName.begin()+OrigSize, Private, 
+  FrameworkName.insert(FrameworkName.begin()+OrigSize, Private,
                        Private+strlen(Private));
   return FileMgr.getFile(FrameworkName.begin(), FrameworkName.end());
 }
@@ -209,7 +209,7 @@
 /// non-null, indicates where the #including file is, in case a relative search
 /// is needed.
 const FileEntry *HeaderSearch::LookupFile(const char *FilenameStart,
-                                          const char *FilenameEnd, 
+                                          const char *FilenameEnd,
                                           bool isAngled,
                                           const DirectoryLookup *FromDir,
                                           const DirectoryLookup *&CurDir,
@@ -220,11 +220,11 @@
 
     // If this was an #include_next "/absolute/file", fail.
     if (FromDir) return 0;
-    
+
     // Otherwise, just return the file.
     return FileMgr.getFile(FilenameStart, FilenameEnd);
   }
-  
+
   // Step #0, unless disabled, check to see if the file is in the #includer's
   // directory.  This has to be based on CurFileEnt, not CurDir, because
   // CurFileEnt could be a #include of a subdirectory (#include "foo/bar.h") and
@@ -249,17 +249,17 @@
       return FE;
     }
   }
-  
+
   CurDir = 0;
 
   // If this is a system #include, ignore the user #include locs.
   unsigned i = isAngled ? SystemDirIdx : 0;
-  
+
   // If this is a #include_next request, start searching after the directory the
   // file was found in.
   if (FromDir)
     i = FromDir-&SearchDirs[0];
-  
+
   // Cache all of the lookups performed by this method.  Many headers are
   // multiply included, and the "pragma once" optimization prevents them from
   // being relex/pp'd, but they would still have to search through a
@@ -279,23 +279,23 @@
     // start point value.
     CacheLookup.first = i+1;
   }
-  
+
   // Check each directory in sequence to see if it contains this file.
   for (; i != SearchDirs.size(); ++i) {
-    const FileEntry *FE = 
+    const FileEntry *FE =
       SearchDirs[i].LookupFile(FilenameStart, FilenameEnd, *this);
     if (!FE) continue;
-    
+
     CurDir = &SearchDirs[i];
-    
+
     // This file is a system header or C++ unfriendly if the dir is.
     getFileInfo(FE).DirInfo = CurDir->getDirCharacteristic();
-    
+
     // Remember this location for the next lookup we do.
     CacheLookup.second = i;
     return FE;
   }
-  
+
   // Otherwise, didn't find it. Remember we didn't find this.
   CacheLookup.second = SearchDirs.size();
   return 0;
@@ -311,20 +311,20 @@
                          const char *FilenameEnd,
                          const FileEntry *ContextFileEnt) {
   assert(ContextFileEnt && "No context file?");
-  
+
   // Framework names must have a '/' in the filename.  Find it.
   const char *SlashPos = std::find(FilenameStart, FilenameEnd, '/');
   if (SlashPos == FilenameEnd) return 0;
-  
+
   // Look up the base framework name of the ContextFileEnt.
   const char *ContextName = ContextFileEnt->getName();
-    
+
   // If the context info wasn't a framework, couldn't be a subframework.
   const char *FrameworkPos = strstr(ContextName, ".framework/");
   if (FrameworkPos == 0)
     return 0;
-  
-  llvm::SmallString<1024> FrameworkName(ContextName, 
+
+  llvm::SmallString<1024> FrameworkName(ContextName,
                                         FrameworkPos+strlen(".framework/"));
 
   // Append Frameworks/HIToolbox.framework/
@@ -334,28 +334,28 @@
 
   llvm::StringMapEntry<const DirectoryEntry *> &CacheLookup =
     FrameworkMap.GetOrCreateValue(FilenameStart, SlashPos);
-  
+
   // Some other location?
   if (CacheLookup.getValue() &&
       CacheLookup.getKeyLength() == FrameworkName.size() &&
       memcmp(CacheLookup.getKeyData(), &FrameworkName[0],
              CacheLookup.getKeyLength()) != 0)
     return 0;
-  
+
   // Cache subframework.
   if (CacheLookup.getValue() == 0) {
     ++NumSubFrameworkLookups;
-    
+
     // If the framework dir doesn't exist, we fail.
     const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.begin(),
                                                      FrameworkName.end());
     if (Dir == 0) return 0;
-    
+
     // Otherwise, if it does, remember that this is the right direntry for this
     // framework.
     CacheLookup.setValue(Dir);
   }
-  
+
   const FileEntry *FE = 0;
 
   // Check ".../Frameworks/HIToolbox.framework/Headers/HIToolbox.h"
@@ -364,7 +364,7 @@
   HeadersFilename.append(SlashPos+1, FilenameEnd);
   if (!(FE = FileMgr.getFile(HeadersFilename.begin(),
                              HeadersFilename.end()))) {
-    
+
     // Check ".../Frameworks/HIToolbox.framework/PrivateHeaders/HIToolbox.h"
     HeadersFilename = FrameworkName;
     HeadersFilename += "PrivateHeaders/";
@@ -372,7 +372,7 @@
     if (!(FE = FileMgr.getFile(HeadersFilename.begin(), HeadersFilename.end())))
       return 0;
   }
-  
+
   // This file is a system header or C++ unfriendly if the old file is.
   //
   // Note that the temporary 'DirInfo' is required here, as either call to
@@ -394,7 +394,7 @@
   if (FE->getUID() >= FileInfo.size())
     FileInfo.resize(FE->getUID()+1);
   return FileInfo[FE->getUID()];
-}  
+}
 
 void HeaderSearch::setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID) {
   if (UID >= FileInfo.size())
@@ -410,13 +410,13 @@
 
   // Get information about this file.
   HeaderFileInfo &FileInfo = getFileInfo(File);
-  
+
   // If this is a #import directive, check that we have not already imported
   // this header.
   if (isImport) {
     // If this has already been imported, don't import it again.
     FileInfo.isImport = true;
-    
+
     // Has this already been #import'ed or #include'd?
     if (FileInfo.NumIncludes) return false;
   } else {
@@ -425,19 +425,19 @@
     if (FileInfo.isImport)
       return false;
   }
-  
+
   // Next, check to see if the file is wrapped with #ifndef guards.  If so, and
   // if the macro that guards it is defined, we know the #include has no effect.
-  if (const IdentifierInfo *ControllingMacro 
+  if (const IdentifierInfo *ControllingMacro
       = FileInfo.getControllingMacro(ExternalLookup))
     if (ControllingMacro->hasMacroDefinition()) {
       ++NumMultiIncludeFileOptzn;
       return false;
     }
-  
+
   // Increment the number of times this file has been included.
   ++FileInfo.NumIncludes;
-  
+
   return true;
 }
 

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Wed Sep  9 10:08:12 2009
@@ -39,7 +39,7 @@
 // Token Class Implementation
 //===----------------------------------------------------------------------===//
 
-/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier. 
+/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier.
 bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
   if (IdentifierInfo *II = getIdentifierInfo())
     return II->getObjCKeywordID() == objcKey;
@@ -57,35 +57,35 @@
 // Lexer Class Implementation
 //===----------------------------------------------------------------------===//
 
-void Lexer::InitLexer(const char *BufStart, const char *BufPtr, 
+void Lexer::InitLexer(const char *BufStart, const char *BufPtr,
                       const char *BufEnd) {
   InitCharacterInfo();
-  
+
   BufferStart = BufStart;
   BufferPtr = BufPtr;
   BufferEnd = BufEnd;
-  
+
   assert(BufEnd[0] == 0 &&
          "We assume that the input buffer has a null character at the end"
          " to simplify lexing!");
-  
+
   Is_PragmaLexer = false;
 
   // Start of the file is a start of line.
   IsAtStartOfLine = true;
-  
+
   // We are not after parsing a #.
   ParsingPreprocessorDirective = false;
-  
+
   // We are not after parsing #include.
   ParsingFilename = false;
-  
+
   // We are not in raw mode.  Raw mode disables diagnostics and interpretation
   // of tokens (e.g. identifiers, thus disabling macro expansion).  It is used
   // to quickly lex the tokens of the buffer, e.g. when handling a "#if 0" block
   // or otherwise skipping over tokens.
   LexingRawMode = false;
-  
+
   // Default to not keeping comments.
   ExtendedTokenMode = 0;
 }
@@ -98,12 +98,12 @@
   : PreprocessorLexer(&PP, FID),
     FileLoc(PP.getSourceManager().getLocForStartOfFile(FID)),
     Features(PP.getLangOptions()) {
-  
+
   const llvm::MemoryBuffer *InputFile = PP.getSourceManager().getBuffer(FID);
-  
+
   InitLexer(InputFile->getBufferStart(), InputFile->getBufferStart(),
             InputFile->getBufferEnd());
-  
+
   // Default to keeping comments if the preprocessor wants them.
   SetCommentRetentionState(PP.getCommentRetentionState());
 }
@@ -116,7 +116,7 @@
   : FileLoc(fileloc), Features(features) {
 
   InitLexer(BufStart, BufPtr, BufEnd);
-  
+
   // We *are* in raw mode.
   LexingRawMode = true;
 }
@@ -128,9 +128,9 @@
   : FileLoc(SM.getLocForStartOfFile(FID)), Features(features) {
   const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID);
 
-  InitLexer(FromFile->getBufferStart(), FromFile->getBufferStart(), 
+  InitLexer(FromFile->getBufferStart(), FromFile->getBufferStart(),
             FromFile->getBufferEnd());
-  
+
   // We *are* in raw mode.
   LexingRawMode = true;
 }
@@ -150,7 +150,7 @@
 /// interface that could handle this stuff.  This would pull GetMappedTokenLoc
 /// out of the critical path of the lexer!
 ///
-Lexer *Lexer::Create_PragmaLexer(SourceLocation SpellingLoc, 
+Lexer *Lexer::Create_PragmaLexer(SourceLocation SpellingLoc,
                                  SourceLocation InstantiationLocStart,
                                  SourceLocation InstantiationLocEnd,
                                  unsigned TokLen, Preprocessor &PP) {
@@ -159,12 +159,12 @@
   // Create the lexer as if we were going to lex the file normally.
   FileID SpellingFID = SM.getFileID(SpellingLoc);
   Lexer *L = new Lexer(SpellingFID, PP);
-  
+
   // Now that the lexer is created, change the start/end locations so that we
   // just lex the subsection of the file that we want.  This is lexing from a
   // scratch buffer.
   const char *StrData = SM.getCharacterData(SpellingLoc);
-  
+
   L->BufferPtr = StrData;
   L->BufferEnd = StrData+TokLen;
   assert(L->BufferEnd[0] == 0 && "Buffer is not nul terminated!");
@@ -174,11 +174,11 @@
   L->FileLoc = SM.createInstantiationLoc(SM.getLocForStartOfFile(SpellingFID),
                                          InstantiationLocStart,
                                          InstantiationLocEnd, TokLen);
-  
+
   // Ensure that the lexer thinks it is inside a directive, so that end \n will
   // return an EOM token.
   L->ParsingPreprocessorDirective = true;
-  
+
   // This lexer really is for _Pragma.
   L->Is_PragmaLexer = true;
   return L;
@@ -220,7 +220,7 @@
                                    const LangOptions &LangOpts) {
   // TODO: this could be special cased for common tokens like identifiers, ')',
   // etc to make this faster, if it mattered.  Just look at StrData[0] to handle
-  // all obviously single-char tokens.  This could use 
+  // all obviously single-char tokens.  This could use
   // Lexer::isObviouslySimpleCharacter for example to handle identifiers or
   // something.
 
@@ -365,7 +365,7 @@
 /// isNumberBody - Return true if this is the body character of an
 /// preprocessing number, which is [a-zA-Z0-9_.].
 static inline bool isNumberBody(unsigned char c) {
-  return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD)) ? 
+  return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD)) ?
     true : false;
 }
 
@@ -386,22 +386,22 @@
                                         SourceLocation FileLoc,
                                         unsigned CharNo, unsigned TokLen) {
   assert(FileLoc.isMacroID() && "Must be an instantiation");
-  
+
   // Otherwise, we're lexing "mapped tokens".  This is used for things like
   // _Pragma handling.  Combine the instantiation location of FileLoc with the
   // spelling location.
   SourceManager &SM = PP.getSourceManager();
-  
+
   // Create a new SLoc which is expanded from Instantiation(FileLoc) but whose
   // characters come from spelling(FileLoc)+Offset.
   SourceLocation SpellingLoc = SM.getSpellingLoc(FileLoc);
   SpellingLoc = SpellingLoc.getFileLocWithOffset(CharNo);
-  
+
   // Figure out the expansion loc range, which is the range covered by the
   // original _Pragma(...) sequence.
   std::pair<SourceLocation,SourceLocation> II =
     SM.getImmediateInstantiationRange(FileLoc);
-  
+
   return SM.createInstantiationLoc(SpellingLoc, II.first, II.second, TokLen);
 }
 
@@ -417,7 +417,7 @@
   unsigned CharNo = Loc-BufferStart;
   if (FileLoc.isFileID())
     return FileLoc.getFileLocWithOffset(CharNo);
-  
+
   // Otherwise, this is the _Pragma lexer case, which pretends that all of the
   // tokens are lexed from where the _Pragma was defined.
   assert(PP && "This doesn't work on raw lexers");
@@ -458,13 +458,13 @@
 static char DecodeTrigraphChar(const char *CP, Lexer *L) {
   char Res = GetTrigraphCharForLetter(*CP);
   if (!Res || !L) return Res;
-  
+
   if (!L->getFeatures().Trigraphs) {
     if (!L->isLexingRawMode())
       L->Diag(CP-2, diag::trigraph_ignored);
     return 0;
   }
-    
+
   if (!L->isLexingRawMode())
     L->Diag(CP-2, diag::trigraph_converted) << std::string()+Res;
   return Res;
@@ -472,12 +472,12 @@
 
 /// getEscapedNewLineSize - Return the size of the specified escaped newline,
 /// or 0 if it is not an escaped newline. P[-1] is known to be a "\" or a
-/// trigraph equivalent on entry to this function.  
+/// trigraph equivalent on entry to this function.
 unsigned Lexer::getEscapedNewLineSize(const char *Ptr) {
   unsigned Size = 0;
   while (isWhitespace(Ptr[Size])) {
     ++Size;
-    
+
     if (Ptr[Size-1] != '\n' && Ptr[Size-1] != '\r')
       continue;
 
@@ -485,10 +485,10 @@
     if ((Ptr[Size] == '\r' || Ptr[Size] == '\n') &&
         Ptr[Size-1] != Ptr[Size])
       ++Size;
-      
+
     return Size;
-  } 
-  
+  }
+
   // Not an escaped newline, must be a \t or something else.
   return 0;
 }
@@ -509,7 +509,7 @@
     } else {
       return P;
     }
-    
+
     unsigned NewLineSize = Lexer::getEscapedNewLineSize(AfterEscape);
     if (NewLineSize == 0) return P;
     P = AfterEscape+NewLineSize;
@@ -543,7 +543,7 @@
 Slash:
     // Common case, backslash-char where the char is not whitespace.
     if (!isWhitespace(Ptr[0])) return '\\';
-    
+
     // See if we have optional whitespace characters between the slash and
     // newline.
     if (unsigned EscapedNewLineSize = getEscapedNewLineSize(Ptr)) {
@@ -553,18 +553,18 @@
       // Warn if there was whitespace between the backslash and newline.
       if (Ptr[0] != '\n' && Ptr[0] != '\r' && Tok && !isLexingRawMode())
         Diag(Ptr, diag::backslash_newline_space);
-        
+
       // Found backslash<whitespace><newline>.  Parse the char after it.
       Size += EscapedNewLineSize;
       Ptr  += EscapedNewLineSize;
       // Use slow version to accumulate a correct size field.
       return getCharAndSizeSlow(Ptr, Size, Tok);
     }
-      
+
     // Otherwise, this is not an escaped newline, just return the slash.
     return '\\';
   }
-  
+
   // If this is a trigraph, process it.
   if (Ptr[0] == '?' && Ptr[1] == '?') {
     // If this is actually a legal trigraph (not something like "??x"), emit
@@ -579,7 +579,7 @@
       return C;
     }
   }
-  
+
   // If this is neither, return a single character.
   ++Size;
   return *Ptr;
@@ -601,21 +601,21 @@
 Slash:
     // Common case, backslash-char where the char is not whitespace.
     if (!isWhitespace(Ptr[0])) return '\\';
-    
+
     // See if we have optional whitespace characters followed by a newline.
     if (unsigned EscapedNewLineSize = getEscapedNewLineSize(Ptr)) {
       // Found backslash<whitespace><newline>.  Parse the char after it.
       Size += EscapedNewLineSize;
       Ptr  += EscapedNewLineSize;
-      
+
       // Use slow version to accumulate a correct size field.
       return getCharAndSizeSlowNoWarn(Ptr, Size, Features);
     }
-    
+
     // Otherwise, this is not an escaped newline, just return the slash.
     return '\\';
   }
-  
+
   // If this is a trigraph, process it.
   if (Features.Trigraphs && Ptr[0] == '?' && Ptr[1] == '?') {
     // If this is actually a legal trigraph (not something like "??x"), return
@@ -627,7 +627,7 @@
       return C;
     }
   }
-  
+
   // If this is neither, return a single character.
   ++Size;
   return *Ptr;
@@ -653,34 +653,34 @@
 FinishIdentifier:
     const char *IdStart = BufferPtr;
     FormTokenWithChars(Result, CurPtr, tok::identifier);
-    
+
     // If we are in raw mode, return this identifier raw.  There is no need to
     // look up identifier information or attempt to macro expand it.
     if (LexingRawMode) return;
-    
+
     // Fill in Result.IdentifierInfo, looking up the identifier in the
     // identifier table.
     IdentifierInfo *II = PP->LookUpIdentifierInfo(Result, IdStart);
-    
+
     // Change the kind of this identifier to the appropriate token kind, e.g.
     // turning "for" into a keyword.
     Result.setKind(II->getTokenID());
-    
+
     // Finally, now that we know we have an identifier, pass this off to the
     // preprocessor, which may macro expand it or something.
     if (II->isHandleIdentifierCase())
       PP->HandleIdentifier(Result);
     return;
   }
-  
+
   // Otherwise, $,\,? in identifier found.  Enter slower path.
-  
+
   C = getCharAndSize(CurPtr, Size);
   while (1) {
     if (C == '$') {
       // If we hit a $ and they are not supported in identifiers, we are done.
       if (!Features.DollarIdents) goto FinishIdentifier;
-      
+
       // Otherwise, emit a diagnostic and continue.
       if (!isLexingRawMode())
         Diag(CurPtr, diag::ext_dollar_in_identifier);
@@ -716,7 +716,7 @@
     PrevCh = C;
     C = getCharAndSize(CurPtr, Size);
   }
-  
+
   // If we fell out, check for a sign, due to 1e+12.  If we have one, continue.
   if ((C == '-' || C == '+') && (PrevCh == 'E' || PrevCh == 'e'))
     return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
@@ -724,7 +724,7 @@
   // If we have a hex FP constant, continue.
   if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p'))
     return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
-  
+
   // Update the location of token as well as BufferPtr.
   const char *TokStart = BufferPtr;
   FormTokenWithChars(Result, CurPtr, tok::numeric_constant);
@@ -735,7 +735,7 @@
 /// either " or L".
 void Lexer::LexStringLiteral(Token &Result, const char *CurPtr, bool Wide) {
   const char *NulCharacter = 0; // Does this string contain the \0 character?
-  
+
   char C = getAndAdvanceChar(CurPtr, Result);
   while (C != '"') {
     // Skip escaped characters.
@@ -753,7 +753,7 @@
     }
     C = getAndAdvanceChar(CurPtr, Result);
   }
-  
+
   // If a nul character existed in the string, warn about it.
   if (NulCharacter && !isLexingRawMode())
     Diag(NulCharacter, diag::null_in_string);
@@ -787,11 +787,11 @@
     }
     C = getAndAdvanceChar(CurPtr, Result);
   }
-  
+
   // If a nul character existed in the string, warn about it.
   if (NulCharacter && !isLexingRawMode())
     Diag(NulCharacter, diag::null_in_string);
-  
+
   // Update the location of token as well as BufferPtr.
   const char *TokStart = BufferPtr;
   FormTokenWithChars(Result, CurPtr, tok::angle_string_literal);
@@ -816,7 +816,7 @@
     // FIXME: UCN's.
     C = getAndAdvanceChar(CurPtr, Result);
   }
-  
+
   if (C && C != '\n' && C != '\r' && CurPtr[0] == '\'') {
     ++CurPtr;
   } else {
@@ -838,7 +838,7 @@
       C = getAndAdvanceChar(CurPtr, Result);
     } while (C != '\'');
   }
-  
+
   if (NulCharacter && !isLexingRawMode())
     Diag(NulCharacter, diag::null_in_char);
 
@@ -860,17 +860,17 @@
     // Skip horizontal whitespace very aggressively.
     while (isHorizontalWhitespace(Char))
       Char = *++CurPtr;
-    
+
     // Otherwise if we have something other than whitespace, we're done.
     if (Char != '\n' && Char != '\r')
       break;
-    
+
     if (ParsingPreprocessorDirective) {
       // End of preprocessor directive line, let LexTokenInternal handle this.
       BufferPtr = CurPtr;
       return false;
     }
-    
+
     // ok, but handle newline.
     // The returned token is at the start of the line.
     Result.setFlag(Token::StartOfLine);
@@ -889,7 +889,7 @@
     FormTokenWithChars(Result, CurPtr, tok::unknown);
     return true;
   }
-  
+
   BufferPtr = CurPtr;
   return false;
 }
@@ -903,12 +903,12 @@
   // extension warning.
   if (!Features.BCPLComment && !isLexingRawMode()) {
     Diag(BufferPtr, diag::ext_bcpl_comment);
-    
+
     // Mark them enabled so we only emit one warning for this translation
     // unit.
     Features.BCPLComment = true;
   }
-  
+
   // Scan over the body of the comment.  The common case, when scanning, is that
   // the comment contains normal ascii characters with nothing interesting in
   // them.  As such, optimize for this case with the inner loop.
@@ -918,7 +918,7 @@
     // FIXME: Speedup BCPL comment lexing.  Just scan for a \n or \r character.
     // If we find a \n character, scan backwards, checking to see if it's an
     // escaped newline, like we do for block comments.
-    
+
     // Skip over characters in the fast loop.
     while (C != 0 &&                // Potentially EOF.
            C != '\\' &&             // Potentially escaped newline.
@@ -929,7 +929,7 @@
     // If this is a newline, we're done.
     if (C == '\n' || C == '\r')
       break;  // Found the newline? Break out!
-    
+
     // Otherwise, this is a hard case.  Fall back on getAndAdvanceChar to
     // properly decode the character.  Read it in raw mode to avoid emitting
     // diagnostics about things like trigraphs.  If we see an escaped newline,
@@ -947,7 +947,7 @@
       --CurPtr;
       C = 'x'; // doesn't matter what this is.
     }
-    
+
     // If we read multiple characters, and one of those characters was a \r or
     // \n, then we had an escaped newline within the comment.  Emit diagnostic
     // unless the next line is also a // comment.
@@ -963,21 +963,21 @@
             if (ForwardPtr[0] == '/' && ForwardPtr[1] == '/')
               break;
           }
-          
+
           if (!isLexingRawMode())
             Diag(OldPtr-1, diag::ext_multi_line_bcpl_comment);
           break;
         }
     }
-    
+
     if (CurPtr == BufferEnd+1) { --CurPtr; break; }
   } while (C != '\n' && C != '\r');
 
   // Found but did not consume the newline.
   if (PP)
-    PP->HandleComment(SourceRange(getSourceLocation(BufferPtr), 
+    PP->HandleComment(SourceRange(getSourceLocation(BufferPtr),
                                   getSourceLocation(CurPtr)));
-                   
+
   // If we are returning comments as tokens, return this comment as a token.
   if (inKeepCommentMode())
     return SaveBCPLComment(Result, CurPtr);
@@ -988,14 +988,14 @@
     BufferPtr = CurPtr;
     return false;
   }
-  
+
   // Otherwise, eat the \n character.  We don't care if this is a \n\r or
   // \r\n sequence.  This is an efficiency hack (because we know the \n can't
   // contribute to another token), it isn't needed for correctness.  Note that
   // this is ok even in KeepWhitespaceMode, because we would have returned the
   /// comment above in that mode.
   ++CurPtr;
-    
+
   // The next returned token is at the start of the line.
   Result.setFlag(Token::StartOfLine);
   // No leading whitespace seen so far.
@@ -1010,17 +1010,17 @@
   // If we're not in a preprocessor directive, just return the // comment
   // directly.
   FormTokenWithChars(Result, CurPtr, tok::comment);
-  
+
   if (!ParsingPreprocessorDirective)
     return true;
-  
+
   // If this BCPL-style comment is in a macro definition, transmogrify it into
   // a C-style block comment.
   std::string Spelling = PP->getSpelling(Result);
   assert(Spelling[0] == '/' && Spelling[1] == '/' && "Not bcpl comment?");
   Spelling[1] = '*';   // Change prefix to "/*".
   Spelling += "*/";    // add suffix.
-  
+
   Result.setKind(tok::comment);
   PP->CreateString(&Spelling[0], Spelling.size(), Result,
                    Result.getLocation());
@@ -1030,13 +1030,13 @@
 /// isBlockCommentEndOfEscapedNewLine - Return true if the specified newline
 /// character (either \n or \r) is part of an escaped newline sequence.  Issue a
 /// diagnostic if so.  We know that the newline is inside of a block comment.
-static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, 
+static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr,
                                                   Lexer *L) {
   assert(CurPtr[0] == '\n' || CurPtr[0] == '\r');
-  
+
   // Back up off the newline.
   --CurPtr;
-  
+
   // If this is a two-character newline sequence, skip the other character.
   if (CurPtr[0] == '\n' || CurPtr[0] == '\r') {
     // \n\n or \r\r -> not escaped newline.
@@ -1045,7 +1045,7 @@
     // \n\r or \r\n -> skip the newline.
     --CurPtr;
   }
-  
+
   // If we have horizontal whitespace, skip over it.  We allow whitespace
   // between the slash and newline.
   bool HasSpace = false;
@@ -1053,7 +1053,7 @@
     --CurPtr;
     HasSpace = true;
   }
-  
+
   // If we have a slash, we know this is an escaped newline.
   if (*CurPtr == '\\') {
     if (CurPtr[-1] != '*') return false;
@@ -1062,7 +1062,7 @@
     if (CurPtr[0] != '/' || CurPtr[-1] != '?' || CurPtr[-2] != '?' ||
         CurPtr[-3] != '*')
       return false;
-    
+
     // This is the trigraph ending the comment.  Emit a stern warning!
     CurPtr -= 2;
 
@@ -1076,15 +1076,15 @@
     if (!L->isLexingRawMode())
       L->Diag(CurPtr, diag::trigraph_ends_block_comment);
   }
-  
+
   // Warn about having an escaped newline between the */ characters.
   if (!L->isLexingRawMode())
     L->Diag(CurPtr, diag::escaped_newline_block_comment_end);
-  
+
   // If there was space between the backslash and newline, warn about it.
   if (HasSpace && !L->isLexingRawMode())
     L->Diag(CurPtr, diag::backslash_newline_space);
-  
+
   return true;
 }
 
@@ -1120,23 +1120,23 @@
     if (!isLexingRawMode())
       Diag(BufferPtr, diag::err_unterminated_block_comment);
     --CurPtr;
-    
+
     // KeepWhitespaceMode should return this broken comment as a token.  Since
     // it isn't a well formed comment, just return it as an 'unknown' token.
     if (isKeepWhitespaceMode()) {
       FormTokenWithChars(Result, CurPtr, tok::unknown);
       return true;
     }
-    
+
     BufferPtr = CurPtr;
     return false;
   }
-  
+
   // Check to see if the first character after the '/*' is another /.  If so,
   // then this slash does not end the block comment, it is part of it.
   if (C == '/')
     C = *CurPtr++;
-  
+
   while (1) {
     // Skip over all non-interesting characters until we find end of buffer or a
     // (probably ending) '/' character.
@@ -1144,7 +1144,7 @@
       // While not aligned to a 16-byte boundary.
       while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0)
         C = *CurPtr++;
-      
+
       if (C == '/') goto FoundSlash;
 
 #ifdef __SSE2__
@@ -1155,13 +1155,13 @@
         CurPtr += 16;
 #elif __ALTIVEC__
       __vector unsigned char Slashes = {
-        '/', '/', '/', '/',  '/', '/', '/', '/', 
+        '/', '/', '/', '/',  '/', '/', '/', '/',
         '/', '/', '/', '/',  '/', '/', '/', '/'
       };
       while (CurPtr+16 <= BufferEnd &&
              !vec_any_eq(*(vector unsigned char*)CurPtr, Slashes))
         CurPtr += 16;
-#else    
+#else
       // Scan for '/' quickly.  Many block comments are very large.
       while (CurPtr[0] != '/' &&
              CurPtr[1] != '/' &&
@@ -1171,20 +1171,20 @@
         CurPtr += 4;
       }
 #endif
-      
+
       // It has to be one of the bytes scanned, increment to it and read one.
       C = *CurPtr++;
     }
-    
+
     // Loop to scan the remainder.
     while (C != '/' && C != '\0')
       C = *CurPtr++;
-    
+
   FoundSlash:
     if (C == '/') {
       if (CurPtr[-2] == '*')  // We found the final */.  We're done!
         break;
-      
+
       if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) {
         if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2, this)) {
           // We found the final */, though it had an escaped newline between the
@@ -1206,22 +1206,22 @@
       // after the /*, but this would involve lexing a lot of what really is the
       // comment, which surely would confuse the parser.
       --CurPtr;
-      
+
       // KeepWhitespaceMode should return this broken comment as a token.  Since
       // it isn't a well formed comment, just return it as an 'unknown' token.
       if (isKeepWhitespaceMode()) {
         FormTokenWithChars(Result, CurPtr, tok::unknown);
         return true;
       }
-      
+
       BufferPtr = CurPtr;
       return false;
     }
     C = *CurPtr++;
   }
-  
-  if (PP) 
-    PP->HandleComment(SourceRange(getSourceLocation(BufferPtr), 
+
+  if (PP)
+    PP->HandleComment(SourceRange(getSourceLocation(BufferPtr),
                                   getSourceLocation(CurPtr)));
 
   // If we are returning comments as tokens, return this comment as a token.
@@ -1279,11 +1279,11 @@
       // Okay, we found the end of the line. First, back up past the \0, \r, \n.
       assert(CurPtr[-1] == Char && "Trigraphs for newline?");
       BufferPtr = CurPtr-1;
-      
+
       // Next, lex the character, which should handle the EOM transition.
       Lex(Tmp);
       assert(Tmp.is(tok::eom) && "Unexpected token!");
-      
+
       // Finally, we're done, return the string we found.
       return Result;
     }
@@ -1303,11 +1303,11 @@
     ParsingPreprocessorDirective = false;
     // Update the location of token as well as BufferPtr.
     FormTokenWithChars(Result, CurPtr, tok::eom);
-    
+
     // Restore comment saving mode, in case it was disabled for directive.
     SetCommentRetentionState(PP->getCommentRetentionState());
     return true;  // Have a token.
-  }        
+  }
 
   // If we are in raw mode, return this event as an EOF token.  Let the caller
   // that put us in raw mode handle the event.
@@ -1317,7 +1317,7 @@
     FormTokenWithChars(Result, BufferEnd, tok::eof);
     return true;
   }
-  
+
   // Otherwise, issue diagnostics for unterminated #if and missing newline.
 
   // If we are in a #if directive, emit an error.
@@ -1326,14 +1326,14 @@
              diag::err_pp_unterminated_conditional);
     ConditionalStack.pop_back();
   }
-  
+
   // C99 5.1.1.2p2: If the file is non-empty and didn't end in a newline, issue
   // a pedwarn.
   if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r'))
     Diag(BufferEnd, diag::ext_no_newline_eof)
       << CodeModificationHint::CreateInsertion(getSourceLocation(BufferEnd),
                                                "\n");
-  
+
   BufferPtr = CurPtr;
 
   // Finally, let the preprocessor handle this.
@@ -1346,27 +1346,27 @@
 /// lexer.
 unsigned Lexer::isNextPPTokenLParen() {
   assert(!LexingRawMode && "How can we expand a macro from a skipping buffer?");
-  
+
   // Switch to 'skipping' mode.  This will ensure that we can lex a token
   // without emitting diagnostics, disables macro expansion, and will cause EOF
   // to return an EOF token instead of popping the include stack.
   LexingRawMode = true;
-  
+
   // Save state that can be changed while lexing so that we can restore it.
   const char *TmpBufferPtr = BufferPtr;
   bool inPPDirectiveMode = ParsingPreprocessorDirective;
-  
+
   Token Tok;
   Tok.startToken();
   LexTokenInternal(Tok);
-  
+
   // Restore state that may have changed.
   BufferPtr = TmpBufferPtr;
   ParsingPreprocessorDirective = inPPDirectiveMode;
-  
+
   // Restore the lexer back to non-skipping mode.
   LexingRawMode = false;
-  
+
   if (Tok.is(tok::eof))
     return 2;
   return Tok.is(tok::l_paren);
@@ -1383,7 +1383,7 @@
   // New token, can't need cleaning yet.
   Result.clearFlag(Token::NeedsCleaning);
   Result.setIdentifierInfo(0);
-  
+
   // CurPtr - Cache BufferPtr in an automatic variable.
   const char *CurPtr = BufferPtr;
 
@@ -1392,7 +1392,7 @@
     ++CurPtr;
     while ((*CurPtr == ' ') || (*CurPtr == '\t'))
       ++CurPtr;
-    
+
     // If we are keeping whitespace and other tokens, just return what we just
     // skipped.  The next lexer invocation will return the token after the
     // whitespace.
@@ -1400,17 +1400,17 @@
       FormTokenWithChars(Result, CurPtr, tok::unknown);
       return;
     }
-    
+
     BufferPtr = CurPtr;
     Result.setFlag(Token::LeadingSpace);
   }
-  
+
   unsigned SizeTmp, SizeTmp2;   // Temporaries for use in cases below.
-  
+
   // Read a character, advancing over it.
   char Char = getAndAdvanceChar(CurPtr, Result);
   tok::TokenKind Kind;
-  
+
   switch (Char) {
   case 0:  // Null.
     // Found end of file?
@@ -1423,13 +1423,13 @@
       assert(PPCache && "Raw buffer::LexEndOfFile should return a token");
       return PPCache->Lex(Result);
     }
-    
+
     if (!isLexingRawMode())
       Diag(CurPtr-1, diag::null_in_file);
     Result.setFlag(Token::LeadingSpace);
     if (SkipWhitespace(Result, CurPtr))
       return; // KeepWhitespaceMode
-      
+
     goto LexNextToken;   // GCC isn't tail call eliminating.
   case '\n':
   case '\r':
@@ -1438,13 +1438,13 @@
     if (ParsingPreprocessorDirective) {
       // Done parsing the "line".
       ParsingPreprocessorDirective = false;
-      
+
       // Restore comment saving mode, in case it was disabled for directive.
       SetCommentRetentionState(PP->getCommentRetentionState());
-      
+
       // Since we consumed a newline, we are back at the start of a line.
       IsAtStartOfLine = true;
-      
+
       Kind = tok::eom;
       break;
     }
@@ -1452,7 +1452,7 @@
     Result.setFlag(Token::StartOfLine);
     // No leading whitespace seen so far.
     Result.clearFlag(Token::LeadingSpace);
-      
+
     if (SkipWhitespace(Result, CurPtr))
       return; // KeepWhitespaceMode
     goto LexNextToken;   // GCC isn't tail call eliminating.
@@ -1467,7 +1467,7 @@
 
   SkipIgnoredUnits:
     CurPtr = BufferPtr;
-    
+
     // If the next token is obviously a // or /* */ comment, skip it efficiently
     // too (without going through the big switch stmt).
     if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() &&
@@ -1489,7 +1489,7 @@
     // Notify MIOpt that we read a non-whitespace/non-comment token.
     MIOpt.ReadToken();
     return LexNumericConstant(Result, CurPtr);
-    
+
   case 'L':   // Identifier (Loony) or wide literal (L'x' or L"xyz").
     // Notify MIOpt that we read a non-whitespace/non-comment token.
     MIOpt.ReadToken();
@@ -1504,7 +1504,7 @@
     if (Char == '\'')
       return LexCharConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result));
     // FALL THROUGH, treating L like the start of an identifier.
-    
+
   // C99 6.4.2: Identifiers.
   case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
   case 'H': case 'I': case 'J': case 'K':    /*'L'*/case 'M': case 'N':
@@ -1527,10 +1527,10 @@
       MIOpt.ReadToken();
       return LexIdentifier(Result, CurPtr);
     }
-    
+
     Kind = tok::unknown;
     break;
-    
+
   // C99 6.4.4: Character Constants.
   case '\'':
     // Notify MIOpt that we read a non-whitespace/non-comment token.
@@ -1596,7 +1596,7 @@
       Kind = tok::amp;
     }
     break;
-  case '*': 
+  case '*':
     if (getCharAndSize(CurPtr, SizeTmp) == '=') {
       Kind = tok::starequal;
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
@@ -1621,7 +1621,7 @@
     if (Char == '-') {      // --
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
       Kind = tok::minusminus;
-    } else if (Char == '>' && Features.CPlusPlus && 
+    } else if (Char == '>' && Features.CPlusPlus &&
                getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') {  // C++ ->*
       CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
                            SizeTmp2, Result);
@@ -1662,20 +1662,20 @@
           getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*') {
         if (SkipBCPLComment(Result, ConsumeChar(CurPtr, SizeTmp, Result)))
           return; // KeepCommentMode
-      
+
         // It is common for the tokens immediately after a // comment to be
         // whitespace (indentation for the next line).  Instead of going through
         // the big switch, handle it efficiently now.
         goto SkipIgnoredUnits;
       }
     }
-      
+
     if (Char == '*') {  // /**/ comment.
       if (SkipBlockComment(Result, ConsumeChar(CurPtr, SizeTmp, Result)))
         return; // KeepCommentMode
       goto LexNextToken;   // GCC isn't tail call eliminating.
     }
-      
+
     if (Char == '=') {
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
       Kind = tok::slashequal;
@@ -1711,7 +1711,7 @@
         if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
           FormTokenWithChars(Result, CurPtr, tok::hash);
           PP->HandleDirective(Result);
-          
+
           // As an optimization, if the preprocessor didn't switch lexers, tail
           // recurse.
           if (PP->isCurrentLexer(this)) {
@@ -1724,10 +1724,10 @@
             }
             goto LexNextToken;   // GCC isn't tail call eliminating.
           }
-          
+
           return PP->Lex(Result);
         }
-        
+
         Kind = tok::hash;
       }
     } else {
@@ -1764,7 +1764,7 @@
     if (Char == '=') {
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
       Kind = tok::greaterequal;
-    } else if (Char == '>' && 
+    } else if (Char == '>' &&
                getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '=') {
       CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
                            SizeTmp2, Result);
@@ -1805,7 +1805,7 @@
     } else if (Features.CPlusPlus && Char == ':') {
       Kind = tok::coloncolon;
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
-    } else {    
+    } else {
       Kind = tok::colon;
     }
     break;
@@ -1817,7 +1817,7 @@
     if (Char == '=') {
       Kind = tok::equalequal;
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
-    } else {      
+    } else {
       Kind = tok::equal;
     }
     break;
@@ -1842,7 +1842,7 @@
       if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
         FormTokenWithChars(Result, CurPtr, tok::hash);
         PP->HandleDirective(Result);
-        
+
         // As an optimization, if the preprocessor didn't switch lexers, tail
         // recurse.
         if (PP->isCurrentLexer(this)) {
@@ -1857,7 +1857,7 @@
         }
         return PP->Lex(Result);
       }
-      
+
       Kind = tok::hash;
     }
     break;
@@ -1869,7 +1869,7 @@
     else
       Kind = tok::unknown;
     break;
-    
+
   case '\\':
     // FIXME: UCN's.
     // FALL THROUGH.
@@ -1877,7 +1877,7 @@
     Kind = tok::unknown;
     break;
   }
-  
+
   // Notify MIOpt that we read a non-whitespace/non-comment token.
   MIOpt.ReadToken();
 

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Wed Sep  9 10:08:12 2009
@@ -44,7 +44,7 @@
   switch (ResultChar) {
   // These map to themselves.
   case '\\': case '\'': case '"': case '?': break;
-    
+
     // These have fixed mappings.
   case 'a':
     // TODO: K&R: the meaning of '\\a' is different in traditional C
@@ -83,7 +83,7 @@
       HadError = 1;
       break;
     }
-    
+
     // Hex escapes are a maximal series of hex digits.
     bool Overflow = false;
     for (; ThisTokBuf != ThisTokEnd; ++ThisTokBuf) {
@@ -99,12 +99,12 @@
     unsigned CharWidth = IsWide
                        ? PP.getTargetInfo().getWCharWidth()
                        : PP.getTargetInfo().getCharWidth();
-                       
+
     if (CharWidth != 32 && (ResultChar >> CharWidth) != 0) {
       Overflow = true;
       ResultChar &= ~0U >> (32-CharWidth);
     }
-    
+
     // Check for overflow.
     if (Overflow)   // Too many digits to fit in
       PP.Diag(Loc, diag::warn_hex_escape_too_large);
@@ -125,19 +125,19 @@
       ++NumDigits;
     } while (ThisTokBuf != ThisTokEnd && NumDigits < 3 &&
              ThisTokBuf[0] >= '0' && ThisTokBuf[0] <= '7');
-    
+
     // Check for overflow.  Reject '\777', but not L'\777'.
     unsigned CharWidth = IsWide
                        ? PP.getTargetInfo().getWCharWidth()
                        : PP.getTargetInfo().getCharWidth();
-                       
+
     if (CharWidth != 32 && (ResultChar >> CharWidth) != 0) {
       PP.Diag(Loc, diag::warn_octal_escape_too_large);
       ResultChar &= ~0U >> (32-CharWidth);
     }
     break;
   }
-    
+
     // Otherwise, these are not valid escapes.
   case '(': case '{': case '[': case '%':
     // GCC accepts these as extensions.  We warn about them as such though.
@@ -151,7 +151,7 @@
       PP.Diag(Loc, diag::ext_unknown_escape) << "x"+llvm::utohexstr(ResultChar);
     break;
   }
-  
+
   return ResultChar;
 }
 
@@ -159,16 +159,16 @@
 /// convert the UTF32 to UTF8. This is a subroutine of StringLiteralParser.
 /// When we decide to implement UCN's for character constants and identifiers,
 /// we will likely rework our support for UCN's.
-static void ProcessUCNEscape(const char *&ThisTokBuf, const char *ThisTokEnd, 
-                             char *&ResultBuf, bool &HadError, 
-                             SourceLocation Loc, bool IsWide, Preprocessor &PP) 
+static void ProcessUCNEscape(const char *&ThisTokBuf, const char *ThisTokEnd,
+                             char *&ResultBuf, bool &HadError,
+                             SourceLocation Loc, bool IsWide, Preprocessor &PP)
 {
   // FIXME: Add a warning - UCN's are only valid in C++ & C99.
   // FIXME: Handle wide strings.
-  
+
   // Save the beginning of the string (for error diagnostics).
   const char *ThisTokBegin = ThisTokBuf;
-  
+
   // Skip the '\u' char's.
   ThisTokBuf += 2;
 
@@ -178,7 +178,7 @@
     return;
   }
   typedef uint32_t UTF32;
-  
+
   UTF32 UcnVal = 0;
   unsigned short UcnLen = (ThisTokBuf[-1] == 'u' ? 4 : 8);
   for (; ThisTokBuf != ThisTokEnd && UcnLen; ++ThisTokBuf, UcnLen--) {
@@ -194,10 +194,10 @@
     HadError = 1;
     return;
   }
-  // Check UCN constraints (C99 6.4.3p2). 
+  // Check UCN constraints (C99 6.4.3p2).
   if ((UcnVal < 0xa0 &&
       (UcnVal != 0x24 && UcnVal != 0x40 && UcnVal != 0x60 )) // $, @, `
-      || (UcnVal >= 0xD800 && UcnVal <= 0xDFFF) 
+      || (UcnVal >= 0xD800 && UcnVal <= 0xDFFF)
       || (UcnVal > 0x10FFFF)) /* the maximum legal UTF32 value */ {
     PP.Diag(Loc, diag::err_ucn_escape_invalid);
     HadError = 1;
@@ -206,7 +206,7 @@
   // Now that we've parsed/checked the UCN, we convert from UTF32->UTF8.
   // The conversion below was inspired by:
   //   http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c
-  // First, we determine how many bytes the result will require. 
+  // First, we determine how many bytes the result will require.
   typedef uint8_t UTF8;
 
   unsigned short bytesToWrite = 0;
@@ -218,13 +218,13 @@
     bytesToWrite = 3;
   else
     bytesToWrite = 4;
-	
+
   const unsigned byteMask = 0xBF;
   const unsigned byteMark = 0x80;
-  
+
   // Once the bits are split out into bytes of UTF8, this is a mask OR-ed
   // into the first byte, depending on how many bytes follow.
-  static const UTF8 firstByteMark[5] = { 
+  static const UTF8 firstByteMark[5] = {
     0x00, 0x00, 0xC0, 0xE0, 0xF0
   };
   // Finally, we write the bytes into ResultBuf.
@@ -244,13 +244,13 @@
 ///         decimal-constant integer-suffix
 ///         octal-constant integer-suffix
 ///         hexadecimal-constant integer-suffix
-///       decimal-constant: 
+///       decimal-constant:
 ///         nonzero-digit
 ///         decimal-constant digit
-///       octal-constant: 
+///       octal-constant:
 ///         0
 ///         octal-constant octal-digit
-///       hexadecimal-constant: 
+///       hexadecimal-constant:
 ///         hexadecimal-prefix hexadecimal-digit
 ///         hexadecimal-constant hexadecimal-digit
 ///       hexadecimal-prefix: one of
@@ -272,7 +272,7 @@
 ///         u U
 ///       long-suffix: one of
 ///         l L
-///       long-long-suffix: one of 
+///       long-long-suffix: one of
 ///         ll LL
 ///
 ///       floating-constant: [C99 6.4.4.2]
@@ -282,14 +282,14 @@
 NumericLiteralParser(const char *begin, const char *end,
                      SourceLocation TokLoc, Preprocessor &pp)
   : PP(pp), ThisTokBegin(begin), ThisTokEnd(end) {
-    
+
   // This routine assumes that the range begin/end matches the regex for integer
   // and FP constants (specifically, the 'pp-number' regex), and assumes that
   // the byte at "*end" is both valid and not part of the regex.  Because of
   // this, it doesn't have to check for 'overscan' in various places.
   assert(!isalnum(*end) && *end != '.' && *end != '_' &&
          "Lexer didn't maximally munch?");
-    
+
   s = DigitsBegin = begin;
   saw_exponent = false;
   saw_period = false;
@@ -299,7 +299,7 @@
   isFloat = false;
   isImaginary = false;
   hadError = false;
-  
+
   if (*s == '0') { // parse radix
     ParseNumberStartingWithZero(TokLoc);
     if (hadError)
@@ -318,7 +318,7 @@
       s++;
       saw_period = true;
       s = SkipDigits(s);
-    } 
+    }
     if ((*s == 'e' || *s == 'E')) { // exponent
       const char *Exponent = s;
       s++;
@@ -337,11 +337,11 @@
   }
 
   SuffixBegin = s;
-  
+
   // Parse the suffix.  At this point we can classify whether we have an FP or
   // integer constant.
   bool isFPConstant = isFloatingLiteral();
-  
+
   // Loop over all of the characters of the suffix.  If we see something bad,
   // we break out of the loop.
   for (; s != ThisTokEnd; ++s) {
@@ -362,7 +362,7 @@
     case 'L':
       if (isLong || isLongLong) break;  // Cannot be repeated.
       if (isFloat) break;               // LF invalid.
-      
+
       // Check for long long.  The L's need to be adjacent and the same case.
       if (s+1 != ThisTokEnd && s[1] == s[0]) {
         if (isFPConstant) break;        // long long invalid for floats.
@@ -377,7 +377,7 @@
         // Allow i8, i16, i32, i64, and i128.
         if (++s == ThisTokEnd) break;
         switch (*s) {
-          case '8': 
+          case '8':
             s++; // i8 suffix
             break;
           case '1':
@@ -414,7 +414,7 @@
     // If we reached here, there was an error.
     break;
   }
-  
+
   // Report an error if there are any.
   if (s != ThisTokEnd) {
     PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin),
@@ -429,12 +429,12 @@
 /// ParseNumberStartingWithZero - This method is called when the first character
 /// of the number is found to be a zero.  This means it is either an octal
 /// number (like '04') or a hex number ('0x123a') a binary number ('0b1010') or
-/// a floating point number (01239.123e4).  Eat the prefix, determining the 
+/// a floating point number (01239.123e4).  Eat the prefix, determining the
 /// radix etc.
 void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
   assert(s[0] == '0' && "Invalid method call");
   s++;
-  
+
   // Handle a hex number like 0x1234.
   if ((*s == 'x' || *s == 'X') && (isxdigit(s[1]) || s[1] == '.')) {
     s++;
@@ -449,7 +449,7 @@
       s = SkipHexDigits(s);
     }
     // A binary exponent can appear with or with a '.'. If dotted, the
-    // binary exponent is required. 
+    // binary exponent is required.
     if (*s == 'p' || *s == 'P') {
       const char *Exponent = s;
       s++;
@@ -463,7 +463,7 @@
         return;
       }
       s = first_non_digit;
-      
+
       if (!PP.getLangOptions().HexFloats)
         PP.Diag(TokLoc, diag::ext_hexconstant_invalid);
     } else if (saw_period) {
@@ -473,7 +473,7 @@
     }
     return;
   }
-  
+
   // Handle simple binary numbers 0b01010
   if (*s == 'b' || *s == 'B') {
     // 0b101010 is a GCC extension.
@@ -492,16 +492,16 @@
     // Other suffixes will be diagnosed by the caller.
     return;
   }
-  
+
   // For now, the radix is set to 8. If we discover that we have a
   // floating point constant, the radix will change to 10. Octal floating
-  // point constants are not permitted (only decimal and hexadecimal). 
+  // point constants are not permitted (only decimal and hexadecimal).
   radix = 8;
   DigitsBegin = s;
   s = SkipOctalDigits(s);
   if (s == ThisTokEnd)
     return; // Done, simple octal number like 01234
-  
+
   // If we have some other non-octal digit that *is* a decimal digit, see if
   // this is part of a floating point number like 094.123 or 09e1.
   if (isdigit(*s)) {
@@ -511,7 +511,7 @@
       radix = 10;
     }
   }
-  
+
   // If we have a hex digit other than 'e' (which denotes a FP exponent) then
   // the code is using an incorrect base.
   if (isxdigit(*s) && *s != 'e' && *s != 'E') {
@@ -520,7 +520,7 @@
     hadError = true;
     return;
   }
-  
+
   if (*s == '.') {
     s++;
     radix = 10;
@@ -537,7 +537,7 @@
     if (first_non_digit != s) {
       s = first_non_digit;
     } else {
-      PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-ThisTokBegin), 
+      PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-ThisTokBegin),
               diag::err_exponent_has_no_digits);
       hadError = true;
       return;
@@ -557,7 +557,7 @@
   // handles the common cases that matter (small decimal integers and
   // hex/octal values which don't overflow).
   unsigned MaxBitsPerDigit = 1;
-  while ((1U << MaxBitsPerDigit) < radix) 
+  while ((1U << MaxBitsPerDigit) < radix)
     MaxBitsPerDigit += 1;
   if ((SuffixBegin - DigitsBegin) * MaxBitsPerDigit <= 64) {
     uint64_t N = 0;
@@ -576,16 +576,16 @@
   llvm::APInt RadixVal(Val.getBitWidth(), radix);
   llvm::APInt CharVal(Val.getBitWidth(), 0);
   llvm::APInt OldVal = Val;
-  
+
   bool OverflowOccurred = false;
   while (s < SuffixBegin) {
     unsigned C = HexDigitValue(*s++);
-    
+
     // If this letter is out of bound for this radix, reject it.
     assert(C < radix && "NumericLiteralParser ctor should have rejected this");
-    
+
     CharVal = C;
-    
+
     // Add the digit to the value in the appropriate radix.  If adding in digits
     // made the value smaller, then this overflowed.
     OldVal = Val;
@@ -606,23 +606,23 @@
 GetFloatValue(const llvm::fltSemantics &Format, bool* isExact) {
   using llvm::APFloat;
   using llvm::StringRef;
-  
+
   llvm::SmallVector<char,256> floatChars;
   unsigned n = std::min(SuffixBegin - ThisTokBegin, ThisTokEnd - ThisTokBegin);
   for (unsigned i = 0; i != n; ++i)
     floatChars.push_back(ThisTokBegin[i]);
-  
+
   floatChars.push_back('\0');
-  
+
   APFloat V (Format, APFloat::fcZero, false);
   APFloat::opStatus status;
-  
+
   status = V.convertFromString(StringRef(&floatChars[0], n),
                                APFloat::rmNearestTiesToEven);
-  
+
   if (isExact)
     *isExact = status == APFloat::opOK;
-  
+
   return V;
 }
 
@@ -631,16 +631,16 @@
                                      SourceLocation Loc, Preprocessor &PP) {
   // At this point we know that the character matches the regex "L?'.*'".
   HadError = false;
-  
+
   // Determine if this is a wide character.
   IsWide = begin[0] == 'L';
   if (IsWide) ++begin;
-  
+
   // Skip over the entry quote.
   assert(begin[0] == '\'' && "Invalid token lexed");
   ++begin;
 
-  // FIXME: The "Value" is an uint64_t so we can handle char literals of 
+  // FIXME: The "Value" is an uint64_t so we can handle char literals of
   // upto 64-bits.
   // FIXME: This extensively assumes that 'char' is 8-bits.
   assert(PP.getTargetInfo().getCharWidth() == 8 &&
@@ -651,9 +651,9 @@
   assert(PP.getTargetInfo().getWCharWidth() <= 64 &&
          "Assumes sizeof(wchar) on target is <= 64");
 
-  // This is what we will use for overflow detection 
+  // This is what we will use for overflow detection
   llvm::APInt LitVal(PP.getTargetInfo().getIntWidth(), 0);
-  
+
   unsigned NumCharsSoFar = 0;
   while (begin[0] != '\'') {
     uint64_t ResultChar;
@@ -676,7 +676,7 @@
         LitVal <<= 8;
       }
     }
-    
+
     LitVal = LitVal + ResultChar;
     ++NumCharsSoFar;
   }
@@ -697,7 +697,7 @@
 
   // Transfer the value from APInt to uint64_t
   Value = LitVal.getZExtValue();
-  
+
   // If this is a single narrow character, sign extend it (e.g. '\xFF' is "-1")
   // if 'char' is signed for this target (C99 6.4.4.4p10).  Note that multiple
   // character constants are not sign extended in the this implementation:
@@ -752,7 +752,7 @@
   MaxTokenLength = StringToks[0].getLength();
   SizeBound = StringToks[0].getLength()-2;  // -2 for "".
   AnyWide = StringToks[0].is(tok::wide_string_literal);
-  
+
   hadError = false;
 
   // Implement Translation Phase #6: concatenation of string literals
@@ -761,20 +761,20 @@
     // The string could be shorter than this if it needs cleaning, but this is a
     // reasonable bound, which is all we need.
     SizeBound += StringToks[i].getLength()-2;  // -2 for "".
-    
+
     // Remember maximum string piece length.
-    if (StringToks[i].getLength() > MaxTokenLength) 
+    if (StringToks[i].getLength() > MaxTokenLength)
       MaxTokenLength = StringToks[i].getLength();
-    
+
     // Remember if we see any wide strings.
     AnyWide |= StringToks[i].is(tok::wide_string_literal);
   }
 
   // Include space for the null terminator.
   ++SizeBound;
-  
+
   // TODO: K&R warning: "traditional C rejects string constant concatenation"
-  
+
   // Get the width in bytes of wchar_t.  If no wchar_t strings are used, do not
   // query the target.  As such, wchar_tByteWidth is only valid if AnyWide=true.
   wchar_tByteWidth = ~0U;
@@ -783,25 +783,25 @@
     assert((wchar_tByteWidth & 7) == 0 && "Assumes wchar_t is byte multiple!");
     wchar_tByteWidth /= 8;
   }
-  
+
   // The output buffer size needs to be large enough to hold wide characters.
   // This is a worst-case assumption which basically corresponds to L"" "long".
   if (AnyWide)
     SizeBound *= wchar_tByteWidth;
-  
+
   // Size the temporary buffer to hold the result string data.
   ResultBuf.resize(SizeBound);
-  
+
   // Likewise, but for each string piece.
   llvm::SmallString<512> TokenBuf;
   TokenBuf.resize(MaxTokenLength);
-  
+
   // Loop over all the strings, getting their spelling, and expanding them to
   // wide strings as appropriate.
   ResultPtr = &ResultBuf[0];   // Next byte to fill in.
-  
+
   Pascal = false;
-  
+
   for (unsigned i = 0, e = NumStringToks; i != e; ++i) {
     const char *ThisTokBuf = &TokenBuf[0];
     // Get the spelling of the token, which eliminates trigraphs, etc.  We know
@@ -809,23 +809,23 @@
     // and 'spelled' tokens can only shrink.
     unsigned ThisTokLen = PP.getSpelling(StringToks[i], ThisTokBuf);
     const char *ThisTokEnd = ThisTokBuf+ThisTokLen-1;  // Skip end quote.
-    
+
     // TODO: Input character set mapping support.
-    
+
     // Skip L marker for wide strings.
     bool ThisIsWide = false;
     if (ThisTokBuf[0] == 'L') {
       ++ThisTokBuf;
       ThisIsWide = true;
     }
-    
+
     assert(ThisTokBuf[0] == '"' && "Expected quote, lexer broken?");
     ++ThisTokBuf;
-    
+
     // Check if this is a pascal string
     if (pp.getLangOptions().PascalStrings && ThisTokBuf + 1 != ThisTokEnd &&
         ThisTokBuf[0] == '\\' && ThisTokBuf[1] == 'p') {
-      
+
       // If the \p sequence is found in the first token, we have a pascal string
       // Otherwise, if we already have a pascal string, ignore the first \p
       if (i == 0) {
@@ -834,7 +834,7 @@
       } else if (Pascal)
         ThisTokBuf += 2;
     }
-      
+
     while (ThisTokBuf != ThisTokEnd) {
       // Is this a span of non-escape characters?
       if (ThisTokBuf[0] != '\\') {
@@ -842,7 +842,7 @@
         do {
           ++ThisTokBuf;
         } while (ThisTokBuf != ThisTokEnd && ThisTokBuf[0] != '\\');
-        
+
         // Copy the character span over.
         unsigned Len = ThisTokBuf-InStart;
         if (!AnyWide) {
@@ -861,7 +861,7 @@
       }
       // Is this a Universal Character Name escape?
       if (ThisTokBuf[1] == 'u' || ThisTokBuf[1] == 'U') {
-        ProcessUCNEscape(ThisTokBuf, ThisTokEnd, ResultPtr, 
+        ProcessUCNEscape(ThisTokBuf, ThisTokEnd, ResultPtr,
                          hadError, StringToks[i].getLocation(), ThisIsWide, PP);
         continue;
       }
@@ -869,17 +869,17 @@
       unsigned ResultChar = ProcessCharEscape(ThisTokBuf, ThisTokEnd, hadError,
                                               StringToks[i].getLocation(),
                                               ThisIsWide, PP);
-      
+
       // Note: our internal rep of wide char tokens is always little-endian.
       *ResultPtr++ = ResultChar & 0xFF;
-      
+
       if (AnyWide) {
         for (unsigned i = 1, e = wchar_tByteWidth; i != e; ++i)
           *ResultPtr++ = ResultChar >> i*8;
       }
     }
   }
-  
+
   if (Pascal) {
     ResultBuf[0] = ResultPtr-&ResultBuf[0]-1;
 
@@ -904,31 +904,31 @@
   // Get the spelling of the token.
   llvm::SmallString<16> SpellingBuffer;
   SpellingBuffer.resize(Tok.getLength());
-  
+
   const char *SpellingPtr = &SpellingBuffer[0];
   unsigned TokLen = PP.getSpelling(Tok, SpellingPtr);
 
   assert(SpellingPtr[0] != 'L' && "Doesn't handle wide strings yet");
 
-  
+
   const char *SpellingStart = SpellingPtr;
   const char *SpellingEnd = SpellingPtr+TokLen;
 
   // Skip over the leading quote.
   assert(SpellingPtr[0] == '"' && "Should be a string literal!");
   ++SpellingPtr;
-  
+
   // Skip over bytes until we find the offset we're looking for.
   while (ByteNo) {
     assert(SpellingPtr < SpellingEnd && "Didn't find byte offset!");
-    
+
     // Step over non-escapes simply.
     if (*SpellingPtr != '\\') {
       ++SpellingPtr;
       --ByteNo;
       continue;
     }
-    
+
     // Otherwise, this is an escape character.  Advance over it.
     bool HadError = false;
     ProcessCharEscape(SpellingPtr, SpellingEnd, HadError,
@@ -936,6 +936,6 @@
     assert(!HadError && "This method isn't valid on erroneous strings");
     --ByteNo;
   }
-  
+
   return SpellingPtr-SpellingStart;
 }

Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
+++ cfe/trunk/lib/Lex/MacroArgs.cpp Wed Sep  9 10:08:12 2009
@@ -23,18 +23,18 @@
                              unsigned NumToks, bool VarargsElided) {
   assert(MI->isFunctionLike() &&
          "Can't have args for an object-like macro!");
-  
+
   // Allocate memory for the MacroArgs object with the lexer tokens at the end.
   MacroArgs *Result = (MacroArgs*)malloc(sizeof(MacroArgs) +
                                          NumToks*sizeof(Token));
   // Construct the macroargs object.
   new (Result) MacroArgs(NumToks, VarargsElided);
-  
+
   // Copy the actual unexpanded tokens to immediately after the result ptr.
   if (NumToks)
     memcpy(const_cast<Token*>(Result->getUnexpArgument(0)),
            UnexpArgTokens, NumToks*sizeof(Token));
-  
+
   return Result;
 }
 
@@ -98,7 +98,7 @@
 const std::vector<Token> &
 MacroArgs::getPreExpArgument(unsigned Arg, Preprocessor &PP) {
   assert(Arg < NumUnexpArgTokens && "Invalid argument number!");
-  
+
   // If we have already computed this, return it.
   if (PreExpArgTokens.empty())
     PreExpArgTokens.resize(NumUnexpArgTokens);
@@ -108,12 +108,12 @@
 
   const Token *AT = getUnexpArgument(Arg);
   unsigned NumToks = getArgLength(AT)+1;  // Include the EOF.
-  
+
   // Otherwise, we have to pre-expand this argument, populating Result.  To do
   // this, we set up a fake TokenLexer to lex from the unexpanded argument
   // list.  With this installed, we lex expanded tokens until we hit the EOF
   // token at the end of the unexp list.
-  PP.EnterTokenStream(AT, NumToks, false /*disable expand*/, 
+  PP.EnterTokenStream(AT, NumToks, false /*disable expand*/,
                       false /*owns tokens*/);
 
   // Lex all of the macro-expanded tokens into Result.
@@ -122,7 +122,7 @@
     Token &Tok = Result.back();
     PP.Lex(Tok);
   } while (Result.back().isNot(tok::eof));
-  
+
   // Pop the token stream off the top of the stack.  We know that the internal
   // pointer inside of it is to the "end" of the token stream, but the stack
   // will not otherwise be popped until the next token is lexed.  The problem is
@@ -145,18 +145,18 @@
   Tok.setKind(tok::string_literal);
 
   const Token *ArgTokStart = ArgToks;
-  
+
   // Stringify all the tokens.
   llvm::SmallString<128> Result;
   Result += "\"";
-  
+
   bool isFirst = true;
   for (; ArgToks->isNot(tok::eof); ++ArgToks) {
     const Token &Tok = *ArgToks;
     if (!isFirst && (Tok.hasLeadingSpace() || Tok.isAtStartOfLine()))
       Result += ' ';
     isFirst = false;
-    
+
     // If this is a string or character constant, escape the token as specified
     // by 6.10.3.2p2.
     if (Tok.is(tok::string_literal) ||       // "foo"
@@ -171,18 +171,18 @@
       Result.resize(CurStrLen+Tok.getLength());
       const char *BufPtr = &Result[CurStrLen];
       unsigned ActualTokLen = PP.getSpelling(Tok, BufPtr);
-      
+
       // If getSpelling returned a pointer to an already uniqued version of the
       // string instead of filling in BufPtr, memcpy it onto our string.
       if (BufPtr != &Result[CurStrLen])
         memcpy(&Result[CurStrLen], BufPtr, ActualTokLen);
-      
+
       // If the token was dirty, the spelling may be shorter than the token.
       if (ActualTokLen != Tok.getLength())
         Result.resize(CurStrLen+ActualTokLen);
     }
   }
-  
+
   // If the last character of the string is a \, and if it isn't escaped, this
   // is an invalid string literal, diagnose it as specified in C99.
   if (Result.back() == '\\') {
@@ -199,27 +199,27 @@
     }
   }
   Result += '"';
-  
+
   // If this is the charify operation and the result is not a legal character
   // constant, diagnose it.
   if (Charify) {
     // First step, turn double quotes into single quotes:
     Result[0] = '\'';
     Result[Result.size()-1] = '\'';
-    
+
     // Check for bogus character.
     bool isBad = false;
     if (Result.size() == 3)
       isBad = Result[1] == '\'';   // ''' is not legal. '\' already fixed above.
     else
       isBad = (Result.size() != 4 || Result[1] != '\\');  // Not '\x'
-    
+
     if (isBad) {
       PP.Diag(ArgTokStart[0], diag::err_invalid_character_to_charify);
       Result = "' '";  // Use something arbitrary, but legal.
     }
   }
-  
+
   PP.CreateString(&Result[0], Result.size(), Tok);
   return Tok;
 }

Modified: cfe/trunk/lib/Lex/MacroArgs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/MacroArgs.h (original)
+++ cfe/trunk/lib/Lex/MacroArgs.h Wed Sep  9 10:08:12 2009
@@ -20,7 +20,7 @@
   class MacroInfo;
   class Preprocessor;
   class Token;
-  
+
 /// MacroArgs - An instance of this class captures information about
 /// the formal arguments specified to a function-like macro invocation.
 class MacroArgs {
@@ -45,7 +45,7 @@
   /// if in strict mode and the C99 varargs macro had only a ... argument, this
   /// is false.
   bool VarargsElided;
-  
+
   MacroArgs(unsigned NumToks, bool varargsElided)
     : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided) {}
   ~MacroArgs() {}
@@ -55,46 +55,46 @@
   static MacroArgs *create(const MacroInfo *MI,
                            const Token *UnexpArgTokens,
                            unsigned NumArgTokens, bool VarargsElided);
-  
+
   /// destroy - Destroy and deallocate the memory for this object.
   ///
   void destroy();
-  
+
   /// ArgNeedsPreexpansion - If we can prove that the argument won't be affected
   /// by pre-expansion, return false.  Otherwise, conservatively return true.
   bool ArgNeedsPreexpansion(const Token *ArgTok, Preprocessor &PP) const;
-  
+
   /// getUnexpArgument - Return a pointer to the first token of the unexpanded
   /// token list for the specified formal.
   ///
   const Token *getUnexpArgument(unsigned Arg) const;
-  
+
   /// getArgLength - Given a pointer to an expanded or unexpanded argument,
   /// return the number of tokens, not counting the EOF, that make up the
   /// argument.
   static unsigned getArgLength(const Token *ArgPtr);
-  
+
   /// getPreExpArgument - Return the pre-expanded form of the specified
   /// argument.
   const std::vector<Token> &
-    getPreExpArgument(unsigned Arg, Preprocessor &PP);  
-  
+    getPreExpArgument(unsigned Arg, Preprocessor &PP);
+
   /// getStringifiedArgument - Compute, cache, and return the specified argument
   /// that has been 'stringified' as required by the # operator.
   const Token &getStringifiedArgument(unsigned ArgNo, Preprocessor &PP);
-  
+
   /// getNumArguments - Return the number of arguments passed into this macro
   /// invocation.
   unsigned getNumArguments() const { return NumUnexpArgTokens; }
-  
-  
+
+
   /// isVarargsElidedUse - Return true if this is a C99 style varargs macro
   /// invocation and there was no argument specified for the "..." argument.  If
   /// the argument was specified (even empty) or this isn't a C99 style varargs
   /// function, or if in strict mode and the C99 varargs macro had only a ...
   /// argument, this returns false.
   bool isVarargsElidedUse() const { return VarargsElided; }
-  
+
   /// StringifyArgument - Implement C99 6.10.3.2p2, converting a sequence of
   /// tokens into the literal string token that should be produced by the C #
   /// preprocessor operator.  If Charify is true, then it should be turned into

Modified: cfe/trunk/lib/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroInfo.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/MacroInfo.cpp (original)
+++ cfe/trunk/lib/Lex/MacroInfo.cpp Wed Sep  9 10:08:12 2009
@@ -22,7 +22,7 @@
   IsBuiltinMacro = false;
   IsDisabled = false;
   IsUsed = true;
-  
+
   ArgumentList = 0;
   NumArguments = 0;
 }
@@ -44,32 +44,32 @@
   for (arg_iterator I = arg_begin(), OI = Other.arg_begin(), E = arg_end();
        I != E; ++I, ++OI)
     if (*I != *OI) return false;
-       
+
   // Check all the tokens.
   for (unsigned i = 0, e = ReplacementTokens.size(); i != e; ++i) {
     const Token &A = ReplacementTokens[i];
     const Token &B = Other.ReplacementTokens[i];
     if (A.getKind() != B.getKind())
       return false;
-    
+
     // If this isn't the first first token, check that the whitespace and
     // start-of-line characteristics match.
     if (i != 0 &&
         (A.isAtStartOfLine() != B.isAtStartOfLine() ||
          A.hasLeadingSpace() != B.hasLeadingSpace()))
       return false;
-    
+
     // If this is an identifier, it is easy.
     if (A.getIdentifierInfo() || B.getIdentifierInfo()) {
       if (A.getIdentifierInfo() != B.getIdentifierInfo())
         return false;
       continue;
     }
-    
+
     // Otherwise, check the spelling.
     if (PP.getSpelling(A) != PP.getSpelling(B))
       return false;
   }
-  
+
   return true;
 }

Modified: cfe/trunk/lib/Lex/PPCaching.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPCaching.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPCaching.cpp (original)
+++ cfe/trunk/lib/Lex/PPCaching.cpp Wed Sep  9 10:08:12 2009
@@ -36,7 +36,7 @@
 }
 
 /// Backtrack - Make Preprocessor re-lex the tokens that were lexed since
-/// EnableBacktrackAtThisPos() was previously called. 
+/// EnableBacktrackAtThisPos() was previously called.
 void Preprocessor::Backtrack() {
   assert(!BacktrackPositions.empty()
          && "EnableBacktrackAtThisPos was not called!");

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Wed Sep  9 10:08:12 2009
@@ -26,7 +26,7 @@
 
 MacroInfo *Preprocessor::AllocateMacroInfo(SourceLocation L) {
   MacroInfo *MI;
-  
+
   if (!MICache.empty()) {
     MI = MICache.back();
     MICache.pop_back();
@@ -61,13 +61,13 @@
 void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) {
   // Read the token, don't allow macro expansion on it.
   LexUnexpandedToken(MacroNameTok);
-  
+
   // Missing macro name?
   if (MacroNameTok.is(tok::eom)) {
     Diag(MacroNameTok, diag::err_pp_missing_macro_name);
     return;
   }
-  
+
   IdentifierInfo *II = MacroNameTok.getIdentifierInfo();
   if (II == 0) {
     std::string Spelling = getSpelling(MacroNameTok);
@@ -93,7 +93,7 @@
     // Okay, we got a good identifier node.  Return it.
     return;
   }
-  
+
   // Invalid macro name, read and discard the rest of the line.  Then set the
   // token kind to tok::eom.
   MacroNameTok.setKind(tok::eom);
@@ -112,12 +112,12 @@
     Lex(Tmp);
   else
     LexUnexpandedToken(Tmp);
-  
+
   // There should be no tokens after the directive, but we allow them as an
   // extension.
   while (Tmp.is(tok::comment))  // Skip comments in -C mode.
     LexUnexpandedToken(Tmp);
-  
+
   if (Tmp.isNot(tok::eom)) {
     // Add a fixit in GNU/C99/C++ mode.  Don't offer a fixit for strict-C89,
     // because it is more trouble than it is worth to insert /**/ and check that
@@ -148,12 +148,12 @@
 
   CurPPLexer->pushConditionalLevel(IfTokenLoc, /*isSkipping*/false,
                                  FoundNonSkipPortion, FoundElse);
-  
+
   if (CurPTHLexer) {
     PTHSkipExcludedConditionalBlock();
     return;
   }
-  
+
   // Enter raw mode to disable identifier lookup (and thus macro expansion),
   // disabling warnings, etc.
   CurPPLexer->LexingRawMode = true;
@@ -163,7 +163,7 @@
       CurLexer->Lex(Tok);
     else
       CurPTHLexer->Lex(Tok);
-    
+
     // If this is the end of the buffer, we have an error.
     if (Tok.is(tok::eof)) {
       // Emit errors for each unterminated conditional on the stack, including
@@ -172,26 +172,26 @@
         Diag(CurPPLexer->ConditionalStack.back().IfLoc,
              diag::err_pp_unterminated_conditional);
         CurPPLexer->ConditionalStack.pop_back();
-      }  
-      
+      }
+
       // Just return and let the caller lex after this #include.
       break;
     }
-    
+
     // If this token is not a preprocessor directive, just skip it.
     if (Tok.isNot(tok::hash) || !Tok.isAtStartOfLine())
       continue;
-      
+
     // We just parsed a # character at the start of a line, so we're in
     // directive mode.  Tell the lexer this so any newlines we see will be
     // converted into an EOM token (this terminates the macro).
     CurPPLexer->ParsingPreprocessorDirective = true;
     if (CurLexer) CurLexer->SetCommentRetentionState(false);
 
-    
+
     // Read the next token, the directive flavor.
     LexUnexpandedToken(Tok);
-    
+
     // If this isn't an identifier directive (e.g. is "# 1\n" or "#\n", or
     // something bogus), skip it.
     if (Tok.isNot(tok::identifier)) {
@@ -208,14 +208,14 @@
     // other common directives.
     const char *RawCharData = SourceMgr.getCharacterData(Tok.getLocation());
     char FirstChar = RawCharData[0];
-    if (FirstChar >= 'a' && FirstChar <= 'z' && 
+    if (FirstChar >= 'a' && FirstChar <= 'z' &&
         FirstChar != 'i' && FirstChar != 'e') {
       CurPPLexer->ParsingPreprocessorDirective = false;
       // Restore comment saving mode.
       if (CurLexer) CurLexer->SetCommentRetentionState(KeepComments);
       continue;
     }
-    
+
     // Get the identifier name without trigraphs or embedded newlines.  Note
     // that we can't use Tok.getIdentifierInfo() because its lookup is disabled
     // when skipping.
@@ -240,7 +240,7 @@
       Directive[IdLen] = 0;
       FirstChar = Directive[0];
     }
-    
+
     if (FirstChar == 'i' && Directive[1] == 'f') {
       if ((IdLen == 2) ||   // "if"
           (IdLen == 5 && !strcmp(Directive+2, "def")) ||   // "ifdef"
@@ -260,7 +260,7 @@
         bool InCond = CurPPLexer->popConditionalLevel(CondInfo);
         InCond = InCond;  // Silence warning in no-asserts mode.
         assert(!InCond && "Can't be skipping if not in a conditional!");
-        
+
         // If we popped the outermost skipping block, we're done skipping!
         if (!CondInfo.WasSkipping)
           break;
@@ -270,13 +270,13 @@
         // as a non-skipping conditional.
         DiscardUntilEndOfDirective();  // C99 6.10p4.
         PPConditionalInfo &CondInfo = CurPPLexer->peekConditionalLevel();
-        
+
         // If this is a #else with a #else before it, report the error.
         if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_else_after_else);
-        
+
         // Note that we've seen a #else in this conditional.
         CondInfo.FoundElse = true;
-        
+
         // If the conditional is at the top level, and the #if block wasn't
         // entered, enter the #else block now.
         if (!CondInfo.WasSkipping && !CondInfo.FoundNonSkip) {
@@ -301,10 +301,10 @@
           ShouldEnter = EvaluateDirectiveExpression(IfNDefMacro);
           CurPPLexer->LexingRawMode = true;
         }
-        
+
         // If this is a #elif with a #else before it, report the error.
         if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_elif_after_else);
-        
+
         // If this condition is true, enter it!
         if (ShouldEnter) {
           CondInfo.FoundNonSkip = true;
@@ -312,7 +312,7 @@
         }
       }
     }
-    
+
     CurPPLexer->ParsingPreprocessorDirective = false;
     // Restore comment saving mode.
     if (CurLexer) CurLexer->SetCommentRetentionState(KeepComments);
@@ -325,11 +325,11 @@
 }
 
 void Preprocessor::PTHSkipExcludedConditionalBlock() {
-  
-  while(1) {
+
+  while (1) {
     assert(CurPTHLexer);
     assert(CurPTHLexer->LexingRawMode == false);
-           
+
     // Skip to the next '#else', '#elif', or #endif.
     if (CurPTHLexer->SkipBlock()) {
       // We have reached an #endif.  Both the '#' and 'endif' tokens
@@ -340,12 +340,12 @@
       assert(!InCond && "Can't be skipping if not in a conditional!");
       break;
     }
-      
+
     // We have reached a '#else' or '#elif'.  Lex the next token to get
     // the directive flavor.
     Token Tok;
     LexUnexpandedToken(Tok);
-                      
+
     // We can actually look up the IdentifierInfo here since we aren't in
     // raw mode.
     tok::PPKeywordKind K = Tok.getIdentifierInfo()->getPPKeywordID();
@@ -357,32 +357,32 @@
       PPConditionalInfo &CondInfo = CurPTHLexer->peekConditionalLevel();
       // Note that we've seen a #else in this conditional.
       CondInfo.FoundElse = true;
-      
+
       // If the #if block wasn't entered then enter the #else block now.
       if (!CondInfo.FoundNonSkip) {
         CondInfo.FoundNonSkip = true;
-        
+
         // Scan until the eom token.
         CurPTHLexer->ParsingPreprocessorDirective = true;
         DiscardUntilEndOfDirective();
         CurPTHLexer->ParsingPreprocessorDirective = false;
-        
+
         break;
       }
-      
+
       // Otherwise skip this block.
       continue;
     }
-    
+
     assert(K == tok::pp_elif);
     PPConditionalInfo &CondInfo = CurPTHLexer->peekConditionalLevel();
 
     // If this is a #elif with a #else before it, report the error.
     if (CondInfo.FoundElse)
       Diag(Tok, diag::pp_err_elif_after_else);
-    
+
     // If this is in a skipping block or if we're already handled this #if
-    // block, don't bother parsing the condition.  We just skip this block.    
+    // block, don't bother parsing the condition.  We just skip this block.
     if (CondInfo.FoundNonSkip)
       continue;
 
@@ -417,7 +417,7 @@
   if (!FromDir) {
     FileID FID = getCurrentFileLexer()->getFileID();
     CurFileEnt = SourceMgr.getFileEntryForID(FID);
-    
+
     // If there is no file entry associated with this file, it must be the
     // predefines buffer.  Any other file is not lexed with a normal lexer, so
     // it won't be scanned for preprocessor directives.   If we have the
@@ -429,14 +429,14 @@
       CurFileEnt = SourceMgr.getFileEntryForID(FID);
     }
   }
-  
+
   // Do a standard file entry lookup.
   CurDir = CurDirLookup;
   const FileEntry *FE =
     HeaderInfo.LookupFile(FilenameStart, FilenameEnd,
                           isAngled, FromDir, CurDir, CurFileEnt);
   if (FE) return FE;
-  
+
   // Otherwise, see if this is a subframework header.  If so, this is relative
   // to one of the headers on the #include stack.  Walk the list of the current
   // headers on the #include stack and pass them to HeaderInfo.
@@ -446,18 +446,18 @@
                                                     CurFileEnt)))
         return FE;
   }
-  
+
   for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
     IncludeStackInfo &ISEntry = IncludeMacroStack[e-i-1];
     if (IsFileLexer(ISEntry)) {
-      if ((CurFileEnt = 
+      if ((CurFileEnt =
            SourceMgr.getFileEntryForID(ISEntry.ThePPLexer->getFileID())))
         if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart,
                                                       FilenameEnd, CurFileEnt)))
           return FE;
     }
   }
-  
+
   // Otherwise, we really couldn't find the file.
   return 0;
 }
@@ -468,31 +468,31 @@
 //===----------------------------------------------------------------------===//
 
 /// HandleDirective - This callback is invoked when the lexer sees a # token
-/// at the start of a line.  This consumes the directive, modifies the 
+/// at the start of a line.  This consumes the directive, modifies the
 /// lexer/preprocessor state, and advances the lexer(s) so that the next token
 /// read is the correct one.
 void Preprocessor::HandleDirective(Token &Result) {
   // FIXME: Traditional: # with whitespace before it not recognized by K&R?
-  
+
   // We just parsed a # character at the start of a line, so we're in directive
   // mode.  Tell the lexer this so any newlines we see will be converted into an
   // EOM token (which terminates the directive).
   CurPPLexer->ParsingPreprocessorDirective = true;
-  
+
   ++NumDirectives;
-  
+
   // We are about to read a token.  For the multiple-include optimization FA to
-  // work, we have to remember if we had read any tokens *before* this 
+  // work, we have to remember if we had read any tokens *before* this
   // pp-directive.
   bool ReadAnyTokensBeforeDirective = CurPPLexer->MIOpt.getHasReadAnyTokensVal();
-  
+
   // Save the '#' token in case we need to return it later.
   Token SavedHash = Result;
-  
+
   // Read the next token, the directive flavor.  This isn't expanded due to
   // C99 6.10.3p8.
   LexUnexpandedToken(Result);
-  
+
   // C99 6.10.3p11: Is this preprocessor directive in macro invocation?  e.g.:
   //   #define A(x) #x
   //   A(abc
@@ -501,7 +501,7 @@
   // If so, the user is relying on non-portable behavior, emit a diagnostic.
   if (InMacroArgs)
     Diag(Result, diag::ext_embedded_directive);
-  
+
 TryAgain:
   switch (Result.getKind()) {
   case tok::eom:
@@ -518,7 +518,7 @@
   default:
     IdentifierInfo *II = Result.getIdentifierInfo();
     if (II == 0) break;  // Not an identifier.
-      
+
     // Ask what the preprocessor keyword ID is.
     switch (II->getPPKeywordID()) {
     default: break;
@@ -535,13 +535,13 @@
       return HandleElseDirective(Result);
     case tok::pp_endif:
       return HandleEndifDirective(Result);
-      
+
     // C99 6.10.2 - Source File Inclusion.
     case tok::pp_include:
       return HandleIncludeDirective(Result);       // Handle #include.
     case tok::pp___include_macros:
       return HandleIncludeMacrosDirective(Result); // Handle -imacros.
-        
+
     // C99 6.10.3 - Macro Replacement.
     case tok::pp_define:
       return HandleDefineDirective(Result);
@@ -551,21 +551,21 @@
     // C99 6.10.4 - Line Control.
     case tok::pp_line:
       return HandleLineDirective(Result);
-      
+
     // C99 6.10.5 - Error Directive.
     case tok::pp_error:
       return HandleUserDiagnosticDirective(Result, false);
-      
+
     // C99 6.10.6 - Pragma Directive.
     case tok::pp_pragma:
       return HandlePragmaDirective();
-      
+
     // GNU Extensions.
     case tok::pp_import:
       return HandleImportDirective(Result);
     case tok::pp_include_next:
       return HandleIncludeNextDirective(Result);
-      
+
     case tok::pp_warning:
       Diag(Result, diag::ext_pp_warning_directive);
       return HandleUserDiagnosticDirective(Result, true);
@@ -582,7 +582,7 @@
     }
     break;
   }
-  
+
   // If this is a .S file, treat unknown # directives as non-preprocessor
   // directives.  This is important because # may be a comment or introduce
   // various pseudo-ops.  Just return the # token and push back the following
@@ -590,7 +590,7 @@
   if (getLangOptions().AsmPreprocessor) {
     Token *Toks = new Token[2];
     // Return the # and the token after it.
-    Toks[0] = SavedHash; 
+    Toks[0] = SavedHash;
     Toks[1] = Result;
     // Enter this token stream so that we re-lex the tokens.  Make sure to
     // enable macro expansion, in case the token after the # is an identifier
@@ -598,13 +598,13 @@
     EnterTokenStream(Toks, 2, false, true);
     return;
   }
-  
+
   // If we reached here, the preprocessing token is not valid!
   Diag(Result, diag::err_pp_invalid_directive);
-  
+
   // Read the rest of the PP line.
   DiscardUntilEndOfDirective();
-  
+
   // Okay, we're done parsing the directive.
 }
 
@@ -614,17 +614,17 @@
                          unsigned DiagID, Preprocessor &PP) {
   if (DigitTok.isNot(tok::numeric_constant)) {
     PP.Diag(DigitTok, DiagID);
-    
+
     if (DigitTok.isNot(tok::eom))
       PP.DiscardUntilEndOfDirective();
     return true;
   }
-  
+
   llvm::SmallString<64> IntegerBuffer;
   IntegerBuffer.resize(DigitTok.getLength());
   const char *DigitTokBegin = &IntegerBuffer[0];
   unsigned ActualLength = PP.getSpelling(DigitTok, DigitTokBegin);
-  
+
   // Verify that we have a simple digit-sequence, and compute the value.  This
   // is always a simple digit string computed in decimal, so we do this manually
   // here.
@@ -636,7 +636,7 @@
       PP.DiscardUntilEndOfDirective();
       return true;
     }
-    
+
     unsigned NextVal = Val*10+(DigitTokBegin[i]-'0');
     if (NextVal < Val) { // overflow.
       PP.Diag(DigitTok, DiagID);
@@ -645,21 +645,21 @@
     }
     Val = NextVal;
   }
-  
-  // Reject 0, this is needed both by #line numbers and flags. 
+
+  // Reject 0, this is needed both by #line numbers and flags.
   if (Val == 0) {
     PP.Diag(DigitTok, DiagID);
     PP.DiscardUntilEndOfDirective();
     return true;
   }
-  
+
   if (DigitTokBegin[0] == '0')
     PP.Diag(DigitTok.getLocation(), diag::warn_pp_line_decimal);
-  
+
   return false;
 }
 
-/// HandleLineDirective - Handle #line directive: C99 6.10.4.  The two 
+/// HandleLineDirective - Handle #line directive: C99 6.10.4.  The two
 /// acceptable forms are:
 ///   # line digit-sequence
 ///   # line digit-sequence "s-char-sequence"
@@ -679,14 +679,14 @@
   unsigned LineLimit = Features.C99 ? 2147483648U : 32768U;
   if (LineNo >= LineLimit)
     Diag(DigitTok, diag::ext_pp_line_too_big) << LineLimit;
-  
+
   int FilenameID = -1;
   Token StrTok;
   Lex(StrTok);
 
   // If the StrTok is "eom", then it wasn't present.  Otherwise, it must be a
   // string followed by eom.
-  if (StrTok.is(tok::eom)) 
+  if (StrTok.is(tok::eom))
     ; // ok
   else if (StrTok.isNot(tok::string_literal)) {
     Diag(StrTok, diag::err_pp_line_invalid_filename);
@@ -704,14 +704,14 @@
     }
     FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString(),
                                                   Literal.GetStringLength());
-    
+
     // Verify that there is nothing after the string, other than EOM.  Because
     // of C99 6.10.4p5, macros that expand to empty tokens are ok.
     CheckEndOfDirective("line", true);
   }
-  
+
   SourceMgr.AddLineNote(DigitTok.getLocation(), LineNo, FilenameID);
-  
+
   if (Callbacks)
     Callbacks->FileChanged(DigitTok.getLocation(), PPCallbacks::RenameFile,
                            SrcMgr::C_User);
@@ -731,21 +731,21 @@
 
   if (FlagVal == 1) {
     IsFileEntry = true;
-    
+
     PP.Lex(FlagTok);
     if (FlagTok.is(tok::eom)) return false;
     if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag,PP))
       return true;
   } else if (FlagVal == 2) {
     IsFileExit = true;
-    
+
     SourceManager &SM = PP.getSourceManager();
     // If we are leaving the current presumed file, check to make sure the
     // presumed include stack isn't empty!
     FileID CurFileID =
       SM.getDecomposedInstantiationLoc(FlagTok.getLocation()).first;
     PresumedLoc PLoc = SM.getPresumedLoc(FlagTok.getLocation());
-      
+
     // If there is no include loc (main file) or if the include loc is in a
     // different physical file, then we aren't in a "1" line marker flag region.
     SourceLocation IncLoc = PLoc.getIncludeLoc();
@@ -755,7 +755,7 @@
       PP.DiscardUntilEndOfDirective();
       return true;
     }
-    
+
     PP.Lex(FlagTok);
     if (FlagTok.is(tok::eom)) return false;
     if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag,PP))
@@ -768,9 +768,9 @@
     PP.DiscardUntilEndOfDirective();
     return true;
   }
-  
+
   IsSystemHeader = true;
-  
+
   PP.Lex(FlagTok);
   if (FlagTok.is(tok::eom)) return false;
   if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag, PP))
@@ -782,9 +782,9 @@
     PP.DiscardUntilEndOfDirective();
     return true;
   }
-  
+
   IsExternCHeader = true;
-  
+
   PP.Lex(FlagTok);
   if (FlagTok.is(tok::eom)) return false;
 
@@ -798,7 +798,7 @@
 /// one of the following forms:
 ///
 ///     # 42
-///     # 42 "file" ('1' | '2')? 
+///     # 42 "file" ('1' | '2')?
 ///     # 42 "file" ('1' | '2')? '3' '4'?
 ///
 void Preprocessor::HandleDigitDirective(Token &DigitTok) {
@@ -808,17 +808,17 @@
   if (GetLineValue(DigitTok, LineNo, diag::err_pp_linemarker_requires_integer,
                    *this))
     return;
-  
+
   Token StrTok;
   Lex(StrTok);
-  
+
   bool IsFileEntry = false, IsFileExit = false;
   bool IsSystemHeader = false, IsExternCHeader = false;
   int FilenameID = -1;
 
   // If the StrTok is "eom", then it wasn't present.  Otherwise, it must be a
   // string followed by eom.
-  if (StrTok.is(tok::eom)) 
+  if (StrTok.is(tok::eom))
     ; // ok
   else if (StrTok.isNot(tok::string_literal)) {
     Diag(StrTok, diag::err_pp_linemarker_invalid_filename);
@@ -835,18 +835,18 @@
     }
     FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString(),
                                                   Literal.GetStringLength());
-    
+
     // If a filename was present, read any flags that are present.
-    if (ReadLineMarkerFlags(IsFileEntry, IsFileExit, 
+    if (ReadLineMarkerFlags(IsFileEntry, IsFileExit,
                             IsSystemHeader, IsExternCHeader, *this))
       return;
   }
-  
+
   // Create a line note with this information.
   SourceMgr.AddLineNote(DigitTok.getLocation(), LineNo, FilenameID,
-                        IsFileEntry, IsFileExit, 
+                        IsFileEntry, IsFileExit,
                         IsSystemHeader, IsExternCHeader);
-  
+
   // If the preprocessor has callbacks installed, notify them of the #line
   // change.  This is used so that the line marker comes out in -E mode for
   // example.
@@ -861,7 +861,7 @@
       FileKind = SrcMgr::C_ExternCSystem;
     else if (IsSystemHeader)
       FileKind = SrcMgr::C_System;
-    
+
     Callbacks->FileChanged(DigitTok.getLocation(), Reason, FileKind);
   }
 }
@@ -869,7 +869,7 @@
 
 /// HandleUserDiagnosticDirective - Handle a #warning or #error directive.
 ///
-void Preprocessor::HandleUserDiagnosticDirective(Token &Tok, 
+void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
                                                  bool isWarning) {
   // PTH doesn't emit #warning or #error directives.
   if (CurPTHLexer)
@@ -892,11 +892,11 @@
 void Preprocessor::HandleIdentSCCSDirective(Token &Tok) {
   // Yes, this directive is an extension.
   Diag(Tok, diag::ext_pp_ident_directive);
-  
+
   // Read the string argument.
   Token StrTok;
   Lex(StrTok);
-  
+
   // If the token kind isn't a string, it's a malformed directive.
   if (StrTok.isNot(tok::string_literal) &&
       StrTok.isNot(tok::wide_string_literal)) {
@@ -905,7 +905,7 @@
       DiscardUntilEndOfDirective();
     return;
   }
-  
+
   // Verify that there is nothing after the string, other than EOM.
   CheckEndOfDirective("ident");
 
@@ -928,7 +928,7 @@
                                               const char *&BufEnd) {
   // Get the text form of the filename.
   assert(BufStart != BufEnd && "Can't have tokens with empty spellings!");
-  
+
   // Make sure the filename is <x> or "x".
   bool isAngled;
   if (BufStart[0] == '<') {
@@ -950,14 +950,14 @@
     BufStart = 0;
     return true;
   }
-  
+
   // Diagnose #include "" as invalid.
   if (BufEnd-BufStart <= 2) {
     Diag(Loc, diag::err_pp_empty_filename);
     BufStart = 0;
     return "";
   }
-  
+
   // Skip the brackets.
   ++BufStart;
   --BufEnd;
@@ -977,33 +977,33 @@
 static bool ConcatenateIncludeName(llvm::SmallVector<char, 128> &FilenameBuffer,
                                    Preprocessor &PP) {
   Token CurTok;
-  
+
   PP.Lex(CurTok);
   while (CurTok.isNot(tok::eom)) {
     // Append the spelling of this token to the buffer. If there was a space
     // before it, add it now.
     if (CurTok.hasLeadingSpace())
       FilenameBuffer.push_back(' ');
-    
+
     // Get the spelling of the token, directly into FilenameBuffer if possible.
     unsigned PreAppendSize = FilenameBuffer.size();
     FilenameBuffer.resize(PreAppendSize+CurTok.getLength());
-    
+
     const char *BufPtr = &FilenameBuffer[PreAppendSize];
     unsigned ActualLen = PP.getSpelling(CurTok, BufPtr);
-    
+
     // If the token was spelled somewhere else, copy it into FilenameBuffer.
     if (BufPtr != &FilenameBuffer[PreAppendSize])
       memcpy(&FilenameBuffer[PreAppendSize], BufPtr, ActualLen);
-    
+
     // Resize FilenameBuffer to the correct size.
     if (CurTok.getLength() != ActualLen)
       FilenameBuffer.resize(PreAppendSize+ActualLen);
-    
+
     // If we found the '>' marker, return success.
     if (CurTok.is(tok::greater))
       return false;
-    
+
     PP.Lex(CurTok);
   }
 
@@ -1017,14 +1017,14 @@
 /// file to be included from the lexer, then include it!  This is a common
 /// routine with functionality shared between #include, #include_next and
 /// #import.  LookupFrom is set when this is a #include_next directive, it
-/// specifies the file to start searching from. 
+/// specifies the file to start searching from.
 void Preprocessor::HandleIncludeDirective(Token &IncludeTok,
                                           const DirectoryLookup *LookupFrom,
                                           bool isImport) {
 
   Token FilenameTok;
   CurPPLexer->LexIncludeFilename(FilenameTok);
-  
+
   // Reserve a buffer to get the spelling.
   llvm::SmallVector<char, 128> FilenameBuffer;
   const char *FilenameStart, *FilenameEnd;
@@ -1033,7 +1033,7 @@
   case tok::eom:
     // If the token kind is EOM, the error has already been diagnosed.
     return;
-  
+
   case tok::angle_string_literal:
   case tok::string_literal: {
     FilenameBuffer.resize(FilenameTok.getLength());
@@ -1042,7 +1042,7 @@
     FilenameEnd = FilenameStart+Len;
     break;
   }
-    
+
   case tok::less:
     // This could be a <foo/bar.h> file coming from a macro expansion.  In this
     // case, glue the tokens together into FilenameBuffer and interpret those.
@@ -1057,7 +1057,7 @@
     DiscardUntilEndOfDirective();
     return;
   }
-  
+
   bool isAngled = GetIncludeFilenameSpelling(FilenameTok.getLocation(),
                                              FilenameStart, FilenameEnd);
   // If GetIncludeFilenameSpelling set the start ptr to null, there was an
@@ -1066,7 +1066,7 @@
     DiscardUntilEndOfDirective();
     return;
   }
-  
+
   // Verify that there is nothing after the filename, other than EOM.  Note that
   // we allow macros that expand to nothing after the filename, because this
   // falls into the category of "#include pp-tokens new-line" specified in
@@ -1078,7 +1078,7 @@
     Diag(FilenameTok, diag::err_pp_include_too_deep);
     return;
   }
-  
+
   // Search include directories.
   const DirectoryLookup *CurDir;
   const FileEntry *File = LookupFile(FilenameStart, FilenameEnd,
@@ -1088,19 +1088,19 @@
        << std::string(FilenameStart, FilenameEnd);
     return;
   }
-  
+
   // Ask HeaderInfo if we should enter this #include file.  If not, #including
   // this file will have no effect.
   if (!HeaderInfo.ShouldEnterIncludeFile(File, isImport))
     return;
-  
+
   // The #included file will be considered to be a system header if either it is
   // in a system include directory, or if the #includer is a system include
   // header.
-  SrcMgr::CharacteristicKind FileCharacter = 
+  SrcMgr::CharacteristicKind FileCharacter =
     std::max(HeaderInfo.getFileDirFlavor(File),
              SourceMgr.getFileCharacteristic(FilenameTok.getLocation()));
-  
+
   // Look up the file, create a File ID for it.
   FileID FID = SourceMgr.createFileID(File, FilenameTok.getLocation(),
                                       FileCharacter);
@@ -1118,7 +1118,7 @@
 ///
 void Preprocessor::HandleIncludeNextDirective(Token &IncludeNextTok) {
   Diag(IncludeNextTok, diag::ext_pp_include_next_directive);
-  
+
   // #include_next is like #include, except that we start searching after
   // the current found directory.  If we can't do this, issue a
   // diagnostic.
@@ -1132,7 +1132,7 @@
     // Start looking up in the next directory.
     ++Lookup;
   }
-  
+
   return HandleIncludeDirective(IncludeNextTok, Lookup);
 }
 
@@ -1141,7 +1141,7 @@
 void Preprocessor::HandleImportDirective(Token &ImportTok) {
   if (!Features.ObjC1)  // #import is standard for ObjC.
     Diag(ImportTok, diag::ext_pp_import_directive);
-  
+
   return HandleIncludeDirective(ImportTok, 0, true);
 }
 
@@ -1159,11 +1159,11 @@
     DiscardUntilEndOfDirective();
     return;
   }
-  
+
   // Treat this as a normal #include for checking purposes.  If this is
   // successful, it will push a new lexer onto the include stack.
   HandleIncludeDirective(IncludeMacrosTok, 0, false);
-  
+
   Token TmpTok;
   do {
     Lex(TmpTok);
@@ -1181,7 +1181,7 @@
 /// parsing the arg list.
 bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) {
   llvm::SmallVector<IdentifierInfo*, 32> Arguments;
-  
+
   Token Tok;
   while (1) {
     LexUnexpandedToken(Tok);
@@ -1223,18 +1223,18 @@
 
       // If this is already used as an argument, it is used multiple times (e.g.
       // #define X(A,A.
-      if (std::find(Arguments.begin(), Arguments.end(), II) != 
+      if (std::find(Arguments.begin(), Arguments.end(), II) !=
           Arguments.end()) {  // C99 6.10.3p6
         Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II;
         return true;
       }
-        
+
       // Add the argument to the macro info.
       Arguments.push_back(II);
-      
+
       // Lex the token after the identifier.
       LexUnexpandedToken(Tok);
-      
+
       switch (Tok.getKind()) {
       default:          // #define X(A B
         Diag(Tok, diag::err_pp_expected_comma_in_arg_list);
@@ -1247,14 +1247,14 @@
       case tok::ellipsis:  // #define X(A... -> GCC extension
         // Diagnose extension.
         Diag(Tok, diag::ext_named_variadic_macro);
-        
+
         // Lex the token after the identifier.
         LexUnexpandedToken(Tok);
         if (Tok.isNot(tok::r_paren)) {
           Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
           return true;
         }
-          
+
         MI->setIsGNUVarargs();
         MI->setArgumentList(&Arguments[0], Arguments.size(), BP);
         return false;
@@ -1270,7 +1270,7 @@
 
   Token MacroNameTok;
   ReadMacroName(MacroNameTok, 1);
-  
+
   // Error reading macro name?  If so, diagnostic already issued.
   if (MacroNameTok.is(tok::eom))
     return;
@@ -1280,13 +1280,13 @@
   // If we are supposed to keep comments in #defines, reenable comment saving
   // mode.
   if (CurLexer) CurLexer->SetCommentRetentionState(KeepMacroComments);
-  
+
   // Create the new macro.
   MacroInfo *MI = AllocateMacroInfo(MacroNameTok.getLocation());
-  
+
   Token Tok;
   LexUnexpandedToken(Tok);
-  
+
   // If this is a function-like macro definition, parse the argument list,
   // marking each of the identifiers as being used as macro arguments.  Also,
   // check other constraints on the first token of the macro body.
@@ -1310,13 +1310,13 @@
 
     // If this is a definition of a variadic C99 function-like macro, not using
     // the GNU named varargs extension, enabled __VA_ARGS__.
-    
+
     // "Poison" __VA_ARGS__, which can only appear in the expansion of a macro.
     // This gets unpoisoned where it is allowed.
     assert(Ident__VA_ARGS__->isPoisoned() && "__VA_ARGS__ should be poisoned!");
     if (MI->isC99Varargs())
       Ident__VA_ARGS__->setIsPoisoned(false);
-    
+
     // Read the first token after the arg list for down below.
     LexUnexpandedToken(Tok);
   } else if (Features.C99) {
@@ -1357,7 +1357,7 @@
       // Get the next token of the macro.
       LexUnexpandedToken(Tok);
     }
-    
+
   } else {
     // Otherwise, read the body of a function-like macro.  While we are at it,
     // check C99 6.10.3.2p1: ensure that # operators are followed by macro
@@ -1367,15 +1367,15 @@
 
       if (Tok.isNot(tok::hash)) {
         MI->AddTokenToBody(Tok);
-        
+
         // Get the next token of the macro.
         LexUnexpandedToken(Tok);
         continue;
       }
-      
+
       // Get the next token of the macro.
       LexUnexpandedToken(Tok);
-     
+
       // Check for a valid macro arg identifier.
       if (Tok.getIdentifierInfo() == 0 ||
           MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
@@ -1389,24 +1389,24 @@
         } else {
           Diag(Tok, diag::err_pp_stringize_not_parameter);
           ReleaseMacroInfo(MI);
-          
+
           // Disable __VA_ARGS__ again.
           Ident__VA_ARGS__->setIsPoisoned(true);
           return;
         }
       }
-      
+
       // Things look ok, add the '#' and param name tokens to the macro.
       MI->AddTokenToBody(LastTok);
       MI->AddTokenToBody(Tok);
       LastTok = Tok;
-      
+
       // Get the next token of the macro.
       LexUnexpandedToken(Tok);
     }
   }
-  
-  
+
+
   // Disable __VA_ARGS__ again.
   Ident__VA_ARGS__->setIsPoisoned(true);
 
@@ -1425,14 +1425,14 @@
       return;
     }
   }
-  
+
   // If this is the primary source file, remember that this macro hasn't been
   // used yet.
   if (isInPrimaryFile())
     MI->setIsUsed(false);
 
   MI->setDefinitionEndLoc(LastTok.getLocation());
-  
+
   // Finally, if this identifier already had a macro defined for it, verify that
   // the macro bodies are identical and free the old definition.
   if (MacroInfo *OtherMI = getMacroInfo(MacroNameTok.getIdentifierInfo())) {
@@ -1452,12 +1452,12 @@
         Diag(OtherMI->getDefinitionLoc(), diag::note_previous_definition);
       }
     }
-    
+
     ReleaseMacroInfo(OtherMI);
   }
-  
+
   setMacroInfo(MacroNameTok.getIdentifierInfo(), MI);
-  
+
   // If the callbacks want to know, tell them about the macro definition.
   if (Callbacks)
     Callbacks->MacroDefined(MacroNameTok.getIdentifierInfo(), MI);
@@ -1470,17 +1470,17 @@
 
   Token MacroNameTok;
   ReadMacroName(MacroNameTok, 2);
-  
+
   // Error reading macro name?  If so, diagnostic already issued.
   if (MacroNameTok.is(tok::eom))
     return;
-  
+
   // Check to see if this is the last token on the #undef line.
   CheckEndOfDirective("undef");
-  
+
   // Okay, we finally have a valid identifier to undef.
   MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());
-  
+
   // If the macro is not defined, this is a noop undef, just return.
   if (MI == 0) return;
 
@@ -1513,7 +1513,7 @@
 
   Token MacroNameTok;
   ReadMacroName(MacroNameTok);
-  
+
   // Error reading macro name?  If so, diagnostic already issued.
   if (MacroNameTok.is(tok::eom)) {
     // Skip code until we get to #endif.  This helps with recovery by not
@@ -1522,7 +1522,7 @@
                                  /*Foundnonskip*/false, /*FoundElse*/false);
     return;
   }
-  
+
   // Check to see if this is the last token on the #if[n]def line.
   CheckEndOfDirective(isIfndef ? "ifndef" : "ifdef");
 
@@ -1541,7 +1541,7 @@
   // If there is a macro, process it.
   if (MI)  // Mark it used.
     MI->setIsUsed(true);
-  
+
   // Should we include the stuff contained by this directive?
   if (!MI == isIfndef) {
     // Yes, remember that we are inside a conditional, then lex the next token.
@@ -1550,7 +1550,7 @@
   } else {
     // No, skip the contents of this block and return the first token after it.
     SkipExcludedConditionalBlock(DirectiveTok.getLocation(),
-                                 /*Foundnonskip*/false, 
+                                 /*Foundnonskip*/false,
                                  /*FoundElse*/false);
   }
 }
@@ -1560,11 +1560,11 @@
 void Preprocessor::HandleIfDirective(Token &IfToken,
                                      bool ReadAnyTokensBeforeDirective) {
   ++NumIf;
-  
+
   // Parse and evaluation the conditional expression.
   IdentifierInfo *IfNDefMacro = 0;
   bool ConditionalTrue = EvaluateDirectiveExpression(IfNDefMacro);
-  
+
 
   // If this condition is equivalent to #ifndef X, and if this is the first
   // directive seen, handle it for the multiple-include optimization.
@@ -1582,7 +1582,7 @@
                                    /*foundnonskip*/true, /*foundelse*/false);
   } else {
     // No, skip the contents of this block and return the first token after it.
-    SkipExcludedConditionalBlock(IfToken.getLocation(), /*Foundnonskip*/false, 
+    SkipExcludedConditionalBlock(IfToken.getLocation(), /*Foundnonskip*/false,
                                  /*FoundElse*/false);
   }
 }
@@ -1591,21 +1591,21 @@
 ///
 void Preprocessor::HandleEndifDirective(Token &EndifToken) {
   ++NumEndif;
-  
+
   // Check that this is the whole directive.
   CheckEndOfDirective("endif");
-  
+
   PPConditionalInfo CondInfo;
   if (CurPPLexer->popConditionalLevel(CondInfo)) {
     // No conditionals on the stack: this is an #endif without an #if.
     Diag(EndifToken, diag::err_pp_endif_without_if);
     return;
   }
-  
+
   // If this the end of a top-level #endif, inform MIOpt.
   if (CurPPLexer->getConditionalStackDepth() == 0)
     CurPPLexer->MIOpt.ExitTopLevelConditional();
-  
+
   assert(!CondInfo.WasSkipping && !CurPPLexer->LexingRawMode &&
          "This code should only be reachable in the non-skipping case!");
 }
@@ -1613,23 +1613,23 @@
 
 void Preprocessor::HandleElseDirective(Token &Result) {
   ++NumElse;
-  
+
   // #else directive in a non-skipping conditional... start skipping.
   CheckEndOfDirective("else");
-  
+
   PPConditionalInfo CI;
   if (CurPPLexer->popConditionalLevel(CI)) {
     Diag(Result, diag::pp_err_else_without_if);
     return;
   }
-  
+
   // If this is a top-level #else, inform the MIOpt.
   if (CurPPLexer->getConditionalStackDepth() == 0)
     CurPPLexer->MIOpt.EnterTopLevelConditional();
 
   // If this is a #else with a #else before it, report the error.
   if (CI.FoundElse) Diag(Result, diag::pp_err_else_after_else);
-  
+
   // Finally, skip the rest of the contents of this block and return the first
   // token after it.
   return SkipExcludedConditionalBlock(CI.IfLoc, /*Foundnonskip*/true,
@@ -1638,7 +1638,7 @@
 
 void Preprocessor::HandleElifDirective(Token &ElifToken) {
   ++NumElse;
-  
+
   // #elif directive in a non-skipping conditional... start skipping.
   // We don't care what the condition is, because we will always skip it (since
   // the block immediately before it was included).
@@ -1649,11 +1649,11 @@
     Diag(ElifToken, diag::pp_err_elif_without_if);
     return;
   }
-  
+
   // If this is a top-level #elif, inform the MIOpt.
   if (CurPPLexer->getConditionalStackDepth() == 0)
     CurPPLexer->MIOpt.EnterTopLevelConditional();
-  
+
   // If this is a #elif with a #else before it, report the error.
   if (CI.FoundElse) Diag(ElifToken, diag::pp_err_elif_after_else);
 

Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Wed Sep  9 10:08:12 2009
@@ -30,18 +30,18 @@
   SourceRange Range;
 public:
   llvm::APSInt Val;
-  
+
   // Default ctor - Construct an 'invalid' PPValue.
   PPValue(unsigned BitWidth) : Val(BitWidth) {}
-  
+
   unsigned getBitWidth() const { return Val.getBitWidth(); }
   bool isUnsigned() const { return Val.isUnsigned(); }
-  
+
   const SourceRange &getRange() const { return Range; }
-  
+
   void setRange(SourceLocation L) { Range.setBegin(L); Range.setEnd(L); }
   void setRange(SourceLocation B, SourceLocation E) {
-    Range.setBegin(B); Range.setEnd(E); 
+    Range.setBegin(B); Range.setEnd(E);
   }
   void setBegin(SourceLocation L) { Range.setBegin(L); }
   void setEnd(SourceLocation L) { Range.setEnd(L); }
@@ -82,7 +82,7 @@
 static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
                           bool ValueLive, Preprocessor &PP) {
   DT.State = DefinedTracker::Unknown;
-  
+
   // If this token's spelling is a pp-identifier, check to see if it is
   // 'defined' or if it is a macro.  Note that we check here because many
   // keywords are pp-identifiers, so we can't check the kind.
@@ -113,13 +113,13 @@
       LParenLoc = PeekTok.getLocation();
       PP.LexUnexpandedToken(PeekTok);
     }
-    
+
     // If we don't have a pp-identifier now, this is an error.
     if ((II = PeekTok.getIdentifierInfo()) == 0) {
       PP.Diag(PeekTok, diag::err_pp_defined_requires_identifier);
       return true;
     }
-    
+
     // Otherwise, we got an identifier, is it defined to something?
     Result.Val = II->hasMacroDefinition();
     Result.Val.setIsUnsigned(false);  // Result is signed intmax_t.
@@ -145,13 +145,13 @@
       Result.setEnd(PeekTok.getLocation());
       PP.LexNonComment(PeekTok);
     }
-    
+
     // Success, remember that we saw defined(X).
     DT.State = DefinedTracker::DefinedMacro;
     DT.TheMacro = II;
     return false;
   }
-  
+
   switch (PeekTok.getKind()) {
   default:  // Non-value token.
     PP.Diag(PeekTok, diag::err_pp_expr_bad_token_start_expr);
@@ -166,11 +166,11 @@
     IntegerBuffer.resize(PeekTok.getLength());
     const char *ThisTokBegin = &IntegerBuffer[0];
     unsigned ActualLength = PP.getSpelling(PeekTok, ThisTokBegin);
-    NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, 
+    NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength,
                                  PeekTok.getLocation(), PP);
     if (Literal.hadError)
       return true; // a diagnostic was already reported.
-    
+
     if (Literal.isFloatingLiteral() || Literal.isImaginary) {
       PP.Diag(PeekTok, diag::err_pp_illegal_floating_literal);
       return true;
@@ -191,7 +191,7 @@
       // Set the signedness of the result to match whether there was a U suffix
       // or not.
       Result.Val.setIsUnsigned(Literal.isUnsigned);
-    
+
       // Detect overflow based on whether the value is signed.  If signed
       // and if the value is too large, emit a warning "integer constant is so
       // large that it is unsigned" e.g. on 12345678901234567890 where intmax_t
@@ -203,7 +203,7 @@
         Result.Val.setIsUnsigned(true);
       }
     }
-    
+
     // Consume the token.
     Result.setRange(PeekTok.getLocation());
     PP.LexNonComment(PeekTok);
@@ -214,7 +214,7 @@
     CharBuffer.resize(PeekTok.getLength());
     const char *ThisTokBegin = &CharBuffer[0];
     unsigned ActualLength = PP.getSpelling(PeekTok, ThisTokBegin);
-    CharLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, 
+    CharLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength,
                               PeekTok.getLocation(), PP);
     if (Literal.hadError())
       return true;  // A diagnostic was already emitted.
@@ -235,7 +235,7 @@
     Val = Literal.getValue();
     // Set the signedness.
     Val.setIsUnsigned(!PP.getLangOptions().CharIsSigned);
-    
+
     if (Result.Val.getBitWidth() > Val.getBitWidth()) {
       Result.Val = Val.extend(Result.Val.getBitWidth());
     } else {
@@ -264,7 +264,7 @@
       // Otherwise, we have something like (x+y), and we consumed '(x'.
       if (EvaluateDirectiveSubExpr(Result, 1, PeekTok, ValueLive, PP))
         return true;
-      
+
       if (PeekTok.isNot(tok::r_paren)) {
         PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_rparen)
           << Result.getRange();
@@ -290,21 +290,21 @@
     PP.LexNonComment(PeekTok);
     if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
     Result.setBegin(Loc);
-    
+
     // C99 6.5.3.3p3: The sign of the result matches the sign of the operand.
     Result.Val = -Result.Val;
-    
+
     // -MININT is the only thing that overflows.  Unsigned never overflows.
     bool Overflow = !Result.isUnsigned() && Result.Val.isMinSignedValue();
-      
+
     // If this operator is live and overflowed, report the issue.
     if (Overflow && ValueLive)
       PP.Diag(Loc, diag::warn_pp_expr_overflow) << Result.getRange();
-    
+
     DT.State = DefinedTracker::Unknown;
     return false;
   }
-    
+
   case tok::tilde: {
     SourceLocation Start = PeekTok.getLocation();
     PP.LexNonComment(PeekTok);
@@ -316,7 +316,7 @@
     DT.State = DefinedTracker::Unknown;
     return false;
   }
-    
+
   case tok::exclaim: {
     SourceLocation Start = PeekTok.getLocation();
     PP.LexNonComment(PeekTok);
@@ -325,14 +325,14 @@
     Result.Val = !Result.Val;
     // C99 6.5.3.3p5: The sign of the result is 'int', aka it is signed.
     Result.Val.setIsUnsigned(false);
-    
+
     if (DT.State == DefinedTracker::DefinedMacro)
       DT.State = DefinedTracker::NotDefinedMacro;
     else if (DT.State == DefinedTracker::NotDefinedMacro)
       DT.State = DefinedTracker::DefinedMacro;
     return false;
   }
-    
+
   // FIXME: Handle #assert
   }
 }
@@ -390,17 +390,17 @@
       << LHS.getRange();
     return true;
   }
-  
+
   while (1) {
     // If this token has a lower precedence than we are allowed to parse, return
     // it so that higher levels of the recursion can parse it.
     if (PeekPrec < MinPrec)
       return false;
-    
+
     tok::TokenKind Operator = PeekTok.getKind();
-    
+
     // If this is a short-circuiting operator, see if the RHS of the operator is
-    // dead.  Note that this cannot just clobber ValueLive.  Consider 
+    // dead.  Note that this cannot just clobber ValueLive.  Consider
     // "0 && 1 ? 4 : 1 / 0", which is parsed as "(0 && 1) ? 4 : (1 / 0)".  In
     // this example, the RHS of the && being dead does not make the rest of the
     // expr dead.
@@ -434,7 +434,7 @@
         << RHS.getRange();
       return true;
     }
-    
+
     // Decide whether to include the next binop in this subexpression.  For
     // example, when parsing x+y*z and looking at '*', we want to recursively
     // handle y*z as a single subexpression.  We do this because the precedence
@@ -451,16 +451,16 @@
       RHSPrec = getPrecedence(tok::comma);
     else  // All others should munch while higher precedence.
       RHSPrec = ThisPrec+1;
-    
+
     if (PeekPrec >= RHSPrec) {
       if (EvaluateDirectiveSubExpr(RHS, RHSPrec, PeekTok, RHSIsLive, PP))
         return true;
       PeekPrec = getPrecedence(PeekTok.getKind());
     }
     assert(PeekPrec <= ThisPrec && "Recursion didn't work!");
-    
+
     // Usual arithmetic conversions (C99 6.3.1.8p1): result is unsigned if
-    // either operand is unsigned.  
+    // either operand is unsigned.
     llvm::APSInt Res(LHS.getBitWidth());
     switch (Operator) {
     case tok::question:       // No UAC for x and y in "x ? y : z".
@@ -489,7 +489,7 @@
       LHS.Val.setIsUnsigned(Res.isUnsigned());
       RHS.Val.setIsUnsigned(Res.isUnsigned());
     }
-    
+
     // FIXME: All of these should detect and report overflow??
     bool Overflow = false;
     switch (Operator) {
@@ -514,7 +514,7 @@
         return true;
       }
       break;
-        
+
     case tok::star:
       Res = LHS.Val * RHS.Val;
       if (Res.isSigned() && LHS.Val != 0 && RHS.Val != 0)
@@ -531,7 +531,7 @@
         Overflow = ShAmt >= LHS.Val.countLeadingZeros();
       else
         Overflow = ShAmt >= LHS.Val.countLeadingOnes();
-      
+
       Res = LHS.Val << ShAmt;
       break;
     }
@@ -607,7 +607,7 @@
         PP.Diag(OpLoc, diag::ext_pp_comma_expr)
           << LHS.getRange() << RHS.getRange();
       Res = RHS.Val; // LHS = LHS,RHS -> RHS.
-      break; 
+      break;
     case tok::question: {
       // Parse the : part of the expression.
       if (PeekTok.isNot(tok::colon)) {
@@ -631,7 +631,7 @@
       if (EvaluateDirectiveSubExpr(AfterColonVal, ThisPrec,
                                    PeekTok, AfterColonLive, PP))
         return true;
-      
+
       // Now that we have the condition, the LHS and the RHS of the :, evaluate.
       Res = LHS.Val != 0 ? RHS.Val : AfterColonVal.Val;
       RHS.setEnd(AfterColonVal.getRange().getEnd());
@@ -639,7 +639,7 @@
       // Usual arithmetic conversions (C99 6.3.1.8p1): result is unsigned if
       // either operand is unsigned.
       Res.setIsUnsigned(RHS.isUnsigned() | AfterColonVal.isUnsigned());
-      
+
       // Figure out the precedence of the token after the : part.
       PeekPrec = getPrecedence(PeekTok.getKind());
       break;
@@ -655,12 +655,12 @@
     if (Overflow && ValueLive)
       PP.Diag(OpLoc, diag::warn_pp_expr_overflow)
         << LHS.getRange() << RHS.getRange();
-    
+
     // Put the result back into 'LHS' for our next iteration.
     LHS.Val = Res;
     LHS.setEnd(RHS.getRange().getEnd());
   }
-  
+
   return false;
 }
 
@@ -672,10 +672,10 @@
   // Peek ahead one token.
   Token Tok;
   Lex(Tok);
-  
+
   // C99 6.10.1p3 - All expressions are evaluated as intmax_t or uintmax_t.
   unsigned BitWidth = getTargetInfo().getIntMaxTWidth();
-    
+
   PPValue ResVal(BitWidth);
   DefinedTracker DT;
   if (EvaluateValue(ResVal, Tok, DT, true, *this)) {
@@ -684,7 +684,7 @@
       DiscardUntilEndOfDirective();
     return false;
   }
-  
+
   // If we are at the end of the expression after just parsing a value, there
   // must be no (unparenthesized) binary operators involved, so we can exit
   // directly.
@@ -693,10 +693,10 @@
     // macro in IfNDefMacro.
     if (DT.State == DefinedTracker::NotDefinedMacro)
       IfNDefMacro = DT.TheMacro;
-    
+
     return ResVal.Val != 0;
   }
-  
+
   // Otherwise, we must have a binary operator (e.g. "#if 1 < 2"), so parse the
   // operator and the stuff after it.
   if (EvaluateDirectiveSubExpr(ResVal, getPrecedence(tok::question),
@@ -706,14 +706,14 @@
       DiscardUntilEndOfDirective();
     return false;
   }
-  
+
   // If we aren't at the tok::eom token, something bad happened, like an extra
   // ')' token.
   if (Tok.isNot(tok::eom)) {
     Diag(Tok, diag::err_pp_expected_eol);
     DiscardUntilEndOfDirective();
   }
-  
+
   return ResVal.Val != 0;
 }
 

Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Wed Sep  9 10:08:12 2009
@@ -31,7 +31,7 @@
 bool Preprocessor::isInPrimaryFile() const {
   if (IsFileLexer())
     return IncludeMacroStack.empty();
-  
+
   // If there are any stacked lexers, we're in a #include.
   assert(IsFileLexer(IncludeMacroStack[0]) &&
          "Top level include stack isn't our primary lexer?");
@@ -47,7 +47,7 @@
 PreprocessorLexer *Preprocessor::getCurrentFileLexer() const {
   if (IsFileLexer())
     return CurPPLexer;
-  
+
   // Look for a stacked lexer.
   for (unsigned i = IncludeMacroStack.size(); i != 0; --i) {
     const IncludeStackInfo& ISI = IncludeMacroStack[i-1];
@@ -68,7 +68,7 @@
 void Preprocessor::EnterSourceFile(FileID FID, const DirectoryLookup *CurDir) {
   assert(CurTokenLexer == 0 && "Cannot #include a file inside a macro!");
   ++NumEnteredSourceFiles;
-  
+
   if (MaxIncludeStackDepth < IncludeMacroStack.size())
     MaxIncludeStackDepth = IncludeMacroStack.size();
 
@@ -77,13 +77,13 @@
       return EnterSourceFileWithPTH(PL, CurDir);
   }
   EnterSourceFileWithLexer(new Lexer(FID, *this), CurDir);
-}  
+}
 
 /// EnterSourceFileWithLexer - Add a source file to the top of the include stack
 ///  and start lexing tokens from it instead of the current buffer.
-void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer, 
+void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer,
                                             const DirectoryLookup *CurDir) {
-    
+
   // Add the current lexer to the include stack.
   if (CurPPLexer || CurTokenLexer)
     PushIncludeMacroStack();
@@ -91,12 +91,12 @@
   CurLexer.reset(TheLexer);
   CurPPLexer = TheLexer;
   CurDirLookup = CurDir;
-  
+
   // Notify the client, if desired, that we are in a new source file.
   if (Callbacks && !CurLexer->Is_PragmaLexer) {
     SrcMgr::CharacteristicKind FileType =
        SourceMgr.getFileCharacteristic(CurLexer->getFileLoc());
-    
+
     Callbacks->FileChanged(CurLexer->getFileLoc(),
                            PPCallbacks::EnterFile, FileType);
   }
@@ -104,9 +104,9 @@
 
 /// EnterSourceFileWithPTH - Add a source file to the top of the include stack
 /// and start getting tokens from it using the PTH cache.
-void Preprocessor::EnterSourceFileWithPTH(PTHLexer *PL, 
+void Preprocessor::EnterSourceFileWithPTH(PTHLexer *PL,
                                           const DirectoryLookup *CurDir) {
-  
+
   if (CurPPLexer || CurTokenLexer)
     PushIncludeMacroStack();
 
@@ -130,7 +130,7 @@
                               MacroArgs *Args) {
   PushIncludeMacroStack();
   CurDirLookup = 0;
-  
+
   if (NumCachedTokenLexers == 0) {
     CurTokenLexer.reset(new TokenLexer(Tok, ILEnd, Args, *this));
   } else {
@@ -174,18 +174,18 @@
 bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
   assert(!CurTokenLexer &&
          "Ending a file when currently in a macro!");
-  
+
   // See if this file had a controlling macro.
   if (CurPPLexer) {  // Not ending a macro, ignore it.
-    if (const IdentifierInfo *ControllingMacro = 
+    if (const IdentifierInfo *ControllingMacro =
           CurPPLexer->MIOpt.GetControllingMacroAtEndOfFile()) {
       // Okay, this has a controlling macro, remember in HeaderFileInfo.
-      if (const FileEntry *FE = 
+      if (const FileEntry *FE =
             SourceMgr.getFileEntryForID(CurPPLexer->getFileID()))
         HeaderInfo.SetFileControllingMacro(FE, ControllingMacro);
     }
   }
-  
+
   // If this is a #include'd file, pop it off the include stack and continue
   // lexing the #includer file.
   if (!IncludeMacroStack.empty()) {
@@ -197,7 +197,7 @@
       SrcMgr::CharacteristicKind FileType =
         SourceMgr.getFileCharacteristic(CurPPLexer->getSourceLocation());
       Callbacks->FileChanged(CurPPLexer->getSourceLocation(),
-                             PPCallbacks::ExitFile, FileType); 
+                             PPCallbacks::ExitFile, FileType);
     }
 
     // Client should lex another token.
@@ -210,21 +210,21 @@
   // actually typed, which is goodness.
   if (CurLexer) {
     const char *EndPos = CurLexer->BufferEnd;
-    if (EndPos != CurLexer->BufferStart && 
+    if (EndPos != CurLexer->BufferStart &&
         (EndPos[-1] == '\n' || EndPos[-1] == '\r')) {
       --EndPos;
-      
+
       // Handle \n\r and \r\n:
-      if (EndPos != CurLexer->BufferStart && 
+      if (EndPos != CurLexer->BufferStart &&
           (EndPos[-1] == '\n' || EndPos[-1] == '\r') &&
           EndPos[-1] != EndPos[0])
         --EndPos;
     }
-    
+
     Result.startToken();
     CurLexer->BufferPtr = EndPos;
     CurLexer->FormTokenWithChars(Result, EndPos, tok::eof);
-    
+
     // We're done with the #included file.
     CurLexer.reset();
   } else {
@@ -232,12 +232,12 @@
     CurPTHLexer->getEOF(Result);
     CurPTHLexer.reset();
   }
-  
+
   CurPPLexer = 0;
 
   // This is the end of the top-level file.  If the diag::pp_macro_not_used
   // diagnostic is enabled, look for macros that have not been used.
-  if (getDiagnostics().getDiagnosticLevel(diag::pp_macro_not_used) != 
+  if (getDiagnostics().getDiagnosticLevel(diag::pp_macro_not_used) !=
         Diagnostic::Ignored) {
     for (macro_iterator I = macro_begin(), E = macro_end(); I != E; ++I)
       if (!I->second->isUsed())
@@ -267,15 +267,15 @@
 /// state of the top-of-stack lexer is unknown.
 void Preprocessor::RemoveTopOfLexerStack() {
   assert(!IncludeMacroStack.empty() && "Ran out of stack entries to load");
-  
+
   if (CurTokenLexer) {
     // Delete or cache the now-dead macro expander.
     if (NumCachedTokenLexers == TokenLexerCacheSize)
       CurTokenLexer.reset();
     else
       TokenLexerCache[NumCachedTokenLexers++] = CurTokenLexer.take();
-  }   
-  
+  }
+
   PopIncludeMacroStack();
 }
 
@@ -285,7 +285,7 @@
 void Preprocessor::HandleMicrosoftCommentPaste(Token &Tok) {
   assert(CurTokenLexer && !CurPPLexer &&
          "Pasted comment can only be formed from macro");
-  
+
   // We handle this by scanning for the closest real lexer, switching it to
   // raw mode and preprocessor mode.  This will cause it to return \n as an
   // explicit EOM token.
@@ -294,7 +294,7 @@
   for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
     IncludeStackInfo &ISI = *(IncludeMacroStack.end()-i-1);
     if (ISI.ThePPLexer == 0) continue;  // Scan for a real lexer.
-    
+
     // Once we find a real lexer, mark it as raw mode (disabling macro
     // expansions) and preprocessor mode (return EOM).  We know that the lexer
     // was *not* in raw mode before, because the macro that the comment came
@@ -307,12 +307,12 @@
     FoundLexer->ParsingPreprocessorDirective = true;
     break;
   }
-  
+
   // Okay, we either found and switched over the lexer, or we didn't find a
   // lexer.  In either case, finish off the macro the comment came from, getting
   // the next token.
   if (!HandleEndOfTokenLexer(Tok)) Lex(Tok);
-  
+
   // Discarding comments as long as we don't have EOF or EOM.  This 'comments
   // out' the rest of the line, including any tokens that came from other macros
   // that were active, as in:
@@ -321,22 +321,22 @@
   // which should lex to 'a' only: 'b' and 'c' should be removed.
   while (Tok.isNot(tok::eom) && Tok.isNot(tok::eof))
     Lex(Tok);
-  
+
   // If we got an eom token, then we successfully found the end of the line.
   if (Tok.is(tok::eom)) {
     assert(FoundLexer && "Can't get end of line without an active lexer");
     // Restore the lexer back to normal mode instead of raw mode.
     FoundLexer->LexingRawMode = false;
-    
+
     // If the lexer was already in preprocessor mode, just return the EOM token
     // to finish the preprocessor line.
     if (LexerWasInPPMode) return;
-    
+
     // Otherwise, switch out of PP mode and return the next lexed token.
     FoundLexer->ParsingPreprocessorDirective = false;
     return Lex(Tok);
   }
-  
+
   // If we got an EOF token, then we reached the end of the token stream but
   // didn't find an explicit \n.  This can only happen if there was no lexer
   // active (an active lexer would return EOM at EOF if there was no \n in

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed Sep  9 10:08:12 2009
@@ -39,7 +39,7 @@
 static IdentifierInfo *RegisterBuiltinMacro(Preprocessor &PP, const char *Name){
   // Get the identifier.
   IdentifierInfo *Id = PP.getIdentifierInfo(Name);
-  
+
   // Mark it as being a macro that is builtin.
   MacroInfo *MI = PP.AllocateMacroInfo(SourceLocation());
   MI->setIsBuiltinMacro();
@@ -57,12 +57,12 @@
   Ident__TIME__ = RegisterBuiltinMacro(*this, "__TIME__");
   Ident__COUNTER__ = RegisterBuiltinMacro(*this, "__COUNTER__");
   Ident_Pragma  = RegisterBuiltinMacro(*this, "_Pragma");
-  
+
   // GCC Extensions.
   Ident__BASE_FILE__     = RegisterBuiltinMacro(*this, "__BASE_FILE__");
   Ident__INCLUDE_LEVEL__ = RegisterBuiltinMacro(*this, "__INCLUDE_LEVEL__");
   Ident__TIMESTAMP__     = RegisterBuiltinMacro(*this, "__TIMESTAMP__");
-  
+
   // Clang Extensions.
   Ident__has_feature     = RegisterBuiltinMacro(*this, "__has_feature");
   Ident__has_builtin     = RegisterBuiltinMacro(*this, "__has_builtin");
@@ -77,14 +77,14 @@
 
   // If the token isn't an identifier, it's always literally expanded.
   if (II == 0) return true;
-  
+
   // If the identifier is a macro, and if that macro is enabled, it may be
   // expanded so it's not a trivial expansion.
   if (II->hasMacroDefinition() && PP.getMacroInfo(II)->isEnabled() &&
       // Fast expanding "#define X X" is ok, because X would be disabled.
       II != MacroIdent)
     return false;
-  
+
   // If this is an object-like macro invocation, it is safe to trivially expand
   // it.
   if (MI->isObjectLike()) return true;
@@ -95,7 +95,7 @@
        I != E; ++I)
     if (*I == II)
       return false;   // Identifier is a macro argument.
-  
+
   return true;
 }
 
@@ -112,7 +112,7 @@
     Val = CurPTHLexer->isNextPPTokenLParen();
   else
     Val = CurTokenLexer->isNextTokenLParen();
-  
+
   if (Val == 2) {
     // We have run off the end.  If it's a source file we don't
     // examine enclosing ones (C99 5.1.1.2p4).  Otherwise walk up the
@@ -127,10 +127,10 @@
         Val = Entry.ThePTHLexer->isNextPPTokenLParen();
       else
         Val = Entry.TheTokenLexer->isNextTokenLParen();
-      
+
       if (Val != 2)
         break;
-      
+
       // Ran off the end of a source file?
       if (Entry.ThePPLexer)
         return false;
@@ -145,72 +145,72 @@
 
 /// HandleMacroExpandedIdentifier - If an identifier token is read that is to be
 /// expanded as a macro, handle it and return the next token as 'Identifier'.
-bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, 
+bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
                                                  MacroInfo *MI) {
   if (Callbacks) Callbacks->MacroExpands(Identifier, MI);
-  
+
   // If this is a macro exapnsion in the "#if !defined(x)" line for the file,
   // then the macro could expand to different things in other contexts, we need
   // to disable the optimization in this case.
   if (CurPPLexer) CurPPLexer->MIOpt.ExpandedMacro();
-  
+
   // If this is a builtin macro, like __LINE__ or _Pragma, handle it specially.
   if (MI->isBuiltinMacro()) {
     ExpandBuiltinMacro(Identifier);
     return false;
   }
-  
+
   /// Args - If this is a function-like macro expansion, this contains,
   /// for each macro argument, the list of tokens that were provided to the
   /// invocation.
   MacroArgs *Args = 0;
-  
+
   // Remember where the end of the instantiation occurred.  For an object-like
   // macro, this is the identifier.  For a function-like macro, this is the ')'.
   SourceLocation InstantiationEnd = Identifier.getLocation();
-  
+
   // If this is a function-like macro, read the arguments.
   if (MI->isFunctionLike()) {
     // C99 6.10.3p10: If the preprocessing token immediately after the the macro
     // name isn't a '(', this macro should not be expanded.
     if (!isNextPPTokenLParen())
       return true;
-    
+
     // Remember that we are now parsing the arguments to a macro invocation.
     // Preprocessor directives used inside macro arguments are not portable, and
     // this enables the warning.
     InMacroArgs = true;
     Args = ReadFunctionLikeMacroArgs(Identifier, MI, InstantiationEnd);
-    
+
     // Finished parsing args.
     InMacroArgs = false;
-    
+
     // If there was an error parsing the arguments, bail out.
     if (Args == 0) return false;
-    
+
     ++NumFnMacroExpanded;
   } else {
     ++NumMacroExpanded;
   }
-  
+
   // Notice that this macro has been used.
   MI->setIsUsed(true);
-  
+
   // If we started lexing a macro, enter the macro expansion body.
-  
+
   // If this macro expands to no tokens, don't bother to push it onto the
   // expansion stack, only to take it right back off.
   if (MI->getNumTokens() == 0) {
     // No need for arg info.
     if (Args) Args->destroy();
-    
+
     // Ignore this macro use, just return the next token in the current
     // buffer.
     bool HadLeadingSpace = Identifier.hasLeadingSpace();
     bool IsAtStartOfLine = Identifier.isAtStartOfLine();
-    
+
     Lex(Identifier);
-    
+
     // If the identifier isn't on some OTHER line, inherit the leading
     // whitespace/first-on-a-line property of this token.  This handles
     // stuff like "! XX," -> "! ," and "   XX," -> "    ,", when XX is
@@ -221,12 +221,12 @@
     }
     ++NumFastMacroExpanded;
     return false;
-    
+
   } else if (MI->getNumTokens() == 1 &&
              isTrivialSingleTokenExpansion(MI, Identifier.getIdentifierInfo(),
                                            *this)) {
     // Otherwise, if this macro expands into a single trivially-expanded
-    // token: expand it now.  This handles common cases like 
+    // token: expand it now.  This handles common cases like
     // "#define VAL 42".
 
     // No need for arg info.
@@ -236,38 +236,38 @@
     // identifier to the expanded token.
     bool isAtStartOfLine = Identifier.isAtStartOfLine();
     bool hasLeadingSpace = Identifier.hasLeadingSpace();
-    
+
     // Remember where the token is instantiated.
     SourceLocation InstantiateLoc = Identifier.getLocation();
-    
+
     // Replace the result token.
     Identifier = MI->getReplacementToken(0);
-    
+
     // Restore the StartOfLine/LeadingSpace markers.
     Identifier.setFlagValue(Token::StartOfLine , isAtStartOfLine);
     Identifier.setFlagValue(Token::LeadingSpace, hasLeadingSpace);
-    
+
     // Update the tokens location to include both its instantiation and physical
     // locations.
     SourceLocation Loc =
       SourceMgr.createInstantiationLoc(Identifier.getLocation(), InstantiateLoc,
                                        InstantiationEnd,Identifier.getLength());
     Identifier.setLocation(Loc);
-    
+
     // If this is #define X X, we must mark the result as unexpandible.
     if (IdentifierInfo *NewII = Identifier.getIdentifierInfo())
       if (getMacroInfo(NewII) == MI)
         Identifier.setFlag(Token::DisableExpand);
-    
+
     // Since this is not an identifier token, it can't be macro expanded, so
     // we're done.
     ++NumFastMacroExpanded;
     return false;
   }
-  
+
   // Start expanding the macro.
   EnterMacro(Identifier, InstantiationEnd, Args);
-  
+
   // Now that the macro is at the top of the include stack, ask the
   // preprocessor to read the next token from it.
   Lex(Identifier);
@@ -284,7 +284,7 @@
   // The number of fixed arguments to parse.
   unsigned NumFixedArgsLeft = MI->getNumArgs();
   bool isVariadic = MI->isVariadic();
-  
+
   // Outer loop, while there are more arguments, keep reading them.
   Token Tok;
 
@@ -292,7 +292,7 @@
   // an argument value in a macro could expand to ',' or '(' or ')'.
   LexUnexpandedToken(Tok);
   assert(Tok.is(tok::l_paren) && "Error computing l-paren-ness?");
-  
+
   // ArgTokens - Build up a list of tokens that make up each argument.  Each
   // argument is separated by an EOF token.  Use a SmallVector so we can avoid
   // heap allocations in the common case.
@@ -302,19 +302,19 @@
   while (Tok.isNot(tok::r_paren)) {
     assert((Tok.is(tok::l_paren) || Tok.is(tok::comma)) &&
            "only expect argument separators here");
-    
+
     unsigned ArgTokenStart = ArgTokens.size();
     SourceLocation ArgStartLoc = Tok.getLocation();
-    
+
     // C99 6.10.3p11: Keep track of the number of l_parens we have seen.  Note
     // that we already consumed the first one.
     unsigned NumParens = 0;
-    
+
     while (1) {
       // Read arguments as unexpanded tokens.  This avoids issues, e.g., where
       // an argument value in a macro could expand to ',' or '(' or ')'.
       LexUnexpandedToken(Tok);
-      
+
       if (Tok.is(tok::eof) || Tok.is(tok::eom)) { // "#if f(<eof>" & "#if f(\n"
         Diag(MacroName, diag::err_unterm_macro_invoc);
         // Do not lose the EOF/EOM.  Return it to the client.
@@ -331,7 +331,7 @@
       } else if (Tok.is(tok::comma) && NumParens == 0) {
         // Comma ends this argument if there are more fixed arguments expected.
         // However, if this is a variadic macro, and this is part of the
-        // variadic part, then the comma is just an argument token. 
+        // variadic part, then the comma is just an argument token.
         if (!isVariadic) break;
         if (NumFixedArgsLeft > 1)
           break;
@@ -344,7 +344,7 @@
         // expanding from to be popped off the expansion stack.  Doing so causes
         // them to be reenabled for expansion.  Here we record whether any
         // identifiers we lex as macro arguments correspond to disabled macros.
-        // If so, we mark the token as noexpand.  This is a subtle aspect of 
+        // If so, we mark the token as noexpand.  This is a subtle aspect of
         // C99 6.10.3.4p2.
         if (MacroInfo *MI = getMacroInfo(Tok.getIdentifierInfo()))
           if (!MI->isEnabled())
@@ -352,7 +352,7 @@
       }
       ArgTokens.push_back(Tok);
     }
-    
+
     // If this was an empty argument list foo(), don't add this as an empty
     // argument.
     if (ArgTokens.empty() && Tok.getKind() == tok::r_paren)
@@ -363,18 +363,18 @@
     if (!isVariadic && NumFixedArgsLeft == 0) {
       if (ArgTokens.size() != ArgTokenStart)
         ArgStartLoc = ArgTokens[ArgTokenStart].getLocation();
-      
+
       // Emit the diagnostic at the macro name in case there is a missing ).
       // Emitting it at the , could be far away from the macro name.
       Diag(ArgStartLoc, diag::err_too_many_args_in_macro_invoc);
       return 0;
     }
-    
+
     // Empty arguments are standard in C99 and supported as an extension in
     // other modes.
     if (ArgTokens.size() == ArgTokenStart && !Features.C99)
       Diag(Tok, diag::ext_empty_fnmacro_arg);
-    
+
     // Add a marker EOF token to the end of the token list for this argument.
     Token EOFTok;
     EOFTok.startToken();
@@ -386,19 +386,19 @@
     assert(NumFixedArgsLeft != 0 && "Too many arguments parsed");
     --NumFixedArgsLeft;
   }
-  
+
   // Okay, we either found the r_paren.  Check to see if we parsed too few
   // arguments.
   unsigned MinArgsExpected = MI->getNumArgs();
-  
+
   // See MacroArgs instance var for description of this.
   bool isVarargsElided = false;
-  
+
   if (NumActuals < MinArgsExpected) {
     // There are several cases where too few arguments is ok, handle them now.
     if (NumActuals == 0 && MinArgsExpected == 1) {
       // #define A(X)  or  #define A(...)   ---> A()
-      
+
       // If there is exactly one argument, and that argument is missing,
       // then we have an empty "()" argument empty list.  This is fine, even if
       // the macro expects one argument (the argument is just empty).
@@ -413,9 +413,9 @@
 
       // Remember this occurred, allowing us to elide the comma when used for
       // cases like:
-      //   #define A(x, foo...) blah(a, ## foo) 
-      //   #define B(x, ...) blah(a, ## __VA_ARGS__) 
-      //   #define C(...) blah(a, ## __VA_ARGS__) 
+      //   #define A(x, foo...) blah(a, ## foo)
+      //   #define B(x, ...) blah(a, ## __VA_ARGS__)
+      //   #define C(...) blah(a, ## __VA_ARGS__)
       //  A(x) B(x) C()
       isVarargsElided = true;
     } else {
@@ -423,7 +423,7 @@
       Diag(Tok, diag::err_too_few_args_in_macro_invoc);
       return 0;
     }
-    
+
     // Add a marker EOF token to the end of the token list for this argument.
     SourceLocation EndLoc = Tok.getLocation();
     Tok.startToken();
@@ -435,14 +435,14 @@
     // If we expect two arguments, add both as empty.
     if (NumActuals == 0 && MinArgsExpected == 2)
       ArgTokens.push_back(Tok);
-    
+
   } else if (NumActuals > MinArgsExpected && !MI->isVariadic()) {
     // Emit the diagnostic at the macro name in case there is a missing ).
     // Emitting it at the , could be far away from the macro name.
     Diag(MacroName, diag::err_too_many_args_in_macro_invoc);
     return 0;
   }
-  
+
   return MacroArgs::create(MI, ArgTokens.data(), ArgTokens.size(),
                            isVarargsElided);
 }
@@ -454,15 +454,15 @@
                              Preprocessor &PP) {
   time_t TT = time(0);
   struct tm *TM = localtime(&TT);
-  
+
   static const char * const Months[] = {
     "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
   };
-  
+
   char TmpBuffer[100];
-  sprintf(TmpBuffer, "\"%s %2d %4d\"", Months[TM->tm_mon], TM->tm_mday, 
+  sprintf(TmpBuffer, "\"%s %2d %4d\"", Months[TM->tm_mon], TM->tm_mday,
           TM->tm_year+1900);
-  
+
   Token TmpTok;
   TmpTok.startToken();
   PP.CreateString(TmpBuffer, strlen(TmpBuffer), TmpTok);
@@ -478,7 +478,7 @@
 /// specified by the identifier.
 static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
   const LangOptions &LangOpts = PP.getLangOptions();
-  
+
   switch (II->getLength()) {
   default: return false;
   case 6:
@@ -510,12 +510,12 @@
   // Figure out which token this is.
   IdentifierInfo *II = Tok.getIdentifierInfo();
   assert(II && "Can't be a macro without id info!");
-  
+
   // If this is an _Pragma directive, expand it, invoke the pragma handler, then
   // lex the token after it.
   if (II == Ident_Pragma)
     return Handle_Pragma(Tok);
-  
+
   ++NumBuiltinMacroExpanded;
 
   char TmpBuffer[100];
@@ -523,17 +523,17 @@
   // Set up the return result.
   Tok.setIdentifierInfo(0);
   Tok.clearFlag(Token::NeedsCleaning);
-  
+
   if (II == Ident__LINE__) {
     // C99 6.10.8: "__LINE__: The presumed line number (within the current
     // source file) of the current source line (an integer constant)".  This can
     // be affected by #line.
     SourceLocation Loc = Tok.getLocation();
-    
+
     // Advance to the location of the first _, this might not be the first byte
     // of the token if it starts with an escaped newline.
     Loc = AdvanceToTokenCharacter(Loc, 0);
-    
+
     // One wrinkle here is that GCC expands __LINE__ to location of the *end* of
     // a macro instantiation.  This doesn't matter for object-like macros, but
     // can matter for a function-like macro that expands to contain __LINE__.
@@ -541,7 +541,7 @@
     // end of the instantiation history.
     Loc = SourceMgr.getInstantiationRange(Loc).second;
     PresumedLoc PLoc = SourceMgr.getPresumedLoc(Loc);
-    
+
     // __LINE__ expands to a simple numeric value.
     sprintf(TmpBuffer, "%u", PLoc.getLine());
     Tok.setKind(tok::numeric_constant);
@@ -561,7 +561,7 @@
         NextLoc = PLoc.getIncludeLoc();
       }
     }
-    
+
     // Escape this filename.  Turn '\' -> '\\' '"' -> '\"'
     std::string FN = PLoc.getFilename();
     FN = '"' + Lexer::Stringify(FN) + '"';
@@ -589,12 +589,12 @@
     // Compute the presumed include depth of this token.  This can be affected
     // by GNU line markers.
     unsigned Depth = 0;
-    
+
     PresumedLoc PLoc = SourceMgr.getPresumedLoc(Tok.getLocation());
     PLoc = SourceMgr.getPresumedLoc(PLoc.getIncludeLoc());
     for (; PLoc.isValid(); ++Depth)
       PLoc = SourceMgr.getPresumedLoc(PLoc.getIncludeLoc());
-    
+
     // __INCLUDE_LEVEL__ expands to a simple numeric value.
     sprintf(TmpBuffer, "%u", Depth);
     Tok.setKind(tok::numeric_constant);
@@ -608,10 +608,10 @@
     // a macro, dig into the include stack.
     const FileEntry *CurFile = 0;
     PreprocessorLexer *TheLexer = getCurrentFileLexer();
-    
+
     if (TheLexer)
       CurFile = SourceMgr.getFileEntryForID(TheLexer->getFileID());
-    
+
     // If this file is older than the file it depends on, emit a diagnostic.
     const char *Result;
     if (CurFile) {
@@ -629,7 +629,7 @@
     CreateString(TmpBuffer, Len+1, Tok, Tok.getLocation());
   } else if (II == Ident__COUNTER__) {
     Diag(Tok, diag::ext_pp_counter);
-    
+
     // __COUNTER__ expands to a simple numeric value.
     sprintf(TmpBuffer, "%u", CounterValue++);
     Tok.setKind(tok::numeric_constant);
@@ -638,10 +638,10 @@
              II == Ident__has_builtin) {
     // The argument to these two builtins should be a parenthesized identifier.
     SourceLocation StartLoc = Tok.getLocation();
-    
+
     bool IsValid = false;
     IdentifierInfo *FeatureII = 0;
-    
+
     // Read the '('.
     Lex(Tok);
     if (Tok.is(tok::l_paren)) {
@@ -649,25 +649,25 @@
       Lex(Tok);
       if (Tok.is(tok::identifier)) {
         FeatureII = Tok.getIdentifierInfo();
-        
+
         // Read the ')'.
         Lex(Tok);
         if (Tok.is(tok::r_paren))
           IsValid = true;
       }
     }
-    
+
     bool Value = false;
     if (!IsValid)
       Diag(StartLoc, diag::err_feature_check_malformed);
     else if (II == Ident__has_builtin) {
-      // Check for a builtin is trivial. 
+      // Check for a builtin is trivial.
       Value = FeatureII->getBuiltinID() != 0;
     } else {
       assert(II == Ident__has_feature && "Must be feature check");
       Value = HasFeature(*this, FeatureII);
     }
-    
+
     sprintf(TmpBuffer, "%d", (int)Value);
     Tok.setKind(tok::numeric_constant);
     CreateString(TmpBuffer, strlen(TmpBuffer), Tok, Tok.getLocation());

Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Wed Sep  9 10:08:12 2009
@@ -37,7 +37,7 @@
                    const unsigned char *ppcond, PTHManager &PM)
   : PreprocessorLexer(&PP, FID), TokBuf(D), CurPtr(D), LastHashTokPtr(0),
     PPCond(ppcond), CurPPCondPtr(ppcond), PTHMgr(PM) {
-      
+
   FileStartLoc = PP.getSourceManager().getLocForStartOfFile(FID);
 }
 
@@ -47,25 +47,25 @@
   //===--------------------------------------==//
   // Read the raw token data.
   //===--------------------------------------==//
-  
+
   // Shadow CurPtr into an automatic variable.
-  const unsigned char *CurPtrShadow = CurPtr;  
+  const unsigned char *CurPtrShadow = CurPtr;
 
   // Read in the data for the token.
   unsigned Word0 = ReadLE32(CurPtrShadow);
   uint32_t IdentifierID = ReadLE32(CurPtrShadow);
   uint32_t FileOffset = ReadLE32(CurPtrShadow);
-  
+
   tok::TokenKind TKind = (tok::TokenKind) (Word0 & 0xFF);
   Token::TokenFlags TFlags = (Token::TokenFlags) ((Word0 >> 8) & 0xFF);
   uint32_t Len = Word0 >> 16;
 
   CurPtr = CurPtrShadow;
-  
+
   //===--------------------------------------==//
   // Construct the token itself.
   //===--------------------------------------==//
-  
+
   Tok.startToken();
   Tok.setKind(TKind);
   Tok.setFlag(TFlags);
@@ -80,57 +80,57 @@
   else if (IdentifierID) {
     MIOpt.ReadToken();
     IdentifierInfo *II = PTHMgr.GetIdentifierInfo(IdentifierID-1);
-    
+
     Tok.setIdentifierInfo(II);
-    
+
     // Change the kind of this identifier to the appropriate token kind, e.g.
     // turning "for" into a keyword.
     Tok.setKind(II->getTokenID());
-    
+
     if (II->isHandleIdentifierCase())
       PP->HandleIdentifier(Tok);
     return;
   }
-  
+
   //===--------------------------------------==//
   // Process the token.
   //===--------------------------------------==//
-#if 0  
+#if 0
   SourceManager& SM = PP->getSourceManager();
   llvm::errs() << SM.getFileEntryForID(FileID)->getName()
     << ':' << SM.getLogicalLineNumber(Tok.getLocation())
     << ':' << SM.getLogicalColumnNumber(Tok.getLocation())
     << '\n';
-#endif  
+#endif
 
   if (TKind == tok::eof) {
     // Save the end-of-file token.
     EofToken = Tok;
-    
+
     Preprocessor *PPCache = PP;
-    
+
     assert(!ParsingPreprocessorDirective);
     assert(!LexingRawMode);
-    
+
     // FIXME: Issue diagnostics similar to Lexer.
     if (PP->HandleEndOfFile(Tok, false))
       return;
-    
+
     assert(PPCache && "Raw buffer::LexEndOfFile should return a token");
     return PPCache->Lex(Tok);
   }
-  
+
   if (TKind == tok::hash && Tok.isAtStartOfLine()) {
     LastHashTokPtr = CurPtr - DISK_TOKEN_SIZE;
     assert(!LexingRawMode);
     PP->HandleDirective(Tok);
-    
+
     if (PP->isCurrentLexer(this))
       goto LexNextToken;
-    
+
     return PP->Lex(Tok);
   }
-  
+
   if (TKind == tok::eom) {
     assert(ParsingPreprocessorDirective);
     ParsingPreprocessorDirective = false;
@@ -154,7 +154,7 @@
   // We assume that if the preprocessor wishes to discard to the end of
   // the line that it also means to end the current preprocessor directive.
   ParsingPreprocessorDirective = false;
-  
+
   // Skip tokens by only peeking at their token kind and the flags.
   // We don't need to actually reconstruct full tokens from the token buffer.
   // This saves some copies and it also reduces IdentifierInfo* lookup.
@@ -163,7 +163,7 @@
     // Read the token kind.  Are we at the end of the file?
     tok::TokenKind x = (tok::TokenKind) (uint8_t) *p;
     if (x == tok::eof) break;
-    
+
     // Read the token flags.  Are we at the start of the next line?
     Token::TokenFlags y = (Token::TokenFlags) (uint8_t) p[1];
     if (y & Token::StartOfLine) break;
@@ -171,7 +171,7 @@
     // Skip to the next token.
     p += DISK_TOKEN_SIZE;
   }
-  
+
   CurPtr = p;
 }
 
@@ -179,18 +179,18 @@
 bool PTHLexer::SkipBlock() {
   assert(CurPPCondPtr && "No cached PP conditional information.");
   assert(LastHashTokPtr && "No known '#' token.");
-  
+
   const unsigned char* HashEntryI = 0;
-  uint32_t Offset; 
+  uint32_t Offset;
   uint32_t TableIdx;
-  
+
   do {
     // Read the token offset from the side-table.
     Offset = ReadLE32(CurPPCondPtr);
-    
-    // Read the target table index from the side-table.    
+
+    // Read the target table index from the side-table.
     TableIdx = ReadLE32(CurPPCondPtr);
-    
+
     // Compute the actual memory address of the '#' token data for this entry.
     HashEntryI = TokBuf + Offset;
 
@@ -208,7 +208,7 @@
       // Read where we should jump to.
       uint32_t TmpOffset = ReadLE32(NextPPCondPtr);
       const unsigned char* HashEntryJ = TokBuf + TmpOffset;
-      
+
       if (HashEntryJ <= LastHashTokPtr) {
         // Jump directly to the next entry in the side table.
         HashEntryI = HashEntryJ;
@@ -218,23 +218,23 @@
       }
     }
   }
-  while (HashEntryI < LastHashTokPtr);  
+  while (HashEntryI < LastHashTokPtr);
   assert(HashEntryI == LastHashTokPtr && "No PP-cond entry found for '#'");
   assert(TableIdx && "No jumping from #endifs.");
-  
+
   // Update our side-table iterator.
   const unsigned char* NextPPCondPtr = PPCond + TableIdx*(sizeof(uint32_t)*2);
   assert(NextPPCondPtr >= CurPPCondPtr);
   CurPPCondPtr = NextPPCondPtr;
-  
+
   // Read where we should jump to.
   HashEntryI = TokBuf + ReadLE32(NextPPCondPtr);
   uint32_t NextIdx = ReadLE32(NextPPCondPtr);
-  
+
   // By construction NextIdx will be zero if this is a #endif.  This is useful
   // to know to obviate lexing another token.
   bool isEndif = NextIdx == 0;
-  
+
   // This case can occur when we see something like this:
   //
   //  #if ...
@@ -243,7 +243,7 @@
   //
   // If we are skipping the first #if block it will be the case that CurPtr
   // already points 'elif'.  Just return.
-  
+
   if (CurPtr > HashEntryI) {
     assert(CurPtr == HashEntryI + DISK_TOKEN_SIZE);
     // Did we reach a #endif?  If so, go ahead and consume that token as well.
@@ -251,13 +251,13 @@
       CurPtr += DISK_TOKEN_SIZE*2;
     else
       LastHashTokPtr = HashEntryI;
-    
+
     return isEndif;
   }
 
   // Otherwise, we need to advance.  Update CurPtr to point to the '#' token.
   CurPtr = HashEntryI;
-  
+
   // Update the location of the last observed '#'.  This is useful if we
   // are skipping multiple blocks.
   LastHashTokPtr = CurPtr;
@@ -265,7 +265,7 @@
   // Skip the '#' token.
   assert(((tok::TokenKind)*CurPtr) == tok::hash);
   CurPtr += DISK_TOKEN_SIZE;
-  
+
   // Did we reach a #endif?  If so, go ahead and consume that token as well.
   if (isEndif) { CurPtr += DISK_TOKEN_SIZE*2; }
 
@@ -297,12 +297,12 @@
 public:
   PTHFileData(uint32_t tokenOff, uint32_t ppCondOff)
     : TokenOff(tokenOff), PPCondOff(ppCondOff) {}
-    
-  uint32_t getTokenOffset() const { return TokenOff; }  
-  uint32_t getPPCondOffset() const { return PPCondOff; }  
+
+  uint32_t getTokenOffset() const { return TokenOff; }
+  uint32_t getPPCondOffset() const { return PPCondOff; }
 };
-  
-  
+
+
 class VISIBILITY_HIDDEN PTHFileLookupCommonTrait {
 public:
   typedef std::pair<unsigned char, const char*> internal_key_type;
@@ -310,84 +310,84 @@
   static unsigned ComputeHash(internal_key_type x) {
     return BernsteinHash(x.second);
   }
-  
+
   static std::pair<unsigned, unsigned>
   ReadKeyDataLength(const unsigned char*& d) {
     unsigned keyLen = (unsigned) ReadUnalignedLE16(d);
     unsigned dataLen = (unsigned) *(d++);
     return std::make_pair(keyLen, dataLen);
   }
-  
+
   static internal_key_type ReadKey(const unsigned char* d, unsigned) {
     unsigned char k = *(d++); // Read the entry kind.
     return std::make_pair(k, (const char*) d);
   }
 };
-  
+
 class VISIBILITY_HIDDEN PTHFileLookupTrait : public PTHFileLookupCommonTrait {
 public:
   typedef const FileEntry* external_key_type;
   typedef PTHFileData      data_type;
-  
+
   static internal_key_type GetInternalKey(const FileEntry* FE) {
     return std::make_pair((unsigned char) 0x1, FE->getName());
   }
 
   static bool EqualKey(internal_key_type a, internal_key_type b) {
     return a.first == b.first && strcmp(a.second, b.second) == 0;
-  }  
-  
-  static PTHFileData ReadData(const internal_key_type& k, 
-                              const unsigned char* d, unsigned) {    
+  }
+
+  static PTHFileData ReadData(const internal_key_type& k,
+                              const unsigned char* d, unsigned) {
     assert(k.first == 0x1 && "Only file lookups can match!");
     uint32_t x = ::ReadUnalignedLE32(d);
     uint32_t y = ::ReadUnalignedLE32(d);
-    return PTHFileData(x, y); 
+    return PTHFileData(x, y);
   }
 };
 
 class VISIBILITY_HIDDEN PTHStringLookupTrait {
 public:
-  typedef uint32_t 
+  typedef uint32_t
           data_type;
 
   typedef const std::pair<const char*, unsigned>
           external_key_type;
 
   typedef external_key_type internal_key_type;
-  
+
   static bool EqualKey(const internal_key_type& a,
                        const internal_key_type& b) {
     return (a.second == b.second) ? memcmp(a.first, b.first, a.second) == 0
                                   : false;
   }
-  
+
   static unsigned ComputeHash(const internal_key_type& a) {
     return BernsteinHash(a.first, a.second);
   }
-  
+
   // This hopefully will just get inlined and removed by the optimizer.
   static const internal_key_type&
   GetInternalKey(const external_key_type& x) { return x; }
-  
+
   static std::pair<unsigned, unsigned>
   ReadKeyDataLength(const unsigned char*& d) {
     return std::make_pair((unsigned) ReadUnalignedLE16(d), sizeof(uint32_t));
   }
-    
+
   static std::pair<const char*, unsigned>
   ReadKey(const unsigned char* d, unsigned n) {
       assert(n >= 2 && d[n-1] == '\0');
       return std::make_pair((const char*) d, n-1);
     }
-    
+
   static uint32_t ReadData(const internal_key_type& k, const unsigned char* d,
                            unsigned) {
     return ::ReadUnalignedLE32(d);
   }
 };
-  
-} // end anonymous namespace  
+
+} // end anonymous namespace
 
 typedef OnDiskChainedHashTable<PTHFileLookupTrait>   PTHFileLookup;
 typedef OnDiskChainedHashTable<PTHStringLookupTrait> PTHStringIdLookup;
@@ -398,7 +398,7 @@
 
 PTHManager::PTHManager(const llvm::MemoryBuffer* buf, void* fileLookup,
                        const unsigned char* idDataTable,
-                       IdentifierInfo** perIDCache, 
+                       IdentifierInfo** perIDCache,
                        void* stringIdLookup, unsigned numIds,
                        const unsigned char* spellingBase,
                        const char* originalSourceFile)
@@ -416,7 +416,7 @@
 
 static void InvalidPTH(Diagnostic *Diags, Diagnostic::Level level,
                        const char* Msg = 0) {
-  if (!Diags) return;  
+  if (!Diags) return;
   if (!Msg) Msg = "Invalid or corrupted PTH file";
   unsigned DiagID = Diags->getCustomDiagID(level, Msg);
   Diags->Report(FullSourceLoc(), DiagID);
@@ -427,7 +427,7 @@
   // Memory map the PTH file.
   llvm::OwningPtr<llvm::MemoryBuffer>
   File(llvm::MemoryBuffer::getFile(file.c_str()));
-  
+
   if (!File) {
     if (Diags) {
       unsigned DiagID = Diags->getCustomDiagID(level,
@@ -437,7 +437,7 @@
 
     return 0;
   }
-  
+
   // Get the buffer ranges and check if there are at least three 32-bit
   // words at the end of the file.
   const unsigned char* BufBeg = (unsigned char*)File->getBufferStart();
@@ -449,54 +449,54 @@
     InvalidPTH(Diags, level);
     return 0;
   }
-  
+
   // Read the PTH version.
   const unsigned char *p = BufBeg + (sizeof("cfe-pth") - 1);
   unsigned Version = ReadLE32(p);
-  
+
   if (Version != PTHManager::Version) {
     InvalidPTH(Diags, level,
-        Version < PTHManager::Version 
+        Version < PTHManager::Version
         ? "PTH file uses an older PTH format that is no longer supported"
         : "PTH file uses a newer PTH format that cannot be read");
     return 0;
   }
 
-  // Compute the address of the index table at the end of the PTH file.  
+  // Compute the address of the index table at the end of the PTH file.
   const unsigned char *PrologueOffset = p;
-  
+
   if (PrologueOffset >= BufEnd) {
     InvalidPTH(Diags, level);
     return 0;
   }
-  
+
   // Construct the file lookup table.  This will be used for mapping from
   // FileEntry*'s to cached tokens.
   const unsigned char* FileTableOffset = PrologueOffset + sizeof(uint32_t)*2;
   const unsigned char* FileTable = BufBeg + ReadLE32(FileTableOffset);
-  
+
   if (!(FileTable > BufBeg && FileTable < BufEnd)) {
     InvalidPTH(Diags, level);
     return 0; // FIXME: Proper error diagnostic?
   }
-  
+
   llvm::OwningPtr<PTHFileLookup> FL(PTHFileLookup::Create(FileTable, BufBeg));
-  
+
   // Warn if the PTH file is empty.  We still want to create a PTHManager
   // as the PTH could be used with -include-pth.
   if (FL->isEmpty())
     InvalidPTH(Diags, level, "PTH file contains no cached source data");
-  
+
   // Get the location of the table mapping from persistent ids to the
   // data needed to reconstruct identifiers.
   const unsigned char* IDTableOffset = PrologueOffset + sizeof(uint32_t)*0;
   const unsigned char* IData = BufBeg + ReadLE32(IDTableOffset);
-  
+
   if (!(IData >= BufBeg && IData < BufEnd)) {
     InvalidPTH(Diags, level);
     return 0;
   }
-  
+
   // Get the location of the hashtable mapping between strings and
   // persistent IDs.
   const unsigned char* StringIdTableOffset = PrologueOffset + sizeof(uint32_t)*1;
@@ -508,7 +508,7 @@
 
   llvm::OwningPtr<PTHStringIdLookup> SL(PTHStringIdLookup::Create(StringIdTable,
                                                                   BufBeg));
-  
+
   // Get the location of the spelling cache.
   const unsigned char* spellingBaseOffset = PrologueOffset + sizeof(uint32_t)*3;
   const unsigned char* spellingBase = BufBeg + ReadLE32(spellingBaseOffset);
@@ -516,19 +516,19 @@
     InvalidPTH(Diags, level);
     return 0;
   }
-  
+
   // Get the number of IdentifierInfos and pre-allocate the identifier cache.
   uint32_t NumIds = ReadLE32(IData);
-  
+
   // Pre-allocate the peristent ID -> IdentifierInfo* cache.  We use calloc()
   // so that we in the best case only zero out memory once when the OS returns
   // us new pages.
   IdentifierInfo** PerIDCache = 0;
-  
+
   if (NumIds) {
-    PerIDCache = (IdentifierInfo**)calloc(NumIds, sizeof(*PerIDCache));  
+    PerIDCache = (IdentifierInfo**)calloc(NumIds, sizeof(*PerIDCache));
     if (!PerIDCache) {
-      InvalidPTH(Diags, level, 
+      InvalidPTH(Diags, level,
                  "Could not allocate memory for processing PTH file");
       return 0;
     }
@@ -537,8 +537,8 @@
   // Compute the address of the original source file.
   const unsigned char* originalSourceBase = PrologueOffset + sizeof(uint32_t)*4;
   unsigned len = ReadUnalignedLE16(originalSourceBase);
-  if (!len) originalSourceBase = 0;  
-  
+  if (!len) originalSourceBase = 0;
+
   // Create the new PTHManager.
   return new PTHManager(File.take(), FL.take(), IData, PerIDCache,
                         SL.take(), NumIds, spellingBase,
@@ -551,7 +551,7 @@
   const unsigned char* IDData =
     (const unsigned char*)Buf->getBufferStart() + ReadLE32(TableEntry);
   assert(IDData < (const unsigned char*)Buf->getBufferEnd());
-  
+
   // Allocate the object.
   std::pair<IdentifierInfo,const unsigned char*> *Mem =
     Alloc.Allocate<std::pair<IdentifierInfo,const unsigned char*> >();
@@ -559,7 +559,7 @@
   Mem->second = IDData;
   assert(IDData[0] != '\0');
   IdentifierInfo *II = new ((void*) Mem) IdentifierInfo();
-  
+
   // Store the new IdentifierInfo in the cache.
   PerIDCache[PersistentID] = II;
   assert(II->getName() && II->getName()[0] != '\0');
@@ -584,18 +584,18 @@
   const FileEntry *FE = PP->getSourceManager().getFileEntryForID(FID);
   if (!FE)
     return 0;
-  
+
   // Lookup the FileEntry object in our file lookup data structure.  It will
   // return a variant that indicates whether or not there is an offset within
   // the PTH file that contains cached tokens.
   PTHFileLookup& PFL = *((PTHFileLookup*)FileLookup);
   PTHFileLookup::iterator I = PFL.find(FE);
-  
+
   if (I == PFL.end()) // No tokens available?
     return 0;
-  
-  const PTHFileData& FileData = *I;  
-  
+
+  const PTHFileData& FileData = *I;
+
   const unsigned char *BufStart = (const unsigned char *)Buf->getBufferStart();
   // Compute the offset of the token data within the buffer.
   const unsigned char* data = BufStart + FileData.getTokenOffset();
@@ -604,9 +604,9 @@
   const unsigned char* ppcond = BufStart + FileData.getPPCondOffset();
   uint32_t Len = ReadLE32(ppcond);
   if (Len == 0) ppcond = 0;
-  
+
   assert(PP && "No preprocessor set yet!");
-  return new PTHLexer(*PP, FID, data, ppcond, *this); 
+  return new PTHLexer(*PP, FID, data, ppcond, *this);
 }
 
 //===----------------------------------------------------------------------===//
@@ -622,19 +622,19 @@
   const mode_t mode;
   const time_t mtime;
   const off_t size;
-  
+
   PTHStatData(ino_t i, dev_t d, mode_t mo, time_t m, off_t s)
-  : hasStat(true), ino(i), dev(d), mode(mo), mtime(m), size(s) {}  
-  
+  : hasStat(true), ino(i), dev(d), mode(mo), mtime(m), size(s) {}
+
   PTHStatData()
     : hasStat(false), ino(0), dev(0), mode(0), mtime(0), size(0) {}
 };
-  
+
 class VISIBILITY_HIDDEN PTHStatLookupTrait : public PTHFileLookupCommonTrait {
 public:
   typedef const char* external_key_type;  // const char*
   typedef PTHStatData data_type;
-    
+
   static internal_key_type GetInternalKey(const char *path) {
     // The key 'kind' doesn't matter here because it is ignored in EqualKey.
     return std::make_pair((unsigned char) 0x0, path);
@@ -644,17 +644,17 @@
     // When doing 'stat' lookups we don't care about the kind of 'a' and 'b',
     // just the paths.
     return strcmp(a.second, b.second) == 0;
-  }  
-  
+  }
+
   static data_type ReadData(const internal_key_type& k, const unsigned char* d,
-                            unsigned) {    
-    
+                            unsigned) {
+
     if (k.first /* File or Directory */) {
       if (k.first == 0x1 /* File */) d += 4 * 2; // Skip the first 2 words.
       ino_t ino = (ino_t) ReadUnalignedLE32(d);
       dev_t dev = (dev_t) ReadUnalignedLE32(d);
       mode_t mode = (mode_t) ReadUnalignedLE16(d);
-      time_t mtime = (time_t) ReadUnalignedLE64(d);    
+      time_t mtime = (time_t) ReadUnalignedLE64(d);
       return data_type(ino, dev, mode, mtime, (off_t) ReadUnalignedLE64(d));
     }
 
@@ -667,22 +667,22 @@
   typedef OnDiskChainedHashTable<PTHStatLookupTrait> CacheTy;
   CacheTy Cache;
 
-public:  
+public:
   PTHStatCache(PTHFileLookup &FL) :
     Cache(FL.getNumBuckets(), FL.getNumEntries(), FL.getBuckets(),
           FL.getBase()) {}
 
   ~PTHStatCache() {}
-  
+
   int stat(const char *path, struct stat *buf) {
     // Do the lookup for the file's data in the PTH file.
     CacheTy::iterator I = Cache.find(path);
 
     // If we don't get a hit in the PTH file just forward to 'stat'.
     if (I == Cache.end()) return ::stat(path, buf);
-    
+
     const PTHStatData& Data = *I;
-    
+
     if (!Data.hasStat)
       return 1;
 

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Wed Sep  9 10:08:12 2009
@@ -44,9 +44,9 @@
                                             bool IgnoreNull) const {
   PragmaHandler *NullHandler = 0;
   for (unsigned i = 0, e = Handlers.size(); i != e; ++i) {
-    if (Handlers[i]->getName() == Name) 
+    if (Handlers[i]->getName() == Name)
       return Handlers[i];
-    
+
     if (Handlers[i]->getName() == 0)
       NullHandler = Handlers[i];
   }
@@ -68,14 +68,14 @@
   // Read the 'namespace' that the directive is in, e.g. STDC.  Do not macro
   // expand it, the user can have a STDC #define, that should not affect this.
   PP.LexUnexpandedToken(Tok);
-  
+
   // Get the handler for this token.  If there is no handler, ignore the pragma.
   PragmaHandler *Handler = FindHandler(Tok.getIdentifierInfo(), false);
   if (Handler == 0) {
     PP.Diag(Tok, diag::warn_pragma_ignored);
     return;
   }
-  
+
   // Otherwise, pass it down.
   Handler->HandlePragma(PP, Tok);
 }
@@ -88,11 +88,11 @@
 /// rest of the pragma, passing it to the registered pragma handlers.
 void Preprocessor::HandlePragmaDirective() {
   ++NumPragma;
-  
+
   // Invoke the first level of pragma handlers which reads the namespace id.
   Token Tok;
   PragmaHandlers->HandlePragma(*this, Tok);
-  
+
   // If the pragma handler didn't read the rest of the line, consume it now.
   if (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective)
     DiscardUntilEndOfDirective();
@@ -104,7 +104,7 @@
 void Preprocessor::Handle_Pragma(Token &Tok) {
   // Remember the pragma token location.
   SourceLocation PragmaLoc = Tok.getLocation();
-  
+
   // Read the '('.
   Lex(Tok);
   if (Tok.isNot(tok::l_paren)) {
@@ -118,7 +118,7 @@
     Diag(PragmaLoc, diag::err__Pragma_malformed);
     return;
   }
-  
+
   // Remember the string.
   std::string StrVal = getSpelling(Tok);
 
@@ -128,9 +128,9 @@
     Diag(PragmaLoc, diag::err__Pragma_malformed);
     return;
   }
-  
+
   SourceLocation RParenLoc = Tok.getLocation();
-  
+
   // The _Pragma is lexically sound.  Destringize according to C99 6.10.9.1:
   // "The string literal is destringized by deleting the L prefix, if present,
   // deleting the leading and trailing double-quotes, replacing each escape
@@ -140,14 +140,14 @@
     StrVal.erase(StrVal.begin());
   assert(StrVal[0] == '"' && StrVal[StrVal.size()-1] == '"' &&
          "Invalid string token!");
-  
+
   // Remove the front quote, replacing it with a space, so that the pragma
   // contents appear to have a space before them.
   StrVal[0] = ' ';
-  
+
   // Replace the terminating quote with a \n.
   StrVal[StrVal.size()-1] = '\n';
-  
+
   // Remove escaped quotes and escapes.
   for (unsigned i = 0, e = StrVal.size(); i != e-1; ++i) {
     if (StrVal[i] == '\\' &&
@@ -157,7 +157,7 @@
       --e;
     }
   }
-  
+
   // Plop the string (including the newline and trailing null) into a buffer
   // where we can lex it.
   Token TmpTok;
@@ -174,7 +174,7 @@
 
   // With everything set up, lex this as a #pragma directive.
   HandlePragmaDirective();
-  
+
   // Finally, return whatever came after the pragma directive.
   return Lex(Tok);
 }
@@ -188,7 +188,7 @@
     Diag(OnceTok, diag::pp_pragma_once_in_main_file);
     return;
   }
-  
+
   // Get the current file lexer we're looking at.  Ignore _Pragma 'files' etc.
   // Mark the file as a once-only file now.
   HeaderInfo.MarkFileIncludeOnce(getCurrentFileLexer()->getFileEntry());
@@ -217,27 +217,27 @@
     if (CurPPLexer) CurPPLexer->LexingRawMode = true;
     LexUnexpandedToken(Tok);
     if (CurPPLexer) CurPPLexer->LexingRawMode = false;
-    
+
     // If we reached the end of line, we're done.
     if (Tok.is(tok::eom)) return;
-    
+
     // Can only poison identifiers.
     if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_pp_invalid_poison);
       return;
     }
-    
+
     // Look up the identifier info for the token.  We disabled identifier lookup
     // by saying we're skipping contents, so we need to do this manually.
     IdentifierInfo *II = LookUpIdentifierInfo(Tok);
-    
+
     // Already poisoned.
     if (II->isPoisoned()) continue;
-    
+
     // If this is a macro identifier, emit a warning.
     if (II->hasMacroDefinition())
       Diag(Tok, diag::pp_poisoning_existing_macro);
-    
+
     // Finally, poison it!
     II->setIsPoisoned();
   }
@@ -250,25 +250,25 @@
     Diag(SysHeaderTok, diag::pp_pragma_sysheader_in_main_file);
     return;
   }
-  
+
   // Get the current file lexer we're looking at.  Ignore _Pragma 'files' etc.
   PreprocessorLexer *TheLexer = getCurrentFileLexer();
-  
+
   // Mark the file as a system header.
   HeaderInfo.MarkFileSystemHeader(TheLexer->getFileEntry());
-  
-  
+
+
   PresumedLoc PLoc = SourceMgr.getPresumedLoc(SysHeaderTok.getLocation());
   unsigned FilenameLen = strlen(PLoc.getFilename());
   unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename(),
                                                          FilenameLen);
-  
+
   // Emit a line marker.  This will change any source locations from this point
   // forward to realize they are in a system header.
   // Create a line note with this information.
   SourceMgr.AddLineNote(SysHeaderTok.getLocation(), PLoc.getLine(), FilenameID,
                         false, false, true, false);
-  
+
   // Notify the client, if desired, that we are in a new source file.
   if (Callbacks)
     Callbacks->FileChanged(SysHeaderTok.getLocation(),
@@ -284,11 +284,11 @@
   // If the token kind is EOM, the error has already been diagnosed.
   if (FilenameTok.is(tok::eom))
     return;
-  
+
   // Reserve a buffer to get the spelling.
   llvm::SmallVector<char, 128> FilenameBuffer;
   FilenameBuffer.resize(FilenameTok.getLength());
-  
+
   const char *FilenameStart = &FilenameBuffer[0];
   unsigned Len = getSpelling(FilenameTok, FilenameStart);
   const char *FilenameEnd = FilenameStart+Len;
@@ -298,7 +298,7 @@
   // error.
   if (FilenameStart == 0)
     return;
-  
+
   // Search include directories for this file.
   const DirectoryLookup *CurDir;
   const FileEntry *File = LookupFile(FilenameStart, FilenameEnd,
@@ -308,7 +308,7 @@
       << std::string(FilenameStart, FilenameEnd);
     return;
   }
-  
+
   const FileEntry *CurFile = getCurrentFileLexer()->getFileEntry();
 
   // If this file is older than the file it depends on, emit a diagnostic.
@@ -320,7 +320,7 @@
       Message += getSpelling(DependencyTok) + " ";
       Lex(DependencyTok);
     }
-    
+
     Message.erase(Message.end()-1);
     Diag(FilenameTok, diag::pp_out_of_date_dependency) << Message;
   }
@@ -339,23 +339,23 @@
     Diag(CommentLoc, diag::err_pragma_comment_malformed);
     return;
   }
-  
+
   // Read the identifier.
   Lex(Tok);
   if (Tok.isNot(tok::identifier)) {
     Diag(CommentLoc, diag::err_pragma_comment_malformed);
     return;
   }
-  
+
   // Verify that this is one of the 5 whitelisted options.
   // FIXME: warn that 'exestr' is deprecated.
   const IdentifierInfo *II = Tok.getIdentifierInfo();
-  if (!II->isStr("compiler") && !II->isStr("exestr") && !II->isStr("lib") && 
+  if (!II->isStr("compiler") && !II->isStr("exestr") && !II->isStr("lib") &&
       !II->isStr("linker") && !II->isStr("user")) {
     Diag(Tok.getLocation(), diag::err_pragma_comment_unknown_kind);
     return;
   }
-  
+
   // Read the optional string if present.
   Lex(Tok);
   std::string ArgumentString;
@@ -390,13 +390,13 @@
     ArgumentString = std::string(Literal.GetString(),
                                  Literal.GetString()+Literal.GetStringLength());
   }
-  
+
   // FIXME: If the kind is "compiler" warn if the string is present (it is
   // ignored).
   // FIXME: 'lib' requires a comment string.
   // FIXME: 'linker' requires a comment string, and has a specific list of
   // things that are allowable.
-  
+
   if (Tok.isNot(tok::r_paren)) {
     Diag(Tok.getLocation(), diag::err_pragma_comment_malformed);
     return;
@@ -407,7 +407,7 @@
     Diag(Tok.getLocation(), diag::err_pragma_comment_malformed);
     return;
   }
-  
+
   // If the pragma is lexically sound, notify any interested PPCallbacks.
   if (Callbacks)
     Callbacks->PragmaComment(CommentLoc, II, ArgumentString);
@@ -419,14 +419,14 @@
 /// AddPragmaHandler - Add the specified pragma handler to the preprocessor.
 /// If 'Namespace' is non-null, then it is a token required to exist on the
 /// pragma line before the pragma string starts, e.g. "STDC" or "GCC".
-void Preprocessor::AddPragmaHandler(const char *Namespace, 
+void Preprocessor::AddPragmaHandler(const char *Namespace,
                                     PragmaHandler *Handler) {
   PragmaNamespace *InsertNS = PragmaHandlers;
-  
+
   // If this is specified to be in a namespace, step down into it.
   if (Namespace) {
     IdentifierInfo *NSID = getIdentifierInfo(Namespace);
-    
+
     // If there is already a pragma handler with the name of this namespace,
     // we either have an error (directive with the same name as a namespace) or
     // we already have the namespace to insert into.
@@ -441,7 +441,7 @@
       PragmaHandlers->AddPragma(InsertNS);
     }
   }
-  
+
   // Check to make sure we don't already have a pragma for this identifier.
   assert(!InsertNS->FindHandler(Handler->getName()) &&
          "Pragma handler already exists for this identifier!");
@@ -455,7 +455,7 @@
 void Preprocessor::RemovePragmaHandler(const char *Namespace,
                                        PragmaHandler *Handler) {
   PragmaNamespace *NS = PragmaHandlers;
-  
+
   // If this is specified to be in a namespace, step down into it.
   if (Namespace) {
     IdentifierInfo *NSID = getIdentifierInfo(Namespace);
@@ -467,7 +467,7 @@
   }
 
   NS->RemovePragmaHandler(Handler);
-  
+
   // If this is a non-default namespace and it is now empty, remove
   // it.
   if (NS != PragmaHandlers && NS->IsEmpty())
@@ -516,7 +516,7 @@
     PP.HandlePragmaDependency(DepToken);
   }
 };
-  
+
 /// PragmaDiagnosticHandler - e.g. '#pragma GCC diagnostic ignored "-Wformat"'
 /// Since clang's diagnostic supports extended functionality beyond GCC's
 /// the constructor takes a clangMode flag to tell it whether or not to allow
@@ -538,7 +538,7 @@
       return;
     }
     IdentifierInfo *II = Tok.getIdentifierInfo();
-    
+
     diag::Mapping Map;
     if (II->isStr("warning"))
       Map = diag::MAP_WARNING;
@@ -550,14 +550,14 @@
       Map = diag::MAP_FATAL;
     else if (ClangMode) {
       if (II->isStr("pop")) {
-        if(!PP.getDiagnostics().popMappings())
+        if (!PP.getDiagnostics().popMappings())
           PP.Diag(Tok, diag::warn_pragma_diagnostic_clang_cannot_ppp);
         return;
       }
 
       if (II->isStr("push")) {
         PP.getDiagnostics().pushMappings();
-				return;
+        return;
       }
 
       PP.Diag(Tok, diag::warn_pragma_diagnostic_clang_invalid);
@@ -566,7 +566,7 @@
       PP.Diag(Tok, diag::warn_pragma_diagnostic_gcc_invalid);
       return;
     }
-    
+
     PP.LexUnexpandedToken(Tok);
 
     // We need at least one string.
@@ -574,7 +574,7 @@
       PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token);
       return;
     }
-    
+
     // String concatenation allows multiple strings, which can even come from
     // macro expansion.
     // "foo " "bar" "Baz"
@@ -583,12 +583,12 @@
       StrToks.push_back(Tok);
       PP.LexUnexpandedToken(Tok);
     }
-    
+
     if (Tok.isNot(tok::eom)) {
       PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token);
       return;
     }
-    
+
     // Concatenate and parse the strings.
     StringLiteralParser Literal(&StrToks[0], StrToks.size(), PP);
     assert(!Literal.AnyWide && "Didn't allow wide strings in");
@@ -610,14 +610,14 @@
               diag::warn_pragma_diagnostic_invalid_option);
       return;
     }
-    
+
     if (PP.getDiagnostics().setDiagnosticGroupMapping(WarningName.c_str()+2,
                                                       Map))
       PP.Diag(StrToks[0].getLocation(),
               diag::warn_pragma_diagnostic_unknown_warning) << WarningName;
   }
 };
-  
+
 /// PragmaCommentHandler - "#pragma comment ...".
 struct PragmaCommentHandler : public PragmaHandler {
   PragmaCommentHandler(const IdentifierInfo *ID) : PragmaHandler(ID) {}
@@ -625,13 +625,13 @@
     PP.HandlePragmaComment(CommentTok);
   }
 };
-  
+
 // Pragma STDC implementations.
 
 enum STDCSetting {
   STDC_ON, STDC_OFF, STDC_DEFAULT, STDC_INVALID
 };
-  
+
 static STDCSetting LexOnOffSwitch(Preprocessor &PP) {
   Token Tok;
   PP.LexUnexpandedToken(Tok);
@@ -659,7 +659,7 @@
     PP.Diag(Tok, diag::ext_stdc_pragma_syntax_eom);
   return Result;
 }
-  
+
 /// PragmaSTDC_FP_CONTRACTHandler - "#pragma STDC FP_CONTRACT ...".
 struct PragmaSTDC_FP_CONTRACTHandler : public PragmaHandler {
   PragmaSTDC_FP_CONTRACTHandler(const IdentifierInfo *ID) : PragmaHandler(ID) {}
@@ -671,7 +671,7 @@
     LexOnOffSwitch(PP);
   }
 };
-  
+
 /// PragmaSTDC_FENV_ACCESSHandler - "#pragma STDC FENV_ACCESS ...".
 struct PragmaSTDC_FENV_ACCESSHandler : public PragmaHandler {
   PragmaSTDC_FENV_ACCESSHandler(const IdentifierInfo *ID) : PragmaHandler(ID) {}
@@ -680,7 +680,7 @@
       PP.Diag(Tok, diag::warn_stdc_fenv_access_not_supported);
   }
 };
-  
+
 /// PragmaSTDC_CX_LIMITED_RANGEHandler - "#pragma STDC CX_LIMITED_RANGE ...".
 struct PragmaSTDC_CX_LIMITED_RANGEHandler : public PragmaHandler {
   PragmaSTDC_CX_LIMITED_RANGEHandler(const IdentifierInfo *ID)
@@ -689,7 +689,7 @@
     LexOnOffSwitch(PP);
   }
 };
-  
+
 /// PragmaSTDC_UnknownHandler - "#pragma STDC ...".
 struct PragmaSTDC_UnknownHandler : public PragmaHandler {
   PragmaSTDC_UnknownHandler() : PragmaHandler(0) {}
@@ -698,7 +698,7 @@
     PP.Diag(UnknownTok, diag::ext_stdc_pragma_ignored);
   }
 };
-  
+
 }  // end anonymous namespace
 
 
@@ -707,7 +707,7 @@
 void Preprocessor::RegisterBuiltinPragmas() {
   AddPragmaHandler(0, new PragmaOnceHandler(getIdentifierInfo("once")));
   AddPragmaHandler(0, new PragmaMarkHandler(getIdentifierInfo("mark")));
-  
+
   // #pragma GCC ...
   AddPragmaHandler("GCC", new PragmaPoisonHandler(getIdentifierInfo("poison")));
   AddPragmaHandler("GCC", new PragmaSystemHeaderHandler(
@@ -735,7 +735,7 @@
   AddPragmaHandler("STDC", new PragmaSTDC_CX_LIMITED_RANGEHandler(
                                         getIdentifierInfo("CX_LIMITED_RANGE")));
   AddPragmaHandler("STDC", new PragmaSTDC_UnknownHandler());
-  
+
   // MS extensions.
   if (Features.Microsoft)
     AddPragmaHandler(0, new PragmaCommentHandler(getIdentifierInfo("comment")));

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Sep  9 10:08:12 2009
@@ -46,7 +46,7 @@
 PreprocessorFactory::~PreprocessorFactory() {}
 
 Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts,
-                           TargetInfo &target, SourceManager &SM, 
+                           TargetInfo &target, SourceManager &SM,
                            HeaderSearch &Headers,
                            IdentifierInfoLookup* IILookup)
   : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()),
@@ -54,20 +54,20 @@
     BuiltinInfo(Target), CurPPLexer(0), CurDirLookup(0), Callbacks(0) {
   ScratchBuf = new ScratchBuffer(SourceMgr);
   CounterValue = 0; // __COUNTER__ starts at 0.
-      
+
   // Clear stats.
   NumDirectives = NumDefined = NumUndefined = NumPragma = 0;
   NumIf = NumElse = NumEndif = 0;
   NumEnteredSourceFiles = 0;
   NumMacroExpanded = NumFnMacroExpanded = NumBuiltinMacroExpanded = 0;
   NumFastMacroExpanded = NumTokenPaste = NumFastTokenPaste = 0;
-  MaxIncludeStackDepth = 0; 
+  MaxIncludeStackDepth = 0;
   NumSkipped = 0;
 
   // Default to discarding comments.
   KeepComments = false;
   KeepMacroComments = false;
-  
+
   // Macro expansion is enabled.
   DisableMacroExpansion = false;
   InMacroArgs = false;
@@ -78,11 +78,11 @@
   // "Poison" __VA_ARGS__, which can only appear in the expansion of a macro.
   // This gets unpoisoned where it is allowed.
   (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
-  
+
   // Initialize the pragma handlers.
   PragmaHandlers = new PragmaNamespace(0);
   RegisterBuiltinPragmas();
-  
+
   // Initialize builtin macros like __LINE__ and friends.
   RegisterBuiltinMacros();
 }
@@ -106,11 +106,11 @@
     I->second->Destroy(BP);
     I->first->setHasMacroDefinition(false);
   }
-  
+
   // Free any cached macro expanders.
   for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i)
     delete TokenLexerCache[i];
-  
+
   // Release pragma information.
   delete PragmaHandlers;
 
@@ -128,9 +128,9 @@
 void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
   llvm::errs() << tok::getTokenName(Tok.getKind()) << " '"
                << getSpelling(Tok) << "'";
-  
+
   if (!DumpFlags) return;
-  
+
   llvm::errs() << "\t";
   if (Tok.isAtStartOfLine())
     llvm::errs() << " [StartOfLine]";
@@ -143,7 +143,7 @@
     llvm::errs() << " [UnClean='" << std::string(Start, Start+Tok.getLength())
                  << "']";
   }
-  
+
   llvm::errs() << "\tLoc=<";
   DumpLocation(Tok.getLocation());
   llvm::errs() << ">";
@@ -201,10 +201,10 @@
   const char* TokStart = SourceMgr.getCharacterData(Tok.getLocation());
   if (!Tok.needsCleaning())
     return std::string(TokStart, TokStart+Tok.getLength());
-  
+
   std::string Result;
   Result.reserve(Tok.getLength());
-  
+
   // Otherwise, hard case, relex the characters into the string.
   for (const char *Ptr = TokStart, *End = TokStart+Tok.getLength();
        Ptr != End; ) {
@@ -230,7 +230,7 @@
 unsigned Preprocessor::getSpelling(const Token &Tok,
                                    const char *&Buffer) const {
   assert((int)Tok.getLength() >= 0 && "Token character range is bogus!");
-  
+
   // If this token is an identifier, just return the string from the identifier
   // table, which is very quick.
   if (const IdentifierInfo *II = Tok.getIdentifierInfo()) {
@@ -240,10 +240,10 @@
 
   // Otherwise, compute the start of the token in the input lexer buffer.
   const char *TokStart = 0;
-  
+
   if (Tok.isLiteral())
     TokStart = Tok.getLiteralData();
-  
+
   if (TokStart == 0)
     TokStart = SourceMgr.getCharacterData(Tok.getLocation());
 
@@ -252,7 +252,7 @@
     Buffer = TokStart;
     return Tok.getLength();
   }
-  
+
   // Otherwise, hard case, relex the characters into the string.
   char *OutBuf = const_cast<char*>(Buffer);
   for (const char *Ptr = TokStart, *End = TokStart+Tok.getLength();
@@ -263,7 +263,7 @@
   }
   assert(unsigned(OutBuf-Buffer) != Tok.getLength() &&
          "NeedsCleaning flag set on something that didn't need cleaning!");
-  
+
   return OutBuf-Buffer;
 }
 
@@ -273,15 +273,15 @@
 void Preprocessor::CreateString(const char *Buf, unsigned Len, Token &Tok,
                                 SourceLocation InstantiationLoc) {
   Tok.setLength(Len);
-  
+
   const char *DestPtr;
   SourceLocation Loc = ScratchBuf->getToken(Buf, Len, DestPtr);
-  
+
   if (InstantiationLoc.isValid())
     Loc = SourceMgr.createInstantiationLoc(Loc, InstantiationLoc,
                                            InstantiationLoc, Len);
   Tok.setLocation(Loc);
-  
+
   // If this is a literal token, set the pointer data.
   if (Tok.isLiteral())
     Tok.setLiteralData(DestPtr);
@@ -290,19 +290,19 @@
 
 /// AdvanceToTokenCharacter - Given a location that specifies the start of a
 /// token, return a new location that specifies a character within the token.
-SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart, 
+SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
                                                      unsigned CharNo) {
   // Figure out how many physical characters away the specified instantiation
   // character is.  This needs to take into consideration newlines and
   // trigraphs.
   const char *TokPtr = SourceMgr.getCharacterData(TokStart);
-  
+
   // If they request the first char of the token, we're trivially done.
   if (CharNo == 0 && Lexer::isObviouslySimpleCharacter(*TokPtr))
     return TokStart;
-  
+
   unsigned PhysOffset = 0;
-  
+
   // The usual case is that tokens don't contain anything interesting.  Skip
   // over the uninteresting characters.  If a token only consists of simple
   // chars, this method is extremely fast.
@@ -311,7 +311,7 @@
       return TokStart.getFileLocWithOffset(PhysOffset);
     ++TokPtr, --CharNo, ++PhysOffset;
   }
-  
+
   // If we have a character that may be a trigraph or escaped newline, use a
   // lexer to parse it correctly.
   for (; CharNo; --CharNo) {
@@ -320,14 +320,14 @@
     TokPtr += Size;
     PhysOffset += Size;
   }
-  
+
   // Final detail: if we end up on an escaped newline, we want to return the
   // location of the actual byte of the token.  For example foo\<newline>bar
   // advanced by 3 should return the location of b, not of \\.  One compounding
   // detail of this is that the escape may be made by a trigraph.
   if (!Lexer::isObviouslySimpleCharacter(*TokPtr))
     PhysOffset = Lexer::SkipEscapedNewLines(TokPtr)-TokPtr;
-  
+
   return TokStart.getFileLocWithOffset(PhysOffset);
 }
 
@@ -364,33 +364,33 @@
   // information) and predefined macros aren't guaranteed to be set properly.
   assert(NumEnteredSourceFiles == 0 && "Cannot reenter the main file!");
   FileID MainFileID = SourceMgr.getMainFileID();
-  
+
   // Enter the main file source buffer.
   EnterSourceFile(MainFileID, 0);
-  
+
   // Tell the header info that the main file was entered.  If the file is later
   // #imported, it won't be re-entered.
   if (const FileEntry *FE = SourceMgr.getFileEntryForID(MainFileID))
     HeaderInfo.IncrementIncludeCount(FE);
-    
+
   std::vector<char> PrologFile;
   PrologFile.reserve(4080);
-  
+
   // FIXME: Don't make a copy.
   PrologFile.insert(PrologFile.end(), Predefines.begin(), Predefines.end());
-  
+
   // Memory buffer must end with a null byte!
   PrologFile.push_back(0);
 
   // Now that we have emitted the predefined macros, #includes, etc into
   // PrologFile, preprocess it to populate the initial preprocessor state.
-  llvm::MemoryBuffer *SB = 
+  llvm::MemoryBuffer *SB =
     llvm::MemoryBuffer::getMemBufferCopy(&PrologFile.front(),&PrologFile.back(),
                                          "<built-in>");
   assert(SB && "Cannot fail to create predefined source buffer");
   FileID FID = SourceMgr.createFileIDForMemBuffer(SB);
   assert(!FID.isInvalid() && "Could not create FileID for predefines?");
-  
+
   // Start parsing the predefines.
   EnterSourceFile(FID, 0);
 }
@@ -406,7 +406,7 @@
                                                    const char *BufPtr) {
   assert(Identifier.is(tok::identifier) && "Not an identifier!");
   assert(Identifier.getIdentifierInfo() == 0 && "Identinfo already exists!");
-  
+
   // Look up this token, see if it is a macro, or if it is a language keyword.
   IdentifierInfo *II;
   if (BufPtr && !Identifier.needsCleaning()) {
@@ -436,7 +436,7 @@
 void Preprocessor::HandleIdentifier(Token &Identifier) {
   assert(Identifier.getIdentifierInfo() &&
          "Can't handle identifiers without identifier info!");
-  
+
   IdentifierInfo &II = *Identifier.getIdentifierInfo();
 
   // If this identifier was poisoned, and if it was not produced from a macro
@@ -447,7 +447,7 @@
     else
       Diag(Identifier, diag::ext_pp_bad_vaargs_use);
   }
-  
+
   // If this is a macro to be expanded, do it.
   if (MacroInfo *MI = getMacroInfo(&II)) {
     if (!DisableMacroExpansion && !Identifier.isExpandDisabled()) {

Modified: cfe/trunk/lib/Lex/PreprocessorLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PreprocessorLexer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PreprocessorLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PreprocessorLexer.cpp Wed Sep  9 10:08:12 2009
@@ -26,13 +26,13 @@
 
   // We are now parsing a filename!
   ParsingFilename = true;
-  
+
   // Lex the filename.
   IndirectLex(FilenameTok);
 
   // We should have obtained the filename now.
   ParsingFilename = false;
-  
+
   // No filename?
   if (FilenameTok.is(tok::eom))
     PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);

Modified: cfe/trunk/lib/Lex/ScratchBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ScratchBuffer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/ScratchBuffer.cpp (original)
+++ cfe/trunk/lib/Lex/ScratchBuffer.cpp Wed Sep  9 10:08:12 2009
@@ -38,16 +38,16 @@
   // Prefix the token with a \n, so that it looks like it is the first thing on
   // its own virtual line in caret diagnostics.
   CurBuffer[BytesUsed++] = '\n';
-  
+
   // Return a pointer to the character data.
   DestPtr = CurBuffer+BytesUsed;
-  
+
   // Copy the token data into the buffer.
   memcpy(CurBuffer+BytesUsed, Buf, Len);
 
   // Remember that we used these bytes.
   BytesUsed += Len+1;
-  
+
   // Add a NUL terminator to the token.  This keeps the tokens separated, in
   // case they get relexed, and puts them on their own virtual lines in case a
   // diagnostic points to one.
@@ -62,8 +62,8 @@
   // support gigantic tokens, which almost certainly won't happen. :)
   if (RequestLen < ScratchBufSize)
     RequestLen = ScratchBufSize;
-  
-  llvm::MemoryBuffer *Buf = 
+
+  llvm::MemoryBuffer *Buf =
     llvm::MemoryBuffer::getNewMemBuffer(RequestLen, "<scratch space>");
   FileID FID = SourceMgr.createFileIDForMemBuffer(Buf);
   BufferStartLoc = SourceMgr.getLocForStartOfFile(FID);

Modified: cfe/trunk/lib/Lex/TokenConcatenation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenConcatenation.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/TokenConcatenation.cpp (original)
+++ cfe/trunk/lib/Lex/TokenConcatenation.cpp Wed Sep  9 10:08:12 2009
@@ -13,7 +13,7 @@
 
 #include "clang/Lex/TokenConcatenation.h"
 #include "clang/Lex/Preprocessor.h"
-using namespace clang; 
+using namespace clang;
 
 
 /// StartsWithL - Return true if the spelling of this token starts with 'L'.
@@ -22,14 +22,14 @@
     SourceManager &SM = PP.getSourceManager();
     return *SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation())) == 'L';
   }
-  
+
   if (Tok.getLength() < 256) {
     char Buffer[256];
     const char *TokPtr = Buffer;
     PP.getSpelling(Tok, TokPtr);
     return TokPtr[0] == 'L';
   }
-  
+
   return PP.getSpelling(Tok)[0] == 'L';
 }
 
@@ -42,21 +42,21 @@
     SourceManager &SM = PP.getSourceManager();
     return *SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation())) == 'L';
   }
-  
+
   if (Tok.getLength() < 256) {
     char Buffer[256];
     const char *TokPtr = Buffer;
-    if (PP.getSpelling(Tok, TokPtr) != 1) 
+    if (PP.getSpelling(Tok, TokPtr) != 1)
       return false;
     return TokPtr[0] == 'L';
   }
-  
+
   return PP.getSpelling(Tok) == "L";
 }
 
 TokenConcatenation::TokenConcatenation(Preprocessor &pp) : PP(pp) {
   memset(TokenInfo, 0, sizeof(TokenInfo));
-  
+
   // These tokens have custom code in AvoidConcat.
   TokenInfo[tok::identifier      ] |= aci_custom;
   TokenInfo[tok::numeric_constant] |= aci_custom_firstchar;
@@ -72,7 +72,7 @@
   TokenInfo[tok::colon           ] |= aci_custom_firstchar;
   TokenInfo[tok::hash            ] |= aci_custom_firstchar;
   TokenInfo[tok::arrow           ] |= aci_custom_firstchar;
-  
+
   // These tokens change behavior if followed by an '='.
   TokenInfo[tok::amp         ] |= aci_avoid_equal;           // &=
   TokenInfo[tok::plus        ] |= aci_avoid_equal;           // +=
@@ -130,29 +130,29 @@
   // source.  If they were, it must be okay to stick them together: if there
   // were an issue, the tokens would have been lexed differently.
   if (PrevTok.getLocation().isFileID() && Tok.getLocation().isFileID() &&
-      PrevTok.getLocation().getFileLocWithOffset(PrevTok.getLength()) == 
+      PrevTok.getLocation().getFileLocWithOffset(PrevTok.getLength()) ==
         Tok.getLocation())
     return false;
-  
+
   tok::TokenKind PrevKind = PrevTok.getKind();
   if (PrevTok.getIdentifierInfo())  // Language keyword or named operator.
     PrevKind = tok::identifier;
-  
+
   // Look up information on when we should avoid concatenation with prevtok.
   unsigned ConcatInfo = TokenInfo[PrevKind];
-  
+
   // If prevtok never causes a problem for anything after it, return quickly.
   if (ConcatInfo == 0) return false;
-  
+
   if (ConcatInfo & aci_avoid_equal) {
     // If the next token is '=' or '==', avoid concatenation.
     if (Tok.is(tok::equal) || Tok.is(tok::equalequal))
       return true;
     ConcatInfo &= ~aci_avoid_equal;
   }
-  
+
   if (ConcatInfo == 0) return false;
-  
+
   // Basic algorithm: we look at the first character of the second token, and
   // determine whether it, if appended to the first token, would form (or
   // would contribute) to a larger token if concatenated.
@@ -162,10 +162,10 @@
   } else {
     FirstChar = GetFirstChar(PP, Tok);
   }
-    
+
   switch (PrevKind) {
   default: assert(0 && "InitAvoidConcatTokenInfo built wrong");
-  case tok::identifier:   // id+id or id+number or id+L"foo".    
+  case tok::identifier:   // id+id or id+number or id+L"foo".
     // id+'.'... will not append.
     if (Tok.is(tok::numeric_constant))
       return GetFirstChar(PP, Tok) != '.';
@@ -173,18 +173,18 @@
     if (Tok.getIdentifierInfo() || Tok.is(tok::wide_string_literal) /* ||
      Tok.is(tok::wide_char_literal)*/)
       return true;
-    
+
     // If this isn't identifier + string, we're done.
     if (Tok.isNot(tok::char_constant) && Tok.isNot(tok::string_literal))
       return false;
-    
+
     // FIXME: need a wide_char_constant!
-    
+
     // If the string was a wide string L"foo" or wide char L'f', it would
     // concat with the previous identifier into fooL"bar".  Avoid this.
     if (StartsWithL(Tok))
       return true;
-    
+
     // Otherwise, this is a narrow character or string.  If the *identifier*
     // is a literal 'L', avoid pasting L "foo" -> L"foo".
     return IsIdentifierL(PrevTok);

Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Wed Sep  9 10:08:12 2009
@@ -27,11 +27,11 @@
   // If the client is reusing a TokenLexer, make sure to free any memory
   // associated with it.
   destroy();
-  
+
   Macro = PP.getMacroInfo(Tok.getIdentifierInfo());
   ActualArgs = Actuals;
   CurToken = 0;
-  
+
   InstantiateLocStart = Tok.getLocation();
   InstantiateLocEnd = ILEnd;
   AtStartOfLine = Tok.isAtStartOfLine();
@@ -45,7 +45,7 @@
   // Tokens to point to the expanded tokens.
   if (Macro->isFunctionLike() && Macro->getNumArgs())
     ExpandFunctionArguments();
-  
+
   // Mark the macro as currently disabled, so that it is not recursively
   // expanded.  The macro must be disabled only after argument pre-expansion of
   // function-like macro arguments occurs.
@@ -61,7 +61,7 @@
   // If the client is reusing a TokenLexer, make sure to free any memory
   // associated with it.
   destroy();
-  
+
   Macro = 0;
   ActualArgs = 0;
   Tokens = TokArray;
@@ -72,7 +72,7 @@
   InstantiateLocStart = InstantiateLocEnd = SourceLocation();
   AtStartOfLine = false;
   HasLeadingSpace = false;
-      
+
   // Set HasLeadingSpace/AtStartOfLine so that the first token will be
   // returned unmodified.
   if (NumToks != 0) {
@@ -90,7 +90,7 @@
     Tokens = 0;
     OwnsTokens = false;
   }
-  
+
   // TokenLexer owns its formal arguments.
   if (ActualArgs) ActualArgs->destroy();
 }
@@ -99,17 +99,17 @@
 /// return preexpanded tokens from Tokens.
 void TokenLexer::ExpandFunctionArguments() {
   llvm::SmallVector<Token, 128> ResultToks;
-  
+
   // Loop through 'Tokens', expanding them into ResultToks.  Keep
   // track of whether we change anything.  If not, no need to keep them.  If so,
   // we install the newly expanded sequence as the new 'Tokens' list.
   bool MadeChange = false;
-  
+
   // NextTokGetsSpace - When this is true, the next token appended to the
   // output list will get a leading space, regardless of whether it had one to
   // begin with or not.  This is used for placemarker support.
   bool NextTokGetsSpace = false;
-  
+
   for (unsigned i = 0, e = NumTokens; i != e; ++i) {
     // If we found the stringify operator, get the argument stringified.  The
     // preprocessor already verified that the following token is a macro name
@@ -118,7 +118,7 @@
     if (CurTok.is(tok::hash) || CurTok.is(tok::hashat)) {
       int ArgNo = Macro->getArgumentNum(Tokens[i+1].getIdentifierInfo());
       assert(ArgNo != -1 && "Token following # is not an argument?");
-    
+
       Token Res;
       if (CurTok.is(tok::hash))  // Stringify
         Res = ActualArgs->getStringifiedArgument(ArgNo, PP);
@@ -127,19 +127,19 @@
         Res = MacroArgs::StringifyArgument(ActualArgs->getUnexpArgument(ArgNo),
                                            PP, true);
       }
-      
+
       // The stringified/charified string leading space flag gets set to match
       // the #/#@ operator.
       if (CurTok.hasLeadingSpace() || NextTokGetsSpace)
         Res.setFlag(Token::LeadingSpace);
-      
+
       ResultToks.push_back(Res);
       MadeChange = true;
       ++i;  // Skip arg name.
       NextTokGetsSpace = false;
       continue;
     }
-    
+
     // Otherwise, if this is not an argument token, just add the token to the
     // output buffer.
     IdentifierInfo *II = CurTok.getIdentifierInfo();
@@ -154,17 +154,17 @@
       }
       continue;
     }
-      
+
     // An argument is expanded somehow, the result is different than the
     // input.
     MadeChange = true;
 
     // Otherwise, this is a use of the argument.  Find out if there is a paste
     // (##) operator before or after the argument.
-    bool PasteBefore = 
+    bool PasteBefore =
       !ResultToks.empty() && ResultToks.back().is(tok::hashhash);
     bool PasteAfter = i+1 != e && Tokens[i+1].is(tok::hashhash);
-    
+
     // If it is not the LHS/RHS of a ## operator, we must pre-expand the
     // argument and substitute the expanded tokens into the result.  This is
     // C99 6.10.3.1p1.
@@ -178,13 +178,13 @@
         ResultArgToks = &ActualArgs->getPreExpArgument(ArgNo, PP)[0];
       else
         ResultArgToks = ArgTok;  // Use non-preexpanded tokens.
-      
+
       // If the arg token expanded into anything, append it.
       if (ResultArgToks->isNot(tok::eof)) {
         unsigned FirstResult = ResultToks.size();
         unsigned NumToks = MacroArgs::getArgLength(ResultArgToks);
         ResultToks.append(ResultArgToks, ResultArgToks+NumToks);
-      
+
         // If any tokens were substituted from the argument, the whitespace
         // before the first token should match the whitespace of the arg
         // identifier.
@@ -199,7 +199,7 @@
       }
       continue;
     }
-    
+
     // Okay, we have a token that is either the LHS or RHS of a paste (##)
     // argument.  It gets substituted as its non-pre-expanded tokens.
     const Token *ArgToks = ActualArgs->getUnexpArgument(ArgNo);
@@ -217,9 +217,9 @@
         PP.Diag(ResultToks.back().getLocation(), diag::ext_paste_comma);
         ResultToks.pop_back();
       }
-      
+
       ResultToks.append(ArgToks, ArgToks+NumToks);
-      
+
       // If this token (the macro argument) was supposed to get leading
       // whitespace, transfer this information onto the first token of the
       // expansion.
@@ -233,11 +233,11 @@
       if ((CurTok.hasLeadingSpace() || NextTokGetsSpace) &&
           !PasteBefore)
         ResultToks[ResultToks.size()-NumToks].setFlag(Token::LeadingSpace);
-      
+
       NextTokGetsSpace = false;
       continue;
     }
-    
+
     // If an empty argument is on the LHS or RHS of a paste, the standard (C99
     // 6.10.3.3p2,3) calls for a bunch of placemarker stuff to occur.  We
     // implement this by eating ## operators when a LHS or RHS expands to
@@ -250,13 +250,13 @@
       ++i;
       continue;
     }
-    
+
     // If this is on the RHS of a paste operator, we've already copied the
     // paste operator to the ResultToks list.  Remove it.
     assert(PasteBefore && ResultToks.back().is(tok::hashhash));
     NextTokGetsSpace |= ResultToks.back().hasLeadingSpace();
     ResultToks.pop_back();
-    
+
     // If this is the __VA_ARGS__ token, and if the argument wasn't provided,
     // and if the macro had at least one real argument, and if the token before
     // the ## was a comma, remove the comma.
@@ -271,7 +271,7 @@
     }
     continue;
   }
-  
+
   // If anything changed, install this as the new Tokens list.
   if (MadeChange) {
     assert(!OwnsTokens && "This would leak if we already own the token list");
@@ -284,7 +284,7 @@
     if (NumTokens)
       memcpy(Res, &ResultToks[0], NumTokens*sizeof(Token));
     Tokens = Res;
-    
+
     // The preprocessor bump pointer owns these tokens, not us.
     OwnsTokens = false;
   }
@@ -309,16 +309,16 @@
     // whatever is next.
     return PPCache.Lex(Tok);
   }
-  
+
   // If this is the first token of the expanded result, we inherit spacing
   // properties later.
   bool isFirstToken = CurToken == 0;
-  
+
   // Get the next token to return.
   Tok = Tokens[CurToken++];
-  
+
   bool TokenIsFromPaste = false;
-  
+
   // If this token is followed by a token paste (##) operator, paste the tokens!
   if (!isAtEnd() && Tokens[CurToken].is(tok::hashhash)) {
     if (PasteTokens(Tok)) {
@@ -328,7 +328,7 @@
     } else {
       TokenIsFromPaste = true;
     }
-  }   
+  }
 
   // The token's current location indicate where the token was lexed from.  We
   // need this information to compute the spelling of the token, but any
@@ -337,26 +337,26 @@
   // that captures all of this.
   if (InstantiateLocStart.isValid()) {   // Don't do this for token streams.
     SourceManager &SM = PP.getSourceManager();
-    Tok.setLocation(SM.createInstantiationLoc(Tok.getLocation(), 
+    Tok.setLocation(SM.createInstantiationLoc(Tok.getLocation(),
                                               InstantiateLocStart,
                                               InstantiateLocEnd,
                                               Tok.getLength()));
   }
-  
+
   // If this is the first token, set the lexical properties of the token to
   // match the lexical properties of the macro identifier.
   if (isFirstToken) {
     Tok.setFlagValue(Token::StartOfLine , AtStartOfLine);
     Tok.setFlagValue(Token::LeadingSpace, HasLeadingSpace);
   }
-  
+
   // Handle recursive expansion!
   if (!Tok.isAnnotation() && Tok.getIdentifierInfo() != 0) {
     // Change the kind of this identifier to the appropriate token kind, e.g.
     // turning "for" into a keyword.
     IdentifierInfo *II = Tok.getIdentifierInfo();
     Tok.setKind(II->getTokenID());
-    
+
     // If this identifier was poisoned and from a paste, emit an error.  This
     // won't be handled by Preprocessor::HandleIdentifier because this is coming
     // from a macro expansion.
@@ -367,7 +367,7 @@
       else
         PP.Diag(Tok, diag::err_pp_used_poisoned_id);
     }
-    
+
     if (!DisableMacroExpansion && II->isHandleIdentifierCase())
       PP.HandleIdentifier(Tok);
   }
@@ -387,33 +387,33 @@
     SourceLocation PasteOpLoc = Tokens[CurToken].getLocation();
     ++CurToken;
     assert(!isAtEnd() && "No token on the RHS of a paste operator!");
-  
+
     // Get the RHS token.
     const Token &RHS = Tokens[CurToken];
-  
+
     // Allocate space for the result token.  This is guaranteed to be enough for
     // the two tokens.
     Buffer.resize(Tok.getLength() + RHS.getLength());
-    
+
     // Get the spelling of the LHS token in Buffer.
     const char *BufPtr = &Buffer[0];
     unsigned LHSLen = PP.getSpelling(Tok, BufPtr);
     if (BufPtr != &Buffer[0])   // Really, we want the chars in Buffer!
       memcpy(&Buffer[0], BufPtr, LHSLen);
-    
+
     BufPtr = &Buffer[LHSLen];
     unsigned RHSLen = PP.getSpelling(RHS, BufPtr);
     if (BufPtr != &Buffer[LHSLen])   // Really, we want the chars in Buffer!
       memcpy(&Buffer[LHSLen], BufPtr, RHSLen);
-    
+
     // Trim excess space.
     Buffer.resize(LHSLen+RHSLen);
-    
+
     // Plop the pasted result (including the trailing newline and null) into a
     // scratch buffer where we can lex it.
     Token ResultTokTmp;
     ResultTokTmp.startToken();
-    
+
     // Claim that the tmp token is a string_literal so that we can get the
     // character pointer back from CreateString.
     ResultTokTmp.setKind(tok::string_literal);
@@ -423,7 +423,7 @@
 
     // Lex the resultant pasted token into Result.
     Token Result;
-    
+
     if (Tok.is(tok::identifier) && RHS.is(tok::identifier)) {
       // Common paste case: identifier+identifier = identifier.  Avoid creating
       // a lexer and other overhead.
@@ -434,42 +434,42 @@
       Result.setLength(LHSLen+RHSLen);
     } else {
       PP.IncrementPasteCounter(false);
-      
+
       assert(ResultTokLoc.isFileID() &&
              "Should be a raw location into scratch buffer");
       SourceManager &SourceMgr = PP.getSourceManager();
       FileID LocFileID = SourceMgr.getFileID(ResultTokLoc);
-      
+
       const char *ScratchBufStart = SourceMgr.getBufferData(LocFileID).first;
-      
+
       // Make a lexer to lex this string from.  Lex just this one token.
       // Make a lexer object so that we lex and expand the paste result.
       Lexer TL(SourceMgr.getLocForStartOfFile(LocFileID),
                PP.getLangOptions(), ScratchBufStart,
                ResultTokStrPtr, ResultTokStrPtr+LHSLen+RHSLen);
-      
+
       // Lex a token in raw mode.  This way it won't look up identifiers
       // automatically, lexing off the end will return an eof token, and
       // warnings are disabled.  This returns true if the result token is the
       // entire buffer.
       bool isInvalid = !TL.LexFromRawLexer(Result);
-      
+
       // If we got an EOF token, we didn't form even ONE token.  For example, we
       // did "/ ## /" to get "//".
       isInvalid |= Result.is(tok::eof);
-    
+
       // If pasting the two tokens didn't form a full new token, this is an
       // error.  This occurs with "x ## +"  and other stuff.  Return with Tok
       // unmodified and with RHS as the next token to lex.
       if (isInvalid) {
         // Test for the Microsoft extension of /##/ turning into // here on the
         // error path.
-        if (PP.getLangOptions().Microsoft && Tok.is(tok::slash) && 
+        if (PP.getLangOptions().Microsoft && Tok.is(tok::slash) &&
             RHS.is(tok::slash)) {
           HandleMicrosoftCommentPaste(Tok);
           return true;
         }
-      
+
         // Do not emit the warning when preprocessing assembler code.
         if (!PP.getLangOptions().AsmPreprocessor) {
           // Explicitly convert the token location to have proper instantiation
@@ -481,26 +481,26 @@
           PP.Diag(Loc, diag::err_pp_bad_paste)
             << std::string(Buffer.begin(), Buffer.end());
         }
-        
+
         // Do not consume the RHS.
         --CurToken;
       }
-    
+
       // Turn ## into 'unknown' to avoid # ## # from looking like a paste
       // operator.
       if (Result.is(tok::hashhash))
         Result.setKind(tok::unknown);
     }
-      
+
     // Transfer properties of the LHS over the the Result.
     Result.setFlagValue(Token::StartOfLine , Tok.isAtStartOfLine());
     Result.setFlagValue(Token::LeadingSpace, Tok.hasLeadingSpace());
-    
+
     // Finally, replace LHS with the result, consume the RHS, and iterate.
     ++CurToken;
     Tok = Result;
   } while (!isAtEnd() && Tokens[CurToken].is(tok::hashhash));
-  
+
   // Now that we got the result token, it will be subject to expansion.  Since
   // token pasting re-lexes the result token in raw mode, identifier information
   // isn't looked up.  As such, if the result is an identifier, look up id info.
@@ -532,11 +532,11 @@
 void TokenLexer::HandleMicrosoftCommentPaste(Token &Tok) {
   // We 'comment out' the rest of this macro by just ignoring the rest of the
   // tokens that have not been lexed yet, if any.
-  
+
   // Since this must be a macro, mark the macro enabled now that it is no longer
   // being expanded.
   assert(Macro && "Token streams can't paste comments");
   Macro->EnableMacro();
-  
+
   PP.HandleMicrosoftCommentPaste(Tok);
 }

Modified: cfe/trunk/lib/Parse/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/AttributeList.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/AttributeList.cpp (original)
+++ cfe/trunk/lib/Parse/AttributeList.cpp Wed Sep  9 10:08:12 2009
@@ -21,7 +21,7 @@
                              AttributeList *n, bool declspec)
   : AttrName(aName), AttrLoc(aLoc), ParmName(pName), ParmLoc(pLoc),
     NumArgs(numArgs), Next(n), DeclspecAttribute(declspec) {
-  
+
   if (numArgs == 0)
     Args = 0;
   else {
@@ -32,12 +32,12 @@
 
 AttributeList::~AttributeList() {
   if (Args) {
-    // FIXME: before we delete the vector, we need to make sure the Expr's 
+    // FIXME: before we delete the vector, we need to make sure the Expr's
     // have been deleted. Since ActionBase::ExprTy is "void", we are dependent
     // on the actions module for actually freeing the memory. The specific
-    // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType, 
-    // ParseField, ParseTag. Once these routines have freed the expression, 
-    // they should zero out the Args slot (to indicate the memory has been 
+    // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType,
+    // ParseField, ParseTag. Once these routines have freed the expression,
+    // they should zero out the Args slot (to indicate the memory has been
     // freed). If any element of the vector is non-null, we should assert.
     delete [] Args;
   }
@@ -54,7 +54,7 @@
     Str += 2;
     Len -= 4;
   }
-  
+
   // FIXME: Hand generating this is neither smart nor efficient.
   switch (Len) {
   case 4:
@@ -103,7 +103,7 @@
     if (!memcmp(Str, "deprecated", 10)) return AT_deprecated;
     if (!memcmp(Str, "visibility", 10)) return AT_visibility;
     if (!memcmp(Str, "destructor", 10)) return AT_destructor;
-    if (!memcmp(Str, "format_arg", 10)) return AT_format_arg; 
+    if (!memcmp(Str, "format_arg", 10)) return AT_format_arg;
     if (!memcmp(Str, "gnu_inline", 10)) return AT_gnu_inline;
     break;
   case 11:
@@ -136,13 +136,13 @@
   case 19:
     if (!memcmp(Str, "ns_returns_retained", 19)) return AT_ns_returns_retained;
     if (!memcmp(Str, "cf_returns_retained", 19)) return AT_cf_returns_retained;
-    break;            
+    break;
   case 20:
     if (!memcmp(Str, "reqd_work_group_size", 20)) return AT_reqd_wg_size;
   case 22:
     if (!memcmp(Str, "no_instrument_function", 22))
       return AT_no_instrument_function;
     break;
-  }  
+  }
   return UnknownAttribute;
 }

Modified: cfe/trunk/lib/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/DeclSpec.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Parse/DeclSpec.cpp Wed Sep  9 10:08:12 2009
@@ -65,7 +65,7 @@
     // parameter list there (in an effort to avoid new/delete traffic).  If it
     // is already used (consider a function returning a function pointer) or too
     // small (function taking too many arguments), go to the heap.
-    if (!TheDeclarator.InlineParamsUsed && 
+    if (!TheDeclarator.InlineParamsUsed &&
         NumArgs <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
       I.Fun.ArgInfo = TheDeclarator.InlineParams;
       I.Fun.DeleteArgInfo = false;
@@ -98,10 +98,10 @@
 
   if (TypeQualifiers != TQ_unspecified)
     Res |= PQ_TypeQualifier;
-  
+
   if (hasTypeSpecifier())
     Res |= PQ_TypeSpecifier;
-  
+
   if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified)
     Res |= PQ_FunctionSpecifier;
   return Res;
@@ -114,7 +114,7 @@
   DiagID = (TNew == TPrev ? diag::ext_duplicate_declspec
             : diag::err_invalid_decl_spec_combination);
   return true;
-} 
+}
 
 const char *DeclSpec::getSpecifierName(DeclSpec::SCS S) {
   switch (S) {
@@ -209,7 +209,7 @@
   return false;
 }
 
-bool DeclSpec::SetStorageClassSpecThread(SourceLocation Loc, 
+bool DeclSpec::SetStorageClassSpecThread(SourceLocation Loc,
                                          const char *&PrevSpec,
                                          unsigned &DiagID) {
   if (SCS_thread_specified) {
@@ -238,7 +238,7 @@
   return false;
 }
 
-bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc, 
+bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc,
                                   const char *&PrevSpec,
                                   unsigned &DiagID) {
   if (TypeSpecComplex != TSC_unspecified)
@@ -248,7 +248,7 @@
   return false;
 }
 
-bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc, 
+bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc,
                                const char *&PrevSpec,
                                unsigned &DiagID) {
   if (TypeSpecSign != TSS_unspecified)
@@ -287,7 +287,7 @@
   if ((TypeQualifiers & T) && !Lang.C99)
     return BadSpecifier(T, T, PrevSpec, DiagID);
   TypeQualifiers |= T;
-  
+
   switch (T) {
   default: assert(0 && "Unknown type qualifier!");
   case TQ_const:    TQ_constLoc = Loc; break;
@@ -380,7 +380,7 @@
     }
     break;
   }
-  
+
   // TODO: if the implementation does not implement _Complex or _Imaginary,
   // disallow their use.  Need information about the backend.
   if (TypeSpecComplex != TSC_unspecified) {
@@ -419,9 +419,9 @@
 
 
   // Okay, now we can infer the real type.
-  
+
   // TODO: return "auto function" and other bad things based on the real type.
-  
+
   // 'data definition has no type or storage class'?
 }
 

Modified: cfe/trunk/lib/Parse/ExtensionRAIIObject.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ExtensionRAIIObject.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ExtensionRAIIObject.h (original)
+++ cfe/trunk/lib/Parse/ExtensionRAIIObject.h Wed Sep  9 10:08:12 2009
@@ -30,7 +30,7 @@
     ExtensionRAIIObject(Diagnostic &diags) : Diags(diags) {
       Diags.IncrementAllExtensionsSilenced();
     }
-    
+
     ~ExtensionRAIIObject() {
       Diags.DecrementAllExtensionsSilenced();
     }

Modified: cfe/trunk/lib/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/MinimalAction.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/lib/Parse/MinimalAction.cpp Wed Sep  9 10:08:12 2009
@@ -34,7 +34,7 @@
                                               SourceLocation IdentLoc,
                                               IdentifierInfo *NamespcName,
                                               AttributeList *AttrList) {
-  
+
   // FIXME: Parser seems to assume that Action::ActOn* takes ownership over
   // passed AttributeList, however other actions don't free it, is it
   // temporary state or bug?
@@ -52,7 +52,7 @@
                                                 OverloadedOperatorKind Op,
                                                 AttributeList *AttrList,
                                                 bool IsTypeName) {
-  
+
   // FIXME: Parser seems to assume that Action::ActOn* takes ownership over
   // passed AttributeList, however other actions don't free it, is it
   // temporary state or bug?
@@ -67,11 +67,11 @@
     OS << ": ";
   }
   OS << Message;
-  
+
   std::string Name = Actions.getDeclName(TheDecl);
   if (!Name.empty())
     OS << " '" << Name << '\'';
-  
+
   OS << '\n';
 }
 
@@ -81,7 +81,7 @@
   struct TypeNameInfo {
     TypeNameInfo *Prev;
     bool isTypeName;
-    
+
     TypeNameInfo(bool istypename, TypeNameInfo *prev) {
       isTypeName = istypename;
       Prev = prev;
@@ -90,13 +90,13 @@
 
   struct TypeNameInfoTable {
     llvm::RecyclingAllocator<llvm::BumpPtrAllocator, TypeNameInfo> Allocator;
-    
+
     void AddEntry(bool isTypename, IdentifierInfo *II) {
       TypeNameInfo *TI = Allocator.Allocate<TypeNameInfo>();
       new (TI) TypeNameInfo(isTypename, II->getFETokenInfo<TypeNameInfo>());
       II->setFETokenInfo(TI);
     }
-    
+
     void DeleteEntry(TypeNameInfo *Entry) {
       Entry->~TypeNameInfo();
       Allocator.Deallocate(Entry);
@@ -108,7 +108,7 @@
   return static_cast<TypeNameInfoTable*>(TP);
 }
 
-MinimalAction::MinimalAction(Preprocessor &pp) 
+MinimalAction::MinimalAction(Preprocessor &pp)
   : Idents(pp.getIdentifierTable()), PP(pp) {
   TypeNameInfoTablePtr = new TypeNameInfoTable();
 }
@@ -127,9 +127,9 @@
     TNIT.AddEntry(true, &Idents.get("__int128_t"));
     TNIT.AddEntry(true, &Idents.get("__uint128_t"));
   }
-  
+
   if (PP.getLangOptions().ObjC1) {
-    // Recognize the ObjC built-in type identifiers as types. 
+    // Recognize the ObjC built-in type identifiers as types.
     TNIT.AddEntry(true, &Idents.get("id"));
     TNIT.AddEntry(true, &Idents.get("SEL"));
     TNIT.AddEntry(true, &Idents.get("Class"));
@@ -159,12 +159,12 @@
   return false;
 }
 
-TemplateNameKind 
+TemplateNameKind
 MinimalAction::isTemplateName(Scope *S,
                               const IdentifierInfo &II,
                               SourceLocation IdLoc,
                               const CXXScopeSpec *SS,
-                              TypeTy *ObjectType,                              
+                              TypeTy *ObjectType,
                               bool EnteringScope,
                               TemplateTy &TemplateDecl) {
   return TNK_Non_template;
@@ -176,10 +176,10 @@
 Action::DeclPtrTy
 MinimalAction::ActOnDeclarator(Scope *S, Declarator &D) {
   IdentifierInfo *II = D.getIdentifier();
-  
+
   // If there is no identifier associated with this declarator, bail out.
   if (II == 0) return DeclPtrTy();
-  
+
   TypeNameInfo *weCurrentlyHaveTypeInfo = II->getFETokenInfo<TypeNameInfo>();
   bool isTypeName =
     D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef;
@@ -190,10 +190,10 @@
   if (weCurrentlyHaveTypeInfo || isTypeName) {
     // Allocate and add the 'TypeNameInfo' "decl".
     getTable(TypeNameInfoTablePtr)->AddEntry(isTypeName, II);
-  
+
     // Remember that this needs to be removed when the scope is popped.
     S->AddDecl(DeclPtrTy::make(II));
-  } 
+  }
   return DeclPtrTy();
 }
 
@@ -212,15 +212,15 @@
   return DeclPtrTy();
 }
 
-/// ActOnForwardClassDeclaration - 
-/// Scope will always be top level file scope. 
+/// ActOnForwardClassDeclaration -
+/// Scope will always be top level file scope.
 Action::DeclPtrTy
 MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                 IdentifierInfo **IdentList, unsigned NumElts) {
   for (unsigned i = 0; i != NumElts; ++i) {
     // Allocate and add the 'TypeNameInfo' "decl".
     getTable(TypeNameInfoTablePtr)->AddEntry(true, IdentList[i]);
-  
+
     // Remember that this needs to be removed when the scope is popped.
     TUScope->AddDecl(DeclPtrTy::make(IdentList[i]));
   }
@@ -231,17 +231,17 @@
 /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field.
 void MinimalAction::ActOnPopScope(SourceLocation Loc, Scope *S) {
   TypeNameInfoTable &Table = *getTable(TypeNameInfoTablePtr);
-  
+
   for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
        I != E; ++I) {
     IdentifierInfo &II = *(*I).getAs<IdentifierInfo>();
     TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>();
     assert(TI && "This decl didn't get pushed??");
-    
+
     if (TI) {
       TypeNameInfo *Next = TI->Prev;
       Table.DeleteEntry(TI);
-      
+
       II.setFETokenInfo(Next);
     }
   }

Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Wed Sep  9 10:08:12 2009
@@ -36,7 +36,7 @@
     // FIXME: Friend templates
     FnD = Actions.ActOnFriendDecl(CurScope, &D, /*IsDefinition*/ true);
   else // FIXME: pass template information through
-    FnD = Actions.ActOnCXXMemberDeclarator(CurScope, AS, D, 
+    FnD = Actions.ActOnCXXMemberDeclarator(CurScope, AS, D,
                                            move(TemplateParams), 0, 0);
 
   HandleMemberFunctionDefaultArgs(D, FnD);
@@ -44,7 +44,7 @@
   // Consume the tokens and store them for later parsing.
 
   getCurrentClass().MethodDefs.push_back(LexedMethod(FnD));
-  getCurrentClass().MethodDefs.back().TemplateScope 
+  getCurrentClass().MethodDefs.back().TemplateScope
     = CurScope->isTemplateParamScope();
   CachedTokens &Toks = getCurrentClass().MethodDefs.back().Toks;
 
@@ -54,7 +54,7 @@
     // Consume everything up to (and including) the left brace.
     if (!ConsumeAndStoreUntil(tok::l_brace, tok::unknown, Toks, tok::semi)) {
       // We didn't find the left-brace we expected after the
-      // constructor initializer. 
+      // constructor initializer.
       if (Tok.is(tok::semi)) {
         // We found a semicolon; complain, consume the semicolon, and
         // don't try to parse this method later.
@@ -66,7 +66,7 @@
     }
 
   } else {
-    // Begin by storing the '{' token. 
+    // Begin by storing the '{' token.
     Toks.push_back(Tok);
     ConsumeBrace();
   }
@@ -100,18 +100,18 @@
 
   for (; !Class.MethodDecls.empty(); Class.MethodDecls.pop_front()) {
     LateParsedMethodDeclaration &LM = Class.MethodDecls.front();
-    
+
     // If this is a member template, introduce the template parameter scope.
     ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
     if (LM.TemplateScope)
       Actions.ActOnReenterTemplateScope(CurScope, LM.Method);
-    
+
     // Start the delayed C++ method declaration
     Actions.ActOnStartDelayedCXXMethodDeclaration(CurScope, LM.Method);
 
     // Introduce the parameters into scope and parse their default
     // arguments.
-    ParseScope PrototypeScope(this, 
+    ParseScope PrototypeScope(this,
                               Scope::FunctionPrototypeScope|Scope::DeclScope);
     for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
       // Introduce the parameter into scope.
@@ -169,7 +169,7 @@
     ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
     if (LM.TemplateScope)
       Actions.ActOnReenterTemplateScope(CurScope, LM.D);
-    
+
     assert(!LM.Toks.empty() && "Empty body!");
     // Append the current token at the end of the new token stream so that it
     // doesn't get lost.
@@ -205,7 +205,7 @@
 
 /// ConsumeAndStoreUntil - Consume and store the token at the passed token
 /// container until the token 'T' is reached (which gets
-/// consumed/stored too, if ConsumeFinalToken). 
+/// consumed/stored too, if ConsumeFinalToken).
 /// If EarlyAbortIf is specified, then we will stop early if we find that
 /// token at the top level.
 /// Returns true if token 'T1' or 'T2' was found.

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Sep  9 10:08:12 2009
@@ -69,10 +69,10 @@
 ///          typespec
 ///          typequal
 ///          storageclass
-///          
+///
 /// FIXME: The GCC grammar/code for this construct implies we need two
-/// token lookahead. Comment from gcc: "If they start with an identifier 
-/// which is followed by a comma or close parenthesis, then the arguments 
+/// token lookahead. Comment from gcc: "If they start with an identifier
+/// which is followed by a comma or close parenthesis, then the arguments
 /// start with that identifier; otherwise they are an expression list."
 ///
 /// At the moment, I am not doing 2 token lookahead. I am also unaware of
@@ -82,9 +82,9 @@
 
 AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
   assert(Tok.is(tok::kw___attribute) && "Not an attribute list!");
-  
+
   AttributeList *CurrAttr = 0;
-  
+
   while (Tok.is(tok::kw___attribute)) {
     ConsumeToken();
     if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
@@ -99,8 +99,8 @@
     // Parse the attribute-list. e.g. __attribute__(( weak, alias("__f") ))
     while (Tok.is(tok::identifier) || isDeclarationSpecifier() ||
            Tok.is(tok::comma)) {
-           
-      if (Tok.is(tok::comma)) { 
+
+      if (Tok.is(tok::comma)) {
         // allows for empty/non-empty attributes. ((__vector_size__(16),,,,))
         ConsumeToken();
         continue;
@@ -108,26 +108,26 @@
       // we have an identifier or declaration specifier (const, int, etc.)
       IdentifierInfo *AttrName = Tok.getIdentifierInfo();
       SourceLocation AttrNameLoc = ConsumeToken();
-      
+
       // check if we have a "paramterized" attribute
       if (Tok.is(tok::l_paren)) {
         ConsumeParen(); // ignore the left paren loc for now
-        
+
         if (Tok.is(tok::identifier)) {
           IdentifierInfo *ParmName = Tok.getIdentifierInfo();
           SourceLocation ParmLoc = ConsumeToken();
-          
-          if (Tok.is(tok::r_paren)) { 
+
+          if (Tok.is(tok::r_paren)) {
             // __attribute__(( mode(byte) ))
             ConsumeParen(); // ignore the right paren loc for now
-            CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
+            CurrAttr = new AttributeList(AttrName, AttrNameLoc,
                                          ParmName, ParmLoc, 0, 0, CurrAttr);
           } else if (Tok.is(tok::comma)) {
             ConsumeToken();
             // __attribute__(( format(printf, 1, 2) ))
             ExprVector ArgExprs(Actions);
             bool ArgExprsOk = true;
-            
+
             // now parse the non-empty comma separated list of expressions
             while (1) {
               OwningExprResult ArgExpr(ParseAssignmentExpression());
@@ -144,7 +144,7 @@
             }
             if (ArgExprsOk && Tok.is(tok::r_paren)) {
               ConsumeParen(); // ignore the right paren loc for now
-              CurrAttr = new AttributeList(AttrName, AttrNameLoc, ParmName, 
+              CurrAttr = new AttributeList(AttrName, AttrNameLoc, ParmName,
                            ParmLoc, ArgExprs.take(), ArgExprs.size(), CurrAttr);
             }
           }
@@ -154,7 +154,7 @@
           // parse a possibly empty comma separated list of expressions
             // __attribute__(( nonnull() ))
             ConsumeParen(); // ignore the right paren loc for now
-            CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
+            CurrAttr = new AttributeList(AttrName, AttrNameLoc,
                                          0, SourceLocation(), 0, 0, CurrAttr);
             break;
           case tok::kw_char:
@@ -174,7 +174,7 @@
             // If it's a builtin type name, eat it and expect a rparen
             // __attribute__(( vec_type_hint(char) ))
             ConsumeToken();
-            CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
+            CurrAttr = new AttributeList(AttrName, AttrNameLoc,
                                          0, SourceLocation(), 0, 0, CurrAttr);
             if (Tok.is(tok::r_paren))
               ConsumeParen();
@@ -183,7 +183,7 @@
             // __attribute__(( aligned(16) ))
             ExprVector ArgExprs(Actions);
             bool ArgExprsOk = true;
-            
+
             // now parse the list of expressions
             while (1) {
               OwningExprResult ArgExpr(ParseAssignmentExpression());
@@ -209,7 +209,7 @@
           }
         }
       } else {
-        CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
+        CurrAttr = new AttributeList(AttrName, AttrNameLoc,
                                      0, SourceLocation(), 0, 0, CurrAttr);
       }
     }
@@ -322,7 +322,7 @@
   default:
     return ParseSimpleDeclaration(Context, DeclEnd);
   }
-  
+
   // This routine returns a DeclGroup, if the thing we parsed only contains a
   // single decl, convert it now.
   return Actions.ConvertDeclToDeclGroup(SingleDecl);
@@ -341,7 +341,7 @@
   // Parse the common declaration-specifiers piece.
   DeclSpec DS;
   ParseDeclarationSpecifiers(DS);
-  
+
   // C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
   // declaration-specifiers init-declarator-list[opt] ';'
   if (Tok.is(tok::semi)) {
@@ -349,24 +349,24 @@
     DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(CurScope, DS);
     return Actions.ConvertDeclToDeclGroup(TheDecl);
   }
-  
+
   Declarator DeclaratorInfo(DS, (Declarator::TheContext)Context);
   ParseDeclarator(DeclaratorInfo);
-  
+
   DeclGroupPtrTy DG =
     ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo);
 
   DeclEnd = Tok.getLocation();
-  
+
   // If the client wants to check what comes after the declaration, just return
   // immediately without checking anything!
   if (!RequireSemi) return DG;
-  
+
   if (Tok.is(tok::semi)) {
     ConsumeToken();
     return DG;
   }
-  
+
   Diag(Tok, diag::err_expected_semi_declaration);
   // Skip to end of block or statement
   SkipUntil(tok::r_brace, true, true);
@@ -406,27 +406,27 @@
       SkipUntil(tok::semi, true, true);
       return DeclPtrTy();
     }
-    
+
     D.setAsmLabel(AsmLabel.release());
     D.SetRangeEnd(Loc);
   }
-  
+
   // If attributes are present, parse them.
   if (Tok.is(tok::kw___attribute)) {
     SourceLocation Loc;
     AttributeList *AttrList = ParseAttributes(&Loc);
     D.AddAttributes(AttrList, Loc);
   }
-  
+
   // Inform the current actions module that we just parsed this declarator.
-  DeclPtrTy ThisDecl = TemplateInfo.TemplateParams? 
+  DeclPtrTy ThisDecl = TemplateInfo.TemplateParams?
       Actions.ActOnTemplateDeclarator(CurScope,
                              Action::MultiTemplateParamsArg(Actions,
                                           TemplateInfo.TemplateParams->data(),
                                           TemplateInfo.TemplateParams->size()),
                                     D)
     : Actions.ActOnDeclarator(CurScope, D);
-  
+
   // Parse declarator '=' initializer.
   if (Tok.is(tok::equal)) {
     ConsumeToken();
@@ -467,7 +467,7 @@
                                             CommaLocs.data(), RParenLoc);
     }
   } else {
-    bool TypeContainsUndeducedAuto = 
+    bool TypeContainsUndeducedAuto =
       D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_auto;
     Actions.ActOnUninitializedDecl(ThisDecl, TypeContainsUndeducedAuto);
   }
@@ -492,25 +492,25 @@
   // Declarators may be grouped together ("int X, *Y, Z();"). Remember the decls
   // that we parse together here.
   llvm::SmallVector<DeclPtrTy, 8> DeclsInGroup;
-  
+
   // At this point, we know that it is not a function definition.  Parse the
   // rest of the init-declarator-list.
   while (1) {
     DeclPtrTy ThisDecl = ParseDeclarationAfterDeclarator(D);
     if (ThisDecl.get())
       DeclsInGroup.push_back(ThisDecl);
-    
+
     // If we don't have a comma, it is either the end of the list (a ';') or an
     // error, bail out.
     if (Tok.isNot(tok::comma))
       break;
-    
+
     // Consume the comma.
     ConsumeToken();
-    
+
     // Parse the next declarator.
     D.clear();
-    
+
     // Accept attributes in an init-declarator.  In the first declarator in a
     // declaration, these would be part of the declspec.  In subsequent
     // declarators, they become part of the declarator itself, so that they
@@ -523,10 +523,10 @@
       AttributeList *AttrList = ParseAttributes(&Loc);
       D.AddAttributes(AttrList, Loc);
     }
-    
+
     ParseDeclarator(D);
   }
-  
+
   return Actions.FinalizeDeclaratorGroup(CurScope, D.getDeclSpec(),
                                          DeclsInGroup.data(),
                                          DeclsInGroup.size());
@@ -542,13 +542,13 @@
   /// specifier-qualifier-list is a subset of declaration-specifiers.  Just
   /// parse declaration-specifiers and complain about extra stuff.
   ParseDeclarationSpecifiers(DS);
-  
+
   // Validate declspec for type-name.
   unsigned Specs = DS.getParsedSpecifiers();
   if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers() &&
       !DS.getAttributes())
     Diag(Tok, diag::err_typename_requires_specqual);
-  
+
   // Issue diagnostic and remove storage class if present.
   if (Specs & DeclSpec::PQ_StorageClassSpecifier) {
     if (DS.getStorageClassSpecLoc().isValid())
@@ -557,7 +557,7 @@
       Diag(DS.getThreadSpecLoc(), diag::err_typename_invalid_storageclass);
     DS.ClearStorageClassSpecs();
   }
-  
+
   // Issue diagnostic and remove function specfier if present.
   if (Specs & DeclSpec::PQ_FunctionSpecifier) {
     if (DS.isInlineSpecified())
@@ -608,7 +608,7 @@
                               const ParsedTemplateInfo &TemplateInfo,
                               AccessSpecifier AS) {
   assert(Tok.is(tok::identifier) && "should have identifier");
-  
+
   SourceLocation Loc = Tok.getLocation();
   // If we see an identifier that is not a type name, we normally would
   // parse it as the identifer being declared.  However, when a typename
@@ -623,7 +623,7 @@
   // next token is obviously invalid for a type.  Parse these as a case
   // with an invalid type specifier.
   assert(!DS.hasTypeSpecifier() && "Type specifier checked above");
-  
+
   // Since we know that this either implicit int (which is rare) or an
   // error, we'd do lookahead to try to do better recovery.
   if (isValidAfterIdentifierInDeclarator(NextToken())) {
@@ -632,7 +632,7 @@
     // identifier in the declarator.
     return false;
   }
-  
+
   // Otherwise, if we don't consume this token, we are going to emit an
   // error anyway.  Try to recover from various common problems.  Check
   // to see if this was a reference to a tag name without a tag specified.
@@ -642,7 +642,7 @@
   if (SS == 0) {
     const char *TagName = 0;
     tok::TokenKind TagKind = tok::unknown;
-  
+
     switch (Actions.isTagName(*Tok.getIdentifierInfo(), CurScope)) {
       default: break;
       case DeclSpec::TST_enum:  TagName="enum"  ;TagKind=tok::kw_enum  ;break;
@@ -650,12 +650,12 @@
       case DeclSpec::TST_struct:TagName="struct";TagKind=tok::kw_struct;break;
       case DeclSpec::TST_class: TagName="class" ;TagKind=tok::kw_class ;break;
     }
-  
+
     if (TagName) {
       Diag(Loc, diag::err_use_of_tag_name_without_tag)
         << Tok.getIdentifierInfo() << TagName
         << CodeModificationHint::CreateInsertion(Tok.getLocation(),TagName);
-      
+
       // Parse this as a tag as if the missing tag were present.
       if (TagKind == tok::kw_enum)
         ParseEnumSpecifier(Loc, DS, AS);
@@ -664,20 +664,20 @@
       return true;
     }
   }
-  
+
   // Since this is almost certainly an invalid type name, emit a
   // diagnostic that says it, eat the token, and mark the declspec as
   // invalid.
   SourceRange R;
   if (SS) R = SS->getRange();
-  
+
   Diag(Loc, diag::err_unknown_typename) << Tok.getIdentifierInfo() << R;
   const char *PrevSpec;
   unsigned DiagID;
   DS.SetTypeSpecType(DeclSpec::TST_error, Loc, PrevSpec, DiagID);
   DS.SetRangeEnd(Tok.getLocation());
   ConsumeToken();
-  
+
   // TODO: Could inject an invalid typedef decl in an enclosing scope to
   // avoid rippling error messages on subsequent uses of the same type,
   // could be useful if #include was forgotten.
@@ -719,13 +719,13 @@
     SourceLocation Loc = Tok.getLocation();
 
     switch (Tok.getKind()) {
-    default: 
+    default:
     DoneWithDeclSpec:
       // If this is not a declaration specifier token, we're done reading decl
       // specifiers.  First verify that DeclSpec's are consistent.
       DS.Finish(Diags, PP);
       return;
-        
+
     case tok::coloncolon: // ::foo::bar
       // Annotate C++ scope specifiers.  If we get one, loop.
       if (TryAnnotateCXXScopeToken(true))
@@ -738,13 +738,13 @@
 
       // We are looking for a qualified typename.
       Token Next = NextToken();
-      if (Next.is(tok::annot_template_id) && 
+      if (Next.is(tok::annot_template_id) &&
           static_cast<TemplateIdAnnotation *>(Next.getAnnotationValue())
             ->Kind == TNK_Type_template) {
         // We have a qualified template-id, e.g., N::A<int>
         CXXScopeSpec SS;
         ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true);
-        assert(Tok.is(tok::annot_template_id) && 
+        assert(Tok.is(tok::annot_template_id) &&
                "ParseOptionalCXXScopeSpecifier not working");
         AnnotateTemplateIdTokenAsType(&SS);
         continue;
@@ -771,26 +771,26 @@
       // If the referenced identifier is not a type, then this declspec is
       // erroneous: We already checked about that it has no type specifier, and
       // C++ doesn't have implicit int.  Diagnose it as a typo w.r.t. to the
-      // typename.  
+      // typename.
       if (TypeRep == 0) {
         ConsumeToken();   // Eat the scope spec so the identifier is current.
         if (ParseImplicitInt(DS, &SS, TemplateInfo, AS)) continue;
         goto DoneWithDeclSpec;
       }
-      
+
       ConsumeToken(); // The C++ scope.
 
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typename, Loc, PrevSpec,
                                      DiagID, TypeRep);
       if (isInvalid)
         break;
-      
+
       DS.SetRangeEnd(Tok.getLocation());
       ConsumeToken(); // The typename.
 
       continue;
     }
-        
+
     case tok::annot_typename: {
       if (Tok.getAnnotationValue())
         isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typename, Loc, PrevSpec,
@@ -799,38 +799,38 @@
         DS.SetTypeSpecError();
       DS.SetRangeEnd(Tok.getAnnotationEndLoc());
       ConsumeToken(); // The typename
-      
+
       // Objective-C supports syntax of the form 'id<proto1,proto2>' where 'id'
       // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an
       // Objective-C interface.  If we don't have Objective-C or a '<', this is
       // just a normal reference to a typedef name.
       if (!Tok.is(tok::less) || !getLang().ObjC1)
         continue;
-      
+
       SourceLocation EndProtoLoc;
       llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
       ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
       DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
-      
+
       DS.SetRangeEnd(EndProtoLoc);
       continue;
     }
-        
+
       // typedef-name
     case tok::identifier: {
       // In C++, check to see if this is a scope specifier like foo::bar::, if
       // so handle it as such.  This is important for ctor parsing.
       if (getLang().CPlusPlus && TryAnnotateCXXScopeToken(true))
         continue;
-      
+
       // This identifier can only be a typedef name if we haven't already seen
       // a type-specifier.  Without this check we misparse:
       //  typedef int X; struct Y { short X; };  as 'short int'.
       if (DS.hasTypeSpecifier())
         goto DoneWithDeclSpec;
-      
+
       // It has to be available as a typedef too!
-      TypeTy *TypeRep = Actions.getTypeName(*Tok.getIdentifierInfo(), 
+      TypeTy *TypeRep = Actions.getTypeName(*Tok.getIdentifierInfo(),
                                             Tok.getLocation(), CurScope);
 
       // If this is not a typedef name, don't parse it as part of the declspec,
@@ -844,11 +844,11 @@
       // being defined and the next token is a '(', then this is a
       // constructor declaration. We're done with the decl-specifiers
       // and will treat this token as an identifier.
-      if (getLang().CPlusPlus && 
-          (CurScope->isClassScope() || 
-           (CurScope->isTemplateParamScope() && 
+      if (getLang().CPlusPlus &&
+          (CurScope->isClassScope() ||
+           (CurScope->isTemplateParamScope() &&
             CurScope->getParent()->isClassScope())) &&
-          Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope) && 
+          Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope) &&
           NextToken().getKind() == tok::l_paren)
         goto DoneWithDeclSpec;
 
@@ -856,7 +856,7 @@
                                      DiagID, TypeRep);
       if (isInvalid)
         break;
-      
+
       DS.SetRangeEnd(Tok.getLocation());
       ConsumeToken(); // The identifier
 
@@ -866,12 +866,12 @@
       // just a normal reference to a typedef name.
       if (!Tok.is(tok::less) || !getLang().ObjC1)
         continue;
-      
+
       SourceLocation EndProtoLoc;
       llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
       ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
       DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
-      
+
       DS.SetRangeEnd(EndProtoLoc);
 
       // Need to support trailing type qualifiers (e.g. "id<p> const").
@@ -881,7 +881,7 @@
 
       // type-name
     case tok::annot_template_id: {
-      TemplateIdAnnotation *TemplateId 
+      TemplateIdAnnotation *TemplateId
         = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
       if (TemplateId->Kind != TNK_Type_template) {
         // This template-id does not refer to a type name, so we're
@@ -904,7 +904,7 @@
     case tok::kw___declspec:
       DS.AddAttributes(ParseMicrosoftDeclSpec());
       continue;
-      
+
     // Microsoft single token adornments.
     case tok::kw___forceinline:
       // FIXME: Add handling here!
@@ -958,7 +958,7 @@
     case tok::kw___thread:
       isInvalid = DS.SetStorageClassSpecThread(Loc, PrevSpec, DiagID);
       break;
-          
+
     // function-specifier
     case tok::kw_inline:
       isInvalid = DS.SetFunctionSpecInline(Loc, PrevSpec, DiagID);
@@ -980,7 +980,7 @@
         isInvalid = true;
       }
       break;
-      
+
     // type-specifier
     case tok::kw_short:
       isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_short, Loc, PrevSpec,
@@ -1111,7 +1111,7 @@
       // but we support it.
       if (DS.hasTypeSpecifier() || !getLang().ObjC1)
         goto DoneWithDeclSpec;
-        
+
       {
         SourceLocation EndProtoLoc;
         llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
@@ -1201,7 +1201,7 @@
     if (NextToken().is(tok::kw_new) ||    // ::new
         NextToken().is(tok::kw_delete))   // ::delete
       return false;
-    
+
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
     if (TryAnnotateTypeOrScopeToken())
@@ -1209,7 +1209,7 @@
                                         TemplateInfo);
     // Otherwise, not a type specifier.
     return false;
-      
+
   // simple-type-specifier:
   case tok::annot_typename: {
     if (Tok.getAnnotationValue())
@@ -1219,19 +1219,19 @@
       DS.SetTypeSpecError();
     DS.SetRangeEnd(Tok.getAnnotationEndLoc());
     ConsumeToken(); // The typename
-    
+
     // Objective-C supports syntax of the form 'id<proto1,proto2>' where 'id'
     // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an
     // Objective-C interface.  If we don't have Objective-C or a '<', this is
     // just a normal reference to a typedef name.
     if (!Tok.is(tok::less) || !getLang().ObjC1)
       return true;
-    
+
     SourceLocation EndProtoLoc;
     llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
     ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
     DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
-    
+
     DS.SetRangeEnd(EndProtoLoc);
     return true;
   }
@@ -1342,7 +1342,7 @@
   case tok::kw_decltype:
     ParseDecltypeSpecifier(DS);
     return true;
-      
+
   // C++0x auto support.
   case tok::kw_auto:
     if (!getLang().CPlusPlus0x)
@@ -1400,11 +1400,11 @@
     ConsumeToken();
     return ParseStructDeclaration(DS, Fields);
   }
-  
+
   // Parse the common specifier-qualifiers-list piece.
   SourceLocation DSStart = Tok.getLocation();
   ParseSpecifierQualifierList(DS);
-  
+
   // If there are no declarators, this is a free-standing declaration
   // specifier. Let the actions module cope with it.
   if (Tok.is(tok::semi)) {
@@ -1416,12 +1416,12 @@
   Fields.push_back(FieldDeclarator(DS));
   while (1) {
     FieldDeclarator &DeclaratorInfo = Fields.back();
-    
+
     /// struct-declarator: declarator
     /// struct-declarator: declarator[opt] ':' constant-expression
     if (Tok.isNot(tok::colon))
       ParseDeclarator(DeclaratorInfo.D);
-    
+
     if (Tok.is(tok::colon)) {
       ConsumeToken();
       OwningExprResult Res(ParseConstantExpression());
@@ -1473,9 +1473,9 @@
   PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
                                         PP.getSourceManager(),
                                         "parsing struct/union body");
-  
+
   SourceLocation LBraceLoc = ConsumeBrace();
-  
+
   ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope);
   Actions.ActOnTagStartDefinition(CurScope, TagDecl);
 
@@ -1491,7 +1491,7 @@
   // While we still have something to read, read the declarations in the struct.
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     // Each iteration of this loop reads one struct-declaration.
-    
+
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi)
@@ -1505,7 +1505,7 @@
     FieldDeclarators.clear();
     if (!Tok.is(tok::at)) {
       ParseStructDeclaration(DS, FieldDeclarators);
-      
+
       // Convert them all to fields.
       for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) {
         FieldDeclarator &FD = FieldDeclarators[i];
@@ -1539,12 +1539,12 @@
         continue;
       }
       llvm::SmallVector<DeclPtrTy, 16> Fields;
-      Actions.ActOnDefs(CurScope, TagDecl, Tok.getLocation(), 
+      Actions.ActOnDefs(CurScope, TagDecl, Tok.getLocation(),
                         Tok.getIdentifierInfo(), Fields);
       FieldDecls.insert(FieldDecls.end(), Fields.begin(), Fields.end());
       ConsumeToken();
       ExpectAndConsume(tok::r_paren, diag::err_expected_rparen);
-    } 
+    }
 
     if (Tok.is(tok::semi)) {
       ConsumeToken();
@@ -1557,9 +1557,9 @@
       SkipUntil(tok::r_brace, true, true);
     }
   }
-  
+
   SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
-  
+
   AttributeList *AttrList = 0;
   // If attributes exist after struct contents, parse them.
   if (Tok.is(tok::kw___attribute))
@@ -1607,16 +1607,16 @@
       }
     }
   }
-  
+
   // Must have either 'enum name' or 'enum {...}'.
   if (Tok.isNot(tok::identifier) && Tok.isNot(tok::l_brace)) {
     Diag(Tok, diag::err_expected_ident_lbrace);
-    
+
     // Skip the rest of this declarator, up until the comma or semicolon.
     SkipUntil(tok::comma, true);
     return;
   }
-  
+
   // If an identifier is present, consume and remember it.
   IdentifierInfo *Name = 0;
   SourceLocation NameLoc;
@@ -1624,7 +1624,7 @@
     Name = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
   }
-  
+
   // There are three options here.  If we have 'enum foo;', then this is a
   // forward declaration.  If we have 'enum foo {...' then this is a
   // definition. Otherwise we have something like 'enum foo xyz', a reference.
@@ -1645,10 +1645,10 @@
                                        StartLoc, SS, Name, NameLoc, Attr, AS,
                                        Action::MultiTemplateParamsArg(Actions),
                                        Owned);
-  
+
   if (Tok.is(tok::l_brace))
     ParseEnumBody(StartLoc, TagDecl);
-  
+
   // TODO: semantic analysis on the declspec for enums.
   const char *PrevSpec = 0;
   unsigned DiagID;
@@ -1673,20 +1673,20 @@
   Actions.ActOnTagStartDefinition(CurScope, EnumDecl);
 
   SourceLocation LBraceLoc = ConsumeBrace();
-  
+
   // C does not allow an empty enumerator-list, C++ does [dcl.enum].
   if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
     Diag(Tok, diag::ext_empty_struct_union_enum) << "enum";
-  
+
   llvm::SmallVector<DeclPtrTy, 32> EnumConstantDecls;
 
   DeclPtrTy LastEnumConstDecl;
-  
+
   // Parse the enumerator-list.
   while (Tok.is(tok::identifier)) {
     IdentifierInfo *Ident = Tok.getIdentifierInfo();
     SourceLocation IdentLoc = ConsumeToken();
-    
+
     SourceLocation EqualLoc;
     OwningExprResult AssignedVal(Actions);
     if (Tok.is(tok::equal)) {
@@ -1695,7 +1695,7 @@
       if (AssignedVal.isInvalid())
         SkipUntil(tok::comma, tok::r_brace, true, true);
     }
-    
+
     // Install the enumerator constant into EnumDecl.
     DeclPtrTy EnumConstDecl = Actions.ActOnEnumConstant(CurScope, EnumDecl,
                                                         LastEnumConstDecl,
@@ -1704,18 +1704,18 @@
                                                         AssignedVal.release());
     EnumConstantDecls.push_back(EnumConstDecl);
     LastEnumConstDecl = EnumConstDecl;
-    
+
     if (Tok.isNot(tok::comma))
       break;
     SourceLocation CommaLoc = ConsumeToken();
-    
-    if (Tok.isNot(tok::identifier) && 
+
+    if (Tok.isNot(tok::identifier) &&
         !(getLang().C99 || getLang().CPlusPlus0x))
       Diag(CommaLoc, diag::ext_enumerator_list_comma)
         << getLang().CPlusPlus
         << CodeModificationHint::CreateRemoval((SourceRange(CommaLoc)));
   }
-  
+
   // Eat the }.
   SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
 
@@ -1727,7 +1727,7 @@
   Actions.ActOnEnumBody(StartLoc, LBraceLoc, RBraceLoc, EnumDecl,
                         EnumConstantDecls.data(), EnumConstantDecls.size(),
                         CurScope, Attr);
-  
+
   EnumScope.Exit();
   Actions.ActOnTagFinishDefinition(CurScope, EnumDecl, RBraceLoc);
 }
@@ -1750,7 +1750,7 @@
 bool Parser::isTypeSpecifierQualifier() {
   switch (Tok.getKind()) {
   default: return false;
-      
+
   case tok::identifier:   // foo::bar
   case tok::kw_typename:  // typename T::type
     // Annotate typenames and C++ scope specifiers.  If we get one, just
@@ -1771,12 +1771,12 @@
       return isTypeSpecifierQualifier();
     // Otherwise, not a type specifier.
     return false;
-      
+
     // GNU attributes support.
   case tok::kw___attribute:
     // GNU typeof support.
   case tok::kw_typeof:
-  
+
     // type-specifiers
   case tok::kw_short:
   case tok::kw_long:
@@ -1797,14 +1797,14 @@
   case tok::kw__Decimal32:
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
-    
+
     // struct-or-union-specifier (C99) or class-specifier (C++)
   case tok::kw_class:
   case tok::kw_struct:
   case tok::kw_union:
     // enum-specifier
   case tok::kw_enum:
-    
+
     // type-qualifier
   case tok::kw_const:
   case tok::kw_volatile:
@@ -1813,11 +1813,11 @@
     // typedef-name
   case tok::annot_typename:
     return true;
-      
+
     // GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'.
   case tok::less:
     return getLang().ObjC1;
-  
+
   case tok::kw___cdecl:
   case tok::kw___stdcall:
   case tok::kw___fastcall:
@@ -1832,7 +1832,7 @@
 bool Parser::isDeclarationSpecifier() {
   switch (Tok.getKind()) {
   default: return false;
-    
+
   case tok::identifier:   // foo::bar
     // Unfortunate hack to support "Class.factoryMethod" notation.
     if (getLang().ObjC1 && NextToken().is(tok::period))
@@ -1850,14 +1850,14 @@
     if (NextToken().is(tok::kw_new) ||    // ::new
         NextToken().is(tok::kw_delete))   // ::delete
       return false;
-    
+
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
     if (TryAnnotateTypeOrScopeToken())
       return isDeclarationSpecifier();
     // Otherwise, not a declaration specifier.
     return false;
-      
+
     // storage-class-specifier
   case tok::kw_typedef:
   case tok::kw_extern:
@@ -1866,7 +1866,7 @@
   case tok::kw_auto:
   case tok::kw_register:
   case tok::kw___thread:
-    
+
     // type-specifiers
   case tok::kw_short:
   case tok::kw_long:
@@ -1888,14 +1888,14 @@
   case tok::kw__Decimal32:
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
-  
+
     // struct-or-union-specifier (C99) or class-specifier (C++)
   case tok::kw_class:
   case tok::kw_struct:
   case tok::kw_union:
     // enum-specifier
   case tok::kw_enum:
-    
+
     // type-qualifier
   case tok::kw_const:
   case tok::kw_volatile:
@@ -1911,15 +1911,15 @@
 
     // GNU typeof support.
   case tok::kw_typeof:
-    
+
     // GNU attributes.
   case tok::kw___attribute:
     return true;
-  
+
     // GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'.
   case tok::less:
     return getLang().ObjC1;
-    
+
   case tok::kw___declspec:
   case tok::kw___cdecl:
   case tok::kw___stdcall:
@@ -2035,7 +2035,7 @@
        Tok.is(tok::annot_cxxscope))) {
     CXXScopeSpec SS;
     if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true)) {
-      if(Tok.isNot(tok::star)) {
+      if (Tok.isNot(tok::star)) {
         // The scope spec really belongs to the direct-declarator.
         D.getCXXScopeSpec() = SS;
         if (DirectDeclParser)
@@ -2093,7 +2093,7 @@
                     SourceLocation());
     else
       // Remember that we parsed a Block type, and remember the type-quals.
-      D.AddTypeInfo(DeclaratorChunk::getBlockPointer(DS.getTypeQualifiers(), 
+      D.AddTypeInfo(DeclaratorChunk::getBlockPointer(DS.getTypeQualifiers(),
                                                      Loc, DS.TakeAttributes()),
                     SourceLocation());
   } else {
@@ -2178,10 +2178,10 @@
 ///         qualified-id            [TODO]
 ///
 ///       unqualified-id: [C++ 5.1]
-///         identifier 
+///         identifier
 ///         operator-function-id
 ///         conversion-function-id  [TODO]
-///          '~' class-name         
+///          '~' class-name
 ///         template-id
 ///
 void Parser::ParseDirectDeclarator(Declarator &D) {
@@ -2191,7 +2191,7 @@
     if (D.mayHaveIdentifier()) {
       // ParseDeclaratorInternal might already have parsed the scope.
       bool afterCXXScope = D.getCXXScopeSpec().isSet() ||
-        ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), /*ObjectType=*/0, 
+        ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), /*ObjectType=*/0,
                                        true);
       if (afterCXXScope) {
         // Change the declaration context for name lookup, until this function
@@ -2203,7 +2203,7 @@
         assert(Tok.getIdentifierInfo() && "Not an identifier?");
 
         // If this identifier is the name of the current class, it's a
-        // constructor name. 
+        // constructor name.
         if (!D.getDeclSpec().hasTypeSpecifier() &&
             Actions.isCurrentClassName(*Tok.getIdentifierInfo(),CurScope)) {
           CXXScopeSpec *SS = afterCXXScope? &D.getCXXScopeSpec() : 0;
@@ -2216,7 +2216,7 @@
         ConsumeToken();
         goto PastIdentifier;
       } else if (Tok.is(tok::annot_template_id)) {
-        TemplateIdAnnotation *TemplateId 
+        TemplateIdAnnotation *TemplateId
           = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
 
         // FIXME: Could this template-id name a constructor?
@@ -2305,11 +2305,11 @@
     D.SetIdentifier(0, Tok.getLocation());
     D.setInvalidType(true);
   }
-  
+
  PastIdentifier:
   assert(D.isPastIdentifier() &&
          "Haven't past the location of the identifier yet?");
-  
+
   while (1) {
     if (Tok.is(tok::l_paren)) {
       // The paren may be part of a C++ direct initializer, eg. "int x(1);".
@@ -2333,7 +2333,7 @@
 
 /// ParseParenDeclarator - We parsed the declarator D up to a paren.  This is
 /// only called before the identifier, so these are most likely just grouping
-/// parens for precedence.  If we find that these are actually function 
+/// parens for precedence.  If we find that these are actually function
 /// parameter parens in an abstract-declarator, we call ParseFunctionDeclarator.
 ///
 ///       direct-declarator:
@@ -2347,7 +2347,7 @@
 void Parser::ParseParenDeclarator(Declarator &D) {
   SourceLocation StartLoc = ConsumeParen();
   assert(!D.isPastIdentifier() && "Should be called before passing identifier");
-  
+
   // Eat any attributes before we look at whether this is a grouping or function
   // declarator paren.  If this is a grouping paren, the attribute applies to
   // the type being built up, for example:
@@ -2362,7 +2362,7 @@
   bool RequiresArg = false;
   if (Tok.is(tok::kw___attribute)) {
     AttrList = ParseAttributes();
-    
+
     // We require that the argument list (if this is a non-grouping paren) be
     // present even if the attribute list was empty.
     RequiresArg = true;
@@ -2373,13 +2373,13 @@
        Tok.is(tok::kw___ptr64)) {
     AttrList = ParseMicrosoftTypeAttributes(AttrList);
   }
-  
+
   // If we haven't past the identifier yet (or where the identifier would be
   // stored, if this is an abstract declarator), then this is probably just
   // grouping parens. However, if this could be an abstract-declarator, then
   // this could also be the start of function arguments (consider 'void()').
   bool isGrouping;
-  
+
   if (!D.mayOmitIdentifier()) {
     // If this can't be an abstract-declarator, this *must* be a grouping
     // paren, because we haven't seen the identifier yet.
@@ -2394,7 +2394,7 @@
     // Otherwise, this is a grouping paren, e.g. 'int (*X)' or 'int(X)'.
     isGrouping = true;
   }
-  
+
   // If this is a grouping paren, handle:
   // direct-declarator: '(' declarator ')'
   // direct-declarator: '(' attributes declarator ')'
@@ -2412,7 +2412,7 @@
     D.SetRangeEnd(Loc);
     return;
   }
-  
+
   // Okay, if this wasn't a grouping paren, it must be the start of a function
   // argument list.  Recognize that this declarator will never have an
   // identifier (and remember where it would have been), then call into
@@ -2458,7 +2458,7 @@
                                      bool RequiresArg) {
   // lparen is already consumed!
   assert(D.isPastIdentifier() && "Should not call before identifier!");
-  
+
   // This parameter list may be empty.
   if (Tok.is(tok::r_paren)) {
     if (RequiresArg) {
@@ -2524,9 +2524,9 @@
       return ParseFunctionDeclaratorIdentifierList(LParenLoc, D);
     }
   }
-  
+
   // Finally, a normal, non-empty parameter type list.
-  
+
   // Build up an array of information about the parsed arguments.
   llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
 
@@ -2534,7 +2534,7 @@
   // function prototype scope, including parameter declarators.
   ParseScope PrototypeScope(this,
                             Scope::FunctionPrototypeScope|Scope::DeclScope);
-  
+
   bool IsVariadic = false;
   SourceLocation EllipsisLoc;
   while (1) {
@@ -2543,9 +2543,9 @@
       EllipsisLoc = ConsumeToken();     // Consume the ellipsis.
       break;
     }
-    
+
     SourceLocation DSStart = Tok.getLocation();
-    
+
     // Parse the declaration-specifiers.
     DeclSpec DS;
 
@@ -2555,7 +2555,7 @@
       AttrList = 0;  // Only apply the attributes to the first parameter.
     }
     ParseDeclarationSpecifiers(DS);
-    
+
     // Parse the declarator.  This is "PrototypeContext", because we must
     // accept either 'declarator' or 'abstract-declarator' here.
     Declarator ParmDecl(DS, Declarator::PrototypeContext);
@@ -2567,10 +2567,10 @@
       AttributeList *AttrList = ParseAttributes(&Loc);
       ParmDecl.AddAttributes(AttrList, Loc);
     }
-    
+
     // Remember this parsed parameter in ParamInfo.
     IdentifierInfo *ParmII = ParmDecl.getIdentifier();
-    
+
     // DefArgToks is used when the parsing of default arguments needs
     // to be delayed.
     CachedTokens *DefArgToks = 0;
@@ -2584,7 +2584,7 @@
     } else {
       // Otherwise, we have something.  Add it and let semantic analysis try
       // to grok it and add the result to the ParamInfo we are building.
-      
+
       // Inform the actions module about the parameter declarator, so it gets
       // added to the current scope.
       DeclPtrTy Param = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
@@ -2605,18 +2605,18 @@
           // FIXME: Can we use a smart pointer for Toks?
           DefArgToks = new CachedTokens;
 
-          if (!ConsumeAndStoreUntil(tok::comma, tok::r_paren, *DefArgToks, 
+          if (!ConsumeAndStoreUntil(tok::comma, tok::r_paren, *DefArgToks,
                                     tok::semi, false)) {
             delete DefArgToks;
             DefArgToks = 0;
             Actions.ActOnParamDefaultArgumentError(Param);
           } else
-            Actions.ActOnParamUnparsedDefaultArgument(Param, EqualLoc, 
+            Actions.ActOnParamUnparsedDefaultArgument(Param, EqualLoc,
                                                 (*DefArgToks)[1].getLocation());
         } else {
           // Consume the '='.
           ConsumeToken();
-        
+
           OwningExprResult DefArgResult(ParseAssignmentExpression());
           if (DefArgResult.isInvalid()) {
             Actions.ActOnParamDefaultArgumentError(Param);
@@ -2628,22 +2628,22 @@
           }
         }
       }
-      
-      ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII, 
-                                          ParmDecl.getIdentifierLoc(), Param, 
+
+      ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
+                                          ParmDecl.getIdentifierLoc(), Param,
                                           DefArgToks));
     }
 
     // If the next token is a comma, consume it and keep reading arguments.
     if (Tok.isNot(tok::comma)) break;
-    
+
     // Consume the comma.
     ConsumeToken();
   }
-  
+
   // Leave prototype scope.
   PrototypeScope.Exit();
-  
+
   // If we have the closing ')', eat it.
   SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
   SourceLocation EndLoc = RParenLoc;
@@ -2698,7 +2698,7 @@
   // Build up an array of information about the parsed arguments.
   llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
   llvm::SmallSet<const IdentifierInfo*, 16> ParamsSoFar;
-  
+
   // If there was no identifier specified for the declarator, either we are in
   // an abstract-declarator, or we are in a parameter declarator which was found
   // to be abstract.  In abstract-declarators, identifier lists are not valid:
@@ -2712,13 +2712,13 @@
   ParamInfo.push_back(DeclaratorChunk::ParamInfo(Tok.getIdentifierInfo(),
                                                  Tok.getLocation(),
                                                  DeclPtrTy()));
-  
+
   ConsumeToken();  // eat the first identifier.
-  
+
   while (Tok.is(tok::comma)) {
     // Eat the comma.
     ConsumeToken();
-    
+
     // If this isn't an identifier, report the error and skip until ')'.
     if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_expected_ident);
@@ -2731,7 +2731,7 @@
     // Reject 'typedef int y; int test(x, y)', but continue parsing.
     if (Actions.getTypeName(*ParmII, Tok.getLocation(), CurScope))
       Diag(Tok, diag::err_unexpected_typedef_ident) << ParmII;
-    
+
     // Verify that the argument identifier has not already been mentioned.
     if (!ParamsSoFar.insert(ParmII)) {
       Diag(Tok, diag::err_param_redefinition) << ParmII;
@@ -2741,7 +2741,7 @@
                                                      Tok.getLocation(),
                                                      DeclPtrTy()));
     }
-    
+
     // Eat the identifier.
     ConsumeToken();
   }
@@ -2769,7 +2769,7 @@
 /// [C99]   direct-declarator '[' type-qual-list[opt] '*' ']'
 void Parser::ParseBracketDeclarator(Declarator &D) {
   SourceLocation StartLoc = ConsumeBracket();
-  
+
   // C array syntax has many features, but by-far the most common is [] and [4].
   // This code does a fast path to handle some of the most obvious cases.
   if (Tok.getKind() == tok::r_square) {
@@ -2791,33 +2791,33 @@
     // If there was an error parsing the assignment-expression, recover.
     if (ExprRes.isInvalid())
       ExprRes.release();  // Deallocate expr, just use [].
-    
+
     // Remember that we parsed a array type, and remember its features.
     D.AddTypeInfo(DeclaratorChunk::getArray(0, false, 0, ExprRes.release(),
                                             StartLoc, EndLoc),
                   EndLoc);
     return;
   }
-  
+
   // If valid, this location is the position where we read the 'static' keyword.
   SourceLocation StaticLoc;
   if (Tok.is(tok::kw_static))
     StaticLoc = ConsumeToken();
-  
+
   // If there is a type-qualifier-list, read it now.
   // Type qualifiers in an array subscript are a C99 feature.
   DeclSpec DS;
   ParseTypeQualifierListOpt(DS, false /*no attributes*/);
-  
+
   // If we haven't already read 'static', check to see if there is one after the
   // type-qualifier-list.
   if (!StaticLoc.isValid() && Tok.is(tok::kw_static))
     StaticLoc = ConsumeToken();
-  
+
   // Handle "direct-declarator [ type-qual-list[opt] * ]".
   bool isStar = false;
   OwningExprResult NumElements(Actions);
-  
+
   // Handle the case where we have '[*]' as the array size.  However, a leading
   // star could be the start of an expression, for example 'X[*p + 4]'.  Verify
   // the the token after the star is a ']'.  Since stars in arrays are
@@ -2835,7 +2835,7 @@
     // of assignment-expr.  The only difference is that assignment-expr allows
     // things like '=' and '*='.  Sema rejects these in C89 mode because they
     // are not i-c-e's, so we don't need to distinguish between the two here.
-    
+
     // Parse the constant-expression or assignment-expression now (depending
     // on dialect).
     if (getLang().CPlusPlus)
@@ -2843,7 +2843,7 @@
     else
       NumElements = ParseAssignmentExpression();
   }
-  
+
   // If there was an error parsing the assignment-expression, recover.
   if (NumElements.isInvalid()) {
     D.setInvalidType(true);
@@ -2885,7 +2885,7 @@
     DS.SetRangeEnd(Tok.getLocation());
   else
     DS.SetRangeEnd(CastRange.getEnd());
-  
+
   if (isCastExpr) {
     if (!CastTy) {
       DS.SetTypeSpecError();

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Sep  9 10:08:12 2009
@@ -38,7 +38,7 @@
 ///
 ///       extension-namespace-definition:
 ///         'namespace' original-namespace-name '{' namespace-body '}'
-///  
+///
 ///       namespace-alias-definition:  [C++ 7.3.2: namespace.alias]
 ///         'namespace' identifier '=' qualified-namespace-specifier ';'
 ///
@@ -46,17 +46,17 @@
                                          SourceLocation &DeclEnd) {
   assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
   SourceLocation NamespaceLoc = ConsumeToken();  // eat the 'namespace'.
-  
+
   SourceLocation IdentLoc;
   IdentifierInfo *Ident = 0;
 
   Token attrTok;
-  
+
   if (Tok.is(tok::identifier)) {
     Ident = Tok.getIdentifierInfo();
     IdentLoc = ConsumeToken();  // eat the identifier.
   }
-  
+
   // Read label attributes, if present.
   Action::AttrTy *AttrList = 0;
   if (Tok.is(tok::kw___attribute)) {
@@ -65,20 +65,20 @@
     // FIXME: save these somewhere.
     AttrList = ParseAttributes();
   }
-  
+
   if (Tok.is(tok::equal)) {
     if (AttrList)
       Diag(attrTok, diag::err_unexpected_namespace_attributes_alias);
 
     return ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);
   }
-  
+
   if (Tok.isNot(tok::l_brace)) {
-    Diag(Tok, Ident ? diag::err_expected_lbrace : 
+    Diag(Tok, Ident ? diag::err_expected_lbrace :
          diag::err_expected_ident_lbrace);
     return DeclPtrTy();
   }
-  
+
   SourceLocation LBrace = ConsumeBrace();
 
   // Enter a scope for the namespace.
@@ -90,10 +90,10 @@
   PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
                                         PP.getSourceManager(),
                                         "parsing namespace");
-  
+
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof))
     ParseExternalDeclaration();
-  
+
   // Leave the namespace scope.
   NamespaceScope.Exit();
 
@@ -108,13 +108,13 @@
 /// alias definition.
 ///
 Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
-                                              SourceLocation AliasLoc, 
+                                              SourceLocation AliasLoc,
                                               IdentifierInfo *Alias,
                                               SourceLocation &DeclEnd) {
   assert(Tok.is(tok::equal) && "Not equal token");
-  
+
   ConsumeToken(); // eat the '='.
-  
+
   CXXScopeSpec SS;
   // Parse (optional) nested-name-specifier.
   ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false);
@@ -129,13 +129,13 @@
   // Parse identifier.
   IdentifierInfo *Ident = Tok.getIdentifierInfo();
   SourceLocation IdentLoc = ConsumeToken();
-  
+
   // Eat the ';'.
   DeclEnd = Tok.getLocation();
   ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name,
                    "", tok::semi);
-  
-  return Actions.ActOnNamespaceAliasDef(CurScope, NamespaceLoc, AliasLoc, Alias, 
+
+  return Actions.ActOnNamespaceAliasDef(CurScope, NamespaceLoc, AliasLoc, Alias,
                                         SS, IdentLoc, Ident);
 }
 
@@ -157,18 +157,18 @@
   SourceLocation Loc = ConsumeStringToken();
 
   ParseScope LinkageScope(this, Scope::DeclScope);
-  DeclPtrTy LinkageSpec 
-    = Actions.ActOnStartLinkageSpecification(CurScope, 
+  DeclPtrTy LinkageSpec
+    = Actions.ActOnStartLinkageSpecification(CurScope,
                                              /*FIXME: */SourceLocation(),
                                              Loc, LangBufPtr, StrSize,
-                                       Tok.is(tok::l_brace)? Tok.getLocation() 
+                                       Tok.is(tok::l_brace)? Tok.getLocation()
                                                            : SourceLocation());
 
   if (Tok.isNot(tok::l_brace)) {
     ParseDeclarationOrFunctionDefinition();
-    return Actions.ActOnFinishLinkageSpecification(CurScope, LinkageSpec, 
+    return Actions.ActOnFinishLinkageSpecification(CurScope, LinkageSpec,
                                                    SourceLocation());
-  } 
+  }
 
   SourceLocation LBrace = ConsumeBrace();
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
@@ -230,15 +230,15 @@
     // FIXME: Are there cases, when we would like to call ActOnUsingDirective?
     return DeclPtrTy();
   }
-  
+
   // Parse identifier.
   NamespcName = Tok.getIdentifierInfo();
   IdentLoc = ConsumeToken();
-  
+
   // Parse (optional) attributes (most likely GNU strong-using extension).
   if (Tok.is(tok::kw___attribute))
     AttrList = ParseAttributes();
-  
+
   // Eat ';'.
   DeclEnd = Tok.getLocation();
   ExpectAndConsume(tok::semi,
@@ -284,16 +284,16 @@
   }
   if (Tok.is(tok::annot_template_id)) {
     // C++0x N2914 [namespace.udecl]p5:
-    // A using-declaration shall not name a template-id. 
+    // A using-declaration shall not name a template-id.
     Diag(Tok, diag::err_using_decl_can_not_refer_to_template_spec);
     SkipUntil(tok::semi);
     return DeclPtrTy();
   }
-  
+
   IdentifierInfo *TargetName = 0;
   OverloadedOperatorKind Op = OO_None;
   SourceLocation IdentLoc;
-  
+
   if (Tok.is(tok::kw_operator)) {
     IdentLoc = Tok.getLocation();
 
@@ -315,11 +315,11 @@
     SkipUntil(tok::semi);
     return DeclPtrTy();
   }
-  
+
   // Parse (optional) attributes (most likely GNU strong-using extension).
   if (Tok.is(tok::kw___attribute))
     AttrList = ParseAttributes();
-  
+
   // Eat ';'.
   DeclEnd = Tok.getLocation();
   ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
@@ -338,12 +338,12 @@
 Parser::DeclPtrTy Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
   assert(Tok.is(tok::kw_static_assert) && "Not a static_assert declaration");
   SourceLocation StaticAssertLoc = ConsumeToken();
-  
+
   if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen);
     return DeclPtrTy();
   }
-  
+
   SourceLocation LParenLoc = ConsumeParen();
 
   OwningExprResult AssertExpr(ParseConstantExpression());
@@ -351,7 +351,7 @@
     SkipUntil(tok::semi);
     return DeclPtrTy();
   }
-  
+
   if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "", tok::semi))
     return DeclPtrTy();
 
@@ -360,17 +360,17 @@
     SkipUntil(tok::semi);
     return DeclPtrTy();
   }
-  
+
   OwningExprResult AssertMessage(ParseStringLiteralExpression());
-  if (AssertMessage.isInvalid()) 
+  if (AssertMessage.isInvalid())
     return DeclPtrTy();
 
   MatchRHSPunctuation(tok::r_paren, LParenLoc);
-  
+
   DeclEnd = Tok.getLocation();
   ExpectAndConsume(tok::semi, diag::err_expected_semi_after_static_assert);
 
-  return Actions.ActOnStaticAssertDeclaration(StaticAssertLoc, move(AssertExpr), 
+  return Actions.ActOnStaticAssertDeclaration(StaticAssertLoc, move(AssertExpr),
                                               move(AssertMessage));
 }
 
@@ -383,15 +383,15 @@
 
   SourceLocation StartLoc = ConsumeToken();
   SourceLocation LParenLoc = Tok.getLocation();
-  
-  if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after, 
+
+  if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
                        "decltype")) {
     SkipUntil(tok::r_paren);
     return;
   }
-  
+
   // Parse the expression
-  
+
   // C++0x [dcl.type.simple]p4:
   //   The operand of the decltype specifier is an unevaluated operand.
   EnterExpressionEvaluationContext Unevaluated(Actions,
@@ -401,21 +401,21 @@
     SkipUntil(tok::r_paren);
     return;
   }
-  
+
   // Match the ')'
   SourceLocation RParenLoc;
   if (Tok.is(tok::r_paren))
     RParenLoc = ConsumeParen();
   else
     MatchRHSPunctuation(tok::r_paren, LParenLoc);
-  
+
   if (RParenLoc.isInvalid())
     return;
 
   const char *PrevSpec = 0;
   unsigned DiagID;
   // Check for duplicate type specifiers (e.g. "int decltype(a)").
-  if (DS.SetTypeSpecType(DeclSpec::TST_decltype, StartLoc, PrevSpec, 
+  if (DS.SetTypeSpecType(DeclSpec::TST_decltype, StartLoc, PrevSpec,
                          DiagID, Result.release()))
     Diag(StartLoc, DiagID) << PrevSpec;
 }
@@ -429,13 +429,13 @@
 ///       class-name: [C++ 9.1]
 ///         identifier
 ///         simple-template-id
-/// 
+///
 Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
                                           const CXXScopeSpec *SS,
                                           bool DestrExpected) {
   // Check whether we have a template-id that names a type.
   if (Tok.is(tok::annot_template_id)) {
-    TemplateIdAnnotation *TemplateId 
+    TemplateIdAnnotation *TemplateId
       = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
     if (TemplateId->Kind == TNK_Type_template) {
       AnnotateTemplateIdTokenAsType(SS);
@@ -459,11 +459,11 @@
   }
 
   // We have an identifier; check whether it is actually a type.
-  TypeTy *Type = Actions.getTypeName(*Tok.getIdentifierInfo(), 
+  TypeTy *Type = Actions.getTypeName(*Tok.getIdentifierInfo(),
                                      Tok.getLocation(), CurScope, SS,
                                      true);
   if (!Type) {
-    Diag(Tok, DestrExpected ? diag::err_destructor_class_name 
+    Diag(Tok, DestrExpected ? diag::err_destructor_class_name
                             : diag::err_expected_class_name);
     return true;
   }
@@ -487,9 +487,9 @@
 ///         class-key nested-name-specifier[opt] simple-template-id
 ///                          base-clause[opt]
 /// [GNU]   class-key attributes[opt] identifier[opt] base-clause[opt]
-/// [GNU]   class-key attributes[opt] nested-name-specifier 
+/// [GNU]   class-key attributes[opt] nested-name-specifier
 ///                          identifier base-clause[opt]
-/// [GNU]   class-key attributes[opt] nested-name-specifier[opt] 
+/// [GNU]   class-key attributes[opt] nested-name-specifier[opt]
 ///                          simple-template-id base-clause[opt]
 ///       class-key:
 ///         'class'
@@ -497,9 +497,9 @@
 ///         'union'
 ///
 ///       elaborated-type-specifier: [C++ dcl.type.elab]
-///         class-key ::[opt] nested-name-specifier[opt] identifier 
-///         class-key ::[opt] nested-name-specifier[opt] 'template'[opt] 
-///                          simple-template-id 
+///         class-key ::[opt] nested-name-specifier[opt] identifier
+///         class-key ::[opt] nested-name-specifier[opt] 'template'[opt]
+///                          simple-template-id
 ///
 ///  Note that the C++ class-specifier and elaborated-type-specifier,
 ///  together, subsume the C99 struct-or-union-specifier:
@@ -535,11 +535,11 @@
   // If declspecs exist after tag, parse them.
   if (Tok.is(tok::kw___declspec))
     Attr = ParseMicrosoftDeclSpec(Attr);
-  
+
   if (TagType == DeclSpec::TST_struct && Tok.is(tok::kw___is_pod)) {
     // GNU libstdc++ 4.2 uses __is_pod as the name of a struct template, but
     // __is_pod is a keyword in GCC >= 4.3. Therefore, when we see the
-    // token sequence "struct __is_pod", make __is_pod into a normal 
+    // token sequence "struct __is_pod", make __is_pod into a normal
     // identifier rather than a keyword, to allow libstdc++ 4.2 to work
     // properly.
     Tok.getIdentifierInfo()->setTokenID(tok::identifier);
@@ -549,16 +549,16 @@
   if (TagType == DeclSpec::TST_struct && Tok.is(tok::kw___is_empty)) {
     // GNU libstdc++ 4.2 uses __is_empty as the name of a struct template, but
     // __is_empty is a keyword in GCC >= 4.3. Therefore, when we see the
-    // token sequence "struct __is_empty", make __is_empty into a normal 
+    // token sequence "struct __is_empty", make __is_empty into a normal
     // identifier rather than a keyword, to allow libstdc++ 4.2 to work
     // properly.
     Tok.getIdentifierInfo()->setTokenID(tok::identifier);
     Tok.setKind(tok::identifier);
   }
-  
+
   // Parse the (optional) nested-name-specifier.
   CXXScopeSpec SS;
-  if (getLang().CPlusPlus && 
+  if (getLang().CPlusPlus &&
       ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true))
     if (Tok.isNot(tok::identifier) && Tok.isNot(tok::annot_template_id))
       Diag(Tok, diag::err_expected_ident);
@@ -584,7 +584,7 @@
 
       Diag(TemplateId->LAngleLoc, diag::err_template_spec_syntax_non_template)
         << Name << static_cast<int>(TemplateId->Kind) << Range;
-      
+
       DS.SetTypeSpecError();
       SkipUntil(tok::semi, false, true);
       TemplateId->Destroy();
@@ -629,7 +629,7 @@
   if (TemplateId) {
     // Explicit specialization, class template partial specialization,
     // or explicit instantiation.
-    ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+    ASTTemplateArgsPtr TemplateArgsPtr(Actions,
                                        TemplateId->getTemplateArgs(),
                                        TemplateId->getTemplateArgIsType(),
                                        TemplateId->NumArgs);
@@ -637,18 +637,18 @@
         TUK == Action::TUK_Declaration) {
       // This is an explicit instantiation of a class template.
       TagOrTempResult
-        = Actions.ActOnExplicitInstantiation(CurScope, 
+        = Actions.ActOnExplicitInstantiation(CurScope,
                                              TemplateInfo.ExternLoc,
-                                             TemplateInfo.TemplateLoc, 
+                                             TemplateInfo.TemplateLoc,
                                              TagType,
-                                             StartLoc, 
+                                             StartLoc,
                                              SS,
-                                     TemplateTy::make(TemplateId->Template), 
-                                             TemplateId->TemplateNameLoc, 
-                                             TemplateId->LAngleLoc, 
+                                     TemplateTy::make(TemplateId->Template),
+                                             TemplateId->TemplateNameLoc,
+                                             TemplateId->LAngleLoc,
                                              TemplateArgsPtr,
                                       TemplateId->getTemplateArgLocations(),
-                                             TemplateId->RAngleLoc, 
+                                             TemplateId->RAngleLoc,
                                              Attr);
     } else if (TUK == Action::TUK_Reference || TUK == Action::TUK_Friend) {
       Action::TypeResult Type
@@ -675,7 +675,7 @@
         Diag(StartLoc, DiagID) << PrevSpec;
 
       return;
-      
+
     } else {
       // This is an explicit specialization or a class template
       // partial specialization.
@@ -692,9 +692,9 @@
         // the '<>' after 'template'.
         assert(TUK == Action::TUK_Definition && "Expected a definition here");
 
-        SourceLocation LAngleLoc 
+        SourceLocation LAngleLoc
           = PP.getLocForEndOfToken(TemplateInfo.TemplateLoc);
-        Diag(TemplateId->TemplateNameLoc, 
+        Diag(TemplateId->TemplateNameLoc,
              diag::err_explicit_instantiation_with_definition)
           << SourceRange(TemplateInfo.TemplateLoc)
           << CodeModificationHint::CreateInsertion(LAngleLoc, "<>");
@@ -703,10 +703,10 @@
         // "template<>", so that we treat this construct as a class
         // template specialization.
         FakedParamLists.push_back(
-          Actions.ActOnTemplateParameterList(0, SourceLocation(), 
+          Actions.ActOnTemplateParameterList(0, SourceLocation(),
                                              TemplateInfo.TemplateLoc,
-                                             LAngleLoc, 
-                                             0, 0, 
+                                             LAngleLoc,
+                                             0, 0,
                                              LAngleLoc));
         TemplateParams = &FakedParamLists;
       }
@@ -715,14 +715,14 @@
       TagOrTempResult
         = Actions.ActOnClassTemplateSpecialization(CurScope, TagType, TUK,
                        StartLoc, SS,
-                       TemplateTy::make(TemplateId->Template), 
-                       TemplateId->TemplateNameLoc, 
-                       TemplateId->LAngleLoc, 
+                       TemplateTy::make(TemplateId->Template),
+                       TemplateId->TemplateNameLoc,
+                       TemplateId->LAngleLoc,
                        TemplateArgsPtr,
                        TemplateId->getTemplateArgLocations(),
-                       TemplateId->RAngleLoc, 
+                       TemplateId->RAngleLoc,
                        Attr,
-                       Action::MultiTemplateParamsArg(Actions, 
+                       Action::MultiTemplateParamsArg(Actions,
                                     TemplateParams? &(*TemplateParams)[0] : 0,
                                  TemplateParams? TemplateParams->size() : 0));
     }
@@ -735,10 +735,10 @@
     //   template struct Outer<int>::Inner;
     //
     TagOrTempResult
-      = Actions.ActOnExplicitInstantiation(CurScope, 
+      = Actions.ActOnExplicitInstantiation(CurScope,
                                            TemplateInfo.ExternLoc,
-                                           TemplateInfo.TemplateLoc, 
-                                           TagType, StartLoc, SS, Name, 
+                                           TemplateInfo.TemplateLoc,
+                                           TagType, StartLoc, SS, Name,
                                            NameLoc, Attr);
   } else {
     if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
@@ -747,9 +747,9 @@
     }
 
     // Declaration or definition of a class type
-    TagOrTempResult = Actions.ActOnTag(CurScope, TagType, TUK, StartLoc, SS, 
+    TagOrTempResult = Actions.ActOnTag(CurScope, TagType, TUK, StartLoc, SS,
                                        Name, NameLoc, Attr, AS,
-                                  Action::MultiTemplateParamsArg(Actions, 
+                                  Action::MultiTemplateParamsArg(Actions,
                                     TemplateParams? &(*TemplateParams)[0] : 0,
                                     TemplateParams? TemplateParams->size() : 0),
                                        Owned);
@@ -775,7 +775,7 @@
     DS.SetTypeSpecError();
     return;
   }
-  
+
   const char *PrevSpec = 0;
   unsigned DiagID;
   if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec, DiagID,
@@ -783,7 +783,7 @@
     Diag(StartLoc, DiagID) << PrevSpec;
 }
 
-/// ParseBaseClause - Parse the base-clause of a C++ class [C++ class.derived]. 
+/// ParseBaseClause - Parse the base-clause of a C++ class [C++ class.derived].
 ///
 ///       base-clause : [C++ class.derived]
 ///         ':' base-specifier-list
@@ -812,7 +812,7 @@
     // If the next token is a comma, consume it and keep reading
     // base-specifiers.
     if (Tok.isNot(tok::comma)) break;
-    
+
     // Consume the comma.
     ConsumeToken();
   }
@@ -846,7 +846,7 @@
   AccessSpecifier Access = getAccessSpecifierIfPresent();
   if (Access)
     ConsumeToken();
-  
+
   // Parse the 'virtual' keyword (again!), in case it came after the
   // access specifier.
   if (Tok.is(tok::kw_virtual))  {
@@ -872,10 +872,10 @@
   TypeResult BaseType = ParseClassName(EndLocation, &SS);
   if (BaseType.isInvalid())
     return true;
-  
-  // Find the complete source range for the base-specifier.  
+
+  // Find the complete source range for the base-specifier.
   SourceRange Range(StartLoc, EndLocation);
-  
+
   // Notify semantic analysis that we have parsed a complete
   // base-specifier.
   return Actions.ActOnBaseSpecifier(ClassDecl, Range, IsVirtual, Access,
@@ -889,8 +889,7 @@
 ///         'private'
 ///         'protected'
 ///         'public'
-AccessSpecifier Parser::getAccessSpecifierIfPresent() const
-{
+AccessSpecifier Parser::getAccessSpecifierIfPresent() const {
   switch (Tok.getKind()) {
   default: return AS_none;
   case tok::kw_private: return AS_private;
@@ -904,7 +903,7 @@
   // We just declared a member function. If this member function
   // has any default arguments, we'll need to parse them later.
   LateParsedMethodDeclaration *LateMethod = 0;
-  DeclaratorChunk::FunctionTypeInfo &FTI 
+  DeclaratorChunk::FunctionTypeInfo &FTI
     = DeclaratorInfo.getTypeObject(0).Fun;
   for (unsigned ParamIdx = 0; ParamIdx < FTI.NumArgs; ++ParamIdx) {
     if (LateMethod || FTI.ArgInfo[ParamIdx].DefaultArgTokens) {
@@ -968,12 +967,12 @@
     ParseStaticAssertDeclaration(DeclEnd);
     return;
   }
-      
+
   if (Tok.is(tok::kw_template)) {
-    assert(!TemplateInfo.TemplateParams && 
+    assert(!TemplateInfo.TemplateParams &&
            "Nested template improperly parsed?");
     SourceLocation DeclEnd;
-    ParseDeclarationStartingWithTemplate(Declarator::MemberContext, DeclEnd, 
+    ParseDeclarationStartingWithTemplate(Declarator::MemberContext, DeclEnd,
                                          AS);
     return;
   }
@@ -988,7 +987,7 @@
 
   if (Tok.is(tok::kw_using)) {
     // FIXME: Check for template aliases
-    
+
     // Eat 'using'.
     SourceLocation UsingLoc = ConsumeToken();
 
@@ -1084,7 +1083,7 @@
       if (BitfieldSize.isInvalid())
         SkipUntil(tok::comma, true, true);
     }
-    
+
     // pure-specifier:
     //   '= 0'
     //
@@ -1138,7 +1137,7 @@
       DeclsInGroup.push_back(ThisDecl);
 
     if (DeclaratorInfo.isFunctionDeclarator() &&
-        DeclaratorInfo.getDeclSpec().getStorageClassSpec() 
+        DeclaratorInfo.getDeclSpec().getStorageClassSpec()
           != DeclSpec::SCS_typedef) {
       HandleMemberFunctionDefaultArgs(DeclaratorInfo, ThisDecl);
     }
@@ -1147,16 +1146,16 @@
     // or an error, bail out.
     if (Tok.isNot(tok::comma))
       break;
-    
+
     // Consume the comma.
     ConsumeToken();
-    
+
     // Parse the next declarator.
     DeclaratorInfo.clear();
     BitfieldSize = 0;
     Init = 0;
     Deleted = false;
-    
+
     // Attributes are only allowed on the second declarator.
     if (Tok.is(tok::kw___attribute)) {
       SourceLocation Loc;
@@ -1198,11 +1197,11 @@
   PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
                                         PP.getSourceManager(),
                                         "parsing struct/union/class body");
-  
+
   SourceLocation LBraceLoc = ConsumeBrace();
 
   // Determine whether this is a top-level (non-nested) class.
-  bool TopLevelClass = ClassStack.empty() || 
+  bool TopLevelClass = ClassStack.empty() ||
     CurScope->isInCXXInlineMethodScope();
 
   // Enter a scope for the class.
@@ -1230,7 +1229,7 @@
   // While we still have something to read, read the member-declarations.
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     // Each iteration of this loop reads one member-declaration.
-    
+
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi);
@@ -1248,13 +1247,13 @@
     }
 
     // FIXME: Make sure we don't have a template here.
-    
+
     // Parse all the comma separated declarators.
     ParseCXXClassMemberDeclaration(CurAS);
   }
-  
+
   SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
-  
+
   AttributeList *AttrList = 0;
   // If attributes exist after class contents, parse them.
   if (Tok.is(tok::kw___attribute))
@@ -1300,19 +1299,19 @@
 /// };
 /// @endcode
 ///
-/// [C++]  ctor-initializer: 
-///          ':' mem-initializer-list 
+/// [C++]  ctor-initializer:
+///          ':' mem-initializer-list
 ///
-/// [C++]  mem-initializer-list: 
-///          mem-initializer 
-///          mem-initializer , mem-initializer-list 
+/// [C++]  mem-initializer-list:
+///          mem-initializer
+///          mem-initializer , mem-initializer-list
 void Parser::ParseConstructorInitializer(DeclPtrTy ConstructorDecl) {
   assert(Tok.is(tok::colon) && "Constructor initializer always starts with ':'");
 
   SourceLocation ColonLoc = ConsumeToken();
-  
+
   llvm::SmallVector<MemInitTy*, 4> MemInitializers;
-  
+
   do {
     MemInitResult MemInit = ParseMemInitializer(ConstructorDecl);
     if (!MemInit.isInvalid())
@@ -1330,7 +1329,7 @@
     }
   } while (true);
 
-  Actions.ActOnMemInitializers(ConstructorDecl, ColonLoc, 
+  Actions.ActOnMemInitializers(ConstructorDecl, ColonLoc,
                                MemInitializers.data(), MemInitializers.size());
 }
 
@@ -1341,7 +1340,7 @@
 ///
 /// [C++] mem-initializer:
 ///         mem-initializer-id '(' expression-list[opt] ')'
-/// 
+///
 /// [C++] mem-initializer-id:
 ///         '::'[opt] nested-name-specifier[opt] class-name
 ///         identifier
@@ -1364,7 +1363,7 @@
     Diag(Tok, diag::err_expected_member_or_base_name);
     return true;
   }
-  
+
   // Get the identifier. This may be a member name or a class name,
   // but we'll let the semantic analysis determine which it is.
   IdentifierInfo *II = Tok.is(tok::identifier) ? Tok.getIdentifierInfo() : 0;
@@ -1400,7 +1399,7 @@
 ///       exception-specification:
 ///         'throw' '(' type-id-list [opt] ')'
 /// [MS]    'throw' '(' '...' ')'
-///      
+///
 ///       type-id-list:
 ///         type-id
 ///         type-id-list ',' type-id
@@ -1412,9 +1411,9 @@
                                              &Ranges,
                                          bool &hasAnyExceptionSpec) {
   assert(Tok.is(tok::kw_throw) && "expected throw");
-  
+
   SourceLocation ThrowLoc = ConsumeToken();
-  
+
   if (!Tok.is(tok::l_paren)) {
     return Diag(Tok, diag::err_expected_lparen_after) << "throw";
   }
@@ -1453,7 +1452,7 @@
 /// so push that class onto our stack of classes that is currently
 /// being parsed.
 void Parser::PushParsingClass(DeclPtrTy ClassDecl, bool TopLevelClass) {
-  assert((TopLevelClass || !ClassStack.empty()) && 
+  assert((TopLevelClass || !ClassStack.empty()) &&
          "Nested class without outer class");
   ClassStack.push(new ParsingClass(ClassDecl, TopLevelClass));
 }
@@ -1477,7 +1476,7 @@
 /// false otherwise.
 void Parser::PopParsingClass() {
   assert(!ClassStack.empty() && "Mismatched push/pop for class parsing");
-  
+
   ParsingClass *Victim = ClassStack.top();
   ClassStack.pop();
   if (Victim->TopLevelClass) {
@@ -1485,7 +1484,7 @@
     // recursively: we don't need to keep any of this information.
     DeallocateParsedClasses(Victim);
     return;
-  } 
+  }
   assert(!ClassStack.empty() && "Missing top-level class?");
 
   if (Victim->MethodDecls.empty() && Victim->MethodDefs.empty() &&

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Wed Sep  9 10:08:12 2009
@@ -55,7 +55,7 @@
 /// getBinOpPrecedence - Return the precedence of the specified binary operator
 /// token.  This returns:
 ///
-static prec::Level getBinOpPrecedence(tok::TokenKind Kind, 
+static prec::Level getBinOpPrecedence(tok::TokenKind Kind,
                                       bool GreaterThanIsOperator,
                                       bool CPlusPlus0x) {
   switch (Kind) {
@@ -67,7 +67,7 @@
     if (GreaterThanIsOperator)
       return prec::Relational;
     return prec::Unknown;
-      
+
   case tok::greatergreater:
     // C++0x [temp.names]p3:
     //
@@ -206,7 +206,7 @@
   return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
 }
 
-/// This routine is called when the '@' is seen and consumed. 
+/// This routine is called when the '@' is seen and consumed.
 /// Current token is an Identifier and is not a 'try'. This
 /// routine is necessary to disambiguate @try-statement from,
 /// for example, @encode-expression.
@@ -277,11 +277,11 @@
 
 Parser::OwningExprResult Parser::ParseConstantExpression() {
   // C++ [basic.def.odr]p2:
-  //   An expression is potentially evaluated unless it appears where an 
+  //   An expression is potentially evaluated unless it appears where an
   //   integral constant expression is required (see 5.19) [...].
   EnterExpressionEvaluationContext Unevaluated(Actions,
                                                Action::Unevaluated);
-  
+
   OwningExprResult LHS(ParseCastExpression(false));
   if (LHS.isInvalid()) return move(LHS);
 
@@ -292,7 +292,7 @@
 /// LHS and has a precedence of at least MinPrec.
 Parser::OwningExprResult
 Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, unsigned MinPrec) {
-  unsigned NextTokPrec = getBinOpPrecedence(Tok.getKind(), 
+  unsigned NextTokPrec = getBinOpPrecedence(Tok.getKind(),
                                             GreaterThanIsOperator,
                                             getLang().CPlusPlus0x);
   SourceLocation ColonLoc;
@@ -465,10 +465,10 @@
 ///                                     assign-expr ')'
 /// [GNU]   '__builtin_types_compatible_p' '(' type-name ',' type-name ')'
 /// [GNU]   '__null'
-/// [OBJC]  '[' objc-message-expr ']'    
+/// [OBJC]  '[' objc-message-expr ']'
 /// [OBJC]  '@selector' '(' objc-selector-arg ')'
-/// [OBJC]  '@protocol' '(' identifier ')'             
-/// [OBJC]  '@encode' '(' type-name ')'                
+/// [OBJC]  '@protocol' '(' identifier ')'
+/// [OBJC]  '@encode' '(' type-name ')'
 /// [OBJC]  objc-string-literal
 /// [C++]   simple-type-specifier '(' expression-list[opt] ')'      [C++ 5.2.3]
 /// [C++]   typename-specifier '(' expression-list[opt] ')'         [TODO]
@@ -537,7 +537,7 @@
   OwningExprResult Res(Actions);
   tok::TokenKind SavedKind = Tok.getKind();
   NotCastExpr = false;
-  
+
   // This handles all of cast-expression, unary-expression, postfix-expression,
   // and primary-expression.  We handle them together like this for efficiency
   // and to simplify handling of an expression starting with a '(' token: which
@@ -560,7 +560,7 @@
     Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
                                parseParenAsExprList, CastTy, RParenLoc);
     if (Res.isInvalid()) return move(Res);
-    
+
     switch (ParenExprType) {
     case SimpleExpr:   break;    // Nothing else to do.
     case CompoundStmt: break;  // Nothing else to do.
@@ -608,23 +608,23 @@
     }
 
     // Support 'Class.property' notation.
-    // We don't use isTokObjCMessageIdentifierReceiver(), since it allows 
+    // We don't use isTokObjCMessageIdentifierReceiver(), since it allows
     // 'super' (which is inappropriate here).
-    if (getLang().ObjC1 && 
-        Actions.getTypeName(*Tok.getIdentifierInfo(), 
+    if (getLang().ObjC1 &&
+        Actions.getTypeName(*Tok.getIdentifierInfo(),
                             Tok.getLocation(), CurScope) &&
         NextToken().is(tok::period)) {
       IdentifierInfo &ReceiverName = *Tok.getIdentifierInfo();
       SourceLocation IdentLoc = ConsumeToken();
       SourceLocation DotLoc = ConsumeToken();
-      
+
       if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         return ExprError();
       }
       IdentifierInfo &PropertyName = *Tok.getIdentifierInfo();
       SourceLocation PropertyLoc = ConsumeToken();
-      
+
       Res = Actions.ActOnClassPropertyRefExpr(ReceiverName, PropertyName,
                                               IdentLoc, PropertyLoc);
       // These can be followed by postfix-expr pieces.
@@ -799,7 +799,7 @@
       return ParseCXXNewExpression(true, CCLoc);
     if (Tok.is(tok::kw_delete))
       return ParseCXXDeleteExpression(true, CCLoc);
-    
+
     // This is not a type name or scope specifier, it is an invalid expression.
     Diag(CCLoc, diag::err_expected_expression);
     return ExprError();
@@ -834,7 +834,7 @@
     // These can be followed by postfix-expr pieces.
     if (getLang().ObjC1)
       return ParsePostfixExpressionSuffix(ParseObjCMessageExpression());
-    // FALL THROUGH.      
+    // FALL THROUGH.
   default:
     NotCastExpr = true;
     return ExprError();
@@ -906,7 +906,7 @@
         MatchRHSPunctuation(tok::r_paren, Loc);
         return ExprError();
       }
-      
+
       if (!LHS.isInvalid()) {
         assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
                "Unexpected number of commas!");
@@ -914,7 +914,7 @@
                                     move_arg(ArgExprs), CommaLocs.data(),
                                     Tok.getLocation());
       }
-      
+
       ConsumeParen();
       break;
     }
@@ -944,19 +944,19 @@
         ConsumeToken();
       } else if (getLang().CPlusPlus && Tok.is(tok::tilde)) {
         // We have a C++ pseudo-destructor or a destructor call, e.g., t.~T()
-        
+
         // Consume the tilde.
         ConsumeToken();
-        
+
         if (!Tok.is(tok::identifier)) {
           Diag(Tok, diag::err_expected_ident);
           return ExprError();
         }
-        
+
         if (!LHS.isInvalid())
-          LHS = Actions.ActOnDestructorReferenceExpr(CurScope, move(LHS), 
+          LHS = Actions.ActOnDestructorReferenceExpr(CurScope, move(LHS),
                                                      OpLoc, OpKind,
-                                                     Tok.getLocation(), 
+                                                     Tok.getLocation(),
                                                      Tok.getIdentifierInfo(),
                                                      SS,
                                                NextToken().is(tok::l_paren));
@@ -987,14 +987,14 @@
       } else if (getLang().CPlusPlus && Tok.is(tok::annot_template_id)) {
         // We have a reference to a member template along with explicitly-
         // specified template arguments, e.g., t.f<int>.
-        TemplateIdAnnotation *TemplateId 
+        TemplateIdAnnotation *TemplateId
           = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
         if (!LHS.isInvalid()) {
-          ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+          ASTTemplateArgsPtr TemplateArgsPtr(Actions,
                                              TemplateId->getTemplateArgs(),
                                              TemplateId->getTemplateArgIsType(),
                                              TemplateId->NumArgs);
-          
+
           LHS = Actions.ActOnMemberTemplateIdReferenceExpr(CurScope, move(LHS),
                                                            OpLoc, OpKind, SS,
                                         TemplateTy::make(TemplateId->Template),
@@ -1014,7 +1014,7 @@
     case tok::plusplus:    // postfix-expression: postfix-expression '++'
     case tok::minusminus:  // postfix-expression: postfix-expression '--'
       if (!LHS.isInvalid()) {
-        LHS = Actions.ActOnPostfixUnaryOp(CurScope, Tok.getLocation(), 
+        LHS = Actions.ActOnPostfixUnaryOp(CurScope, Tok.getLocation(),
                                           Tok.getKind(), move(LHS));
       }
       ConsumeToken();
@@ -1045,13 +1045,13 @@
                                           bool &isCastExpr,
                                           TypeTy *&CastTy,
                                           SourceRange &CastRange) {
-  
-  assert((OpTok.is(tok::kw_typeof)    || OpTok.is(tok::kw_sizeof) || 
+
+  assert((OpTok.is(tok::kw_typeof)    || OpTok.is(tok::kw_sizeof) ||
           OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof)) &&
           "Not a typeof/sizeof/alignof expression!");
 
   OwningExprResult Operand(Actions);
-  
+
   // If the operand doesn't start with an '(', it must be an expression.
   if (Tok.isNot(tok::l_paren)) {
     isCastExpr = false;
@@ -1059,9 +1059,9 @@
       Diag(Tok,diag::err_expected_lparen_after_id) << OpTok.getIdentifierInfo();
       return ExprError();
     }
-    
+
     // C++0x [expr.sizeof]p1:
-    //   [...] The operand is either an expression, which is an unevaluated 
+    //   [...] The operand is either an expression, which is an unevaluated
     //   operand (Clause 5) [...]
     //
     // The GNU typeof and alignof extensions also behave as unevaluated
@@ -1076,9 +1076,9 @@
     // expression.
     ParenParseOption ExprType = CastExpr;
     SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
-    
+
     // C++0x [expr.sizeof]p1:
-    //   [...] The operand is either an expression, which is an unevaluated 
+    //   [...] The operand is either an expression, which is an unevaluated
     //   operand (Clause 5) [...]
     //
     // The GNU typeof and alignof extensions also behave as unevaluated
@@ -1096,7 +1096,7 @@
       return ExprEmpty();
     }
 
-    // If this is a parenthesized expression, it is the start of a 
+    // If this is a parenthesized expression, it is the start of a
     // unary-expression, but doesn't include any postfix pieces.  Parse these
     // now if present.
     Operand = ParsePostfixExpressionSuffix(move(Operand));
@@ -1121,7 +1121,7 @@
          "Not a sizeof/alignof expression!");
   Token OpTok = Tok;
   ConsumeToken();
-  
+
   bool isCastExpr;
   TypeTy *CastTy;
   SourceRange CastRange;
@@ -1153,7 +1153,7 @@
 /// [GNU]   '__builtin_choose_expr' '(' assign-expr ',' assign-expr ','
 ///                                     assign-expr ')'
 /// [GNU]   '__builtin_types_compatible_p' '(' type-name ',' type-name ')'
-/// 
+///
 /// [GNU] offsetof-member-designator:
 /// [GNU]   identifier
 /// [GNU]   offsetof-member-designator '.' identifier
@@ -1205,7 +1205,7 @@
       SkipUntil(tok::r_paren);
       return ExprError();
     }
-    
+
     if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
       return ExprError();
 
@@ -1261,8 +1261,8 @@
         } else if (Ty.isInvalid()) {
           Res = ExprError();
         } else {
-          Res = Actions.ActOnBuiltinOffsetOf(CurScope, StartLoc, TypeLoc, 
-                                             Ty.get(), &Comps[0], 
+          Res = Actions.ActOnBuiltinOffsetOf(CurScope, StartLoc, TypeLoc,
+                                             Ty.get(), &Comps[0],
                                              Comps.size(), ConsumeParen());
         }
         break;
@@ -1342,7 +1342,7 @@
 ///
 Parser::OwningExprResult
 Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
-                             bool parseAsExprList, TypeTy *&CastTy, 
+                             bool parseAsExprList, TypeTy *&CastTy,
                              SourceLocation &RParenLoc) {
   assert(Tok.is(tok::l_paren) && "Not a paren expr!");
   GreaterThanIsOperatorScope G(GreaterThanIsOperator, true);
@@ -1362,9 +1362,9 @@
 
   } else if (ExprType >= CompoundLiteral &&
              isTypeIdInParens(isAmbiguousTypeId)) {
-    
+
     // Otherwise, this is a compound literal expression or cast expression.
-    
+
     // In C++, if the type-id is ambiguous we disambiguate based on context.
     // If stopIfCastExpr is true the context is a typeof/sizeof/alignof
     // in which case we should treat it as type-id.
@@ -1373,7 +1373,7 @@
     if (isAmbiguousTypeId && !stopIfCastExpr)
       return ParseCXXAmbiguousParenExpression(ExprType, CastTy,
                                               OpenLoc, RParenLoc);
-    
+
     TypeResult Ty = ParseTypeName();
 
     // Match the ')'.
@@ -1419,7 +1419,7 @@
 
     if (!ParseExpressionList(ArgExprs, CommaLocs)) {
       ExprType = SimpleExpr;
-      Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(), 
+      Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(),
                                           move_arg(ArgExprs));
     }
   } else {
@@ -1434,7 +1434,7 @@
     SkipUntil(tok::r_paren);
     return ExprError();
   }
-  
+
   if (Tok.is(tok::r_paren))
     RParenLoc = ConsumeParen();
   else
@@ -1554,7 +1554,7 @@
   PrettyStackTraceLoc CrashInfo(PP.getSourceManager(), CaretLoc,
                                 "block literal parsing");
 
-  // Enter a scope to hold everything within the block.  This includes the 
+  // Enter a scope to hold everything within the block.  This includes the
   // argument decls, decls within the compound expression, etc.  This also
   // allows determining whether a variable reference inside the block is
   // within or outside of the block.
@@ -1564,7 +1564,7 @@
 
   // Inform sema that we are starting a block.
   Actions.ActOnBlockStart(CaretLoc, CurScope);
-  
+
   // Parse the return type if present.
   DeclSpec DS;
   Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
@@ -1602,7 +1602,7 @@
     ParseBlockId();
   } else {
     // Otherwise, pretend we saw (void).
-    ParamInfo.AddTypeInfo(DeclaratorChunk::getFunction(true, false, 
+    ParamInfo.AddTypeInfo(DeclaratorChunk::getFunction(true, false,
                                                        SourceLocation(),
                                                        0, 0, 0,
                                                        false, SourceLocation(),
@@ -1629,7 +1629,7 @@
     Actions.ActOnBlockError(CaretLoc, CurScope);
     return ExprError();
   }
-  
+
   OwningStmtResult Stmt(ParseCompoundStatementBody());
   if (!Stmt.isInvalid())
     Result = Actions.ActOnBlockStmtExpr(CaretLoc, move(Stmt), CurScope);

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Sep  9 10:08:12 2009
@@ -16,10 +16,10 @@
 #include "clang/Parse/DeclSpec.h"
 using namespace clang;
 
-/// \brief Parse global scope or nested-name-specifier if present. 
+/// \brief Parse global scope or nested-name-specifier if present.
 ///
 /// Parses a C++ global scope specifier ('::') or nested-name-specifier (which
-/// may be preceded by '::'). Note that this routine will not parse ::new or 
+/// may be preceded by '::'). Note that this routine will not parse ::new or
 /// ::delete; it will just leave them in the token stream.
 ///
 ///       '::'[opt] nested-name-specifier
@@ -32,10 +32,10 @@
 ///         nested-name-specifier 'template'[opt] simple-template-id '::'
 ///
 ///
-/// \param SS the scope specifier that will be set to the parsed 
+/// \param SS the scope specifier that will be set to the parsed
 /// nested-name-specifier (or empty)
 ///
-/// \param ObjectType if this nested-name-specifier is being parsed following 
+/// \param ObjectType if this nested-name-specifier is being parsed following
 /// the "." or "->" of a member access expression, this parameter provides the
 /// type of the object whose members are being accessed.
 ///
@@ -48,7 +48,7 @@
                                             bool EnteringContext) {
   assert(getLang().CPlusPlus &&
          "Call sites of this function should be guarded by checking for C++");
-  
+
   if (Tok.is(tok::annot_cxxscope)) {
     SS.setScopeRep(Tok.getAnnotationValue());
     SS.setRange(Tok.getAnnotationRange());
@@ -63,7 +63,7 @@
     tok::TokenKind NextKind = NextToken().getKind();
     if (NextKind == tok::kw_new || NextKind == tok::kw_delete)
       return false;
-    
+
     // '::' - Global scope qualifier.
     SourceLocation CCLoc = ConsumeToken();
     SS.setBeginLoc(CCLoc);
@@ -86,7 +86,7 @@
       // seen a leading '::' or part of a nested-name-specifier.
       ObjectType = 0;
     }
-    
+
     // nested-name-specifier:
     //   nested-name-specifier 'template'[opt] simple-template-id '::'
 
@@ -100,14 +100,14 @@
         break;
 
       SourceLocation TemplateKWLoc = ConsumeToken();
-      
+
       if (Tok.isNot(tok::identifier)) {
-        Diag(Tok.getLocation(), 
+        Diag(Tok.getLocation(),
              diag::err_id_after_template_in_nested_name_spec)
           << SourceRange(TemplateKWLoc);
         break;
       }
-      
+
       if (NextToken().isNot(tok::less)) {
         Diag(NextToken().getLocation(),
              diag::err_less_after_template_name_in_nested_name_spec)
@@ -115,8 +115,8 @@
           << SourceRange(TemplateKWLoc, Tok.getLocation());
         break;
       }
-      
-      TemplateTy Template 
+
+      TemplateTy Template
         = Actions.ActOnDependentTemplateName(TemplateKWLoc,
                                              *Tok.getIdentifierInfo(),
                                              Tok.getLocation(), SS,
@@ -126,40 +126,40 @@
       if (AnnotateTemplateIdToken(Template, TNK_Dependent_template_name,
                                   &SS, TemplateKWLoc, false))
         break;
-      
+
       continue;
     }
-    
+
     if (Tok.is(tok::annot_template_id) && NextToken().is(tok::coloncolon)) {
-      // We have 
+      // We have
       //
       //   simple-template-id '::'
       //
       // So we need to check whether the simple-template-id is of the
       // right kind (it should name a type or be dependent), and then
       // convert it into a type within the nested-name-specifier.
-      TemplateIdAnnotation *TemplateId 
+      TemplateIdAnnotation *TemplateId
         = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
 
-      if (TemplateId->Kind == TNK_Type_template || 
+      if (TemplateId->Kind == TNK_Type_template ||
           TemplateId->Kind == TNK_Dependent_template_name) {
         AnnotateTemplateIdTokenAsType(&SS);
 
-        assert(Tok.is(tok::annot_typename) && 
+        assert(Tok.is(tok::annot_typename) &&
                "AnnotateTemplateIdTokenAsType isn't working");
         Token TypeToken = Tok;
         ConsumeToken();
         assert(Tok.is(tok::coloncolon) && "NextToken() not working properly!");
         SourceLocation CCLoc = ConsumeToken();
-        
+
         if (!HasScopeSpecifier) {
           SS.setBeginLoc(TypeToken.getLocation());
           HasScopeSpecifier = true;
         }
-        
+
         if (TypeToken.getAnnotationValue())
           SS.setScopeRep(
-            Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, 
+            Actions.ActOnCXXNestedNameSpecifier(CurScope, SS,
                                                 TypeToken.getAnnotationValue(),
                                                 TypeToken.getAnnotationRange(),
                                                 CCLoc));
@@ -168,7 +168,7 @@
         SS.setEndLoc(CCLoc);
         continue;
       }
-      
+
       assert(false && "FIXME: Only type template names supported here");
     }
 
@@ -191,22 +191,22 @@
       SourceLocation IdLoc = ConsumeToken();
       assert(Tok.is(tok::coloncolon) && "NextToken() not working properly!");
       SourceLocation CCLoc = ConsumeToken();
-      
+
       if (!HasScopeSpecifier) {
         SS.setBeginLoc(IdLoc);
         HasScopeSpecifier = true;
       }
-      
+
       if (SS.isInvalid())
         continue;
-      
+
       SS.setScopeRep(
         Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II,
                                             ObjectType, EnteringContext));
       SS.setEndLoc(CCLoc);
       continue;
     }
-    
+
     // nested-name-specifier:
     //   type-name '<'
     if (Next.is(tok::less)) {
@@ -234,7 +234,7 @@
     // nested-name-specifier, so we're done.
     break;
   }
-    
+
   return HasScopeSpecifier;
 }
 
@@ -337,17 +337,17 @@
   }
 
   case tok::annot_template_id: {
-    TemplateIdAnnotation *TemplateId 
+    TemplateIdAnnotation *TemplateId
       = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
     assert((TemplateId->Kind == TNK_Function_template ||
             TemplateId->Kind == TNK_Dependent_template_name) &&
            "A template type name is not an ID expression");
 
-    ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+    ASTTemplateArgsPtr TemplateArgsPtr(Actions,
                                        TemplateId->getTemplateArgs(),
                                        TemplateId->getTemplateArgIsType(),
                                        TemplateId->NumArgs);
-    
+
     OwningExprResult Result
       = Actions.ActOnTemplateIdExpr(TemplateTy::make(TemplateId->Template),
                                     TemplateId->TemplateNameLoc,
@@ -403,11 +403,11 @@
     return ExprError();
 
   OwningExprResult Result = ParseExpression();
-  
+
   // Match the ')'.
   if (Result.isInvalid())
     SkipUntil(tok::r_paren);
-  
+
   if (Tok.is(tok::r_paren))
     RParenLoc = ConsumeParen();
   else
@@ -455,11 +455,11 @@
                                     Ty.get(), RParenLoc);
   } else {
     // C++0x [expr.typeid]p3:
-    //   When typeid is applied to an expression other than an lvalue of a 
-    //   polymorphic class type [...] The expression is an unevaluated 
+    //   When typeid is applied to an expression other than an lvalue of a
+    //   polymorphic class type [...] The expression is an unevaluated
     //   operand (Clause 5).
     //
-    // Note that we can't tell whether the expression is an lvalue of a 
+    // Note that we can't tell whether the expression is an lvalue of a
     // polymorphic class type until after we've parsed the expression, so
     // we the expression is potentially potentially evaluated.
     EnterExpressionEvaluationContext Unevaluated(Actions,
@@ -654,12 +654,12 @@
   const char *PrevSpec;
   unsigned DiagID;
   SourceLocation Loc = Tok.getLocation();
-  
+
   switch (Tok.getKind()) {
   case tok::identifier:   // foo::bar
   case tok::coloncolon:   // ::foo::bar
     assert(0 && "Annotation token should already be formed!");
-  default: 
+  default:
     assert(0 && "Not a simple-type-specifier token!");
     abort();
 
@@ -669,7 +669,7 @@
                        Tok.getAnnotationValue());
     break;
   }
-    
+
   // builtin types
   case tok::kw_short:
     DS.SetTypeSpecWidth(DeclSpec::TSW_short, Loc, PrevSpec, DiagID);
@@ -710,7 +710,7 @@
   case tok::kw_bool:
     DS.SetTypeSpecType(DeclSpec::TST_bool, Loc, PrevSpec, DiagID);
     break;
-  
+
   // GNU typeof support.
   case tok::kw_typeof:
     ParseTypeofSpecifier(DS);
@@ -747,7 +747,7 @@
     Diag(Tok, diag::err_operator_missing_type_specifier);
     return true;
   }
-  
+
   while (ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec, DiagID)) ;
 
   return false;
@@ -878,7 +878,7 @@
 
 /// ParseCXXNewExpression - Parse a C++ new-expression. New is used to allocate
 /// memory in a typesafe manner and call constructors.
-/// 
+///
 /// This method is called to parse the new expression after the optional :: has
 /// been already parsed.  If the :: was present, "UseGlobal" is true and "Start"
 /// is its location.  Otherwise, "Start" is the location of the 'new' token.
@@ -1087,8 +1087,7 @@
   return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, move(Operand));
 }
 
-static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind)
-{
+static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
   switch(kind) {
   default: assert(false && "Not a known unary type trait.");
   case tok::kw___has_nothrow_assign:      return UTT_HasNothrowAssign;
@@ -1116,8 +1115,7 @@
 ///       primary-expression:
 /// [GNU]             unary-type-trait '(' type-id ')'
 ///
-Parser::OwningExprResult Parser::ParseUnaryTypeTrait()
-{
+Parser::OwningExprResult Parser::ParseUnaryTypeTrait() {
   UnaryTypeTrait UTT = UnaryTypeTraitFromTokKind(Tok.getKind());
   SourceLocation Loc = ConsumeToken();
 
@@ -1172,7 +1170,7 @@
   // parsing a cast-expression), and then we re-introduce the cached tokens
   // into the token stream and parse them appropriately.
 
-  ParenParseOption ParseAs;  
+  ParenParseOption ParseAs;
   CachedTokens Toks;
 
   // Store the tokens of the parentheses. We will parse them after we determine
@@ -1204,7 +1202,7 @@
     ParseAs = NotCastExpr ? SimpleExpr : CastExpr;
   }
 
-  // The current token should go after the cached tokens. 
+  // The current token should go after the cached tokens.
   Toks.push_back(Tok);
   // Re-enter the stored parenthesized tokens into the token stream, so we may
   // parse them now.
@@ -1227,7 +1225,7 @@
       ExprType = CompoundLiteral;
       return ParseCompoundLiteralExpression(Ty.get(), LParenLoc, RParenLoc);
     }
-    
+
     // We parsed '(' type-id ')' and the thing after it wasn't a '{'.
     assert(ParseAs == CastExpr);
 
@@ -1238,11 +1236,11 @@
 
     // Result is what ParseCastExpression returned earlier.
     if (!Result.isInvalid())
-      Result = Actions.ActOnCastExpr(CurScope, LParenLoc, CastTy, RParenLoc, 
+      Result = Actions.ActOnCastExpr(CurScope, LParenLoc, CastTy, RParenLoc,
                                      move(Result));
     return move(Result);
   }
-  
+
   // Not a compound literal, and not followed by a cast-expression.
   assert(ParseAs == SimpleExpr);
 
@@ -1256,7 +1254,7 @@
     SkipUntil(tok::r_paren);
     return ExprError();
   }
-  
+
   if (Tok.is(tok::r_paren))
     RParenLoc = ConsumeParen();
   else

Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Wed Sep  9 10:08:12 2009
@@ -20,7 +20,7 @@
 
 /// MayBeDesignationStart - Return true if this token might be the start of a
 /// designator.  If we can tell it is impossible that it is a designator, return
-/// false. 
+/// false.
 static bool MayBeDesignationStart(tok::TokenKind K, Preprocessor &PP) {
   switch (K) {
   default: return false;
@@ -70,46 +70,46 @@
     NewSyntax += " = ";
 
     SourceLocation NameLoc = ConsumeToken(); // Eat the identifier.
-    
+
     assert(Tok.is(tok::colon) && "MayBeDesignationStart not working properly!");
     SourceLocation ColonLoc = ConsumeToken();
 
     Diag(Tok, diag::ext_gnu_old_style_field_designator)
-      << CodeModificationHint::CreateReplacement(SourceRange(NameLoc, 
+      << CodeModificationHint::CreateReplacement(SourceRange(NameLoc,
                                                              ColonLoc),
                                                  NewSyntax);
 
     Designation D;
     D.AddDesignator(Designator::getField(FieldName, SourceLocation(), NameLoc));
-    return Actions.ActOnDesignatedInitializer(D, ColonLoc, true, 
+    return Actions.ActOnDesignatedInitializer(D, ColonLoc, true,
                                               ParseInitializer());
   }
-  
+
   // Desig - This is initialized when we see our first designator.  We may have
   // an objc message send with no designator, so we don't want to create this
   // eagerly.
   Designation Desig;
-  
+
   // Parse each designator in the designator list until we find an initializer.
   while (Tok.is(tok::period) || Tok.is(tok::l_square)) {
     if (Tok.is(tok::period)) {
       // designator: '.' identifier
       SourceLocation DotLoc = ConsumeToken();
-      
+
       if (Tok.isNot(tok::identifier)) {
         Diag(Tok.getLocation(), diag::err_expected_field_designator);
         return ExprError();
       }
-      
+
       Desig.AddDesignator(Designator::getField(Tok.getIdentifierInfo(), DotLoc,
                                                Tok.getLocation()));
       ConsumeToken(); // Eat the identifier.
       continue;
     }
-    
+
     // We must have either an array designator now or an objc message send.
     assert(Tok.is(tok::l_square) && "Unexpected token!");
-    
+
     // Handle the two forms of array designator:
     //   array-designator: '[' constant-expression ']'
     //   array-designator: '[' constant-expression '...' constant-expression ']'
@@ -123,14 +123,14 @@
     //   [4][foo bar]      -> obsolete GNU designation with objc message send.
     //
     SourceLocation StartLoc = ConsumeBracket();
-    
+
     // If Objective-C is enabled and this is a typename or other identifier
     // receiver, parse this as a message send expression.
     if (getLang().ObjC1 && isTokObjCMessageIdentifierReceiver()) {
       // If we have exactly one array designator, this used the GNU
       // 'designation: array-designator' extension, otherwise there should be no
       // designators at all!
-      if (Desig.getNumDesignators() == 1 && 
+      if (Desig.getNumDesignators() == 1 &&
           (Desig.getDesignator(0).isArrayDesignator() ||
            Desig.getDesignator(0).isArrayRangeDesignator()))
         Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
@@ -151,18 +151,18 @@
       SkipUntil(tok::r_square);
       return move(Idx);
     }
-    
+
     // Given an expression, we could either have a designator (if the next
     // tokens are '...' or ']' or an objc message send.  If this is an objc
-    // message send, handle it now.  An objc-message send is the start of 
+    // message send, handle it now.  An objc-message send is the start of
     // an assignment-expression production.
-    if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) && 
+    if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) &&
         Tok.isNot(tok::r_square)) {
-      
+
       // If we have exactly one array designator, this used the GNU
       // 'designation: array-designator' extension, otherwise there should be no
       // designators at all!
-      if (Desig.getNumDesignators() == 1 && 
+      if (Desig.getNumDesignators() == 1 &&
           (Desig.getDesignator(0).isArrayDesignator() ||
            Desig.getDesignator(0).isArrayRangeDesignator()))
         Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
@@ -213,7 +213,7 @@
   // an initializer.  If we have exactly one array designator, this
   // is the GNU 'designation: array-designator' extension.  Otherwise, it is a
   // parse error.
-  if (Desig.getNumDesignators() == 1 && 
+  if (Desig.getNumDesignators() == 1 &&
       (Desig.getDesignator(0).isArrayDesignator() ||
        Desig.getDesignator(0).isArrayRangeDesignator())) {
     Diag(Tok, diag::ext_gnu_missing_equal_designator)
@@ -267,13 +267,13 @@
       SubElt = ParseInitializerWithPotentialDesignator();
     else
       SubElt = ParseInitializer();
-    
+
     // If we couldn't parse the subelement, bail out.
     if (!SubElt.isInvalid()) {
       InitExprs.push_back(SubElt.release());
     } else {
       InitExprsOk = false;
-      
+
       // We have two ways to try to recover from this error: if the code looks
       // gramatically ok (i.e. we have a comma coming up) try to continue
       // parsing the rest of the initializer.  This allows us to emit

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Sep  9 10:08:12 2009
@@ -29,7 +29,7 @@
 /// [OBJC]  '@' 'end'
 Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
   SourceLocation AtLoc = ConsumeToken(); // the "@"
-  
+
   switch (Tok.getObjCKeywordID()) {
   case tok::objc_class:
     return ParseObjCAtClassDeclaration(AtLoc);
@@ -55,13 +55,13 @@
 }
 
 ///
-/// objc-class-declaration: 
+/// objc-class-declaration:
 ///    '@' 'class' identifier-list ';'
-///  
+///
 Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
   ConsumeToken(); // the identifier "class"
   llvm::SmallVector<IdentifierInfo *, 8> ClassNames;
-  
+
   while (1) {
     if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_expected_ident);
@@ -70,17 +70,17 @@
     }
     ClassNames.push_back(Tok.getIdentifierInfo());
     ConsumeToken();
-    
+
     if (Tok.isNot(tok::comma))
       break;
-    
+
     ConsumeToken();
   }
-  
+
   // Consume the ';'.
   if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
     return DeclPtrTy();
-  
+
   return Actions.ActOnForwardClassDeclaration(atLoc,
                                       &ClassNames[0], ClassNames.size());
 }
@@ -91,14 +91,14 @@
 ///     objc-category-interface
 ///
 ///   objc-class-interface:
-///     '@' 'interface' identifier objc-superclass[opt] 
+///     '@' 'interface' identifier objc-superclass[opt]
 ///       objc-protocol-refs[opt]
-///       objc-class-instance-variables[opt] 
+///       objc-class-instance-variables[opt]
 ///       objc-interface-decl-list
 ///     @end
 ///
 ///   objc-category-interface:
-///     '@' 'interface' identifier '(' identifier[opt] ')' 
+///     '@' 'interface' identifier '(' identifier[opt] ')'
 ///       objc-protocol-refs[opt]
 ///       objc-interface-decl-list
 ///     @end
@@ -118,7 +118,7 @@
   assert(Tok.isObjCAtKeyword(tok::objc_interface) &&
          "ParseObjCAtInterfaceDeclaration(): Expected @interface");
   ConsumeToken(); // the "interface" identifier
-  
+
   if (Tok.isNot(tok::identifier)) {
     Diag(Tok, diag::err_expected_ident); // missing class or category name.
     return DeclPtrTy();
@@ -126,12 +126,12 @@
   // We have a class or category name - consume it.
   IdentifierInfo *nameId = Tok.getIdentifierInfo();
   SourceLocation nameLoc = ConsumeToken();
-  
+
   if (Tok.is(tok::l_paren)) { // we have a category.
     SourceLocation lparenLoc = ConsumeParen();
     SourceLocation categoryLoc, rparenLoc;
     IdentifierInfo *categoryId = 0;
-    
+
     // For ObjC2, the category name is optional (not an error).
     if (Tok.is(tok::identifier)) {
       categoryId = Tok.getIdentifierInfo();
@@ -146,25 +146,25 @@
       return DeclPtrTy();
     }
     rparenLoc = ConsumeParen();
-    
+
     // Next, we need to check for any protocol references.
     SourceLocation EndProtoLoc;
     llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs;
     if (Tok.is(tok::less) &&
         ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
       return DeclPtrTy();
-    
+
     if (attrList) // categories don't support attributes.
       Diag(Tok, diag::err_objc_no_attributes_on_category);
-    
+
     DeclPtrTy CategoryType =
-      Actions.ActOnStartCategoryInterface(atLoc, 
+      Actions.ActOnStartCategoryInterface(atLoc,
                                           nameId, nameLoc,
                                           categoryId, categoryLoc,
                                           ProtocolRefs.data(),
                                           ProtocolRefs.size(),
                                           EndProtoLoc);
-    
+
     ParseObjCInterfaceDeclList(CategoryType, tok::objc_not_keyword);
     return CategoryType;
   }
@@ -187,13 +187,13 @@
   if (Tok.is(tok::less) &&
       ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
     return DeclPtrTy();
-  
-  DeclPtrTy ClsType = 
-    Actions.ActOnStartClassInterface(atLoc, nameId, nameLoc, 
+
+  DeclPtrTy ClsType =
+    Actions.ActOnStartClassInterface(atLoc, nameId, nameLoc,
                                      superClassId, superClassLoc,
                                      ProtocolRefs.data(), ProtocolRefs.size(),
                                      EndProtoLoc, attrList);
-            
+
   if (Tok.is(tok::l_brace))
     ParseObjCClassInstanceVariables(ClsType, atLoc);
 
@@ -219,13 +219,13 @@
   llvm::SmallVector<DeclPtrTy, 16> allProperties;
   llvm::SmallVector<DeclGroupPtrTy, 8> allTUVariables;
   tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
-  
+
   SourceLocation AtEndLoc;
 
   while (1) {
     // If this is a method prototype, parse it.
     if (Tok.is(tok::minus) || Tok.is(tok::plus)) {
-      DeclPtrTy methodPrototype = 
+      DeclPtrTy methodPrototype =
         ParseObjCMethodPrototype(interfaceDecl, MethodImplKind);
       allMethods.push_back(methodPrototype);
       // Consume the ';' here, since ParseObjCMethodPrototype() is re-used for
@@ -234,17 +234,17 @@
                        "", tok::semi);
       continue;
     }
-    
+
     // Ignore excess semicolons.
     if (Tok.is(tok::semi)) {
       ConsumeToken();
       continue;
     }
-    
+
     // If we got to the end of the file, exit the loop.
     if (Tok.is(tok::eof))
       break;
-    
+
     // If we don't have an @ directive, parse it as a function definition.
     if (Tok.isNot(tok::at)) {
       // The code below does not consume '}'s because it is afraid of eating the
@@ -252,22 +252,22 @@
       // erroneous r_brace would cause an infinite loop if not handled here.
       if (Tok.is(tok::r_brace))
         break;
-      
+
       // FIXME: as the name implies, this rule allows function definitions.
       // We could pass a flag or check for functions during semantic analysis.
       allTUVariables.push_back(ParseDeclarationOrFunctionDefinition());
       continue;
     }
-    
+
     // Otherwise, we have an @ directive, eat the @.
     SourceLocation AtLoc = ConsumeToken(); // the "@"
     tok::ObjCKeywordKind DirectiveKind = Tok.getObjCKeywordID();
-    
+
     if (DirectiveKind == tok::objc_end) { // @end -> terminate list
       AtEndLoc = AtLoc;
       break;
     }
-    
+
     // Eat the identifier.
     ConsumeToken();
 
@@ -281,7 +281,7 @@
       // Skip until we see an '@' or '}' or ';'.
       SkipUntil(tok::r_brace, tok::at);
       break;
-      
+
     case tok::objc_required:
     case tok::objc_optional:
       // This is only valid on protocols.
@@ -291,24 +291,24 @@
       else
         MethodImplKind = DirectiveKind;
       break;
-        
+
     case tok::objc_property:
       if (!getLang().ObjC2)
         Diag(AtLoc, diag::err_objc_propertoes_require_objc2);
 
       ObjCDeclSpec OCDS;
-      // Parse property attribute list, if any. 
+      // Parse property attribute list, if any.
       if (Tok.is(tok::l_paren))
         ParseObjCPropertyAttribute(OCDS);
-        
+
       // Parse all the comma separated declarators.
       DeclSpec DS;
       llvm::SmallVector<FieldDeclarator, 8> FieldDeclarators;
       ParseStructDeclaration(DS, FieldDeclarators);
-      
+
       ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list, "",
                        tok::at);
-      
+
       // Convert them all to property declarations.
       for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) {
         FieldDeclarator &FD = FieldDeclarators[i];
@@ -322,12 +322,12 @@
             << FD.D.getSourceRange();
           continue;
         }
-        
+
         // Install the property declarator into interfaceDecl.
         IdentifierInfo *SelName =
           OCDS.getGetterName() ? OCDS.getGetterName() : FD.D.getIdentifier();
-        
-        Selector GetterSel = 
+
+        Selector GetterSel =
           PP.getSelectorTable().getNullarySelector(SelName);
         IdentifierInfo *SetterName = OCDS.getSetterName();
         Selector SetterSel;
@@ -340,7 +340,7 @@
         bool isOverridingProperty = false;
         DeclPtrTy Property = Actions.ActOnProperty(CurScope, AtLoc, FD, OCDS,
                                                    GetterSel, SetterSel,
-                                                   interfaceDecl, 
+                                                   interfaceDecl,
                                                    &isOverridingProperty,
                                                    MethodImplKind);
         if (!isOverridingProperty)
@@ -356,11 +356,11 @@
     ConsumeToken(); // the "end" identifier
   else
     Diag(Tok, diag::err_objc_missing_end);
-  
+
   // Insert collected methods declarations into the @interface object.
   // This passes in an invalid SourceLocation for AtEndLoc when EOF is hit.
   Actions.ActOnAtEnd(AtEndLoc, interfaceDecl,
-                     allMethods.data(), allMethods.size(), 
+                     allMethods.data(), allMethods.size(),
                      allProperties.data(), allProperties.size(),
                      allTUVariables.data(), allTUVariables.size());
 }
@@ -384,18 +384,18 @@
 void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
   assert(Tok.getKind() == tok::l_paren);
   SourceLocation LHSLoc = ConsumeParen(); // consume '('
-  
+
   while (1) {
     const IdentifierInfo *II = Tok.getIdentifierInfo();
-    
+
     // If this is not an identifier at all, bail out early.
     if (II == 0) {
       MatchRHSPunctuation(tok::r_paren, LHSLoc);
       return;
     }
-    
+
     SourceLocation AttrName = ConsumeToken(); // consume last attribute name
-    
+
     if (II->isStr("readonly"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly);
     else if (II->isStr("assign"))
@@ -413,18 +413,18 @@
       if (ExpectAndConsume(tok::equal, diag::err_objc_expected_equal, "",
                            tok::r_paren))
         return;
-      
+
       if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         SkipUntil(tok::r_paren);
         return;
       }
-      
+
       if (II->getName()[0] == 's') {
         DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter);
         DS.setSetterName(Tok.getIdentifierInfo());
         ConsumeToken();  // consume method name
-        
+
         if (ExpectAndConsume(tok::colon, diag::err_expected_colon, "",
                              tok::r_paren))
           return;
@@ -438,18 +438,18 @@
       SkipUntil(tok::r_paren);
       return;
     }
-    
+
     if (Tok.isNot(tok::comma))
       break;
-    
+
     ConsumeToken();
   }
-  
+
   MatchRHSPunctuation(tok::r_paren, LHSLoc);
 }
 
 ///   objc-method-proto:
-///     objc-instance-method objc-method-decl objc-method-attributes[opt] 
+///     objc-instance-method objc-method-decl objc-method-attributes[opt]
 ///     objc-class-method objc-method-decl objc-method-attributes[opt]
 ///
 ///   objc-instance-method: '-'
@@ -458,13 +458,13 @@
 ///   objc-method-attributes:         [OBJC2]
 ///     __attribute__((deprecated))
 ///
-Parser::DeclPtrTy Parser::ParseObjCMethodPrototype(DeclPtrTy IDecl, 
+Parser::DeclPtrTy Parser::ParseObjCMethodPrototype(DeclPtrTy IDecl,
                                           tok::ObjCKeywordKind MethodImplKind) {
   assert((Tok.is(tok::minus) || Tok.is(tok::plus)) && "expected +/-");
 
-  tok::TokenKind methodType = Tok.getKind();  
+  tok::TokenKind methodType = Tok.getKind();
   SourceLocation mLoc = ConsumeToken();
-  
+
   DeclPtrTy MDecl = ParseObjCMethodDecl(mLoc, methodType, IDecl,MethodImplKind);
   // Since this rule is used for both method declarations and definitions,
   // the caller is (optionally) responsible for consuming the ';'.
@@ -564,7 +564,7 @@
   // FIXME: May have to do additional look-ahead to only allow for
   // valid tokens following an 'in'; such as an identifier, unary operators,
   // '[' etc.
-  return (getLang().ObjC2 && Tok.is(tok::identifier) && 
+  return (getLang().ObjC2 && Tok.is(tok::identifier) &&
           Tok.getIdentifierInfo() == ObjCTypeQuals[objc_in]);
 }
 
@@ -580,12 +580,12 @@
   while (1) {
     if (Tok.isNot(tok::identifier))
       return;
-    
+
     const IdentifierInfo *II = Tok.getIdentifierInfo();
     for (unsigned i = 0; i != objc_NumQuals; ++i) {
       if (II != ObjCTypeQuals[i])
         continue;
-      
+
       ObjCDeclSpec::ObjCDeclQualifier Qual;
       switch (i) {
       default: assert(0 && "Unknown decl qualifier");
@@ -601,7 +601,7 @@
       II = 0;
       break;
     }
-    
+
     // If this wasn't a recognized qualifier, bail out.
     if (II) return;
   }
@@ -613,10 +613,10 @@
 ///
 Parser::TypeTy *Parser::ParseObjCTypeName(ObjCDeclSpec &DS) {
   assert(Tok.is(tok::l_paren) && "expected (");
-  
+
   SourceLocation LParenLoc = ConsumeParen();
   SourceLocation TypeStartLoc = Tok.getLocation();
-  
+
   // Parse type qualifiers, in, inout, etc.
   ParseObjCTypeQualifierList(DS);
 
@@ -626,7 +626,7 @@
     if (!TypeSpec.isInvalid())
       Ty = TypeSpec.get();
   }
-  
+
   if (Tok.is(tok::r_paren))
     ConsumeParen();
   else if (Tok.getLocation() == TypeStartLoc) {
@@ -648,7 +648,7 @@
 ///     objc-type-name objc-keyword-selector objc-parmlist[opt]
 ///
 ///   objc-keyword-selector:
-///     objc-keyword-decl 
+///     objc-keyword-decl
 ///     objc-keyword-selector objc-keyword-decl
 ///
 ///   objc-keyword-decl:
@@ -678,7 +678,7 @@
   ObjCDeclSpec DSRet;
   if (Tok.is(tok::l_paren))
     ReturnType = ParseObjCTypeName(DSRet);
-  
+
   SourceLocation selLoc;
   IdentifierInfo *SelIdent = ParseObjCSelectorPiece(selLoc);
 
@@ -690,14 +690,14 @@
     SkipUntil(tok::r_brace);
     return DeclPtrTy();
   }
-  
+
   llvm::SmallVector<Declarator, 8> CargNames;
   if (Tok.isNot(tok::colon)) {
     // If attributes exist after the method, parse them.
     AttributeList *MethodAttrs = 0;
-    if (getLang().ObjC2 && Tok.is(tok::kw___attribute)) 
+    if (getLang().ObjC2 && Tok.is(tok::kw___attribute))
       MethodAttrs = ParseAttributes();
-    
+
     Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent);
     return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
                                           mType, IDecl, DSRet, ReturnType, Sel,
@@ -707,17 +707,17 @@
 
   llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
   llvm::SmallVector<Action::ObjCArgInfo, 12> ArgInfos;
-  
+
   while (1) {
     Action::ObjCArgInfo ArgInfo;
-    
+
     // Each iteration parses a single keyword argument.
     if (Tok.isNot(tok::colon)) {
       Diag(Tok, diag::err_expected_colon);
       break;
     }
     ConsumeToken(); // Eat the ':'.
-    
+
     ArgInfo.Type = 0;
     if (Tok.is(tok::l_paren)) // Parse the argument type if present.
       ArgInfo.Type = ParseObjCTypeName(ArgInfo.DeclSpec);
@@ -731,11 +731,11 @@
       Diag(Tok, diag::err_expected_ident); // missing argument name.
       break;
     }
-    
+
     ArgInfo.Name = Tok.getIdentifierInfo();
     ArgInfo.NameLoc = Tok.getLocation();
     ConsumeToken(); // Eat the identifier.
-    
+
     ArgInfos.push_back(ArgInfo);
     KeyIdents.push_back(SelIdent);
 
@@ -746,9 +746,9 @@
       break;
     // We have a selector or a colon, continue parsing.
   }
-  
+
   bool isVariadic = false;
-  
+
   // Parse the (optional) parameter list.
   while (Tok.is(tok::comma)) {
     ConsumeToken();
@@ -759,18 +759,18 @@
     }
     DeclSpec DS;
     ParseDeclarationSpecifiers(DS);
-    // Parse the declarator. 
+    // Parse the declarator.
     Declarator ParmDecl(DS, Declarator::PrototypeContext);
     ParseDeclarator(ParmDecl);
     CargNames.push_back(ParmDecl);
   }
-  
+
   // FIXME: Add support for optional parmameter list...
   // If attributes exist after the method, parse them.
   AttributeList *MethodAttrs = 0;
-  if (getLang().ObjC2 && Tok.is(tok::kw___attribute)) 
+  if (getLang().ObjC2 && Tok.is(tok::kw___attribute))
     MethodAttrs = ParseAttributes();
-  
+
   if (KeyIdents.size() == 0)
     return DeclPtrTy();
   Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
@@ -788,11 +788,11 @@
 ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &Protocols,
                             bool WarnOnDeclarations, SourceLocation &EndLoc) {
   assert(Tok.is(tok::less) && "expected <");
-  
+
   ConsumeToken(); // the "<"
-  
+
   llvm::SmallVector<IdentifierLocPair, 8> ProtocolIdents;
-  
+
   while (1) {
     if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_expected_ident);
@@ -802,20 +802,20 @@
     ProtocolIdents.push_back(std::make_pair(Tok.getIdentifierInfo(),
                                        Tok.getLocation()));
     ConsumeToken();
-    
+
     if (Tok.isNot(tok::comma))
       break;
     ConsumeToken();
   }
-  
+
   // Consume the '>'.
   if (Tok.isNot(tok::greater)) {
     Diag(Tok, diag::err_expected_greater);
     return true;
   }
-  
+
   EndLoc = ConsumeAnyToken();
-  
+
   // Convert the list of protocols identifiers into a list of protocol decls.
   Actions.FindProtocolDeclaration(WarnOnDeclarations,
                                   &ProtocolIdents[0], ProtocolIdents.size(),
@@ -841,7 +841,7 @@
 ///     @package [OBJC2]
 ///
 ///   objc-instance-variable-decl:
-///     struct-declaration 
+///     struct-declaration
 ///
 void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
                                              SourceLocation atLoc) {
@@ -852,19 +852,19 @@
   ParseScope ClassScope(this, Scope::DeclScope|Scope::ClassScope);
 
   SourceLocation LBraceLoc = ConsumeBrace(); // the "{"
-  
+
   tok::ObjCKeywordKind visibility = tok::objc_protected;
   // While we still have something to read, read the instance variables.
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     // Each iteration of this loop reads one objc-instance-variable-decl.
-    
+
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi);
       ConsumeToken();
       continue;
     }
-    
+
     // Set the default visibility to private.
     if (Tok.is(tok::at)) { // parse objc-visibility-spec
       ConsumeToken(); // eat the @ sign
@@ -875,18 +875,18 @@
       case tok::objc_package:
         visibility = Tok.getObjCKeywordID();
         ConsumeToken();
-        continue; 
+        continue;
       default:
         Diag(Tok, diag::err_objc_illegal_visibility_spec);
         continue;
       }
     }
-    
+
     // Parse all the comma separated declarators.
     DeclSpec DS;
     FieldDeclarators.clear();
     ParseStructDeclaration(DS, FieldDeclarators);
-    
+
     // Convert them all to fields.
     for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) {
       FieldDeclarator &FD = FieldDeclarators[i];
@@ -897,7 +897,7 @@
                                           FD.D, FD.BitfieldSize, visibility);
       AllIvarDecls.push_back(Field);
     }
-    
+
     if (Tok.is(tok::semi)) {
       ConsumeToken();
     } else {
@@ -920,9 +920,9 @@
 ///     objc-protocol-forward-reference
 ///
 ///   objc-protocol-definition:
-///     @protocol identifier 
-///       objc-protocol-refs[opt] 
-///       objc-interface-decl-list 
+///     @protocol identifier
+///       objc-protocol-refs[opt]
+///       objc-interface-decl-list
 ///     @end
 ///
 ///   objc-protocol-forward-reference:
@@ -936,7 +936,7 @@
   assert(Tok.isObjCAtKeyword(tok::objc_protocol) &&
          "ParseObjCAtProtocolDeclaration(): Expected @protocol");
   ConsumeToken(); // the "protocol" identifier
-  
+
   if (Tok.isNot(tok::identifier)) {
     Diag(Tok, diag::err_expected_ident); // missing protocol name.
     return DeclPtrTy();
@@ -944,14 +944,14 @@
   // Save the protocol name, then consume it.
   IdentifierInfo *protocolName = Tok.getIdentifierInfo();
   SourceLocation nameLoc = ConsumeToken();
-  
+
   if (Tok.is(tok::semi)) { // forward declaration of one protocol.
     IdentifierLocPair ProtoInfo(protocolName, nameLoc);
     ConsumeToken();
-    return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtoInfo, 1, 
+    return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtoInfo, 1,
                                                    attrList);
   }
-  
+
   if (Tok.is(tok::comma)) { // list of forward declarations.
     llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
     ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
@@ -967,20 +967,20 @@
       ProtocolRefs.push_back(IdentifierLocPair(Tok.getIdentifierInfo(),
                                                Tok.getLocation()));
       ConsumeToken(); // the identifier
-      
+
       if (Tok.isNot(tok::comma))
         break;
     }
     // Consume the ';'.
     if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol"))
       return DeclPtrTy();
-    
+
     return Actions.ActOnForwardProtocolDeclaration(AtLoc,
-                                                   &ProtocolRefs[0], 
+                                                   &ProtocolRefs[0],
                                                    ProtocolRefs.size(),
                                                    attrList);
   }
-  
+
   // Last, and definitely not least, parse a protocol declaration.
   SourceLocation EndProtoLoc;
 
@@ -988,7 +988,7 @@
   if (Tok.is(tok::less) &&
       ParseObjCProtocolReferences(ProtocolRefs, false, EndProtoLoc))
     return DeclPtrTy();
-  
+
   DeclPtrTy ProtoType =
     Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc,
                                         ProtocolRefs.data(),
@@ -1013,7 +1013,7 @@
   assert(Tok.isObjCAtKeyword(tok::objc_implementation) &&
          "ParseObjCAtImplementationDeclaration(): Expected @implementation");
   ConsumeToken(); // the "implementation" identifier
-  
+
   if (Tok.isNot(tok::identifier)) {
     Diag(Tok, diag::err_expected_ident); // missing class or category name.
     return DeclPtrTy();
@@ -1021,20 +1021,20 @@
   // We have a class or category name - consume it.
   IdentifierInfo *nameId = Tok.getIdentifierInfo();
   SourceLocation nameLoc = ConsumeToken(); // consume class or category name
-  
-  if (Tok.is(tok::l_paren)) { 
+
+  if (Tok.is(tok::l_paren)) {
     // we have a category implementation.
     SourceLocation lparenLoc = ConsumeParen();
     SourceLocation categoryLoc, rparenLoc;
     IdentifierInfo *categoryId = 0;
-    
+
     if (Tok.is(tok::identifier)) {
       categoryId = Tok.getIdentifierInfo();
       categoryLoc = ConsumeToken();
     } else {
       Diag(Tok, diag::err_expected_ident); // missing category name.
       return DeclPtrTy();
-    }   
+    }
     if (Tok.isNot(tok::r_paren)) {
       Diag(Tok, diag::err_expected_rparen);
       SkipUntil(tok::r_paren, false); // don't stop at ';'
@@ -1042,7 +1042,7 @@
     }
     rparenLoc = ConsumeParen();
     DeclPtrTy ImplCatType = Actions.ActOnStartCategoryImplementation(
-                                    atLoc, nameId, nameLoc, categoryId, 
+                                    atLoc, nameId, nameLoc, categoryId,
                                     categoryLoc);
     ObjCImpDecl = ImplCatType;
     return DeclPtrTy();
@@ -1063,11 +1063,11 @@
   DeclPtrTy ImplClsType = Actions.ActOnStartClassImplementation(
                                   atLoc, nameId, nameLoc,
                                   superClassId, superClassLoc);
-  
+
   if (Tok.is(tok::l_brace)) // we have ivars
     ParseObjCClassInstanceVariables(ImplClsType/*FIXME*/, atLoc);
   ObjCImpDecl = ImplClsType;
-  
+
   return DeclPtrTy();
 }
 
@@ -1131,7 +1131,7 @@
     Diag(Tok, diag::err_expected_ident);
     return DeclPtrTy();
   }
-  
+
   while (Tok.is(tok::identifier)) {
     IdentifierInfo *propertyIvar = 0;
     IdentifierInfo *propertyId = Tok.getIdentifierInfo();
@@ -1186,7 +1186,7 @@
     Diag(Tok, diag::err_expected_semi_after) << "@dynamic";
   return DeclPtrTy();
 }
- 
+
 ///  objc-throw-statement:
 ///    throw expression[opt];
 ///
@@ -1288,7 +1288,7 @@
           DeclSpec DS;
           ParseDeclarationSpecifiers(DS);
           // For some odd reason, the name of the exception variable is
-          // optional. As a result, we need to use "PrototypeContext", because 
+          // optional. As a result, we need to use "PrototypeContext", because
           // we must accept either 'declarator' or 'abstract-declarator' here.
           Declarator ParmDecl(DS, Declarator::PrototypeContext);
           ParseDeclarator(ParmDecl);
@@ -1298,9 +1298,9 @@
           FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
         } else
           ConsumeToken(); // consume '...'
-          
+
         SourceLocation RParenLoc;
-        
+
         if (Tok.is(tok::r_paren))
           RParenLoc = ConsumeParen();
         else // Skip over garbage, until we get to ')'.  Eat the ')'.
@@ -1352,11 +1352,11 @@
 ///
 Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
   DeclPtrTy MDecl = ParseObjCMethodPrototype(ObjCImpDecl);
-  
+
   PrettyStackTraceActionsDecl CrashInfo(MDecl, Tok.getLocation(), Actions,
                                         PP.getSourceManager(),
                                         "parsing Objective-C method");
-  
+
   // parse optional ';'
   if (Tok.is(tok::semi))
     ConsumeToken();
@@ -1364,19 +1364,19 @@
   // We should have an opening brace now.
   if (Tok.isNot(tok::l_brace)) {
     Diag(Tok, diag::err_expected_method_body);
-    
+
     // Skip over garbage, until we get to '{'.  Don't eat the '{'.
     SkipUntil(tok::l_brace, true, true);
-    
+
     // If we didn't find the '{', bail out.
     if (Tok.isNot(tok::l_brace))
       return DeclPtrTy();
   }
   SourceLocation BraceLoc = Tok.getLocation();
-  
+
   // Enter a scope for the method body.
   ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
-  
+
   // Tell the actions module that we have entered a method definition with the
   // specified Declarator for the method.
   Actions.ActOnStartOfObjCMethodDef(CurScope, MDecl);
@@ -1390,7 +1390,7 @@
 
   // TODO: Pass argument information.
   Actions.ActOnFinishFunctionBody(MDecl, move(FnBody));
-  
+
   // Leave the function body scope.
   BodyScope.Exit();
 
@@ -1439,7 +1439,7 @@
   }
 }
 
-///   objc-message-expr: 
+///   objc-message-expr:
 ///     '[' objc-receiver objc-message-args ']'
 ///
 ///   objc-receiver:
@@ -1472,7 +1472,7 @@
 
 /// ParseObjCMessageExpressionBody - Having parsed "'[' objc-receiver", parse
 /// the rest of a message expression.
-/// 
+///
 ///   objc-message-args:
 ///     objc-selector
 ///     objc-keywordarg-list
@@ -1481,7 +1481,7 @@
 ///     objc-keywordarg
 ///     objc-keywordarg-list objc-keywordarg
 ///
-///   objc-keywordarg: 
+///   objc-keywordarg:
 ///     selector-name[opt] ':' objc-keywordexpr
 ///
 ///   objc-keywordexpr:
@@ -1501,7 +1501,7 @@
   IdentifierInfo *selIdent = ParseObjCSelectorPiece(Loc);
 
   SourceLocation SelectorLoc = Loc;
-    
+
   llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
   ExprVector KeyExprs(Actions);
 
@@ -1520,7 +1520,7 @@
       }
 
       ConsumeToken(); // Eat the ':'.
-      ///  Parse the expression after ':' 
+      ///  Parse the expression after ':'
       OwningExprResult Res(ParseAssignmentExpression());
       if (Res.isInvalid()) {
         // We must manually skip to a ']', otherwise the expression skipper will
@@ -1542,7 +1542,7 @@
     // Parse the, optional, argument list, comma separated.
     while (Tok.is(tok::comma)) {
       ConsumeToken(); // Eat the ','.
-      ///  Parse the expression after ',' 
+      ///  Parse the expression after ','
       OwningExprResult Res(ParseAssignmentExpression());
       if (Res.isInvalid()) {
         // We must manually skip to a ']', otherwise the expression skipper will
@@ -1584,7 +1584,7 @@
   // We've just parsed a keyword message.
   if (ReceiverName)
     return Owned(Actions.ActOnClassMessage(CurScope, ReceiverName, Sel,
-                                           LBracLoc, NameLoc, SelectorLoc, 
+                                           LBracLoc, NameLoc, SelectorLoc,
                                            RBracLoc,
                                            KeyExprs.take(), KeyExprs.size()));
   return Owned(Actions.ActOnInstanceMessage(ReceiverExpr.release(), Sel,
@@ -1642,7 +1642,7 @@
   if (Ty.isInvalid())
     return ExprError();
 
-  return Owned(Actions.ParseObjCEncodeExpression(AtLoc, EncLoc, LParenLoc, 
+  return Owned(Actions.ParseObjCEncodeExpression(AtLoc, EncLoc, LParenLoc,
                                                  Ty.get(), RParenLoc));
 }
 

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Wed Sep  9 10:08:12 2009
@@ -37,7 +37,7 @@
   IdentifierInfo *Name = 0;
   Action::OwningExprResult Alignment(Actions);
   SourceLocation LParenLoc = Tok.getLocation();
-  PP.Lex(Tok);  
+  PP.Lex(Tok);
   if (Tok.is(tok::numeric_constant)) {
     Alignment = Actions.ActOnNumericConstant(Tok);
     if (Alignment.isInvalid())
@@ -57,12 +57,12 @@
       } else {
         PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_invalid_action);
         return;
-      }        
+      }
       PP.Lex(Tok);
-    
+
       if (Tok.is(tok::comma)) {
         PP.Lex(Tok);
-        
+
         if (Tok.is(tok::numeric_constant)) {
           Alignment = Actions.ActOnNumericConstant(Tok);
           if (Alignment.isInvalid())
@@ -72,15 +72,15 @@
         } else if (Tok.is(tok::identifier)) {
           Name = Tok.getIdentifierInfo();
           PP.Lex(Tok);
-          
+
           if (Tok.is(tok::comma)) {
             PP.Lex(Tok);
-            
+
             if (Tok.isNot(tok::numeric_constant)) {
               PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed);
               return;
             }
-            
+
             Alignment = Actions.ActOnNumericConstant(Tok);
             if (Alignment.isInvalid())
               return;
@@ -115,7 +115,7 @@
 void PragmaUnusedHandler::HandlePragma(Preprocessor &PP, Token &UnusedTok) {
   // FIXME: Should we be expanding macros here? My guess is no.
   SourceLocation UnusedLoc = UnusedTok.getLocation();
-  
+
   // Lex the left '('.
   Token Tok;
   PP.Lex(Tok);
@@ -124,17 +124,17 @@
     return;
   }
   SourceLocation LParenLoc = Tok.getLocation();
-  
+
   // Lex the declaration reference(s).
   llvm::SmallVector<Token, 5> Identifiers;
   SourceLocation RParenLoc;
   bool LexID = true;
-  
+
   while (true) {
     PP.Lex(Tok);
-    
+
     if (LexID) {
-      if (Tok.is(tok::identifier)) {  
+      if (Tok.is(tok::identifier)) {
         Identifiers.push_back(Tok);
         LexID = false;
         continue;
@@ -144,18 +144,18 @@
       PP.Diag(Tok.getLocation(), diag::warn_pragma_unused_expected_var);
       return;
     }
-    
+
     // We are execting a ')' or a ','.
     if (Tok.is(tok::comma)) {
       LexID = true;
       continue;
     }
-    
+
     if (Tok.is(tok::r_paren)) {
       RParenLoc = Tok.getLocation();
       break;
     }
-    
+
     // Illegal token!
     PP.Diag(Tok.getLocation(), diag::warn_pragma_unused_expected_punc);
     return;
@@ -172,7 +172,7 @@
   assert(RParenLoc.isValid() && "Valid '#pragma unused' must have ')'");
   assert(!Identifiers.empty() && "Valid '#pragma unused' must have arguments");
 
-  // Perform the action to handle the pragma.    
+  // Perform the action to handle the pragma.
   Actions.ActOnPragmaUnused(Identifiers.data(), Identifiers.size(),
                             parser.CurScope, UnusedLoc, LParenLoc, RParenLoc);
 }
@@ -197,7 +197,7 @@
   if (Tok.is(tok::equal)) {
     PP.Lex(Tok);
     if (Tok.isNot(tok::identifier)) {
-      PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier) 
+      PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
           << "weak";
       return;
     }

Modified: cfe/trunk/lib/Parse/ParsePragma.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.h (original)
+++ cfe/trunk/lib/Parse/ParsePragma.h Wed Sep  9 10:08:12 2009
@@ -23,29 +23,29 @@
 class PragmaPackHandler : public PragmaHandler {
   Action &Actions;
 public:
-  PragmaPackHandler(const IdentifierInfo *N, Action &A) : PragmaHandler(N), 
+  PragmaPackHandler(const IdentifierInfo *N, Action &A) : PragmaHandler(N),
                                                           Actions(A) {}
-  
-  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);  
+
+  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
-  
+
 class PragmaUnusedHandler : public PragmaHandler {
   Action &Actions;
   Parser &parser;
 public:
   PragmaUnusedHandler(const IdentifierInfo *N, Action &A, Parser& p)
     : PragmaHandler(N), Actions(A), parser(p) {}
-  
-  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);  
-};  
+
+  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
+};
 
 class PragmaWeakHandler : public PragmaHandler {
   Action &Actions;
 public:
   PragmaWeakHandler(const IdentifierInfo *N, Action &A)
     : PragmaHandler(N), Actions(A) {}
-  
-  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);  
+
+  virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 }  // end namespace clang

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Wed Sep  9 10:08:12 2009
@@ -71,8 +71,8 @@
 ///
 /// [OBC] objc-throw-statement:
 /// [OBC]   '@' 'throw' expression ';'
-/// [OBC]   '@' 'throw' ';' 
-/// 
+/// [OBC]   '@' 'throw' ';'
+///
 Parser::OwningStmtResult
 Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
   const char *SemiError = 0;
@@ -108,7 +108,7 @@
       Diag(Tok, diag::err_expected_statement);
       return StmtError();
     }
-    
+
     // expression[opt] ';'
     OwningExprResult Expr(ParseExpression());
     if (Expr.isInvalid()) {
@@ -187,7 +187,7 @@
     // Skip until we see a } or ;, but don't eat it.
     SkipUntil(tok::r_brace, true, true);
   }
-  
+
   return move(Res);
 }
 
@@ -233,7 +233,7 @@
 ///
 Parser::OwningStmtResult Parser::ParseCaseStatement() {
   assert(Tok.is(tok::kw_case) && "Not a case stmt!");
-  
+
   // It is very very common for code to contain many case statements recursively
   // nested, as in (but usually without indentation):
   //  case 1:
@@ -247,20 +247,20 @@
   // flatten this recursion into an iterative loop.  This is complex and gross,
   // but all the grossness is constrained to ParseCaseStatement (and some
   // wierdness in the actions), so this is just local grossness :).
-  
+
   // TopLevelCase - This is the highest level we have parsed.  'case 1' in the
   // example above.
   OwningStmtResult TopLevelCase(Actions, true);
-  
+
   // DeepestParsedCaseStmt - This is the deepest statement we have parsed, which
   // gets updated each time a new case is parsed, and whose body is unset so
   // far.  When parsing 'case 4', this is the 'case 3' node.
   StmtTy *DeepestParsedCaseStmt = 0;
-  
+
   // While we have case statements, eat and stack them.
   do {
     SourceLocation CaseLoc = ConsumeToken();  // eat the 'case'.
-    
+
     OwningExprResult LHS(ParseConstantExpression());
     if (LHS.isInvalid()) {
       SkipUntil(tok::colon);
@@ -288,11 +288,11 @@
     }
 
     SourceLocation ColonLoc = ConsumeToken();
-    
+
     OwningStmtResult Case =
       Actions.ActOnCaseStmt(CaseLoc, move(LHS), DotDotDotLoc,
                             move(RHS), ColonLoc);
-    
+
     // If we had a sema error parsing this case, then just ignore it and
     // continue parsing the sub-stmt.
     if (Case.isInvalid()) {
@@ -309,15 +309,15 @@
         Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, move(Case));
       DeepestParsedCaseStmt = NextDeepest;
     }
-    
+
     // Handle all case statements.
   } while (Tok.is(tok::kw_case));
-    
+
   assert(!TopLevelCase.isInvalid() && "Should have parsed at least one case!");
-  
+
   // If we found a non-case statement, start by parsing it.
   OwningStmtResult SubStmt(Actions);
-  
+
   if (Tok.isNot(tok::r_brace)) {
     SubStmt = ParseStatement();
   } else {
@@ -327,11 +327,11 @@
     Diag(Tok, diag::err_label_end_of_compound_statement);
     SubStmt = true;
   }
-  
+
   // Broken sub-stmt shouldn't prevent forming the case statement properly.
   if (SubStmt.isInvalid())
     SubStmt = Actions.ActOnNullStmt(SourceLocation());
-  
+
   // Install the body into the most deeply-nested case.
   Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, move(SubStmt));
 
@@ -415,10 +415,10 @@
 /// consume the '}' at the end of the block.  It does not manipulate the scope
 /// stack.
 Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
-  PrettyStackTraceLoc CrashInfo(PP.getSourceManager(), 
+  PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),
                                 Tok.getLocation(),
                                 "in compound statement ('{}')");
-  
+
   SourceLocation LBraceLoc = ConsumeBrace();  // eat the '{'.
 
   // TODO: "__label__ X, Y, Z;" is the GNU "Local Label" extension.  These are
@@ -496,12 +496,12 @@
                                        SourceLocation *RParenLocPtr) {
   SourceLocation LParenLoc = ConsumeParen();
   if (LParenLocPtr) *LParenLocPtr = LParenLoc;
-  
+
   if (getLang().CPlusPlus)
     CondExp = ParseCXXCondition();
   else
     CondExp = ParseExpression();
-  
+
   // If the parser was confused by the condition and we don't have a ')', try to
   // recover by skipping ahead to a semi and bailing out.  If condexp is
   // semantically invalid but we have well formed code, keep going.
@@ -512,7 +512,7 @@
     if (Tok.isNot(tok::r_paren))
       return true;
   }
-  
+
   // Otherwise the condition is valid or the rparen is present.
   SourceLocation RPLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
   if (RParenLocPtr) *RParenLocPtr = RPLoc;
@@ -559,7 +559,7 @@
     return StmtError();
 
   FullExprArg FullCondExp(Actions.FullExpr(CondExp));
-  
+
   // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
@@ -578,7 +578,7 @@
   //    would have to notify ParseStatement not to create a new scope. It's
   //    simpler to let it create a new scope.
   //
-  ParseScope InnerScope(this, Scope::DeclScope, 
+  ParseScope InnerScope(this, Scope::DeclScope,
                         C99orCXX && Tok.isNot(tok::l_brace));
 
   // Read the 'then' stmt.
@@ -619,14 +619,14 @@
   }
 
   IfScope.Exit();
-  
+
   // If the condition was invalid, discard the if statement.  We could recover
   // better by replacing it with a valid expr, but don't do that yet.
   if (CondExp.isInvalid())
     return StmtError();
 
   // If the then or else stmt is invalid and the other is valid (and present),
-  // make turn the invalid one into a null stmt to avoid dropping the other 
+  // make turn the invalid one into a null stmt to avoid dropping the other
   // part.  If both are invalid, return error.
   if ((ThenStmt.isInvalid() && ElseStmt.isInvalid()) ||
       (ThenStmt.isInvalid() && ElseStmt.get() == 0) ||
@@ -641,7 +641,7 @@
   if (ElseStmt.isInvalid())
     ElseStmt = Actions.ActOnNullStmt(ElseStmtLoc);
 
-  return Actions.ActOnIfStmt(IfLoc, FullCondExp, move(ThenStmt), 
+  return Actions.ActOnIfStmt(IfLoc, FullCondExp, move(ThenStmt),
                              ElseLoc, move(ElseStmt));
 }
 
@@ -698,7 +698,7 @@
   // See comments in ParseIfStatement for why we create a scope for the
   // condition and a new scope for substatement in C++.
   //
-  ParseScope InnerScope(this, Scope::DeclScope, 
+  ParseScope InnerScope(this, Scope::DeclScope,
                         C99orCXX && Tok.isNot(tok::l_brace));
 
   // Read the body statement.
@@ -763,7 +763,7 @@
     return StmtError();
 
   FullExprArg FullCond(Actions.FullExpr(Cond));
-  
+
   // C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
@@ -775,7 +775,7 @@
   // See comments in ParseIfStatement for why we create a scope for the
   // condition and a new scope for substatement in C++.
   //
-  ParseScope InnerScope(this, Scope::DeclScope, 
+  ParseScope InnerScope(this, Scope::DeclScope,
                         C99orCXX && Tok.isNot(tok::l_brace));
 
   // Read the body statement.
@@ -818,7 +818,7 @@
   // which is entered and exited each time through the loop.
   //
   ParseScope InnerScope(this, Scope::DeclScope,
-                        (getLang().C99 || getLang().CPlusPlus) && 
+                        (getLang().C99 || getLang().CPlusPlus) &&
                         Tok.isNot(tok::l_brace));
 
   // Read the body statement.
@@ -847,7 +847,7 @@
   OwningExprResult Cond(Actions);
   SourceLocation LPLoc, RPLoc;
   ParseParenExprOrCondition(Cond, true, &LPLoc, &RPLoc);
-  
+
   DoScope.Exit();
 
   if (Cond.isInvalid() || Body.isInvalid())
@@ -926,11 +926,11 @@
     DeclGroupPtrTy DG = ParseSimpleDeclaration(Declarator::ForContext, DeclEnd,
                                                false);
     FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation());
-    
+
     if (Tok.is(tok::semi)) {  // for (int x = 4;
       ConsumeToken();
     } else if ((ForEach = isTokIdentifier_in())) {
-      // ObjC: for (id x in expr) 
+      // ObjC: for (id x in expr)
       ConsumeToken(); // consume 'in'
       SecondPart = ParseExpression();
     } else {
@@ -988,7 +988,7 @@
   // See comments in ParseIfStatement for why we create a scope for
   // for-init-statement/condition and a new scope for substatement in C++.
   //
-  ParseScope InnerScope(this, Scope::DeclScope, 
+  ParseScope InnerScope(this, Scope::DeclScope,
                         C99orCXXorObjC && Tok.isNot(tok::l_brace));
 
   // Read the body statement.
@@ -1007,7 +1007,7 @@
     return Actions.ActOnForStmt(ForLoc, LParenLoc, move(FirstPart),
                               move(SecondPart), move(ThirdPart),
                               RParenLoc, move(Body));
-  
+
   return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
                                             move(FirstPart),
                                             move(SecondPart),
@@ -1096,7 +1096,7 @@
     do {
       ConsumeAnyToken();
     } while (BraceCount > savedBraceCount && Tok.isNot(tok::eof));
-  } else { 
+  } else {
     // From the MS website: If used without braces, the __asm keyword means
     // that the rest of the line is an assembly-language statement.
     SourceManager &SrcMgr = PP.getSourceManager();
@@ -1105,8 +1105,8 @@
     do {
       ConsumeAnyToken();
       TokLoc = Tok.getLocation();
-    } while ((SrcMgr.getInstantiationLineNumber(TokLoc) == LineNo) && 
-             Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) && 
+    } while ((SrcMgr.getInstantiationLineNumber(TokLoc) == LineNo) &&
+             Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) &&
              Tok.isNot(tok::eof));
   }
   return Actions.ActOnNullStmt(Tok.getLocation());
@@ -1196,7 +1196,7 @@
         return StmtError();
 
     assert(Names.size() == Constraints.size() &&
-           Constraints.size() == Exprs.size() 
+           Constraints.size() == Exprs.size()
            && "Input operand size mismatch!");
 
     NumInputs = Names.size() - NumOutputs;
@@ -1247,22 +1247,22 @@
   // Only do anything if this operand is present.
   if (Tok.isNot(tok::colon)) return false;
   ConsumeToken();
-  
+
   // 'asm-operands' isn't present?
   if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
     return false;
-  
-  while (1) {   
+
+  while (1) {
     // Read the [id] if present.
     if (Tok.is(tok::l_square)) {
       SourceLocation Loc = ConsumeBracket();
-      
+
       if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         SkipUntil(tok::r_paren);
         return true;
       }
-      
+
       IdentifierInfo *II = Tok.getIdentifierInfo();
       ConsumeToken();
 
@@ -1308,7 +1308,7 @@
   PrettyStackTraceActionsDecl CrashInfo(Decl, LBraceLoc, Actions,
                                         PP.getSourceManager(),
                                         "parsing function body");
-  
+
   // Do not enter a scope for the brace, as the arguments are in the same scope
   // (the function body) as the body itself.  Instead, just read the statement
   // list and put it into a CompoundStmt for safe keeping.
@@ -1316,7 +1316,7 @@
 
   // If the function body could not be parsed, make a bogus compoundstmt.
   if (FnBody.isInvalid())
-    FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, 
+    FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc,
                                        MultiStmtArg(Actions), false);
 
   return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Wed Sep  9 10:08:12 2009
@@ -25,7 +25,7 @@
                                              SourceLocation &DeclEnd,
                                              AccessSpecifier AS) {
   if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less))
-    return ParseExplicitInstantiation(SourceLocation(), ConsumeToken(), 
+    return ParseExplicitInstantiation(SourceLocation(), ConsumeToken(),
                                       DeclEnd);
 
   return ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS);
@@ -38,18 +38,18 @@
     unsigned AddedLevels;
 
   public:
-    explicit TemplateParameterDepthCounter(unsigned &Depth) 
+    explicit TemplateParameterDepthCounter(unsigned &Depth)
       : Depth(Depth), AddedLevels(0) { }
-    
+
     ~TemplateParameterDepthCounter() {
       Depth -= AddedLevels;
     }
-    
-    void operator++() { 
+
+    void operator++() {
       ++Depth;
       ++AddedLevels;
     }
-    
+
     operator unsigned() const { return Depth; }
   };
 }
@@ -73,9 +73,9 @@
 Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
                                                  SourceLocation &DeclEnd,
                                                  AccessSpecifier AS) {
-  assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) && 
-	 "Token does not start a template declaration.");
-  
+  assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
+         "Token does not start a template declaration.");
+
   // Enter template-parameter scope.
   ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
 
@@ -118,33 +118,33 @@
       Diag(Tok.getLocation(), diag::err_expected_template);
       return DeclPtrTy();
     }
-  
+
     // Parse the '<' template-parameter-list '>'
     SourceLocation LAngleLoc, RAngleLoc;
     TemplateParameterList TemplateParams;
-    if (ParseTemplateParameters(Depth, TemplateParams, LAngleLoc, 
+    if (ParseTemplateParameters(Depth, TemplateParams, LAngleLoc,
                                 RAngleLoc)) {
       // Skip until the semi-colon or a }.
       SkipUntil(tok::r_brace, true, true);
       if (Tok.is(tok::semi))
         ConsumeToken();
-      return DeclPtrTy();      
+      return DeclPtrTy();
     }
 
     ParamLists.push_back(
-      Actions.ActOnTemplateParameterList(Depth, ExportLoc, 
-                                         TemplateLoc, LAngleLoc, 
+      Actions.ActOnTemplateParameterList(Depth, ExportLoc,
+                                         TemplateLoc, LAngleLoc,
                                          TemplateParams.data(),
                                          TemplateParams.size(), RAngleLoc));
 
     if (!TemplateParams.empty()) {
       isSpecialization = false;
       ++Depth;
-    }    
+    }
   } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
 
   // Parse the actual template declaration.
-  return ParseSingleDeclarationAfterTemplate(Context, 
+  return ParseSingleDeclarationAfterTemplate(Context,
                                              ParsedTemplateInfo(&ParamLists,
                                                              isSpecialization),
                                              DeclEnd, AS);
@@ -170,7 +170,7 @@
 /// declaration. Will be AS_none for namespace-scope declarations.
 ///
 /// \returns the new declaration.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseSingleDeclarationAfterTemplate(
                                        unsigned Context,
                                        const ParsedTemplateInfo &TemplateInfo,
@@ -184,7 +184,7 @@
     ParseCXXClassMemberDeclaration(AS, TemplateInfo);
     return DeclPtrTy::make((void*)0);
   }
-  
+
   // Parse the declaration specifiers.
   DeclSpec DS;
   ParseDeclarationSpecifiers(DS, TemplateInfo, AS);
@@ -205,7 +205,7 @@
       ConsumeToken();
     return DeclPtrTy();
   }
-  
+
   // If we have a declaration or declarator list, handle it.
   if (isDeclarationAfterDeclarator()) {
     // Parse this declaration.
@@ -256,7 +256,7 @@
 /// is the number of template headers directly enclosing this template header.
 /// TemplateParams is the current list of template parameters we're building.
 /// The template parameter we parse will be added to this list. LAngleLoc and
-/// RAngleLoc will receive the positions of the '<' and '>', respectively, 
+/// RAngleLoc will receive the positions of the '<' and '>', respectively,
 /// that enclose this template parameter list.
 ///
 /// \returns true if an error occurred, false otherwise.
@@ -265,17 +265,17 @@
                                      SourceLocation &LAngleLoc,
                                      SourceLocation &RAngleLoc) {
   // Get the template parameter list.
-  if(!Tok.is(tok::less)) {
+  if (!Tok.is(tok::less)) {
     Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
     return true;
   }
   LAngleLoc = ConsumeToken();
-  
+
   // Try to parse the template parameter list.
   if (Tok.is(tok::greater))
     RAngleLoc = ConsumeToken();
-  else if(ParseTemplateParameterList(Depth, TemplateParams)) {
-    if(!Tok.is(tok::greater)) {
+  else if (ParseTemplateParameterList(Depth, TemplateParams)) {
+    if (!Tok.is(tok::greater)) {
       Diag(Tok.getLocation(), diag::err_expected_greater);
       return true;
     }
@@ -287,15 +287,15 @@
 /// ParseTemplateParameterList - Parse a template parameter list. If
 /// the parsing fails badly (i.e., closing bracket was left out), this
 /// will try to put the token stream in a reasonable position (closing
-/// a statement, etc.) and return false. 
+/// a statement, etc.) and return false.
 ///
 ///       template-parameter-list:    [C++ temp]
 ///         template-parameter
 ///         template-parameter-list ',' template-parameter
-bool 
+bool
 Parser::ParseTemplateParameterList(unsigned Depth,
                                    TemplateParameterList &TemplateParams) {
-  while(1) {
+  while (1) {
     if (DeclPtrTy TmpParam
           = ParseTemplateParameter(Depth, TemplateParams.size())) {
       TemplateParams.push_back(TmpParam);
@@ -304,11 +304,11 @@
       // a comma or closing brace.
       SkipUntil(tok::comma, tok::greater, true, true);
     }
-    
+
     // Did we find a comma or the end of the template parmeter list?
-    if(Tok.is(tok::comma)) {
+    if (Tok.is(tok::comma)) {
       ConsumeToken();
-    } else if(Tok.is(tok::greater)) {
+    } else if (Tok.is(tok::greater)) {
       // Don't consume this... that's done by template parser.
       break;
     } else {
@@ -338,16 +338,16 @@
 ///         'typename' identifier[opt] '=' type-id
 ///         'template' ...[opt][C++0x] '<' template-parameter-list '>' 'class' identifier[opt]
 ///         'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
-  if(Tok.is(tok::kw_class) ||
-     (Tok.is(tok::kw_typename) && 
-         // FIXME: Next token has not been annotated!
-	 NextToken().isNot(tok::annot_typename))) {
+  if (Tok.is(tok::kw_class) ||
+      (Tok.is(tok::kw_typename) &&
+       // FIXME: Next token has not been annotated!
+       NextToken().isNot(tok::annot_typename))) {
     return ParseTypeParameter(Depth, Position);
   }
-  
-  if(Tok.is(tok::kw_template))
+
+  if (Tok.is(tok::kw_template))
     return ParseTemplateTemplateParameter(Depth, Position);
 
   // If it's none of the above, then it must be a parameter declaration.
@@ -367,7 +367,7 @@
 ///         'typename' identifier[opt] '=' type-id
 Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
   assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
-	 "A type-parameter starts with 'class' or 'typename'");
+         "A type-parameter starts with 'class' or 'typename'");
 
   // Consume the 'class' or 'typename' keyword.
   bool TypenameKeyword = Tok.is(tok::kw_typename);
@@ -379,33 +379,33 @@
   if (Tok.is(tok::ellipsis)) {
     Ellipsis = true;
     EllipsisLoc = ConsumeToken();
-    
-    if (!getLang().CPlusPlus0x) 
+
+    if (!getLang().CPlusPlus0x)
       Diag(EllipsisLoc, diag::err_variadic_templates);
   }
-  
+
   // Grab the template parameter name (if given)
   SourceLocation NameLoc;
   IdentifierInfo* ParamName = 0;
-  if(Tok.is(tok::identifier)) {
+  if (Tok.is(tok::identifier)) {
     ParamName = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
-  } else if(Tok.is(tok::equal) || Tok.is(tok::comma) ||
-	    Tok.is(tok::greater)) {
+  } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
+            Tok.is(tok::greater)) {
     // Unnamed template parameter. Don't have to do anything here, just
     // don't consume this token.
   } else {
     Diag(Tok.getLocation(), diag::err_expected_ident);
     return DeclPtrTy();
   }
-  
+
   DeclPtrTy TypeParam = Actions.ActOnTypeParameter(CurScope, TypenameKeyword,
                                                    Ellipsis, EllipsisLoc,
                                                    KeyLoc, ParamName, NameLoc,
                                                    Depth, Position);
 
   // Grab a default type id (if given).
-  if(Tok.is(tok::equal)) {
+  if (Tok.is(tok::equal)) {
     SourceLocation EqualLoc = ConsumeToken();
     SourceLocation DefaultLoc = Tok.getLocation();
     TypeResult DefaultType = ParseTypeName();
@@ -413,12 +413,12 @@
       Actions.ActOnTypeParameterDefault(TypeParam, EqualLoc, DefaultLoc,
                                         DefaultType.get());
   }
-  
+
   return TypeParam;
 }
 
 /// ParseTemplateTemplateParameter - Handle the parsing of template
-/// template parameters. 
+/// template parameters.
 ///
 ///       type-parameter:    [C++ temp.param]
 ///         'template' '<' template-parameter-list '>' 'class' identifier[opt]
@@ -429,11 +429,11 @@
 
   // Handle the template <...> part.
   SourceLocation TemplateLoc = ConsumeToken();
-  TemplateParameterList TemplateParams; 
+  TemplateParameterList TemplateParams;
   SourceLocation LAngleLoc, RAngleLoc;
   {
     ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
-    if(ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
+    if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
                                RAngleLoc)) {
       return DeclPtrTy();
     }
@@ -441,8 +441,8 @@
 
   // Generate a meaningful error if the user forgot to put class before the
   // identifier, comma, or greater.
-  if(!Tok.is(tok::kw_class)) {
-    Diag(Tok.getLocation(), diag::err_expected_class_before) 
+  if (!Tok.is(tok::kw_class)) {
+    Diag(Tok.getLocation(), diag::err_expected_class_before)
       << PP.getSpelling(Tok);
     return DeclPtrTy();
   }
@@ -451,10 +451,10 @@
   // Get the identifier, if given.
   SourceLocation NameLoc;
   IdentifierInfo* ParamName = 0;
-  if(Tok.is(tok::identifier)) {
+  if (Tok.is(tok::identifier)) {
     ParamName = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
-  } else if(Tok.is(tok::equal) || Tok.is(tok::comma) || Tok.is(tok::greater)) {
+  } else if (Tok.is(tok::equal) || Tok.is(tok::comma) || Tok.is(tok::greater)) {
     // Unnamed template parameter. Don't have to do anything here, just
     // don't consume this token.
   } else {
@@ -462,10 +462,10 @@
     return DeclPtrTy();
   }
 
-  TemplateParamsTy *ParamList = 
+  TemplateParamsTy *ParamList =
     Actions.ActOnTemplateParameterList(Depth, SourceLocation(),
                                        TemplateLoc, LAngleLoc,
-                                       &TemplateParams[0], 
+                                       &TemplateParams[0],
                                        TemplateParams.size(),
                                        RAngleLoc);
 
@@ -489,7 +489,7 @@
 }
 
 /// ParseNonTypeTemplateParameter - Handle the parsing of non-type
-/// template parameters (e.g., in "template<int Size> class array;"). 
+/// template parameters (e.g., in "template<int Size> class array;").
 ///
 ///       template-parameter:
 ///         ...
@@ -501,7 +501,7 @@
 /// parameters.
 /// FIXME: We need to make a ParseParameterDeclaration that works for
 /// non-type template parameters and normal function parameters.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
   SourceLocation StartLoc = Tok.getLocation();
 
@@ -524,7 +524,7 @@
     return DeclPtrTy();
   }
 
-  // Create the parameter. 
+  // Create the parameter.
   DeclPtrTy Param = Actions.ActOnNonTypeTemplateParameter(CurScope, ParamDecl,
                                                           Depth, Position);
 
@@ -537,16 +537,16 @@
     //   template-parameter, the first non-nested > is taken as the
     //   end of the template-parameter-list rather than a greater-than
     //   operator.
-    GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);   
+    GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
 
     OwningExprResult DefaultArg = ParseAssignmentExpression();
     if (DefaultArg.isInvalid())
       SkipUntil(tok::comma, tok::greater, true, true);
     else if (Param)
-      Actions.ActOnNonTypeTemplateParameterDefault(Param, EqualLoc, 
+      Actions.ActOnNonTypeTemplateParameterDefault(Param, EqualLoc,
                                                    move(DefaultArg));
   }
-  
+
   return Param;
 }
 
@@ -568,9 +568,9 @@
 /// token that forms the template-id. Otherwise, we will leave the
 /// last token in the stream (e.g., so that it can be replaced with an
 /// annotation token).
-bool 
+bool
 Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template,
-                                         SourceLocation TemplateNameLoc, 
+                                         SourceLocation TemplateNameLoc,
                                          const CXXScopeSpec *SS,
                                          bool ConsumeLastToken,
                                          SourceLocation &LAngleLoc,
@@ -628,7 +628,7 @@
 
   return false;
 }
-                                              
+
 /// \brief Replace the tokens that form a simple-template-id with an
 /// annotation token containing the complete template-id.
 ///
@@ -667,7 +667,7 @@
 /// formed, this function returns true.
 ///
 bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK,
-                                     const CXXScopeSpec *SS, 
+                                     const CXXScopeSpec *SS,
                                      SourceLocation TemplateKWLoc,
                                      bool AllowTypeAnnotation) {
   assert(getLang().CPlusPlus && "Can only annotate template-ids in C++");
@@ -684,12 +684,12 @@
   TemplateArgIsTypeList TemplateArgIsType;
   TemplateArgLocationList TemplateArgLocations;
   bool Invalid = ParseTemplateIdAfterTemplateName(Template, TemplateNameLoc,
-                                                  SS, false, LAngleLoc, 
-                                                  TemplateArgs, 
+                                                  SS, false, LAngleLoc,
+                                                  TemplateArgs,
                                                   TemplateArgIsType,
                                                   TemplateArgLocations,
                                                   RAngleLoc);
-  
+
   if (Invalid) {
     // If we failed to parse the template ID but skipped ahead to a >, we're not
     // going to be able to form a token annotation.  Eat the '>' if present.
@@ -704,7 +704,7 @@
 
   // Build the annotation token.
   if (TNK == TNK_Type_template && AllowTypeAnnotation) {
-    Action::TypeResult Type 
+    Action::TypeResult Type
       = Actions.ActOnTemplateIdType(Template, TemplateNameLoc,
                                     LAngleLoc, TemplateArgsPtr,
                                     &TemplateArgLocations[0],
@@ -723,13 +723,13 @@
       Tok.setLocation(SS->getBeginLoc());
     else if (TemplateKWLoc.isValid())
       Tok.setLocation(TemplateKWLoc);
-    else 
+    else
       Tok.setLocation(TemplateNameLoc);
   } else {
     // Build a template-id annotation token that can be processed
     // later.
     Tok.setKind(tok::annot_template_id);
-    TemplateIdAnnotation *TemplateId 
+    TemplateIdAnnotation *TemplateId
       = TemplateIdAnnotation::Allocate(TemplateArgs.size());
     TemplateId->TemplateNameLoc = TemplateNameLoc;
     TemplateId->Name = Name;
@@ -772,21 +772,21 @@
 void Parser::AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS) {
   assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
 
-  TemplateIdAnnotation *TemplateId 
+  TemplateIdAnnotation *TemplateId
     = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
   assert((TemplateId->Kind == TNK_Type_template ||
           TemplateId->Kind == TNK_Dependent_template_name) &&
          "Only works for type and dependent templates");
-  
-  ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+
+  ASTTemplateArgsPtr TemplateArgsPtr(Actions,
                                      TemplateId->getTemplateArgs(),
                                      TemplateId->getTemplateArgIsType(),
                                      TemplateId->NumArgs);
 
-  Action::TypeResult Type 
+  Action::TypeResult Type
     = Actions.ActOnTemplateIdType(TemplateTy::make(TemplateId->Template),
                                   TemplateId->TemplateNameLoc,
-                                  TemplateId->LAngleLoc, 
+                                  TemplateId->LAngleLoc,
                                   TemplateArgsPtr,
                                   TemplateId->getTemplateArgLocations(),
                                   TemplateId->RAngleLoc);
@@ -839,7 +839,7 @@
 ///       template-argument-list: [C++ 14.2]
 ///         template-argument
 ///         template-argument-list ',' template-argument
-bool 
+bool
 Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs,
                                   TemplateArgIsTypeList &TemplateArgIsType,
                               TemplateArgLocationList &TemplateArgLocations) {
@@ -867,18 +867,18 @@
   return Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater);
 }
 
-/// \brief Parse a C++ explicit template instantiation 
+/// \brief Parse a C++ explicit template instantiation
 /// (C++ [temp.explicit]).
 ///
 ///       explicit-instantiation:
 ///         'extern' [opt] 'template' declaration
 ///
 /// Note that the 'extern' is a GNU extension and C++0x feature.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseExplicitInstantiation(SourceLocation ExternLoc,
                                    SourceLocation TemplateLoc,
                                    SourceLocation &DeclEnd) {
-  return ParseSingleDeclarationAfterTemplate(Declarator::FileContext, 
+  return ParseSingleDeclarationAfterTemplate(Declarator::FileContext,
                                              ParsedTemplateInfo(ExternLoc,
                                                                 TemplateLoc),
                                              DeclEnd, AS_none);

Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Wed Sep  9 10:08:12 2009
@@ -270,7 +270,7 @@
   return TPR == TPResult::True();
 }
 
-  /// \brief Determine whether the next set of tokens contains a type-id. 
+  /// \brief Determine whether the next set of tokens contains a type-id.
   ///
   /// The context parameter states what context we're parsing right
   /// now, which affects how this routine copes with the token
@@ -288,7 +288,7 @@
   ///   type-specifier-seq abstract-declarator[opt]
   ///
 bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
-  
+
   isAmbiguous = false;
 
   // C++ 8.2p2:
@@ -601,14 +601,14 @@
       if (NextToken().is(tok::kw_new) ||    // ::new
           NextToken().is(tok::kw_delete))   // ::delete
         return TPResult::False();
-      
+
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
     if (TryAnnotateTypeOrScopeToken())
       return isCXXDeclarationSpecifier();
     // Otherwise, not a typename.
     return TPResult::False();
-      
+
     // decl-specifier:
     //   storage-class-specifier
     //   type-specifier
@@ -654,7 +654,7 @@
   case tok::kw__Complex:
   case tok::kw___attribute:
     return TPResult::True();
-    
+
     // Microsoft
   case tok::kw___declspec:
   case tok::kw___cdecl:
@@ -758,7 +758,7 @@
     TryParseTypeofSpecifier();
   else
     ConsumeToken();
-  
+
   assert(Tok.is(tok::l_paren) && "Expected '('!");
   return TPResult::Ambiguous();
 }
@@ -880,7 +880,7 @@
 /// If TryParseFunctionDeclarator fully parsed the function declarator, it will
 /// return TPResult::Ambiguous(), otherwise it will return either False() or
 /// Error().
-/// 
+///
 /// '(' parameter-declaration-clause ')' cv-qualifier-seq[opt]
 ///         exception-specification[opt]
 ///

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Wed Sep  9 10:08:12 2009
@@ -24,17 +24,17 @@
 /// to the parser action.
 class ActionCommentHandler : public CommentHandler {
   Action &Actions;
-  
+
 public:
   explicit ActionCommentHandler(Action &Actions) : Actions(Actions) { }
-  
+
   virtual void HandleComment(Preprocessor &PP, SourceRange Comment) {
     Actions.ActOnComment(Comment);
   }
 };
 
 Parser::Parser(Preprocessor &pp, Action &actions)
-  : CrashInfo(*this), PP(pp), Actions(actions), Diags(PP.getDiagnostics()), 
+  : CrashInfo(*this), PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
     GreaterThanIsOperator(true), TemplateParameterDepth(0) {
   Tok.setKind(tok::eof);
   CurScope = 0;
@@ -47,7 +47,7 @@
   PackHandler.reset(new
           PragmaPackHandler(&PP.getIdentifierTable().get("pack"), actions));
   PP.AddPragmaHandler(0, PackHandler.get());
-      
+
   UnusedHandler.reset(new
           PragmaUnusedHandler(&PP.getIdentifierTable().get("unused"), actions,
                               *this));
@@ -56,9 +56,9 @@
   WeakHandler.reset(new
           PragmaWeakHandler(&PP.getIdentifierTable().get("weak"), actions));
   PP.AddPragmaHandler(0, WeakHandler.get());
-      
+
   CommentHandler.reset(new ActionCommentHandler(actions));
-  PP.AddCommentHandler(CommentHandler.get());    
+  PP.AddCommentHandler(CommentHandler.get());
 }
 
 /// If a crash happens while the parser is active, print out a line indicating
@@ -69,12 +69,12 @@
     OS << "<eof> parser at end of file\n";
     return;
   }
-  
+
   if (Tok.getLocation().isInvalid()) {
     OS << "<unknown> parser at unknown location\n";
     return;
   }
-  
+
   const Preprocessor &PP = P.getPreprocessor();
   Tok.getLocation().print(OS, PP.getSourceManager());
   OS << ": current parser token '" << PP.getSpelling(Tok) << "'\n";
@@ -104,8 +104,8 @@
     Diag(Loc, DK);
     return;
   }
-    
-  Diag(Loc, DK) 
+
+  Diag(Loc, DK)
     << CodeModificationHint::CreateInsertion(ParenRange.getBegin(), "(")
     << CodeModificationHint::CreateInsertion(EndLoc, ")");
 }
@@ -152,10 +152,10 @@
 
   const char *Spelling = 0;
   SourceLocation EndLoc = PP.getLocForEndOfToken(PrevTokLocation);
-  if (EndLoc.isValid() && 
+  if (EndLoc.isValid() &&
       (Spelling = tok::getTokenSimpleSpelling(ExpectedTok))) {
     // Show what code to insert to fix this problem.
-    Diag(EndLoc, DiagID) 
+    Diag(EndLoc, DiagID)
       << Msg
       << CodeModificationHint::CreateInsertion(EndLoc, Spelling);
   } else
@@ -365,7 +365,7 @@
   DeclGroupPtrTy Res;
   while (!ParseTopLevelDecl(Res))
     /*parse them all*/;
-  
+
   ExitScope();
   assert(CurScope == 0 && "Scope imbalance!");
 }
@@ -399,7 +399,7 @@
     if (!getLang().CPlusPlus0x)
       Diag(Tok, diag::ext_top_level_semi)
         << CodeModificationHint::CreateRemoval(SourceRange(Tok.getLocation()));
-      
+
     ConsumeToken();
     // TODO: Invoke action for top-level semicolon.
     return DeclGroupPtrTy();
@@ -462,16 +462,16 @@
       return Actions.ConvertDeclToDeclGroup(
                   ParseExplicitInstantiation(ExternLoc, TemplateLoc, DeclEnd));
     }
-    
+
     // FIXME: Detect C++ linkage specifications here?
-      
+
     // Fall through to handle other declarations or function definitions.
-      
+
   default:
     // We can't tell whether this is a function-definition or declaration yet.
     return ParseDeclarationOrFunctionDefinition();
   }
-  
+
   // This routine returns a DeclGroup, if the thing we parsed only contains a
   // single decl, convert it now.
   return Actions.ConvertDeclToDeclGroup(SingleDecl);
@@ -493,7 +493,7 @@
 /// declarator, indicates the start of a function definition.
 bool Parser::isStartOfFunctionDefinition() {
   return Tok.is(tok::l_brace) ||    // int X() {}
-    (!getLang().CPlusPlus && 
+    (!getLang().CPlusPlus &&
      isDeclarationSpecifier()) ||   // int X(f) int f; {}
     (getLang().CPlusPlus &&
      (Tok.is(tok::colon) ||         // X() : Base() {} (used for ctors)
@@ -504,7 +504,7 @@
 /// a declaration.  We can't tell which we have until we read up to the
 /// compound-statement in function-definition. TemplateParams, if
 /// non-NULL, provides the template parameters when we're parsing a
-/// C++ template-declaration. 
+/// C++ template-declaration.
 ///
 ///       function-definition: [C99 6.9.1]
 ///         decl-specs      declarator declaration-list[opt] compound-statement
@@ -535,7 +535,7 @@
   // attributes here, no types, etc.
   if (getLang().ObjC2 && Tok.is(tok::at)) {
     SourceLocation AtLoc = ConsumeToken(); // the "@"
-    if (!Tok.isObjCAtKeyword(tok::objc_interface) && 
+    if (!Tok.isObjCAtKeyword(tok::objc_interface) &&
         !Tok.isObjCAtKeyword(tok::objc_protocol)) {
       Diag(Tok, diag::err_objc_unexpected_attr);
       SkipUntil(tok::semi); // FIXME: better skip?
@@ -545,7 +545,7 @@
     unsigned DiagID;
     if (DS.SetTypeSpecType(DeclSpec::TST_unspecified, AtLoc, PrevSpec, DiagID))
       Diag(AtLoc, DiagID) << PrevSpec;
-    
+
     DeclPtrTy TheDecl;
     if (Tok.isObjCAtKeyword(tok::objc_protocol))
       TheDecl = ParseObjCAtProtocolDeclaration(AtLoc, DS.getAttributes());
@@ -585,7 +585,7 @@
     ExpectAndConsume(tok::semi, diag::err_expected_semi_declaration);
     return DG;
   }
-  
+
   if (DeclaratorInfo.isFunctionDeclarator() &&
       isStartOfFunctionDefinition()) {
     if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
@@ -605,7 +605,7 @@
     DeclPtrTy TheDecl = ParseFunctionDefinition(DeclaratorInfo);
     return Actions.ConvertDeclToDeclGroup(TheDecl);
   }
-  
+
   if (DeclaratorInfo.isFunctionDeclarator())
     Diag(Tok, diag::err_expected_fn_body);
   else
@@ -672,7 +672,7 @@
 
   // Tell the actions module that we have entered a function definition with the
   // specified Declarator for the function.
-  DeclPtrTy Res = TemplateInfo.TemplateParams? 
+  DeclPtrTy Res = TemplateInfo.TemplateParams?
       Actions.ActOnStartOfFunctionTemplateDef(CurScope,
                               Action::MultiTemplateParamsArg(Actions,
                                           TemplateInfo.TemplateParams->data(),
@@ -882,24 +882,24 @@
 ///
 /// This returns true if the token was annotated or an unrecoverable error
 /// occurs.
-/// 
+///
 /// Note that this routine emits an error if you call it with ::new or ::delete
 /// as the current tokens, so only call it in contexts where these are invalid.
 bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
-  assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) 
+  assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)
           || Tok.is(tok::kw_typename)) &&
          "Cannot be a type or scope token!");
-  
+
   if (Tok.is(tok::kw_typename)) {
     // Parse a C++ typename-specifier, e.g., "typename T::type".
     //
     //   typename-specifier:
     //     'typename' '::' [opt] nested-name-specifier identifier
-    //     'typename' '::' [opt] nested-name-specifier template [opt] 
+    //     'typename' '::' [opt] nested-name-specifier template [opt]
     //            simple-template-id
     SourceLocation TypenameLoc = ConsumeToken();
     CXXScopeSpec SS;
-    bool HadNestedNameSpecifier 
+    bool HadNestedNameSpecifier
       = ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false);
     if (!HadNestedNameSpecifier) {
       Diag(Tok.getLocation(), diag::err_expected_qualified_after_typename);
@@ -909,10 +909,10 @@
     TypeResult Ty;
     if (Tok.is(tok::identifier)) {
       // FIXME: check whether the next token is '<', first!
-      Ty = Actions.ActOnTypenameType(TypenameLoc, SS, *Tok.getIdentifierInfo(), 
+      Ty = Actions.ActOnTypenameType(TypenameLoc, SS, *Tok.getIdentifierInfo(),
                                      Tok.getLocation());
     } else if (Tok.is(tok::annot_template_id)) {
-      TemplateIdAnnotation *TemplateId 
+      TemplateIdAnnotation *TemplateId
         = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
       if (TemplateId->Kind == TNK_Function_template) {
         Diag(Tok, diag::err_typename_refers_to_non_type_template)
@@ -921,7 +921,7 @@
       }
 
       AnnotateTemplateIdTokenAsType(0);
-      assert(Tok.is(tok::annot_typename) && 
+      assert(Tok.is(tok::annot_typename) &&
              "AnnotateTemplateIdTokenAsType isn't working properly");
       if (Tok.getAnnotationValue())
         Ty = Actions.ActOnTypenameType(TypenameLoc, SS, SourceLocation(),
@@ -948,7 +948,7 @@
 
   if (Tok.is(tok::identifier)) {
     // Determine whether the identifier is a type name.
-    if (TypeTy *Ty = Actions.getTypeName(*Tok.getIdentifierInfo(), 
+    if (TypeTy *Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
                                          Tok.getLocation(), CurScope, &SS)) {
       // This is a typename. Replace the current token in-place with an
       // annotation type token.
@@ -957,27 +957,27 @@
       Tok.setAnnotationEndLoc(Tok.getLocation());
       if (SS.isNotEmpty()) // it was a C++ qualified type name.
         Tok.setLocation(SS.getBeginLoc());
-      
+
       // In case the tokens were cached, have Preprocessor replace
       // them with the annotation token.
       PP.AnnotateCachedTokens(Tok);
       return true;
-    } 
+    }
 
     if (!getLang().CPlusPlus) {
       // If we're in C, we can't have :: tokens at all (the lexer won't return
       // them).  If the identifier is not a type, then it can't be scope either,
-      // just early exit. 
+      // just early exit.
       return false;
     }
-    
+
     // If this is a template-id, annotate with a template-id or type token.
     if (NextToken().is(tok::less)) {
       TemplateTy Template;
-      if (TemplateNameKind TNK 
-            = Actions.isTemplateName(CurScope, *Tok.getIdentifierInfo(), 
-                                     Tok.getLocation(), &SS, 
-                                     /*ObjectType=*/0, EnteringContext, 
+      if (TemplateNameKind TNK
+            = Actions.isTemplateName(CurScope, *Tok.getIdentifierInfo(),
+                                     Tok.getLocation(), &SS,
+                                     /*ObjectType=*/0, EnteringContext,
                                      Template))
         if (AnnotateTemplateIdToken(Template, TNK, &SS)) {
           // If an unrecoverable error occurred, we need to return true here,
@@ -991,10 +991,10 @@
     // template-id, is not part of the annotation. Fall through to
     // push that token back into the stream and complete the C++ scope
     // specifier annotation.
-  } 
+  }
 
   if (Tok.is(tok::annot_template_id)) {
-    TemplateIdAnnotation *TemplateId 
+    TemplateIdAnnotation *TemplateId
       = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
     if (TemplateId->Kind == TNK_Type_template) {
       // A template-id that refers to a type was parsed into a
@@ -1008,7 +1008,7 @@
 
   if (SS.isEmpty())
     return Tok.isNot(tok::identifier) && Tok.isNot(tok::coloncolon);
-  
+
   // A C++ scope specifier that isn't followed by a typename.
   // Push the current token back into the token stream (or revert it if it is
   // cached) and use an annotation scope token for current token.
@@ -1030,7 +1030,7 @@
 /// annotates C++ scope specifiers and template-ids.  This returns
 /// true if the token was annotated or there was an error that could not be
 /// recovered from.
-/// 
+///
 /// Note that this routine emits an error if you call it with ::new or ::delete
 /// as the current tokens, so only call it in contexts where these are invalid.
 bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) {

Modified: cfe/trunk/lib/Rewrite/DeltaTree.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/DeltaTree.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/DeltaTree.cpp (original)
+++ cfe/trunk/lib/Rewrite/DeltaTree.cpp Wed Sep  9 10:08:12 2009
@@ -39,7 +39,7 @@
 /// former and adds children pointers.  Each node knows the full delta of all
 /// entries (recursively) contained inside of it, which allows us to get the
 /// full delta implied by a whole subtree in constant time.
-  
+
 namespace {
   /// SourceDelta - As code in the original input buffer is added and deleted,
   /// SourceDelta records are used to keep track of how the input SourceLocation
@@ -47,7 +47,7 @@
   struct SourceDelta {
     unsigned FileLoc;
     int Delta;
-    
+
     static SourceDelta get(unsigned Loc, int D) {
       SourceDelta Delta;
       Delta.FileLoc = Loc;
@@ -71,36 +71,36 @@
   ///
   class DeltaTreeNode {
     friend class DeltaTreeInteriorNode;
-    
+
     /// WidthFactor - This controls the number of K/V slots held in the BTree:
     /// how wide it is.  Each level of the BTree is guaranteed to have at least
     /// WidthFactor-1 K/V pairs (except the root) and may have at most
     /// 2*WidthFactor-1 K/V pairs.
     enum { WidthFactor = 8 };
-    
+
     /// Values - This tracks the SourceDelta's currently in this node.
     ///
     SourceDelta Values[2*WidthFactor-1];
-    
+
     /// NumValuesUsed - This tracks the number of values this node currently
     /// holds.
     unsigned char NumValuesUsed;
-    
+
     /// IsLeaf - This is true if this is a leaf of the btree.  If false, this is
     /// an interior node, and is actually an instance of DeltaTreeInteriorNode.
     bool IsLeaf;
-    
+
     /// FullDelta - This is the full delta of all the values in this node and
     /// all children nodes.
     int FullDelta;
   public:
     DeltaTreeNode(bool isLeaf = true)
       : NumValuesUsed(0), IsLeaf(isLeaf), FullDelta(0) {}
-    
+
     bool isLeaf() const { return IsLeaf; }
     int getFullDelta() const { return FullDelta; }
     bool isFull() const { return NumValuesUsed == 2*WidthFactor-1; }
-    
+
     unsigned getNumValuesUsed() const { return NumValuesUsed; }
     const SourceDelta &getValue(unsigned i) const {
       assert(i < NumValuesUsed && "Invalid value #");
@@ -110,7 +110,7 @@
       assert(i < NumValuesUsed && "Invalid value #");
       return Values[i];
     }
-    
+
     /// DoInsertion - Do an insertion of the specified FileIndex/Delta pair into
     /// this node.  If insertion is easy, do it and return false.  Otherwise,
     /// split the node, populate InsertRes with info about the split, and return
@@ -118,14 +118,14 @@
     bool DoInsertion(unsigned FileIndex, int Delta, InsertResult *InsertRes);
 
     void DoSplit(InsertResult &InsertRes);
-    
-    
+
+
     /// RecomputeFullDeltaLocally - Recompute the FullDelta field by doing a
     /// local walk over our contained deltas.
     void RecomputeFullDeltaLocally();
-    
+
     void Destroy();
-    
+
     static inline bool classof(const DeltaTreeNode *) { return true; }
   };
 } // end anonymous namespace
@@ -142,14 +142,14 @@
     friend class DeltaTreeNode;
   public:
     DeltaTreeInteriorNode() : DeltaTreeNode(false /*nonleaf*/) {}
-    
+
     DeltaTreeInteriorNode(DeltaTreeNode *FirstChild)
     : DeltaTreeNode(false /*nonleaf*/) {
       FullDelta = FirstChild->FullDelta;
       Children[0] = FirstChild;
     }
-    
-    DeltaTreeInteriorNode(const InsertResult &IR) 
+
+    DeltaTreeInteriorNode(const InsertResult &IR)
       : DeltaTreeNode(false /*nonleaf*/) {
       Children[0] = IR.LHS;
       Children[1] = IR.RHS;
@@ -157,7 +157,7 @@
       FullDelta = IR.LHS->getFullDelta()+IR.RHS->getFullDelta()+IR.Split.Delta;
       NumValuesUsed = 1;
     }
-    
+
     const DeltaTreeNode *getChild(unsigned i) const {
       assert(i < getNumValuesUsed()+1 && "Invalid child");
       return Children[i];
@@ -166,7 +166,7 @@
       assert(i < getNumValuesUsed()+1 && "Invalid child");
       return Children[i];
     }
-    
+
     static inline bool classof(const DeltaTreeInteriorNode *) { return true; }
     static inline bool classof(const DeltaTreeNode *N) { return !N->isLeaf(); }
   };
@@ -197,16 +197,16 @@
 /// this node.  If insertion is easy, do it and return false.  Otherwise,
 /// split the node, populate InsertRes with info about the split, and return
 /// true.
-bool DeltaTreeNode::DoInsertion(unsigned FileIndex, int Delta, 
+bool DeltaTreeNode::DoInsertion(unsigned FileIndex, int Delta,
                                 InsertResult *InsertRes) {
   // Maintain full delta for this node.
   FullDelta += Delta;
-  
+
   // Find the insertion point, the first delta whose index is >= FileIndex.
   unsigned i = 0, e = getNumValuesUsed();
   while (i != e && FileIndex > getValue(i).FileLoc)
     ++i;
-  
+
   // If we found an a record for exactly this file index, just merge this
   // value into the pre-existing record and finish early.
   if (i != e && getValue(i).FileLoc == FileIndex) {
@@ -230,19 +230,19 @@
       ++NumValuesUsed;
       return false;
     }
-    
+
     // Otherwise, if this is leaf is full, split the node at its median, insert
     // the value into one of the children, and return the result.
     assert(InsertRes && "No result location specified");
     DoSplit(*InsertRes);
-    
+
     if (InsertRes->Split.FileLoc > FileIndex)
       InsertRes->LHS->DoInsertion(FileIndex, Delta, 0 /*can't fail*/);
     else
       InsertRes->RHS->DoInsertion(FileIndex, Delta, 0 /*can't fail*/);
     return true;
   }
- 
+
   // Otherwise, this is an interior node.  Send the request down the tree.
   DeltaTreeInteriorNode *IN = cast<DeltaTreeInteriorNode>(this);
   if (!IN->Children[i]->DoInsertion(FileIndex, Delta, InsertRes))
@@ -259,21 +259,21 @@
               (e-i)*sizeof(IN->Children[0]));
     IN->Children[i] = InsertRes->LHS;
     IN->Children[i+1] = InsertRes->RHS;
-    
+
     if (e != i)
       memmove(&Values[i+1], &Values[i], (e-i)*sizeof(Values[0]));
     Values[i] = InsertRes->Split;
     ++NumValuesUsed;
     return false;
   }
-  
+
   // Finally, if this interior node was full and a node is percolated up, split
   // ourself and return that up the chain.  Start by saving all our info to
   // avoid having the split clobber it.
   IN->Children[i] = InsertRes->LHS;
   DeltaTreeNode *SubRHS = InsertRes->RHS;
   SourceDelta SubSplit = InsertRes->Split;
-  
+
   // Do the split.
   DoSplit(*InsertRes);
 
@@ -283,22 +283,22 @@
     InsertSide = cast<DeltaTreeInteriorNode>(InsertRes->LHS);
   else
     InsertSide = cast<DeltaTreeInteriorNode>(InsertRes->RHS);
-  
-  // We now have a non-empty interior node 'InsertSide' to insert 
+
+  // We now have a non-empty interior node 'InsertSide' to insert
   // SubRHS/SubSplit into.  Find out where to insert SubSplit.
-  
+
   // Find the insertion point, the first delta whose index is >SubSplit.FileLoc.
   i = 0; e = InsertSide->getNumValuesUsed();
   while (i != e && SubSplit.FileLoc > InsertSide->getValue(i).FileLoc)
     ++i;
-  
+
   // Now we know that i is the place to insert the split value into.  Insert it
   // and the child right after it.
   if (i != e)
     memmove(&InsertSide->Children[i+2], &InsertSide->Children[i+1],
             (e-i)*sizeof(IN->Children[0]));
   InsertSide->Children[i+1] = SubRHS;
-  
+
   if (e != i)
     memmove(&InsertSide->Values[i+1], &InsertSide->Values[i],
             (e-i)*sizeof(Values[0]));
@@ -313,12 +313,12 @@
 /// Return the pieces in InsertRes.
 void DeltaTreeNode::DoSplit(InsertResult &InsertRes) {
   assert(isFull() && "Why split a non-full node?");
-  
+
   // Since this node is full, it contains 2*WidthFactor-1 values.  We move
   // the first 'WidthFactor-1' values to the LHS child (which we leave in this
   // node), propagate one value up, and move the last 'WidthFactor-1' values
   // into the RHS child.
-  
+
   // Create the new child node.
   DeltaTreeNode *NewNode;
   if (DeltaTreeInteriorNode *IN = dyn_cast<DeltaTreeInteriorNode>(this)) {
@@ -332,18 +332,18 @@
     // Just create the new leaf node.
     NewNode = new DeltaTreeNode();
   }
-  
+
   // Move over the last 'WidthFactor-1' values from here to NewNode.
   memcpy(&NewNode->Values[0], &Values[WidthFactor],
          (WidthFactor-1)*sizeof(Values[0]));
-  
+
   // Decrease the number of values in the two nodes.
   NewNode->NumValuesUsed = NumValuesUsed = WidthFactor-1;
-  
+
   // Recompute the two nodes' full delta.
   NewNode->RecomputeFullDeltaLocally();
   RecomputeFullDeltaLocally();
-  
+
   InsertRes.LHS = this;
   InsertRes.RHS = NewNode;
   InsertRes.Split = Values[WidthFactor-1];
@@ -374,7 +374,7 @@
     assert(FullDelta == N->getFullDelta());
     return;
   }
-  
+
   // Verify interior nodes: Ensure that FullDelta matches up and the
   // elements are in proper order and the children are in proper order.
   int FullDelta = 0;
@@ -385,18 +385,18 @@
       assert(IN->getValue(i-1).FileLoc < IVal.FileLoc);
     FullDelta += IVal.Delta;
     FullDelta += IChild->getFullDelta();
-    
+
     // The largest value in child #i should be smaller than FileLoc.
     assert(IChild->getValue(IChild->getNumValuesUsed()-1).FileLoc <
            IVal.FileLoc);
-    
+
     // The smallest value in child #i+1 should be larger than FileLoc.
     assert(IN->getChild(i+1)->getValue(0).FileLoc > IVal.FileLoc);
     VerifyTree(IChild);
   }
-  
+
   FullDelta += IN->getChild(IN->getNumValuesUsed())->getFullDelta();
-  
+
   assert(FullDelta == N->getFullDelta());
 }
 #endif  // VERIFY_TREE
@@ -424,9 +424,9 @@
 /// specified file index.
 int DeltaTree::getDeltaAt(unsigned FileIndex) const {
   const DeltaTreeNode *Node = getRoot(Root);
-  
+
   int Result = 0;
-  
+
   // Walk down the tree.
   while (1) {
     // For all nodes, include any local deltas before the specified file
@@ -436,29 +436,29 @@
     for (unsigned e = Node->getNumValuesUsed(); NumValsGreater != e;
          ++NumValsGreater) {
       const SourceDelta &Val = Node->getValue(NumValsGreater);
-      
+
       if (Val.FileLoc >= FileIndex)
         break;
       Result += Val.Delta;
     }
-    
+
     // If we have an interior node, include information about children and
     // recurse.  Otherwise, if we have a leaf, we're done.
     const DeltaTreeInteriorNode *IN = dyn_cast<DeltaTreeInteriorNode>(Node);
     if (!IN) return Result;
-    
+
     // Include any children to the left of the values we skipped, all of
     // their deltas should be included as well.
     for (unsigned i = 0; i != NumValsGreater; ++i)
       Result += IN->getChild(i)->getFullDelta();
-    
+
     // If we found exactly the value we were looking for, break off the
     // search early.  There is no need to search the RHS of the value for
     // partial results.
     if (NumValsGreater != Node->getNumValuesUsed() &&
         Node->getValue(NumValsGreater).FileLoc == FileIndex)
       return Result+IN->getChild(NumValsGreater)->getFullDelta();
-    
+
     // Otherwise, traverse down the tree.  The selected subtree may be
     // partially included in the range.
     Node = IN->getChild(NumValsGreater);
@@ -472,12 +472,12 @@
 void DeltaTree::AddDelta(unsigned FileIndex, int Delta) {
   assert(Delta && "Adding a noop?");
   DeltaTreeNode *MyRoot = getRoot(Root);
-  
+
   InsertResult InsertRes;
   if (MyRoot->DoInsertion(FileIndex, Delta, &InsertRes)) {
     Root = MyRoot = new DeltaTreeInteriorNode(InsertRes);
   }
-  
+
 #ifdef VERIFY_TREE
   VerifyTree(MyRoot);
 #endif

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Wed Sep  9 10:08:12 2009
@@ -39,10 +39,10 @@
 
   unsigned BOffset = SM.getFileOffset(B);
   unsigned EOffset = SM.getFileOffset(E);
-  
+
   // Include the whole end token in the range.
   EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr(), R.getLangOpts());
-  
+
   HighlightRange(R.getEditBuffer(FID), BOffset, EOffset,
                  SM.getBufferData(FID).first, StartTag, EndTag);
 }
@@ -55,11 +55,11 @@
   // Insert the tag at the absolute start/end of the range.
   RB.InsertTextAfter(B, StartTag);
   RB.InsertTextBefore(E, EndTag);
-  
+
   // Scan the range to see if there is a \r or \n.  If so, and if the line is
   // not blank, insert tags on that line as well.
   bool HadOpenTag = true;
-  
+
   unsigned LastNonWhiteSpace = B;
   for (unsigned i = B; i != E; ++i) {
     switch (BufferStart[i]) {
@@ -69,7 +69,7 @@
       // to insert a close tag at the first non-whitespace before the newline.
       if (HadOpenTag)
         RB.InsertTextBefore(LastNonWhiteSpace+1, EndTag);
-        
+
       // Instead of inserting an open tag immediately after the newline, we
       // wait until we see a non-whitespace character.  This prevents us from
       // inserting tags around blank lines, and also allows the open tag to
@@ -83,14 +83,14 @@
     case '\v':
       // Ignore whitespace.
       break;
-    
+
     default:
       // If there is no tag open, do it now.
       if (!HadOpenTag) {
         RB.InsertTextAfter(i, StartTag);
         HadOpenTag = true;
       }
-        
+
       // Remember this character.
       LastNonWhiteSpace = i;
       break;
@@ -100,13 +100,13 @@
 
 void html::EscapeText(Rewriter &R, FileID FID,
                       bool EscapeSpaces, bool ReplaceTabs) {
-  
+
   const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FID);
   const char* C = Buf->getBufferStart();
   const char* FileEnd = Buf->getBufferEnd();
-  
+
   assert (C <= FileEnd);
-  
+
   RewriteBuffer &RB = R.getEditBuffer(FID);
 
   unsigned ColNo = 0;
@@ -117,7 +117,7 @@
     case '\r':
       ColNo = 0;
       break;
-      
+
     case ' ':
       if (EscapeSpaces)
         RB.ReplaceText(FilePos, 1, " ");
@@ -127,7 +127,7 @@
       RB.ReplaceText(FilePos, 1, "<hr>");
       ColNo = 0;
       break;
-        
+
     case '\t': {
       if (!ReplaceTabs)
         break;
@@ -145,12 +145,12 @@
       RB.ReplaceText(FilePos, 1, "<");
       ++ColNo;
       break;
-      
+
     case '>':
       RB.ReplaceText(FilePos, 1, ">");
       ++ColNo;
       break;
-      
+
     case '&':
       RB.ReplaceText(FilePos, 1, "&");
       ++ColNo;
@@ -161,23 +161,23 @@
 
 std::string html::EscapeText(const std::string& s, bool EscapeSpaces,
                              bool ReplaceTabs) {
-  
+
   unsigned len = s.size();
   std::string Str;
   llvm::raw_string_ostream os(Str);
-  
+
   for (unsigned i = 0 ; i < len; ++i) {
-    
+
     char c = s[i];
     switch (c) {
     default:
       os << c; break;
-      
+
     case ' ':
       if (EscapeSpaces) os << " ";
       else os << ' ';
       break;
-      
+
     case '\t':
       if (ReplaceTabs) {
         if (EscapeSpaces)
@@ -187,17 +187,17 @@
           for (unsigned i = 0; i < 4; ++i)
             os << " ";
       }
-      else 
+      else
         os << c;
-      
+
       break;
-      
+
     case '<': os << "<"; break;
     case '>': os << ">"; break;
     case '&': os << "&"; break;
     }
   }
-  
+
   return os.str();
 }
 
@@ -209,7 +209,7 @@
   OS << "<tr><td class=\"num\" id=\"LN"
      << LineNo << "\">"
      << LineNo << "</td><td class=\"line\">";
-  
+
   if (B == E) { // Handle empty lines.
     OS << " </td></tr>";
     RB.InsertTextBefore(B, OS.str());
@@ -226,44 +226,44 @@
   const char* FileEnd = Buf->getBufferEnd();
   const char* C = FileBeg;
   RewriteBuffer &RB = R.getEditBuffer(FID);
-  
+
   assert (C <= FileEnd);
-  
+
   unsigned LineNo = 0;
   unsigned FilePos = 0;
-  
-  while (C != FileEnd) {    
-    
+
+  while (C != FileEnd) {
+
     ++LineNo;
     unsigned LineStartPos = FilePos;
     unsigned LineEndPos = FileEnd - FileBeg;
-    
+
     assert (FilePos <= LineEndPos);
     assert (C < FileEnd);
-    
+
     // Scan until the newline (or end-of-file).
-    
+
     while (C != FileEnd) {
       char c = *C;
       ++C;
-      
+
       if (c == '\n') {
         LineEndPos = FilePos++;
         break;
       }
-      
+
       ++FilePos;
     }
-    
+
     AddLineNumber(RB, LineNo, LineStartPos, LineEndPos);
   }
-  
+
   // Add one big table tag that surrounds all of the code.
   RB.InsertTextBefore(0, "<table class=\"code\">\n");
   RB.InsertTextAfter(FileEnd - FileBeg, "</table>");
 }
 
-void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID, 
+void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
                                              const char *title) {
 
   const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FID);
@@ -277,10 +277,10 @@
   llvm::raw_string_ostream os(s);
   os << "<!doctype html>\n" // Use HTML 5 doctype
         "<html>\n<head>\n";
-  
+
   if (title)
     os << "<title>" << html::EscapeText(title) << "</title>\n";
-  
+
   os << "<style type=\"text/css\">\n"
       " body { color:#000000; background-color:#ffffff }\n"
       " body { font-family:Helvetica, sans-serif; font-size:10pt }\n"
@@ -341,7 +341,7 @@
   // Generate header
   R.InsertTextBefore(StartLoc, os.str());
   // Generate footer
-  
+
   R.InsertTextAfter(EndLoc, "</body></html>\n");
 }
 
@@ -355,16 +355,16 @@
   const SourceManager &SM = PP.getSourceManager();
   Lexer L(FID, SM, PP.getLangOptions());
   const char *BufferStart = L.getBufferStart();
-  
-  // Inform the preprocessor that we want to retain comments as tokens, so we 
+
+  // Inform the preprocessor that we want to retain comments as tokens, so we
   // can highlight them.
   L.SetCommentRetentionState(true);
- 
+
   // Lex all the tokens in raw mode, to avoid entering #includes or expanding
   // macros.
   Token Tok;
   L.LexFromRawLexer(Tok);
-  
+
   while (Tok.isNot(tok::eof)) {
     // Since we are lexing unexpanded tokens, all tokens are from the main
     // FileID.
@@ -376,7 +376,7 @@
       // Fill in Result.IdentifierInfo, looking up the identifier in the
       // identifier table.
       IdentifierInfo *II = PP.LookUpIdentifierInfo(Tok, BufferStart+TokOffs);
-        
+
       // If this is a pp-identifier, for a keyword, highlight it as such.
       if (II->getTokenID() != tok::identifier)
         HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart,
@@ -400,7 +400,7 @@
       // If this is a preprocessor directive, all tokens to end of line are too.
       if (!Tok.isAtStartOfLine())
         break;
-        
+
       // Eat all of the tokens until we get to the next one at the start of
       // line.
       unsigned TokEnd = TokOffs+TokLen;
@@ -409,16 +409,16 @@
         TokEnd = SM.getFileOffset(Tok.getLocation())+Tok.getLength();
         L.LexFromRawLexer(Tok);
       }
-      
+
       // Find end of line.  This is a hack.
       HighlightRange(RB, TokOffs, TokEnd, BufferStart,
                      "<span class='directive'>", "</span>");
-      
+
       // Don't skip the next token.
       continue;
     }
     }
-    
+
     L.LexFromRawLexer(Tok);
   }
 }
@@ -442,15 +442,15 @@
   // Re-lex the raw token stream into a token buffer.
   const SourceManager &SM = PP.getSourceManager();
   std::vector<Token> TokenStream;
-  
+
   Lexer L(FID, SM, PP.getLangOptions());
-  
+
   // Lex all the tokens in raw mode, to avoid entering #includes or expanding
   // macros.
   while (1) {
     Token Tok;
     L.LexFromRawLexer(Tok);
-    
+
     // If this is a # at the start of a line, discard it from the token stream.
     // We don't want the re-preprocess step to see #defines, #includes or other
     // preprocessor directives.
@@ -461,7 +461,7 @@
     // it will not produce an error.
     if (Tok.is(tok::hashhash))
       Tok.setKind(tok::unknown);
-    
+
     // If this raw token is an identifier, the raw lexer won't have looked up
     // the corresponding identifier info for it.  Do this now so that it will be
     // macro expanded when we re-preprocess it.
@@ -469,30 +469,30 @@
       // Change the kind of this identifier to the appropriate token kind, e.g.
       // turning "for" into a keyword.
       Tok.setKind(PP.LookUpIdentifierInfo(Tok)->getTokenID());
-    }    
-      
+    }
+
     TokenStream.push_back(Tok);
-    
+
     if (Tok.is(tok::eof)) break;
   }
-  
+
   // Temporarily change the diagnostics object so that we ignore any generated
   // diagnostics from this pass.
   IgnoringDiagClient TmpDC;
   Diagnostic TmpDiags(&TmpDC);
-  
+
   Diagnostic *OldDiags = &PP.getDiagnostics();
   PP.setDiagnostics(TmpDiags);
-  
+
   // Inform the preprocessor that we don't want comments.
   PP.SetCommentRetentionState(false, false);
 
   // Enter the tokens we just lexed.  This will cause them to be macro expanded
   // but won't enter sub-files (because we removed #'s).
   PP.EnterTokenStream(&TokenStream[0], TokenStream.size(), false, false);
-  
+
   TokenConcatenation ConcatInfo(PP);
-  
+
   // Lex all the tokens.
   Token Tok;
   PP.Lex(Tok);
@@ -502,13 +502,13 @@
       PP.Lex(Tok);
       continue;
     }
-    
+
     // Okay, we have the first token of a macro expansion: highlight the
     // instantiation by inserting a start tag before the macro instantiation and
     // end tag after it.
     std::pair<SourceLocation, SourceLocation> LLoc =
       SM.getInstantiationRange(Tok.getLocation());
-    
+
     // Ignore tokens whose instantiation location was not the main file.
     if (SM.getFileID(LLoc.first) != FID) {
       PP.Lex(Tok);
@@ -520,11 +520,11 @@
 
     std::string Expansion = EscapeText(PP.getSpelling(Tok));
     unsigned LineLen = Expansion.size();
-    
+
     Token PrevTok = Tok;
     // Okay, eat this token, getting the next one.
     PP.Lex(Tok);
-    
+
     // Skip all the rest of the tokens that are part of this macro
     // instantiation.  It would be really nice to pop up a window with all the
     // spelling of the tokens or something.
@@ -535,23 +535,23 @@
         Expansion += "<br>";
         LineLen = 0;
       }
-      
+
       LineLen -= Expansion.size();
-      
+
       // If the tokens were already space separated, or if they must be to avoid
       // them being implicitly pasted, add a space between them.
       if (Tok.hasLeadingSpace() ||
           ConcatInfo.AvoidConcat(PrevTok, Tok))
         Expansion += ' ';
-      
+
       // Escape any special characters in the token text.
       Expansion += EscapeText(PP.getSpelling(Tok));
       LineLen += Expansion.size();
-      
+
       PrevTok = Tok;
       PP.Lex(Tok);
     }
-    
+
 
     // Insert the expansion as the end tag, so that multi-line macros all get
     // highlighted.
@@ -567,7 +567,7 @@
 
 void html::HighlightMacros(Rewriter &R, FileID FID,
                            PreprocessorFactory &PPF) {
-  
+
   llvm::OwningPtr<Preprocessor> PP(PPF.CreatePreprocessor());
   HighlightMacros(R, FID, *PP);
 }

Modified: cfe/trunk/lib/Rewrite/RewriteRope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteRope.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteRope.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteRope.cpp Wed Sep  9 10:08:12 2009
@@ -81,24 +81,24 @@
     /// the root, which may have less) and may have at most 2*WidthFactor
     /// elements.
     enum { WidthFactor = 8 };
-    
+
     /// Size - This is the number of bytes of file this node (including any
     /// potential children) covers.
     unsigned Size;
-    
+
     /// IsLeaf - True if this is an instance of RopePieceBTreeLeaf, false if it
     /// is an instance of RopePieceBTreeInterior.
     bool IsLeaf;
-    
+
     RopePieceBTreeNode(bool isLeaf) : Size(0), IsLeaf(isLeaf) {}
     ~RopePieceBTreeNode() {}
   public:
-    
+
     bool isLeaf() const { return IsLeaf; }
     unsigned size() const { return Size; }
-    
+
     void Destroy();
-    
+
     /// split - Split the range containing the specified offset so that we are
     /// guaranteed that there is a place to do an insertion at the specified
     /// offset.  The offset is relative, so "0" is the start of the node.
@@ -106,7 +106,7 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *split(unsigned Offset);
-    
+
     /// insert - Insert the specified ropepiece into this tree node at the
     /// specified offset.  The offset is relative, so "0" is the start of the
     /// node.
@@ -114,13 +114,13 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *insert(unsigned Offset, const RopePiece &R);
-    
+
     /// erase - Remove NumBytes from this node at the specified offset.  We are
     /// guaranteed that there is a split at Offset.
     void erase(unsigned Offset, unsigned NumBytes);
-    
+
     static inline bool classof(const RopePieceBTreeNode *) { return true; }
-    
+
   };
 } // end anonymous namespace
 
@@ -140,11 +140,11 @@
     /// NumPieces - This holds the number of rope pieces currently active in the
     /// Pieces array.
     unsigned char NumPieces;
-    
+
     /// Pieces - This tracks the file chunks currently in this leaf.
     ///
     RopePiece Pieces[2*WidthFactor];
-    
+
     /// NextLeaf - This is a pointer to the next leaf in the tree, allowing
     /// efficient in-order forward iteration of the tree without traversal.
     RopePieceBTreeLeaf **PrevLeaf, *NextLeaf;
@@ -155,34 +155,34 @@
       if (PrevLeaf || NextLeaf)
         removeFromLeafInOrder();
     }
-    
+
     bool isFull() const { return NumPieces == 2*WidthFactor; }
-    
+
     /// clear - Remove all rope pieces from this leaf.
     void clear() {
       while (NumPieces)
         Pieces[--NumPieces] = RopePiece();
       Size = 0;
     }
-    
+
     unsigned getNumPieces() const { return NumPieces; }
-    
+
     const RopePiece &getPiece(unsigned i) const {
       assert(i < getNumPieces() && "Invalid piece ID");
       return Pieces[i];
     }
-    
+
     const RopePieceBTreeLeaf *getNextLeafInOrder() const { return NextLeaf; }
     void insertAfterLeafInOrder(RopePieceBTreeLeaf *Node) {
       assert(PrevLeaf == 0 && NextLeaf == 0 && "Already in ordering");
-      
+
       NextLeaf = Node->NextLeaf;
       if (NextLeaf)
         NextLeaf->PrevLeaf = &NextLeaf;
       PrevLeaf = &Node->NextLeaf;
       Node->NextLeaf = this;
     }
-    
+
     void removeFromLeafInOrder() {
       if (PrevLeaf) {
         *PrevLeaf = NextLeaf;
@@ -192,7 +192,7 @@
         NextLeaf->PrevLeaf = 0;
       }
     }
-    
+
     /// FullRecomputeSizeLocally - This method recomputes the 'Size' field by
     /// summing the size of all RopePieces.
     void FullRecomputeSizeLocally() {
@@ -200,7 +200,7 @@
       for (unsigned i = 0, e = getNumPieces(); i != e; ++i)
         Size += getPiece(i).size();
     }
-    
+
     /// split - Split the range containing the specified offset so that we are
     /// guaranteed that there is a place to do an insertion at the specified
     /// offset.  The offset is relative, so "0" is the start of the node.
@@ -208,7 +208,7 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *split(unsigned Offset);
-    
+
     /// insert - Insert the specified ropepiece into this tree node at the
     /// specified offset.  The offset is relative, so "0" is the start of the
     /// node.
@@ -216,12 +216,12 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *insert(unsigned Offset, const RopePiece &R);
-    
-    
+
+
     /// erase - Remove NumBytes from this node at the specified offset.  We are
     /// guaranteed that there is a split at Offset.
     void erase(unsigned Offset, unsigned NumBytes);
-    
+
     static inline bool classof(const RopePieceBTreeLeaf *) { return true; }
     static inline bool classof(const RopePieceBTreeNode *N) {
       return N->isLeaf();
@@ -242,7 +242,7 @@
     // Fastpath for a common case.  There is already a splitpoint at the end.
     return 0;
   }
-  
+
   // Find the piece that this offset lands in.
   unsigned PieceOffs = 0;
   unsigned i = 0;
@@ -250,23 +250,23 @@
     PieceOffs += Pieces[i].size();
     ++i;
   }
-  
+
   // If there is already a split point at the specified offset, just return
   // success.
   if (PieceOffs == Offset)
     return 0;
-  
+
   // Otherwise, we need to split piece 'i' at Offset-PieceOffs.  Convert Offset
   // to being Piece relative.
   unsigned IntraPieceOffset = Offset-PieceOffs;
-  
+
   // We do this by shrinking the RopePiece and then doing an insert of the tail.
   RopePiece Tail(Pieces[i].StrData, Pieces[i].StartOffs+IntraPieceOffset,
                  Pieces[i].EndOffs);
   Size -= Pieces[i].size();
   Pieces[i].EndOffs = Pieces[i].StartOffs+IntraPieceOffset;
   Size += Pieces[i].size();
-  
+
   return insert(Offset, Tail);
 }
 
@@ -292,7 +292,7 @@
         SlotOffs += getPiece(i).size();
       assert(SlotOffs == Offset && "Split didn't occur before insertion!");
     }
-    
+
     // For an insertion into a non-full leaf node, just insert the value in
     // its sorted position.  This requires moving later values over.
     for (; i != e; --e)
@@ -302,31 +302,31 @@
     Size += R.size();
     return 0;
   }
-  
+
   // Otherwise, if this is leaf is full, split it in two halves.  Since this
   // node is full, it contains 2*WidthFactor values.  We move the first
   // 'WidthFactor' values to the LHS child (which we leave in this node) and
   // move the last 'WidthFactor' values into the RHS child.
-  
+
   // Create the new node.
   RopePieceBTreeLeaf *NewNode = new RopePieceBTreeLeaf();
-  
+
   // Move over the last 'WidthFactor' values from here to NewNode.
   std::copy(&Pieces[WidthFactor], &Pieces[2*WidthFactor],
             &NewNode->Pieces[0]);
   // Replace old pieces with null RopePieces to drop refcounts.
   std::fill(&Pieces[WidthFactor], &Pieces[2*WidthFactor], RopePiece());
-  
+
   // Decrease the number of values in the two nodes.
   NewNode->NumPieces = NumPieces = WidthFactor;
-  
+
   // Recompute the two nodes' size.
   NewNode->FullRecomputeSizeLocally();
   FullRecomputeSizeLocally();
-  
+
   // Update the list of leaves.
   NewNode->insertAfterLeafInOrder(this);
-  
+
   // These insertions can't fail.
   if (this->size() >= Offset)
     this->insert(Offset, R);
@@ -345,42 +345,42 @@
   for (; Offset > PieceOffs; ++i)
     PieceOffs += getPiece(i).size();
   assert(PieceOffs == Offset && "Split didn't occur before erase!");
-  
+
   unsigned StartPiece = i;
-  
+
   // Figure out how many pieces completely cover 'NumBytes'.  We want to remove
   // all of them.
   for (; Offset+NumBytes > PieceOffs+getPiece(i).size(); ++i)
     PieceOffs += getPiece(i).size();
-  
+
   // If we exactly include the last one, include it in the region to delete.
   if (Offset+NumBytes == PieceOffs+getPiece(i).size())
     PieceOffs += getPiece(i).size(), ++i;
-  
+
   // If we completely cover some RopePieces, erase them now.
   if (i != StartPiece) {
     unsigned NumDeleted = i-StartPiece;
     for (; i != getNumPieces(); ++i)
       Pieces[i-NumDeleted] = Pieces[i];
-    
+
     // Drop references to dead rope pieces.
     std::fill(&Pieces[getNumPieces()-NumDeleted], &Pieces[getNumPieces()],
               RopePiece());
     NumPieces -= NumDeleted;
-    
+
     unsigned CoverBytes = PieceOffs-Offset;
     NumBytes -= CoverBytes;
     Size -= CoverBytes;
   }
-  
+
   // If we completely removed some stuff, we could be done.
   if (NumBytes == 0) return;
-  
+
   // Okay, now might be erasing part of some Piece.  If this is the case, then
   // move the start point of the piece.
   assert(getPiece(StartPiece).size() > NumBytes);
   Pieces[StartPiece].StartOffs += NumBytes;
-  
+
   // The size of this node just shrunk by NumBytes.
   Size -= NumBytes;
 }
@@ -399,7 +399,7 @@
     RopePieceBTreeNode *Children[2*WidthFactor];
   public:
     RopePieceBTreeInterior() : RopePieceBTreeNode(false), NumChildren(0) {}
-    
+
     RopePieceBTreeInterior(RopePieceBTreeNode *LHS, RopePieceBTreeNode *RHS)
     : RopePieceBTreeNode(false) {
       Children[0] = LHS;
@@ -407,9 +407,9 @@
       NumChildren = 2;
       Size = LHS->size() + RHS->size();
     }
-    
+
     bool isFull() const { return NumChildren == 2*WidthFactor; }
-    
+
     unsigned getNumChildren() const { return NumChildren; }
     const RopePieceBTreeNode *getChild(unsigned i) const {
       assert(i < NumChildren && "invalid child #");
@@ -419,7 +419,7 @@
       assert(i < NumChildren && "invalid child #");
       return Children[i];
     }
-    
+
     /// FullRecomputeSizeLocally - Recompute the Size field of this node by
     /// summing up the sizes of the child nodes.
     void FullRecomputeSizeLocally() {
@@ -427,8 +427,8 @@
       for (unsigned i = 0, e = getNumChildren(); i != e; ++i)
         Size += getChild(i)->size();
     }
-    
-    
+
+
     /// split - Split the range containing the specified offset so that we are
     /// guaranteed that there is a place to do an insertion at the specified
     /// offset.  The offset is relative, so "0" is the start of the node.
@@ -436,8 +436,8 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *split(unsigned Offset);
-    
-    
+
+
     /// insert - Insert the specified ropepiece into this tree node at the
     /// specified offset.  The offset is relative, so "0" is the start of the
     /// node.
@@ -445,18 +445,18 @@
     /// If there is no space in this subtree for the extra piece, the extra tree
     /// node is returned and must be inserted into a parent.
     RopePieceBTreeNode *insert(unsigned Offset, const RopePiece &R);
-    
+
     /// HandleChildPiece - A child propagated an insertion result up to us.
     /// Insert the new child, and/or propagate the result further up the tree.
     RopePieceBTreeNode *HandleChildPiece(unsigned i, RopePieceBTreeNode *RHS);
-    
+
     /// erase - Remove NumBytes from this node at the specified offset.  We are
     /// guaranteed that there is a split at Offset.
     void erase(unsigned Offset, unsigned NumBytes);
-    
+
     static inline bool classof(const RopePieceBTreeInterior *) { return true; }
     static inline bool classof(const RopePieceBTreeNode *N) {
-      return !N->isLeaf(); 
+      return !N->isLeaf();
     }
   };
 } // end anonymous namespace
@@ -471,18 +471,18 @@
   // Figure out which child to split.
   if (Offset == 0 || Offset == size())
     return 0;  // If we have an exact offset, we're already split.
-  
+
   unsigned ChildOffset = 0;
   unsigned i = 0;
   for (; Offset >= ChildOffset+getChild(i)->size(); ++i)
     ChildOffset += getChild(i)->size();
-  
+
   // If already split there, we're done.
   if (ChildOffset == Offset)
     return 0;
-  
+
   // Otherwise, recursively split the child.
-  if (RopePieceBTreeNode *RHS = getChild(i)->split(Offset-ChildOffset)) 
+  if (RopePieceBTreeNode *RHS = getChild(i)->split(Offset-ChildOffset))
     return HandleChildPiece(i, RHS);
   return 0;  // Done!
 }
@@ -498,7 +498,7 @@
   // Find the insertion point.  We are guaranteed that there is a split at the
   // specified offset so find it.
   unsigned i = 0, e = getNumChildren();
-  
+
   unsigned ChildOffs = 0;
   if (Offset == size()) {
     // Fastpath for a common case.  Insert at end of last child.
@@ -508,13 +508,13 @@
     for (; Offset > ChildOffs+getChild(i)->size(); ++i)
       ChildOffs += getChild(i)->size();
   }
-  
+
   Size += R.size();
-  
+
   // Insert at the end of this child.
   if (RopePieceBTreeNode *RHS = getChild(i)->insert(Offset-ChildOffs, R))
     return HandleChildPiece(i, RHS);
-  
+
   return 0;
 }
 
@@ -533,27 +533,27 @@
     ++NumChildren;
     return false;
   }
-  
+
   // Okay, this node is full.  Split it in half, moving WidthFactor children to
   // a newly allocated interior node.
-  
+
   // Create the new node.
   RopePieceBTreeInterior *NewNode = new RopePieceBTreeInterior();
-  
+
   // Move over the last 'WidthFactor' values from here to NewNode.
   memcpy(&NewNode->Children[0], &Children[WidthFactor],
          WidthFactor*sizeof(Children[0]));
-  
+
   // Decrease the number of values in the two nodes.
   NewNode->NumChildren = NumChildren = WidthFactor;
-  
+
   // Finally, insert the two new children in the side the can (now) hold them.
   // These insertions can't fail.
   if (i < WidthFactor)
     this->HandleChildPiece(i, RHS);
   else
     NewNode->HandleChildPiece(i-WidthFactor, RHS);
-  
+
   // Recompute the two nodes' size.
   NewNode->FullRecomputeSizeLocally();
   FullRecomputeSizeLocally();
@@ -565,24 +565,24 @@
 void RopePieceBTreeInterior::erase(unsigned Offset, unsigned NumBytes) {
   // This will shrink this node by NumBytes.
   Size -= NumBytes;
-  
+
   // Find the first child that overlaps with Offset.
   unsigned i = 0;
   for (; Offset >= getChild(i)->size(); ++i)
     Offset -= getChild(i)->size();
-  
+
   // Propagate the delete request into overlapping children, or completely
   // delete the children as appropriate.
   while (NumBytes) {
     RopePieceBTreeNode *CurChild = getChild(i);
-    
+
     // If we are deleting something contained entirely in the child, pass on the
     // request.
     if (Offset+NumBytes < CurChild->size()) {
       CurChild->erase(Offset, NumBytes);
       return;
     }
-    
+
     // If this deletion request starts somewhere in the middle of the child, it
     // must be deleting to the end of the child.
     if (Offset) {
@@ -665,19 +665,19 @@
 // begin iterator.
 RopePieceBTreeIterator::RopePieceBTreeIterator(const void *n) {
   const RopePieceBTreeNode *N = static_cast<const RopePieceBTreeNode*>(n);
-  
+
   // Walk down the left side of the tree until we get to a leaf.
   while (const RopePieceBTreeInterior *IN = dyn_cast<RopePieceBTreeInterior>(N))
     N = IN->getChild(0);
-  
+
   // We must have at least one leaf.
   CurNode = cast<RopePieceBTreeLeaf>(N);
-  
+
   // If we found a leaf that happens to be empty, skip over it until we get
   // to something full.
   while (CurNode && getCN(CurNode)->getNumPieces() == 0)
     CurNode = getCN(CurNode)->getNextLeafInOrder();
-  
+
   if (CurNode != 0)
     CurPiece = &getCN(CurNode)->getPiece(0);
   else  // Empty tree, this is an end() iterator.
@@ -691,12 +691,12 @@
     ++CurPiece;
     return;
   }
-  
+
   // Find the next non-empty leaf node.
   do
     CurNode = getCN(CurNode)->getNextLeafInOrder();
   while (CurNode && getCN(CurNode)->getNumPieces() == 0);
-  
+
   if (CurNode != 0)
     CurPiece = &getCN(CurNode)->getPiece(0);
   else // Hit end().
@@ -740,7 +740,7 @@
   // #1. Split at Offset.
   if (RopePieceBTreeNode *RHS = getRoot(Root)->split(Offset))
     Root = new RopePieceBTreeInterior(getRoot(Root), RHS);
-  
+
   // #2. Do the insertion.
   if (RopePieceBTreeNode *RHS = getRoot(Root)->insert(Offset, R))
     Root = new RopePieceBTreeInterior(getRoot(Root), RHS);
@@ -750,7 +750,7 @@
   // #1. Split at Offset.
   if (RopePieceBTreeNode *RHS = getRoot(Root)->split(Offset))
     Root = new RopePieceBTreeInterior(getRoot(Root), RHS);
-  
+
   // #2. Do the erasing.
   getRoot(Root)->erase(Offset, NumBytes);
 }
@@ -766,38 +766,38 @@
 RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
   unsigned Len = End-Start;
   assert(Len && "Zero length RopePiece is invalid!");
-  
+
   // If we have space for this string in the current alloc buffer, use it.
   if (AllocOffs+Len <= AllocChunkSize) {
     memcpy(AllocBuffer->Data+AllocOffs, Start, Len);
     AllocOffs += Len;
     return RopePiece(AllocBuffer, AllocOffs-Len, AllocOffs);
   }
-  
+
   // If we don't have enough room because this specific allocation is huge,
   // just allocate a new rope piece for it alone.
   if (Len > AllocChunkSize) {
     unsigned Size = End-Start+sizeof(RopeRefCountString)-1;
-    RopeRefCountString *Res = 
+    RopeRefCountString *Res =
       reinterpret_cast<RopeRefCountString *>(new char[Size]);
     Res->RefCount = 0;
     memcpy(Res->Data, Start, End-Start);
     return RopePiece(Res, 0, End-Start);
   }
-  
+
   // Otherwise, this was a small request but we just don't have space for it
   // Make a new chunk and share it with later allocations.
-  
+
   // If we had an old allocation, drop our reference to it.
   if (AllocBuffer && --AllocBuffer->RefCount == 0)
     delete [] (char*)AllocBuffer;
-  
+
   unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize;
   AllocBuffer = reinterpret_cast<RopeRefCountString *>(new char[AllocSize]);
   AllocBuffer->RefCount = 0;
   memcpy(AllocBuffer->Data, Start, Len);
   AllocOffs = Len;
-  
+
   // Start out the new allocation with a refcount of 1, since we have an
   // internal reference to it.
   AllocBuffer->addRef();

Modified: cfe/trunk/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Rewriter.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp Wed Sep  9 10:08:12 2009
@@ -26,7 +26,7 @@
 
   unsigned RealOffset = getMappedOffset(OrigOffset, true);
   assert(RealOffset+Size < Buffer.size() && "Invalid location");
-  
+
   // Remove the dead characters.
   Buffer.erase(RealOffset, Size);
 
@@ -36,13 +36,13 @@
 
 void RewriteBuffer::InsertText(unsigned OrigOffset, const llvm::StringRef &Str,
                                bool InsertAfter) {
-  
+
   // Nothing to insert, exit early.
   if (Str.empty()) return;
 
   unsigned RealOffset = getMappedOffset(OrigOffset, InsertAfter);
   Buffer.insert(RealOffset, Str.begin(), Str.end());
-  
+
   // Add a delta so that future changes are offset correctly.
   AddInsertDelta(OrigOffset, Str.size());
 }
@@ -69,16 +69,16 @@
 int Rewriter::getRangeSize(SourceRange Range) const {
   if (!isRewritable(Range.getBegin()) ||
       !isRewritable(Range.getEnd())) return -1;
-  
+
   FileID StartFileID, EndFileID;
   unsigned StartOff, EndOff;
-  
+
   StartOff = getLocationOffsetAndFileID(Range.getBegin(), StartFileID);
   EndOff   = getLocationOffsetAndFileID(Range.getEnd(), EndFileID);
-  
+
   if (StartFileID != EndFileID)
     return -1;
-  
+
   // If edits have been made to this buffer, the delta between the range may
   // have changed.
   std::map<FileID, RewriteBuffer>::const_iterator I =
@@ -89,17 +89,17 @@
     StartOff = RB.getMappedOffset(StartOff);
   }
 
-  
+
   // Adjust the end offset to the end of the last token, instead of being the
   // start of the last token.
   EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
-  
+
   return EndOff-StartOff;
 }
 
 /// getRewritenText - Return the rewritten form of the text in the specified
 /// range.  If the start or end of the range was unrewritable or if they are
-/// in different buffers, this returns an empty string. 
+/// in different buffers, this returns an empty string.
 ///
 /// Note that this method is not particularly efficient.
 ///
@@ -107,15 +107,15 @@
   if (!isRewritable(Range.getBegin()) ||
       !isRewritable(Range.getEnd()))
     return "";
-  
+
   FileID StartFileID, EndFileID;
   unsigned StartOff, EndOff;
   StartOff = getLocationOffsetAndFileID(Range.getBegin(), StartFileID);
   EndOff   = getLocationOffsetAndFileID(Range.getEnd(), EndFileID);
-  
+
   if (StartFileID != EndFileID)
     return ""; // Start and end in different buffers.
-  
+
   // If edits have been made to this buffer, the delta between the range may
   // have changed.
   std::map<FileID, RewriteBuffer>::const_iterator I =
@@ -123,17 +123,17 @@
   if (I == RewriteBuffers.end()) {
     // If the buffer hasn't been rewritten, just return the text from the input.
     const char *Ptr = SourceMgr->getCharacterData(Range.getBegin());
-    
+
     // Adjust the end offset to the end of the last token, instead of being the
     // start of the last token.
     EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
     return std::string(Ptr, Ptr+EndOff-StartOff);
   }
-  
+
   const RewriteBuffer &RB = I->second;
   EndOff = RB.getMappedOffset(EndOff, true);
   StartOff = RB.getMappedOffset(StartOff);
-  
+
   // Adjust the end offset to the end of the last token, instead of being the
   // start of the last token.
   EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
@@ -143,7 +143,7 @@
   std::advance(Start, StartOff);
   RewriteBuffer::iterator End = Start;
   std::advance(End, EndOff-StartOff);
-  
+
   return std::string(Start, End);
 }
 
@@ -161,13 +161,13 @@
 RewriteBuffer &Rewriter::getEditBuffer(FileID FID) {
   std::map<FileID, RewriteBuffer>::iterator I =
     RewriteBuffers.lower_bound(FID);
-  if (I != RewriteBuffers.end() && I->first == FID) 
+  if (I != RewriteBuffers.end() && I->first == FID)
     return I->second;
   I = RewriteBuffers.insert(I, std::make_pair(FID, RewriteBuffer()));
-  
+
   std::pair<const char*, const char*> MB = SourceMgr->getBufferData(FID);
   I->second.Initialize(MB.first, MB.second);
-  
+
   return I->second;
 }
 
@@ -199,7 +199,7 @@
   if (!isRewritable(Start)) return true;
   FileID StartFileID;
   unsigned StartOffs = getLocationOffsetAndFileID(Start, StartFileID);
-  
+
   getEditBuffer(StartFileID).ReplaceText(StartOffs, OrigLength, NewStr);
   return false;
 }
@@ -212,7 +212,7 @@
   int Size = getRangeSize(From->getSourceRange());
   if (Size == -1)
     return true;
-  
+
   // Get the new text.
   std::string SStr;
   llvm::raw_string_ostream S(SStr);

Modified: cfe/trunk/lib/Rewrite/TokenRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/TokenRewriter.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/TokenRewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/TokenRewriter.cpp Wed Sep  9 10:08:12 2009
@@ -21,10 +21,10 @@
 TokenRewriter::TokenRewriter(FileID FID, SourceManager &SM,
                              const LangOptions &LangOpts) {
   ScratchBuf.reset(new ScratchBuffer(SM));
-  
+
   // Create a lexer to lex all the tokens of the main file in raw mode.
   Lexer RawLex(FID, SM, LangOpts);
-  
+
   // Return all comments and whitespace as tokens.
   RawLex.SetKeepWhitespaceMode(true);
 
@@ -39,7 +39,7 @@
       Tok.setIdentifierInfo(PP.LookUpIdentifierInfo(Tok));
     }
 #endif
-      
+
     AddToken(RawTok, TokenList.end());
     RawLex.LexFromRawLexer(RawTok);
   }
@@ -53,10 +53,10 @@
 /// TokenRefTy (a non-const iterator).
 TokenRewriter::TokenRefTy TokenRewriter::RemapIterator(token_iterator I) {
   if (I == token_end()) return TokenList.end();
-  
+
   // FIXME: This is horrible, we should use our own list or something to avoid
   // this.
-  std::map<SourceLocation, TokenRefTy>::iterator MapIt = 
+  std::map<SourceLocation, TokenRefTy>::iterator MapIt =
     TokenAtLoc.find(I->getLocation());
   assert(MapIt != TokenAtLoc.end() && "iterator not in rewriter?");
   return MapIt->second;
@@ -65,22 +65,22 @@
 
 /// AddToken - Add the specified token into the Rewriter before the other
 /// position.
-TokenRewriter::TokenRefTy 
+TokenRewriter::TokenRefTy
 TokenRewriter::AddToken(const Token &T, TokenRefTy Where) {
   Where = TokenList.insert(Where, T);
-  
+
   bool InsertSuccess = TokenAtLoc.insert(std::make_pair(T.getLocation(),
                                                         Where)).second;
   assert(InsertSuccess && "Token location already in rewriter!");
   InsertSuccess = InsertSuccess;
   return Where;
 }
-  
+
 
 TokenRewriter::token_iterator
 TokenRewriter::AddTokenBefore(token_iterator I, const char *Val) {
   unsigned Len = strlen(Val);
-  
+
   // Plop the string into the scratch buffer, then create a token for this
   // string.
   Token Tok;
@@ -88,7 +88,7 @@
   const char *Spelling;
   Tok.setLocation(ScratchBuf->getToken(Val, Len, Spelling));
   Tok.setLength(Len);
-  
+
   // TODO: Form a whole lexer around this and relex the token!  For now, just
   // set kind to tok::unknown.
   Tok.setKind(tok::unknown);

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

==============================================================================
--- cfe/trunk/lib/Sema/IdentifierResolver.cpp (original)
+++ cfe/trunk/lib/Sema/IdentifierResolver.cpp Wed Sep  9 10:08:12 2009
@@ -32,7 +32,7 @@
   // New vectors are added when the current one is full.
   std::list< std::vector<IdDeclInfo> > IDIVecs;
   unsigned int CurIndex;
-  
+
 public:
   IdDeclInfoMap() : CurIndex(VECTOR_SIZE) {}
 
@@ -75,7 +75,7 @@
   assert(0 && "Didn't find this decl on its identifier's chain!");
 }
 
-bool 
+bool
 IdentifierResolver::IdDeclInfo::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
   for (DeclsTy::iterator I = Decls.end(); I != Decls.begin(); --I) {
     if (Old == *(I-1)) {
@@ -108,7 +108,7 @@
 
   if (Ctx->isFunctionOrMethod()) {
     // Ignore the scopes associated within transparent declaration contexts.
-    while (S->getEntity() && 
+    while (S->getEntity() &&
            ((DeclContext *)S->getEntity())->isTransparentContext())
       S = S->getParent();
 
@@ -200,14 +200,14 @@
     Name.setFETokenInfo(NULL);
     return;
   }
-  
+
   return toIdDeclInfo(Ptr)->RemoveDecl(D);
 }
 
 bool IdentifierResolver::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
-  assert(Old->getDeclName() == New->getDeclName() && 
+  assert(Old->getDeclName() == New->getDeclName() &&
          "Cannot replace a decl with another decl of a different name");
-  
+
   DeclarationName Name = Old->getDeclName();
   void *Ptr = Name.getFETokenInfo<void>();
 
@@ -222,7 +222,7 @@
     return false;
   }
 
-  return toIdDeclInfo(Ptr)->ReplaceDecl(Old, New);  
+  return toIdDeclInfo(Ptr)->ReplaceDecl(Old, New);
 }
 
 /// begin - Returns an iterator for decls with name 'Name'.
@@ -243,7 +243,7 @@
   return end();
 }
 
-void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II, 
+void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
                                                   NamedDecl *D) {
   void *Ptr = II->getFETokenInfo<void>();
 

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

==============================================================================
--- cfe/trunk/lib/Sema/IdentifierResolver.h (original)
+++ cfe/trunk/lib/Sema/IdentifierResolver.h Wed Sep  9 10:08:12 2009
@@ -99,7 +99,7 @@
       assert(isIterator() && "Ptr not an iterator!");
       return reinterpret_cast<BaseIter>(Ptr & ~0x3);
     }
-    
+
     friend class IdentifierResolver;
   public:
     iterator() : Ptr(0) {}
@@ -110,14 +110,14 @@
       else
         return reinterpret_cast<NamedDecl*>(Ptr);
     }
-    
+
     bool operator==(const iterator &RHS) const {
       return Ptr == RHS.Ptr;
     }
     bool operator!=(const iterator &RHS) const {
       return Ptr != RHS.Ptr;
     }
-    
+
     // Preincrement.
     iterator& operator++() {
       if (!isIterator()) // common case.
@@ -127,7 +127,7 @@
         void *InfoPtr = D->getDeclName().getFETokenInfo<void>();
         assert(!isDeclPtr(InfoPtr) && "Decl with wrong id ?");
         IdDeclInfo *Info = toIdDeclInfo(InfoPtr);
-        
+
         BaseIter I = getIterator();
         if (I != Info->decls_begin())
           *this = iterator(I-1);
@@ -138,7 +138,7 @@
     }
 
     uintptr_t getAsOpaqueValue() const { return Ptr; }
-    
+
     static iterator getFromOpaqueValue(uintptr_t P) {
       iterator Result;
       Result.Ptr = P;

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

==============================================================================
--- cfe/trunk/lib/Sema/JumpDiagnostics.cpp (original)
+++ cfe/trunk/lib/Sema/JumpDiagnostics.cpp Wed Sep  9 10:08:12 2009
@@ -28,7 +28,7 @@
 ///
 class JumpScopeChecker {
   Sema &S;
-  
+
   /// GotoScope - This is a record that we use to keep track of all of the
   /// scopes that are introduced by VLAs and other things that scope jumps like
   /// gotos.  This scope tree has nothing to do with the source scope tree,
@@ -38,17 +38,17 @@
     /// ParentScope - The index in ScopeMap of the parent scope.  This is 0 for
     /// the parent scope is the function body.
     unsigned ParentScope;
-    
+
     /// Diag - The diagnostic to emit if there is a jump into this scope.
     unsigned Diag;
-    
+
     /// Loc - Location to emit the diagnostic.
     SourceLocation Loc;
-    
+
     GotoScope(unsigned parentScope, unsigned diag, SourceLocation L)
     : ParentScope(parentScope), Diag(diag), Loc(L) {}
   };
- 
+
   llvm::SmallVector<GotoScope, 48> Scopes;
   llvm::DenseMap<Stmt*, unsigned> LabelAndGotoScopes;
   llvm::SmallVector<Stmt*, 16> Jumps;
@@ -66,15 +66,15 @@
 JumpScopeChecker::JumpScopeChecker(Stmt *Body, Sema &s) : S(s) {
   // Add a scope entry for function scope.
   Scopes.push_back(GotoScope(~0U, ~0U, SourceLocation()));
-  
+
   // Build information for the top level compound statement, so that we have a
   // defined scope record for every "goto" and label.
   BuildScopeInformation(Body, 0);
-  
+
   // Check that all jumps we saw are kosher.
   VerifyJumps();
 }
-  
+
 /// GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a
 /// diagnostic that should be emitted if control goes over it. If not, return 0.
 static unsigned GetDiagForGotoScopeDecl(const Decl *D) {
@@ -89,7 +89,7 @@
     if (TD->getUnderlyingType()->isVariablyModifiedType())
       return diag::note_protected_by_vla_typedef;
   }
-  
+
   return 0;
 }
 
@@ -99,7 +99,7 @@
 /// statements, adding any labels or gotos to LabelAndGotoScopes and recursively
 /// walking the AST as needed.
 void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
-  
+
   // If we found a label, remember that it is in ParentScope scope.
   if (isa<LabelStmt>(S) || isa<DefaultStmt>(S) || isa<CaseStmt>(S)) {
     LabelAndGotoScopes[S] = ParentScope;
@@ -110,12 +110,12 @@
     LabelAndGotoScopes[S] = ParentScope;
     Jumps.push_back(S);
   }
-  
+
   for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end(); CI != E;
        ++CI) {
     Stmt *SubStmt = *CI;
     if (SubStmt == 0) continue;
-    
+
     // FIXME: diagnose jumps past initialization: required in C++, warning in C.
     //   goto L; int X = 4;   L: ;
 
@@ -131,7 +131,7 @@
           Scopes.push_back(GotoScope(ParentScope, Diag, (*I)->getLocation()));
           ParentScope = Scopes.size()-1;
         }
-      
+
         // If the decl has an initializer, walk it with the potentially new
         // scope we just installed.
         if (VarDecl *VD = dyn_cast<VarDecl>(*I))
@@ -156,10 +156,10 @@
         Scopes.push_back(GotoScope(ParentScope,
                                    diag::note_protected_by_objc_catch,
                                    AC->getAtCatchLoc()));
-        // @catches are nested and it isn't 
+        // @catches are nested and it isn't
         BuildScopeInformation(AC->getCatchBody(), Scopes.size()-1);
       }
-      
+
       // Jump from the finally to the try or catch is not valid.
       if (ObjCAtFinallyStmt *AF = AT->getFinallyStmt()) {
         Scopes.push_back(GotoScope(ParentScope,
@@ -167,17 +167,17 @@
                                    AF->getAtFinallyLoc()));
         BuildScopeInformation(AF, Scopes.size()-1);
       }
-      
+
       continue;
     }
-    
+
     // Disallow jumps into the protected statement of an @synchronized, but
     // allow jumps into the object expression it protects.
     if (ObjCAtSynchronizedStmt *AS = dyn_cast<ObjCAtSynchronizedStmt>(SubStmt)){
       // Recursively walk the AST for the @synchronized object expr, it is
       // evaluated in the normal scope.
       BuildScopeInformation(AS->getSynchExpr(), ParentScope);
-      
+
       // Recursively walk the AST for the @synchronized part, protected by a new
       // scope.
       Scopes.push_back(GotoScope(ParentScope,
@@ -196,7 +196,7 @@
         BuildScopeInformation(TryBlock, Scopes.size()-1);
 
       // Jump from the catch into the try is not allowed either.
-      for(unsigned I = 0, E = TS->getNumHandlers(); I != E; ++I) {
+      for (unsigned I = 0, E = TS->getNumHandlers(); I != E; ++I) {
         CXXCatchStmt *CS = TS->getHandler(I);
         Scopes.push_back(GotoScope(ParentScope,
                                    diag::note_protected_by_cxx_catch,
@@ -217,14 +217,14 @@
 void JumpScopeChecker::VerifyJumps() {
   while (!Jumps.empty()) {
     Stmt *Jump = Jumps.pop_back_val();
-    
-    // With a goto, 
+
+    // With a goto,
     if (GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
       CheckJump(GS, GS->getLabel(), GS->getGotoLoc(),
                 diag::err_goto_into_protected_scope);
       continue;
     }
-    
+
     if (SwitchStmt *SS = dyn_cast<SwitchStmt>(Jump)) {
       for (SwitchCase *SC = SS->getSwitchCaseList(); SC;
            SC = SC->getNextSwitchCase()) {
@@ -236,7 +236,7 @@
     }
 
     unsigned DiagnosticScope;
-    
+
     // We don't know where an indirect goto goes, require that it be at the
     // top level of scoping.
     if (IndirectGotoStmt *IG = dyn_cast<IndirectGotoStmt>(Jump)) {
@@ -254,12 +254,12 @@
       // indirectly jumping to the label.
       assert(isa<AddrLabelExpr>(Jump) && "Unknown jump type");
       LabelStmt *TheLabel = cast<AddrLabelExpr>(Jump)->getLabel();
-    
+
       assert(LabelAndGotoScopes.count(TheLabel) &&
              "Referenced label didn't get added to scopes?");
       unsigned LabelScope = LabelAndGotoScopes[TheLabel];
       if (LabelScope == 0) continue; // Addr of label is ok.
-    
+
       S.Diag(Jump->getLocStart(), diag::err_addr_of_label_in_protected_scope);
       DiagnosticScope = LabelScope;
     }
@@ -282,10 +282,10 @@
 
   assert(LabelAndGotoScopes.count(To) && "Jump didn't get added to scopes?");
   unsigned ToScope = LabelAndGotoScopes[To];
-  
+
   // Common case: exactly the same scope, which is fine.
   if (FromScope == ToScope) return;
-  
+
   // The only valid mismatch jump case happens when the jump is more deeply
   // nested inside the jump target.  Do a quick scan to see if the jump is valid
   // because valid code is more common than invalid code.
@@ -294,11 +294,11 @@
     // If we found the jump target, then we're jumping out of our current scope,
     // which is perfectly fine.
     if (TestScope == ToScope) return;
-    
+
     // Otherwise, scan up the hierarchy.
     TestScope = Scopes[TestScope].ParentScope;
   }
-  
+
   // If we get here, then we know we have invalid code.  Diagnose the bad jump,
   // and then emit a note at each VLA being jumped out of.
   S.Diag(DiagLoc, JumpDiag);
@@ -318,7 +318,7 @@
     FromScopes.pop_back();
     ToScopes.pop_back();
   }
-  
+
   // Emit diagnostics for whatever is left in ToScopes.
   for (unsigned i = 0, e = ToScopes.size(); i != e; ++i)
     S.Diag(Scopes[ToScopes[i]].Loc, Scopes[ToScopes[i]].Diag);

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

==============================================================================
--- cfe/trunk/lib/Sema/ParseAST.cpp (original)
+++ cfe/trunk/lib/Sema/ParseAST.cpp Wed Sep  9 10:08:12 2009
@@ -43,17 +43,17 @@
   Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit);
   Parser P(PP, S);
   PP.EnterMainSourceFile();
-    
+
   // Initialize the parser.
   P.Initialize();
-  
+
   Consumer->Initialize(Ctx);
-  
+
   if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer))
     SC->InitializeSema(S);
 
   if (ExternalASTSource *External = Ctx.getExternalSource()) {
-    if (ExternalSemaSource *ExternalSema = 
+    if (ExternalSemaSource *ExternalSema =
           dyn_cast<ExternalSemaSource>(External))
       ExternalSema->InitializeSema(S);
 
@@ -61,7 +61,7 @@
   }
 
   Parser::DeclGroupPtrTy ADecl;
-  
+
   while (!P.ParseTopLevelDecl(ADecl)) {  // Not end of file.
     // If we got a null return and something *was* parsed, ignore it.  This
     // is due to a top-level semicolon, an action override, or a parse error
@@ -69,7 +69,7 @@
     if (ADecl)
       Consumer->HandleTopLevelDecl(ADecl.getAsVal<DeclGroupRef>());
   };
-  
+
   // process any TopLevelDecls generated by #pragma weak
   for (llvm::SmallVector<Decl*,2>::iterator
         I = S.WeakTopLevelDecls().begin(),
@@ -85,7 +85,7 @@
     Decl::PrintStats();
     Stmt::PrintStats();
     Consumer->PrintStats();
-    
+
     Decl::CollectingStats(false);
     Stmt::CollectingStats(false);
   }

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

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed Sep  9 10:08:12 2009
@@ -23,7 +23,7 @@
 #include "clang/Basic/TargetInfo.h"
 using namespace clang;
 
-/// ConvertQualTypeToStringFn - This function is used to pretty print the 
+/// ConvertQualTypeToStringFn - This function is used to pretty print the
 /// specified QualType as a string in diagnostics.
 static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
                                  const char *Modifier, unsigned ModLen,
@@ -31,7 +31,7 @@
                                  llvm::SmallVectorImpl<char> &Output,
                                  void *Cookie) {
   ASTContext &Context = *static_cast<ASTContext*>(Cookie);
-  
+
   std::string S;
   if (Kind == Diagnostic::ak_qualtype) {
     assert(ModLen == 0 && ArgLen == 0 &&
@@ -41,7 +41,7 @@
 
     // FIXME: Playing with std::string is really slow.
     S = Ty.getAsString(Context.PrintingPolicy);
-    
+
     // If this is a sugared type (like a typedef, typeof, etc), then unwrap one
     // level of the sugar so that the type is more obvious to the user.
     QualType DesugaredTy = Ty->getDesugaredType(true);
@@ -56,13 +56,13 @@
         // Don't aka just because we saw an elaborated type.
         (!isa<ElaboratedType>(Ty) ||
          cast<ElaboratedType>(Ty)->getUnderlyingType() != DesugaredTy) &&
-      
+
         // Don't desugar magic Objective-C types.
         Ty.getUnqualifiedType() != Context.getObjCIdType() &&
         Ty.getUnqualifiedType() != Context.getObjCClassType() &&
         Ty.getUnqualifiedType() != Context.getObjCSelType() &&
         Ty.getUnqualifiedType() != Context.getObjCProtoType() &&
-        
+
         // Not va_list.
         Ty.getUnqualifiedType() != Context.getBuiltinVaListType()) {
       S = "'"+S+"' (aka '";
@@ -71,12 +71,12 @@
       Output.append(S.begin(), S.end());
       return;
     }
-    
+
   } else if (Kind == Diagnostic::ak_declarationname) {
-   
+
     DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
     S = N.getAsString();
-    
+
     if (ModLen == 9 && !memcmp(Modifier, "objcclass", 9) && ArgLen == 0)
       S = '+' + S;
     else if (ModLen == 12 && !memcmp(Modifier, "objcinstance", 12) && ArgLen==0)
@@ -87,7 +87,7 @@
   } else if (Kind == Diagnostic::ak_nameddecl) {
     if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0)
       S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString();
-    else { 
+    else {
       assert(ModLen == 0 && ArgLen == 0 &&
            "Invalid modifier for NamedDecl* argument");
       S = reinterpret_cast<NamedDecl*>(Val)->getNameAsString();
@@ -95,10 +95,10 @@
   } else {
     llvm::raw_string_ostream OS(S);
     assert(Kind == Diagnostic::ak_nestednamespec);
-    reinterpret_cast<NestedNameSpecifier*> (Val)->print(OS, 
+    reinterpret_cast<NestedNameSpecifier*> (Val)->print(OS,
                                                         Context.PrintingPolicy);
   }
-  
+
   Output.push_back('\'');
   Output.append(S.begin(), S.end());
   Output.push_back('\'');
@@ -107,11 +107,11 @@
 
 static inline RecordDecl *CreateStructDecl(ASTContext &C, const char *Name) {
   if (C.getLangOptions().CPlusPlus)
-    return CXXRecordDecl::Create(C, TagDecl::TK_struct, 
+    return CXXRecordDecl::Create(C, TagDecl::TK_struct,
                                  C.getTranslationUnitDecl(),
                                  SourceLocation(), &C.Idents.get(Name));
 
-  return RecordDecl::Create(C, TagDecl::TK_struct, 
+  return RecordDecl::Create(C, TagDecl::TK_struct,
                             C.getTranslationUnitDecl(),
                             SourceLocation(), &C.Idents.get(Name));
 }
@@ -119,7 +119,7 @@
 void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
   TUScope = S;
   PushDeclContext(S, Context.getTranslationUnitDecl());
-  
+
   if (PP.getTargetInfo().getPointerWidth(0) >= 64) {
     // Install [u]int128_t for 64-bit targets.
     PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
@@ -131,16 +131,16 @@
                                           &Context.Idents.get("__uint128_t"),
                                           Context.UnsignedInt128Ty), TUScope);
   }
-  
-  
+
+
   if (!PP.getLangOptions().ObjC1) return;
-  
+
   // Built-in ObjC types may already be set by PCHReader (hence isNull checks).
   if (Context.getObjCSelType().isNull()) {
     // Synthesize "typedef struct objc_selector *SEL;"
     RecordDecl *SelTag = CreateStructDecl(Context, "objc_selector");
     PushOnScopeChains(SelTag, TUScope);
-  
+
     QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag));
     TypedefDecl *SelTypedef = TypedefDecl::Create(Context, CurContext,
                                                   SourceLocation(),
@@ -154,15 +154,15 @@
   if (Context.getObjCProtoType().isNull()) {
     ObjCInterfaceDecl *ProtocolDecl =
       ObjCInterfaceDecl::Create(Context, CurContext, SourceLocation(),
-                                &Context.Idents.get("Protocol"), 
+                                &Context.Idents.get("Protocol"),
                                 SourceLocation(), true);
     Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl));
     PushOnScopeChains(ProtocolDecl, TUScope);
   }
   // Create the built-in typedef for 'id'.
   if (Context.getObjCIdType().isNull()) {
-    TypedefDecl *IdTypedef = 
-      TypedefDecl::Create( 
+    TypedefDecl *IdTypedef =
+      TypedefDecl::Create(
         Context, CurContext, SourceLocation(), &Context.Idents.get("id"),
         Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy)
       );
@@ -172,8 +172,8 @@
   }
   // Create the built-in typedef for 'Class'.
   if (Context.getObjCClassType().isNull()) {
-    TypedefDecl *ClassTypedef = 
-      TypedefDecl::Create( 
+    TypedefDecl *ClassTypedef =
+      TypedefDecl::Create(
         Context, CurContext, SourceLocation(), &Context.Idents.get("Class"),
         Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy)
       );
@@ -186,36 +186,36 @@
 Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
            bool CompleteTranslationUnit)
   : LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer),
-    Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()), 
+    Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
     ExternalSource(0), CurContext(0), PreDeclaratorDC(0),
     CurBlock(0), PackContext(0), IdResolver(pp.getLangOptions()),
     GlobalNewDeleteDeclared(false), ExprEvalContext(PotentiallyEvaluated),
     CompleteTranslationUnit(CompleteTranslationUnit),
     NumSFINAEErrors(0), CurrentInstantiationScope(0) {
-  
+
   StdNamespace = 0;
   TUScope = 0;
   if (getLangOptions().CPlusPlus)
     FieldCollector.reset(new CXXFieldCollector());
-      
+
   // Tell diagnostics how to render things from the AST library.
   PP.getDiagnostics().SetArgToStringFn(ConvertArgToStringFn, &Context);
 }
 
-/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast. 
+/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
 /// If there is already an implicit cast, merge into the existing one.
 /// If isLvalue, the result of the cast is an lvalue.
-void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, 
+void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
                              const CastExpr::CastInfo &Info, bool isLvalue) {
   QualType ExprTy = Context.getCanonicalType(Expr->getType());
   QualType TypeTy = Context.getCanonicalType(Ty);
-  
+
   if (ExprTy == TypeTy)
     return;
-  
+
   if (Expr->getType().getTypePtr()->isPointerType() &&
       Ty.getTypePtr()->isPointerType()) {
-    QualType ExprBaseType = 
+    QualType ExprBaseType =
       cast<PointerType>(ExprTy.getUnqualifiedType())->getPointeeType();
     QualType BaseType =
       cast<PointerType>(TypeTy.getUnqualifiedType())->getPointeeType();
@@ -224,12 +224,12 @@
         << Expr->getSourceRange();
     }
   }
-  
+
   if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
     ImpCast->setType(Ty);
     ImpCast->setLvalueCast(isLvalue);
-  } else 
-    Expr = new (Context) ImplicitCastExpr(Ty, Info, Expr, 
+  } else
+    Expr = new (Context) ImplicitCastExpr(Ty, Info, Expr,
                                           isLvalue);
 }
 
@@ -250,12 +250,12 @@
   // keep track of the point of instantiation (C++ [temp.point]). This means
   // that name lookup that occurs within the template instantiation will
   // always happen at the end of the translation unit, so it will find
-  // some names that should not be found. Although this is common behavior 
+  // some names that should not be found. Although this is common behavior
   // for C++ compilers, it is technically wrong. In the future, we either need
   // to be able to filter the results of name lookup or we need to perform
   // template instantiations earlier.
   PerformPendingImplicitInstantiations();
-  
+
   // Check for #pragma weak identifiers that were never declared
   // FIXME: This will cause diagnostics to be emitted in a non-determinstic
   // order!  Iterating over a densemap like this is bad.
@@ -263,7 +263,7 @@
        I = WeakUndeclaredIdentifiers.begin(),
        E = WeakUndeclaredIdentifiers.end(); I != E; ++I) {
     if (I->second.getUsed()) continue;
-    
+
     Diag(I->second.getLocation(), diag::warn_weak_identifier_undeclared)
       << I->first;
   }
@@ -284,29 +284,29 @@
   //   translation unit, with an initializer equal to 0.
   for (unsigned i = 0, e = TentativeDefinitionList.size(); i != e; ++i) {
     VarDecl *VD = TentativeDefinitions.lookup(TentativeDefinitionList[i]);
-    
+
     // If the tentative definition was completed, it will be in the list, but
     // not the map.
     if (VD == 0 || VD->isInvalidDecl() || !VD->isTentativeDefinition(Context))
       continue;
 
-    if (const IncompleteArrayType *ArrayT 
+    if (const IncompleteArrayType *ArrayT
         = Context.getAsIncompleteArrayType(VD->getType())) {
-      if (RequireCompleteType(VD->getLocation(), 
+      if (RequireCompleteType(VD->getLocation(),
                               ArrayT->getElementType(),
                               diag::err_tentative_def_incomplete_type_arr)) {
         VD->setInvalidDecl();
         continue;
       }
-      
+
       // Set the length of the array to 1 (C99 6.9.2p5).
       Diag(VD->getLocation(), diag::warn_tentative_incomplete_array);
       llvm::APInt One(Context.getTypeSize(Context.getSizeType()), true);
-      QualType T 
+      QualType T
         = Context.getConstantArrayWithoutExprType(ArrayT->getElementType(),
                                                   One, ArrayType::Normal, 0);
       VD->setType(T);
-    } else if (RequireCompleteType(VD->getLocation(), VD->getType(), 
+    } else if (RequireCompleteType(VD->getLocation(), VD->getType(),
                                    diag::err_tentative_def_incomplete_type))
       VD->setInvalidDecl();
 
@@ -324,10 +324,10 @@
 
 DeclContext *Sema::getFunctionLevelDeclContext() {
   DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
-  
+
   while (isa<BlockDecl>(DC))
     DC = DC->getParent();
-  
+
   return DC;
 }
 
@@ -351,7 +351,7 @@
   return 0;
 }
 
-void Sema::DiagnoseMissingMember(SourceLocation MemberLoc, 
+void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
                                  DeclarationName Member,
                                  NestedNameSpecifier *NNS, SourceRange Range) {
   switch (NNS->getKind()) {
@@ -379,17 +379,17 @@
 Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
   if (!this->Emit())
     return;
-  
+
   // If this is not a note, and we're in a template instantiation
   // that is different from the last template instantiation where
   // we emitted an error, print a template instantiation
   // backtrace.
   if (!SemaRef.Diags.isBuiltinNote(DiagID) &&
       !SemaRef.ActiveTemplateInstantiations.empty() &&
-      SemaRef.ActiveTemplateInstantiations.back() 
+      SemaRef.ActiveTemplateInstantiations.back()
         != SemaRef.LastTemplateInstantiationErrorContext) {
     SemaRef.PrintInstantiationStack();
-    SemaRef.LastTemplateInstantiationErrorContext 
+    SemaRef.LastTemplateInstantiationErrorContext
       = SemaRef.ActiveTemplateInstantiations.back();
   }
 }
@@ -398,7 +398,7 @@
 Sema::Diag(SourceLocation Loc, const PartialDiagnostic& PD) {
   SemaDiagnosticBuilder Builder(Diag(Loc, PD.getDiagID()));
   PD.Emit(Builder);
-  
+
   return Builder;
 }
 

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

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Sep  9 10:08:12 2009
@@ -100,30 +100,30 @@
   bool hasPrototype;
   bool isVariadic;
   bool hasBlockDeclRefExprs;
-  
+
   BlockDecl *TheDecl;
-  
+
   /// TheScope - This is the scope for the block itself, which contains
   /// arguments etc.
   Scope *TheScope;
-  
+
   /// ReturnType - This will get set to block result type, by looking at
   /// return types, if any, in the block body.
   QualType ReturnType;
-  
+
   /// LabelMap - This is a mapping from label identifiers to the LabelStmt for
   /// it (which acts like the label decl in some ways).  Forward referenced
   /// labels have a LabelStmt created for them with a null location & SubStmt.
   llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
-  
+
   /// SwitchStack - This is the current set of active switch statements in the
   /// block.
   llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
-  
+
   /// SavedFunctionNeedsScopeChecking - This is the value of
   /// CurFunctionNeedsScopeChecking at the point when the block started.
   bool SavedFunctionNeedsScopeChecking;
-  
+
   /// PrevBlockInfo - If this is nested inside another block, this points
   /// to the outer block.
   BlockSemaInfo *PrevBlockInfo;
@@ -138,7 +138,7 @@
 class LocInfoType : public Type {
   enum {
     // The last number that can fit in Type's TC.
-    // Avoids conflict with an existing Type class. 
+    // Avoids conflict with an existing Type class.
     LocInfo = (1 << TypeClassBitSize) - 1
   };
 
@@ -201,13 +201,13 @@
   /// Note that this should always be accessed through getLabelMap() in order
   /// to handle blocks properly.
   llvm::DenseMap<IdentifierInfo*, LabelStmt*> FunctionLabelMap;
-  
+
   /// FunctionSwitchStack - This is the current set of active switch statements
   /// in the top level function.  Clients should always use getSwitchStack() to
   /// handle the case when they are in a block.
   llvm::SmallVector<SwitchStmt*, 8> FunctionSwitchStack;
 
-  /// ExprTemporaries - This is the stack of temporaries that are created by 
+  /// ExprTemporaries - This is the stack of temporaries that are created by
   /// the current full expression.
   llvm::SmallVector<CXXTemporary*, 8> ExprTemporaries;
 
@@ -216,22 +216,22 @@
   /// scopes that need to be checked for goto conditions.  If a function does
   /// not contain this, then it need not have the jump checker run on it.
   bool CurFunctionNeedsScopeChecking;
-  
+
   /// ExtVectorDecls - This is a list all the extended vector types. This allows
   /// us to associate a raw vector type with one of the ext_vector type names.
   /// This is only necessary for issuing pretty diagnostics.
   llvm::SmallVector<TypedefDecl*, 24> ExtVectorDecls;
-  
+
   /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
   llvm::OwningPtr<CXXFieldCollector> FieldCollector;
 
   typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy;
-  
-  /// PureVirtualClassDiagSet - a set of class declarations which we have 
+
+  /// PureVirtualClassDiagSet - a set of class declarations which we have
   /// emitted a list of pure virtual functions. Used to prevent emitting the
   /// same list more than once.
   llvm::OwningPtr<RecordDeclSetTy> PureVirtualClassDiagSet;
-  
+
   /// \brief A mapping from external names to the most recent
   /// locally-scoped external declaration with that name.
   ///
@@ -315,17 +315,17 @@
 
   /// The current expression evaluation context.
   ExpressionEvaluationContext ExprEvalContext;
-  
-  typedef std::vector<std::pair<SourceLocation, Decl *> > 
+
+  typedef std::vector<std::pair<SourceLocation, Decl *> >
     PotentiallyReferencedDecls;
-  
+
   /// A stack of declarations, each element of which is a set of declarations
   /// that will be marked as referenced if the corresponding potentially
   /// potentially evaluated expression is potentially evaluated. Each element
   /// in the stack corresponds to a PotentiallyPotentiallyEvaluated expression
   /// evaluation context.
   std::list<PotentiallyReferencedDecls> PotentiallyReferencedDeclStack;
-  
+
   /// \brief Whether the code handled by Sema should be considered a
   /// complete translation unit or not.
   ///
@@ -346,11 +346,11 @@
 
   /// Instance/Factory Method Pools - allows efficient lookup when typechecking
   /// messages to "id". We need to maintain a list, since selectors can have
-  /// differing signatures across classes. In Cocoa, this happens to be 
+  /// differing signatures across classes. In Cocoa, this happens to be
   /// extremely uncommon (only 1% of selectors are "overloaded").
   MethodPool InstanceMethodPool;
   MethodPool FactoryMethodPool;
-  
+
   MethodPool::iterator ReadMethodPool(Selector Sel, bool isInstance);
 
   /// Private Helper predicate to check for 'self'.
@@ -361,7 +361,7 @@
   ~Sema() {
     if (PackContext) FreePackedContext();
   }
-  
+
   const LangOptions &getLangOptions() const { return LangOpts; }
   Diagnostic &getDiagnostics() const { return Diags; }
   SourceManager &getSourceManager() const { return SourceMgr; }
@@ -383,7 +383,7 @@
     SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
       : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
 
-    explicit SemaDiagnosticBuilder(Sema &SemaRef) 
+    explicit SemaDiagnosticBuilder(Sema &SemaRef)
       : DiagnosticBuilder(DiagnosticBuilder::Suppress), SemaRef(SemaRef) { }
 
     ~SemaDiagnosticBuilder();
@@ -424,7 +424,7 @@
   llvm::DenseMap<IdentifierInfo*, LabelStmt*> &getLabelMap() {
     return CurBlock ? CurBlock->LabelMap : FunctionLabelMap;
   }
-  
+
   /// getSwitchStack - This is returns the switch stack for the current block or
   /// function.
   llvm::SmallVector<SwitchStmt*,8> &getSwitchStack() {
@@ -433,7 +433,7 @@
 
   /// WeakTopLevelDeclDecls - access to #pragma weak-generated Decls
   llvm::SmallVector<Decl*,2> &WeakTopLevelDecls() { return WeakTopLevelDecl; }
-  
+
   virtual void ActOnComment(SourceRange Comment);
 
   //===--------------------------------------------------------------------===//
@@ -443,21 +443,21 @@
   QualType ConvertDeclSpecToType(const DeclSpec &DS, SourceLocation DeclLoc,
                                  bool &IsInvalid);
   void ProcessTypeAttributeList(QualType &Result, const AttributeList *AL);
-  QualType BuildPointerType(QualType T, unsigned Quals, 
+  QualType BuildPointerType(QualType T, unsigned Quals,
                             SourceLocation Loc, DeclarationName Entity);
   QualType BuildReferenceType(QualType T, bool LValueRef, unsigned Quals,
                               SourceLocation Loc, DeclarationName Entity);
   QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
                           Expr *ArraySize, unsigned Quals,
                           SourceRange Brackets, DeclarationName Entity);
-  QualType BuildExtVectorType(QualType T, ExprArg ArraySize, 
+  QualType BuildExtVectorType(QualType T, ExprArg ArraySize,
                               SourceLocation AttrLoc);
   QualType BuildFunctionType(QualType T,
                              QualType *ParamTypes, unsigned NumParamTypes,
                              bool Variadic, unsigned Quals,
                              SourceLocation Loc, DeclarationName Entity);
-  QualType BuildMemberPointerType(QualType T, QualType Class, 
-                                  unsigned Quals, SourceLocation Loc, 
+  QualType BuildMemberPointerType(QualType T, QualType Class,
+                                  unsigned Quals, SourceLocation Loc,
                                   DeclarationName Entity);
   QualType BuildBlockPointerType(QualType T, unsigned Quals,
                                  SourceLocation Loc, DeclarationName Entity);
@@ -487,32 +487,32 @@
 
   bool RequireCompleteType(SourceLocation Loc, QualType T,
                            const PartialDiagnostic &PD);
-  
+
   QualType getQualifiedNameType(const CXXScopeSpec &SS, QualType T);
 
   QualType BuildTypeofExprType(Expr *E);
   QualType BuildDecltypeType(Expr *E);
-  
+
   //===--------------------------------------------------------------------===//
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
   //
 
   /// getDeclName - Return a pretty name for the specified decl if possible, or
-  /// an empty string if not.  This is used for pretty crash reporting. 
+  /// an empty string if not.  This is used for pretty crash reporting.
   virtual std::string getDeclName(DeclPtrTy D);
-  
+
   DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr);
 
-  virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, 
+  virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
                               Scope *S, const CXXScopeSpec *SS,
                               bool isClassName = false);
   virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S);
-  
+
   virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
     return HandleDeclarator(S, D, MultiTemplateParamsArg(*this), false);
   }
-  
-  DeclPtrTy HandleDeclarator(Scope *S, Declarator &D, 
+
+  DeclPtrTy HandleDeclarator(Scope *S, Declarator &D,
                              MultiTemplateParamsArg TemplateParameterLists,
                              bool IsFunctionDefinition);
   void RegisterLocallyScopedExternCDecl(NamedDecl *ND, NamedDecl *PrevDecl,
@@ -530,26 +530,26 @@
                                 bool &Redeclaration);
   NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
                                      QualType R, DeclaratorInfo *DInfo,
-                                     NamedDecl* PrevDecl, 
+                                     NamedDecl* PrevDecl,
                                      MultiTemplateParamsArg TemplateParamLists,
                                      bool IsFunctionDefinition,
                                      bool &Redeclaration);
   void CheckFunctionDeclaration(FunctionDecl *NewFD, NamedDecl *&PrevDecl,
-                                bool &Redeclaration, 
+                                bool &Redeclaration,
                                 bool &OverloadableAttrRequired);
   void CheckMain(FunctionDecl *FD);
   virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D);
   virtual void ActOnParamDefaultArgument(DeclPtrTy param,
                                          SourceLocation EqualLoc,
                                          ExprArg defarg);
-  virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param, 
+  virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
                                                  SourceLocation EqualLoc,
                                                  SourceLocation ArgLoc);
   virtual void ActOnParamDefaultArgumentError(DeclPtrTy param);
   bool SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
                                SourceLocation EqualLoc);
 
-  
+
   // Contains the locations of the beginning of unparsed default
   // argument locations.
   llvm::DenseMap<ParmVarDecl *,SourceLocation> UnparsedDefaultArgLocs;
@@ -570,19 +570,19 @@
   virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body);
   DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body,
                                     bool IsInstantiation);
-  
+
   /// \brief Diagnose any unused parameters in the given sequence of
   /// ParmVarDecl pointers.
   template<typename InputIterator>
   void DiagnoseUnusedParameters(InputIterator Param, InputIterator ParamEnd) {
     for (; Param != ParamEnd; ++Param) {
-      if (!(*Param)->isUsed() && (*Param)->getDeclName() && 
+      if (!(*Param)->isUsed() && (*Param)->getDeclName() &&
           !(*Param)->template hasAttr<UnusedAttr>())
         Diag((*Param)->getLocation(), diag::warn_unused_parameter)
           << (*Param)->getDeclName();
     }
   }
-  
+
   void DiagnoseInvalidJumps(Stmt *Body);
   virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr);
 
@@ -593,13 +593,13 @@
   /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
   /// no declarator (e.g. "struct foo;") is parsed.
   virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS);
-  
+
   bool InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner,
                                            RecordDecl *AnonRecord);
-  virtual DeclPtrTy BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, 
+  virtual DeclPtrTy BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
                                                 RecordDecl *Record);
 
-  bool isAcceptableTagRedeclaration(const TagDecl *Previous, 
+  bool isAcceptableTagRedeclaration(const TagDecl *Previous,
                                     TagDecl::TagKind NewTag,
                                     SourceLocation NewTagLoc,
                                     const IdentifierInfo &Name);
@@ -610,7 +610,7 @@
                              AttributeList *Attr, AccessSpecifier AS,
                              MultiTemplateParamsArg TemplateParameterLists,
                              bool &OwnedDecl);
-  
+
   virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
                          IdentifierInfo *ClassName,
                          llvm::SmallVectorImpl<DeclPtrTy> &Decls);
@@ -623,7 +623,7 @@
                          AccessSpecifier AS);
 
   FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T,
-                            DeclaratorInfo *DInfo, 
+                            DeclaratorInfo *DInfo,
                             RecordDecl *Record, SourceLocation Loc,
                             bool Mutable, Expr *BitfieldWidth,
                             SourceLocation TSSL,
@@ -637,7 +637,7 @@
     CXXDestructor = 3
   };
   void DiagnoseNontrivial(const RecordType* Record, CXXSpecialMember mem);
-  
+
   virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
                               DeclPtrTy IntfDecl,
                               Declarator &D, ExprTy *BitfieldWidth,
@@ -680,19 +680,19 @@
   /// Set the current declaration context until it gets popped.
   void PushDeclContext(Scope *S, DeclContext *DC);
   void PopDeclContext();
-  
+
   /// EnterDeclaratorContext - Used when we must lookup names in the context
   /// of a declarator's nested name specifier.
   void EnterDeclaratorContext(Scope *S, DeclContext *DC);
   void ExitDeclaratorContext(Scope *S);
-  
+
   DeclContext *getFunctionLevelDeclContext();
-  
+
   /// getCurFunctionDecl - If inside of a function body, this returns a pointer
   /// to the function decl for the function being parsed.  If we're currently
   /// in a 'block', this returns the containing context.
   FunctionDecl *getCurFunctionDecl();
-  
+
   /// getCurMethodDecl - If inside of a method body, this returns a pointer to
   /// the method decl for the method being parsed.  If we're currently
   /// in a 'block', this returns the containing context.
@@ -736,9 +736,9 @@
   bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old);
 
   /// C++ Overloading.
-  bool IsOverload(FunctionDecl *New, Decl* OldD, 
+  bool IsOverload(FunctionDecl *New, Decl* OldD,
                   OverloadedFunctionDecl::function_iterator &MatchedDecl);
-  ImplicitConversionSequence 
+  ImplicitConversionSequence
   TryImplicitConversion(Expr* From, QualType ToType,
                         bool SuppressUserConversions,
                         bool AllowExplicit,
@@ -761,20 +761,20 @@
   bool CheckMemberPointerConversion(Expr *From, QualType ToType,
                                     CastExpr::CastKind &Kind);
   bool IsQualificationConversion(QualType FromType, QualType ToType);
-  bool IsUserDefinedConversion(Expr *From, QualType ToType, 
+  bool IsUserDefinedConversion(Expr *From, QualType ToType,
                                UserDefinedConversionSequence& User,
                                bool AllowConversionFunctions,
                                bool AllowExplicit, bool ForceRValue);
 
-  ImplicitConversionSequence::CompareKind 
+  ImplicitConversionSequence::CompareKind
   CompareImplicitConversionSequences(const ImplicitConversionSequence& ICS1,
                                      const ImplicitConversionSequence& ICS2);
 
-  ImplicitConversionSequence::CompareKind 
+  ImplicitConversionSequence::CompareKind
   CompareStandardConversionSequences(const StandardConversionSequence& SCS1,
                                      const StandardConversionSequence& SCS2);
 
-  ImplicitConversionSequence::CompareKind 
+  ImplicitConversionSequence::CompareKind
   CompareQualificationConversions(const StandardConversionSequence& SCS1,
                                   const StandardConversionSequence& SCS2);
 
@@ -782,11 +782,11 @@
   CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1,
                                   const StandardConversionSequence& SCS2);
 
-  ImplicitConversionSequence 
+  ImplicitConversionSequence
   TryCopyInitialization(Expr* From, QualType ToType,
                         bool SuppressUserConversions, bool ForceRValue,
                         bool InOverloadResolution);
-  bool PerformCopyInitialization(Expr *&From, QualType ToType, 
+  bool PerformCopyInitialization(Expr *&From, QualType ToType,
                                  const char *Flavor, bool Elidable = false);
 
   ImplicitConversionSequence
@@ -795,7 +795,7 @@
 
   ImplicitConversionSequence TryContextuallyConvertToBool(Expr *From);
   bool PerformContextuallyConvertToBool(Expr *&From);
-  
+
   bool PerformObjectMemberConversion(Expr *&From, NamedDecl *Member);
 
   /// OverloadingResult - Capture the result of performing overload
@@ -814,7 +814,7 @@
   typedef llvm::SmallPtrSet<AnyFunctionDecl, 16> FunctionSet;
   typedef llvm::SmallPtrSet<CXXRecordDecl *, 16> AssociatedClassSet;
 
-  void AddOverloadCandidate(FunctionDecl *Function, 
+  void AddOverloadCandidate(FunctionDecl *Function,
                             Expr **Args, unsigned NumArgs,
                             OverloadCandidateSet& CandidateSet,
                             bool SuppressUserConversions = false,
@@ -864,13 +864,13 @@
                                    Expr **Args, unsigned NumArgs,
                                    OverloadCandidateSet& CandidateSet,
                                    SourceRange OpRange = SourceRange());
-  void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, 
+  void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
                            Expr **Args, unsigned NumArgs,
                            OverloadCandidateSet& CandidateSet,
                            bool IsAssignmentOperator = false,
                            unsigned NumContextualBoolArguments = 0);
-  void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, 
-                                    Expr **Args, unsigned NumArgs, 
+  void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
+                                    Expr **Args, unsigned NumArgs,
                                     OverloadCandidateSet& CandidateSet);
   void AddArgumentDependentLookupCandidates(DeclarationName Name,
                                             Expr **Args, unsigned NumArgs,
@@ -882,7 +882,7 @@
                                        OverloadCandidateSet::iterator& Best);
   void PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
                                bool OnlyViable);
-                               
+
   FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
                                                    bool Complain);
   void FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn);
@@ -894,7 +894,7 @@
                                         unsigned NumExplicitTemplateArgs,
                                         SourceLocation LParenLoc,
                                         Expr **Args, unsigned NumArgs,
-                                        SourceLocation *CommaLocs, 
+                                        SourceLocation *CommaLocs,
                                         SourceLocation RParenLoc,
                                         bool &ArgumentDependentLookup);
 
@@ -910,18 +910,18 @@
 
   ExprResult
   BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
-                            SourceLocation LParenLoc, Expr **Args, 
+                            SourceLocation LParenLoc, Expr **Args,
                             unsigned NumArgs, SourceLocation *CommaLocs,
                             SourceLocation RParenLoc);
-  ExprResult 
+  ExprResult
   BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc,
                                Expr **Args, unsigned NumArgs,
-                               SourceLocation *CommaLocs, 
+                               SourceLocation *CommaLocs,
                                SourceLocation RParenLoc);
 
   OwningExprResult BuildOverloadedArrowExpr(Scope *S, ExprArg Base,
                                             SourceLocation OpLoc);
-               
+
   /// Helpers for dealing with blocks and functions.
   void CheckFallThroughForFunctionDef(Decl *D, Stmt *Body);
   void CheckFallThroughForBlock(QualType BlockTy, Stmt *Body);
@@ -941,7 +941,7 @@
   /// overloaded operator names, constructor names, etc.) into zero or
   /// more declarations within a particular scope. The major entry
   /// points are LookupName, which performs unqualified name lookup,
-  /// and LookupQualifiedName, which performs qualified name lookup. 
+  /// and LookupQualifiedName, which performs qualified name lookup.
   ///
   /// All name lookup is performed based on some specific criteria,
   /// which specify what names will be visible to name lookup and how
@@ -988,7 +988,7 @@
     LookupNamespaceName,
     /// Look up an ordinary name that is going to be redeclared as a
     /// name with linkage. This lookup ignores any declarations that
-    /// are outside of the current scope unless they have linkage. See 
+    /// are outside of the current scope unless they have linkage. See
     /// C99 6.2.2p4-5 and C++ [basic.link]p6.
     LookupRedeclarationWithLinkage,
     /// Look up the name of an Objective-C protocol.
@@ -1005,7 +1005,7 @@
   /// single name lookup, which can return no result (nothing found),
   /// a single declaration, a set of overloaded functions, or an
   /// ambiguity. Use the getKind() method to determine which of these
-  /// results occurred for a given lookup. 
+  /// results occurred for a given lookup.
   ///
   /// Any non-ambiguous lookup can be converted into a single
   /// (possibly NULL) @c NamedDecl* via a conversion function or the
@@ -1085,7 +1085,7 @@
       /// struct A { void f(int); }
       /// struct B { void f(double); }
       /// struct C : A, B { };
-      /// void test(C c) { 
+      /// void test(C c) {
       ///   c.f(0); // error: A::f and B::f come from subobjects of different
       ///           // types. overload resolution is not performed.
       /// }
@@ -1124,15 +1124,15 @@
 
     static LookupResult CreateLookupResult(ASTContext &Context, NamedDecl *D);
 
-    static LookupResult CreateLookupResult(ASTContext &Context, 
-                                           IdentifierResolver::iterator F, 
+    static LookupResult CreateLookupResult(ASTContext &Context,
+                                           IdentifierResolver::iterator F,
                                            IdentifierResolver::iterator L);
 
-    static LookupResult CreateLookupResult(ASTContext &Context, 
-                                           DeclContext::lookup_iterator F, 
+    static LookupResult CreateLookupResult(ASTContext &Context,
+                                           DeclContext::lookup_iterator F,
                                            DeclContext::lookup_iterator L);
 
-    static LookupResult CreateLookupResult(ASTContext &Context, BasePaths *Paths, 
+    static LookupResult CreateLookupResult(ASTContext &Context, BasePaths *Paths,
                                            bool DifferentSubobjectTypes) {
       LookupResult Result;
       Result.StoredKind = AmbiguousLookupStoresBasePaths;
@@ -1252,37 +1252,37 @@
     case Sema::LookupObjCImplementationName:
     case Sema::LookupObjCCategoryImplName:
       return D->isInIdentifierNamespace(IDNS);
-      
+
     case Sema::LookupOperatorName:
-      return D->isInIdentifierNamespace(IDNS) && 
+      return D->isInIdentifierNamespace(IDNS) &&
              !D->getDeclContext()->isRecord();
 
     case Sema::LookupNestedNameSpecifierName:
       return isa<TypedefDecl>(D) || D->isInIdentifierNamespace(Decl::IDNS_Tag);
-      
+
     case Sema::LookupNamespaceName:
       return isa<NamespaceDecl>(D) || isa<NamespaceAliasDecl>(D);
     }
-    
-    assert(false && 
+
+    assert(false &&
            "isAcceptableLookupResult always returns before this point");
     return false;
   }
 
-  LookupResult LookupName(Scope *S, DeclarationName Name, 
-                          LookupNameKind NameKind, 
+  LookupResult LookupName(Scope *S, DeclarationName Name,
+                          LookupNameKind NameKind,
                           bool RedeclarationOnly = false,
                           bool AllowBuiltinCreation = false,
                           SourceLocation Loc = SourceLocation());
   LookupResult LookupQualifiedName(DeclContext *LookupCtx, DeclarationName Name,
-                                   LookupNameKind NameKind, 
+                                   LookupNameKind NameKind,
                                    bool RedeclarationOnly = false);
   Decl *LookupQualifiedNameWithType(DeclContext *LookupCtx,
                                     DeclarationName Name,
                                     QualType T);
-  LookupResult LookupParsedName(Scope *S, const CXXScopeSpec *SS, 
+  LookupResult LookupParsedName(Scope *S, const CXXScopeSpec *SS,
                                 DeclarationName Name,
-                                LookupNameKind NameKind, 
+                                LookupNameKind NameKind,
                                 bool RedeclarationOnly = false,
                                 bool AllowBuiltinCreation = false,
                                 SourceLocation Loc = SourceLocation(),
@@ -1292,9 +1292,9 @@
   ObjCCategoryImplDecl *LookupObjCCategoryImpl(IdentifierInfo *II);
 
   void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
-                                    QualType T1, QualType T2, 
+                                    QualType T1, QualType T2,
                                     FunctionSet &Functions);
-                          
+
   void ArgumentDependentLookup(DeclarationName Name,
                                Expr **Args, unsigned NumArgs,
                                FunctionSet &Functions);
@@ -1304,12 +1304,12 @@
                                    AssociatedClassSet &AssociatedClasses);
 
   bool DiagnoseAmbiguousLookup(LookupResult &Result, DeclarationName Name,
-                               SourceLocation NameLoc, 
+                               SourceLocation NameLoc,
                                SourceRange LookupRange = SourceRange());
   //@}
-  
+
   ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id);
-  NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, 
+  NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
                                  Scope *S, bool ForRedeclaration,
                                  SourceLocation Loc);
   NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
@@ -1318,7 +1318,7 @@
 
   // More parsing and symbol table subroutines.
 
-  // Decl attributes - this routine is the top level dispatcher. 
+  // Decl attributes - this routine is the top level dispatcher.
   void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
   void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AttrList);
 
@@ -1328,10 +1328,10 @@
                                    ObjCMethodDecl *IntfMethod);
 
   NamespaceDecl *GetStdNamespace();
-  
+
   bool isPropertyReadonly(ObjCPropertyDecl *PropertyDecl,
                           ObjCInterfaceDecl *IDecl);
-                           
+
   /// CheckProtocolMethodDefs - This routine checks unimplemented
   /// methods declared in protocol, and those referenced by it.
   /// \param IDecl - Used for checking for methods which may have been
@@ -1342,24 +1342,24 @@
                                const llvm::DenseSet<Selector> &InsMap,
                                const llvm::DenseSet<Selector> &ClsMap,
                                ObjCInterfaceDecl *IDecl);
-  
+
   /// CheckImplementationIvars - This routine checks if the instance variables
-  /// listed in the implelementation match those listed in the interface. 
+  /// listed in the implelementation match those listed in the interface.
   void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
                                 ObjCIvarDecl **Fields, unsigned nIvars,
                                 SourceLocation Loc);
-  
+
   /// ImplMethodsVsClassMethods - This is main routine to warn if any method
   /// remains unimplemented in the class or category @implementation.
-  void ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, 
-                                 ObjCContainerDecl* IDecl, 
+  void ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl,
+                                 ObjCContainerDecl* IDecl,
                                  bool IncompleteImpl = false);
-  
+
   /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
   /// true, or false, accordingly.
-  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, 
+  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
                                   const ObjCMethodDecl *PrevMethod,
-                                  bool matchBasedOnSizeAndAlignment = false); 
+                                  bool matchBasedOnSizeAndAlignment = false);
 
   /// MatchAllMethodDeclarations - Check methods declaraed in interface or
   /// or protocol against those declared in their implementations.
@@ -1377,7 +1377,7 @@
   /// a selector with a method declaraation for purposes of typechecking
   /// messages sent to "id" (where the class of the object is unknown).
   void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method);
-  
+
   /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
   /// there are multiple signatures.
   ObjCMethodDecl *LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R,
@@ -1386,7 +1386,7 @@
   /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
   /// there are multiple signatures.
   ObjCMethodDecl *LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R);
-  
+
   /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
   void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method);
   //===--------------------------------------------------------------------===//
@@ -1405,7 +1405,7 @@
                                     SourceLocation DotDotDotLoc, ExprArg RHSVal,
                                     SourceLocation ColonLoc);
   virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt);
-  
+
   virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
                                             SourceLocation ColonLoc,
                                             StmtArg SubStmt, Scope *CurScope);
@@ -1413,13 +1413,13 @@
                                           IdentifierInfo *II,
                                           SourceLocation ColonLoc,
                                           StmtArg SubStmt);
-  virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc, 
-                                       FullExprArg CondVal, StmtArg ThenVal, 
+  virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
+                                       FullExprArg CondVal, StmtArg ThenVal,
                                        SourceLocation ElseLoc, StmtArg ElseVal);
   virtual OwningStmtResult ActOnStartOfSwitchStmt(ExprArg Cond);
   virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
                                                  StmtArg Switch, StmtArg Body);
-  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, 
+  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
                                           FullExprArg Cond, StmtArg Body);
   virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
                                        SourceLocation WhileLoc,
@@ -1477,7 +1477,7 @@
                                               StmtArg Catch, StmtArg Finally);
 
   virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
-                                                ExprArg Throw, 
+                                                ExprArg Throw,
                                                 Scope *CurScope);
   virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
                                                        ExprArg SynchExpr,
@@ -1501,26 +1501,26 @@
   /// DiagnoseUnusedExprResult - If the statement passed in is an expression
   /// whose result is unused, warn.
   void DiagnoseUnusedExprResult(const Stmt *S);
-  
+
   //===--------------------------------------------------------------------===//
   // Expression Parsing Callbacks: SemaExpr.cpp.
 
   bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc);
-  bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, 
+  bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
                                         ObjCMethodDecl *Getter,
                                         SourceLocation Loc);
   void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
                              Expr **Args, unsigned NumArgs);
 
-  virtual ExpressionEvaluationContext 
+  virtual ExpressionEvaluationContext
   PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext);
-  
-  virtual void 
+
+  virtual void
   PopExpressionEvaluationContext(ExpressionEvaluationContext OldContext,
                                  ExpressionEvaluationContext NewContext);
-  
+
   void MarkDeclarationReferenced(SourceLocation Loc, Decl *D);
-  
+
   // Primary Expressions.
   virtual SourceRange getExprRange(ExprTy *E) const;
 
@@ -1541,8 +1541,8 @@
                                                     bool HasTrailingLParen,
                                                     const CXXScopeSpec &SS,
                                                     bool isAddressOfOperand);
-  OwningExprResult BuildDeclRefExpr(NamedDecl *D, QualType Ty, 
-                                    SourceLocation Loc, bool TypeDependent, 
+  OwningExprResult BuildDeclRefExpr(NamedDecl *D, QualType Ty,
+                                    SourceLocation Loc, bool TypeDependent,
                                     bool ValueDependent,
                                     const CXXScopeSpec *SS = 0);
   VarDecl *BuildAnonymousStructUnionMemberPath(FieldDecl *Field,
@@ -1559,9 +1559,9 @@
                                             bool isAddressOfOperand = false);
   OwningExprResult BuildDeclarationNameExpr(SourceLocation Loc, NamedDecl *D,
                                             bool HasTrailingLParen,
-                                            const CXXScopeSpec *SS, 
+                                            const CXXScopeSpec *SS,
                                             bool isAddressOfOperand);
-    
+
   virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
                                                tok::TokenKind Kind);
   virtual OwningExprResult ActOnNumericConstant(const Token &);
@@ -1571,7 +1571,7 @@
   virtual OwningExprResult ActOnParenListExpr(SourceLocation L,
                                               SourceLocation R,
                                               MultiExprArg Val);
-  
+
   /// ActOnStringLiteral - The specified tokens were lexed as pasted string
   /// fragments (e.g. "foo" "bar" L"baz").
   virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
@@ -1579,19 +1579,19 @@
 
   // Binary/Unary Operators.  'Tok' is the token for the operator.
   OwningExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc,
-                                        unsigned OpcIn, 
+                                        unsigned OpcIn,
                                         ExprArg InputArg);
   virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
                                         tok::TokenKind Op, ExprArg Input);
 
-  OwningExprResult CreateSizeOfAlignOfExpr(QualType T, SourceLocation OpLoc, 
+  OwningExprResult CreateSizeOfAlignOfExpr(QualType T, SourceLocation OpLoc,
                                            bool isSizeOf, SourceRange R);
-  OwningExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, 
+  OwningExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
                                            bool isSizeOf, SourceRange R);
   virtual OwningExprResult
     ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
                            void *TyOrEx, const SourceRange &ArgRange);
-                                           
+
   bool CheckAlignOfExpr(Expr *E, SourceLocation OpLoc, const SourceRange &R);
   bool CheckSizeOfAlignOfOperand(QualType type, SourceLocation OpLoc,
                                  const SourceRange &R, bool isSizeof);
@@ -1613,7 +1613,7 @@
                                             DeclPtrTy ImplDecl,
                                             const CXXScopeSpec *SS = 0,
                                           NamedDecl *FirstQualifierInScope = 0) {
-    // FIXME: Temporary helper while we migrate existing calls to 
+    // FIXME: Temporary helper while we migrate existing calls to
     // BuildMemberReferenceExpr to support explicitly-specified template
     // arguments.
     return BuildMemberReferenceExpr(S, move(Base), OpLoc, OpKind, MemberLoc,
@@ -1621,7 +1621,7 @@
                                     SourceLocation(), ImplDecl, SS,
                                     FirstQualifierInScope);
   }
-  
+
   OwningExprResult BuildMemberReferenceExpr(Scope *S, ExprArg Base,
                                             SourceLocation OpLoc,
                                             tok::TokenKind OpKind,
@@ -1635,7 +1635,7 @@
                                             DeclPtrTy ImplDecl,
                                             const CXXScopeSpec *SS,
                                           NamedDecl *FirstQualifierInScope = 0);
-  
+
   virtual OwningExprResult ActOnMemberReferenceExpr(Scope *S, ExprArg Base,
                                                     SourceLocation OpLoc,
                                                     tok::TokenKind OpKind,
@@ -1667,7 +1667,7 @@
   virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
                                          TypeTy *Ty, SourceLocation RParenLoc,
                                          ExprArg Op);
-  
+
   OwningExprResult MaybeConvertParenListExprToParenExpr(Scope *S, ExprArg ME);
   OwningExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
                                             SourceLocation RParenLoc, ExprArg E,
@@ -1769,7 +1769,7 @@
                                         SourceLocation IdentLoc,
                                         IdentifierInfo *NamespcName,
                                         AttributeList *AttrList);
-  
+
   void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir);
 
   virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope,
@@ -1786,7 +1786,7 @@
                                    DeclarationName Name,
                                    AttributeList *AttrList,
                                    bool IsTypeName);
-  
+
   virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
                                           AccessSpecifier AS,
                                           SourceLocation UsingLoc,
@@ -1796,8 +1796,8 @@
                                           OverloadedOperatorKind Op,
                                           AttributeList *AttrList,
                                           bool IsTypeName);
-  
-  /// AddCXXDirectInitializerToDecl - This action is called immediately after 
+
+  /// AddCXXDirectInitializerToDecl - This action is called immediately after
   /// ActOnDeclarator, when a C++ direct initializer is present.
   /// e.g: "int x(1);"
   virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
@@ -1808,73 +1808,73 @@
 
   /// InitializeVarWithConstructor - Creates an CXXConstructExpr
   /// and sets it as the initializer for the the passed in VarDecl.
-  bool InitializeVarWithConstructor(VarDecl *VD, 
+  bool InitializeVarWithConstructor(VarDecl *VD,
                                     CXXConstructorDecl *Constructor,
-                                    QualType DeclInitType, 
+                                    QualType DeclInitType,
                                     MultiExprArg Exprs);
 
   /// BuildCXXConstructExpr - Creates a complete call to a constructor,
   /// including handling of its default argument expressions.
-  OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, 
+  OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc,
                                          QualType DeclInitType,
                                          CXXConstructorDecl *Constructor,
                                          MultiExprArg Exprs);
 
   // FIXME: Can re remove this and have the above BuildCXXConstructExpr check if
   // the constructor can be elidable?
-  OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, 
+  OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc,
                                          QualType DeclInitType,
                                          CXXConstructorDecl *Constructor,
                                          bool Elidable,
                                          MultiExprArg Exprs);
-  
-  OwningExprResult BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Cons, 
-                                               QualType writtenTy, 
-                                               SourceLocation tyBeginLoc, 
+
+  OwningExprResult BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Cons,
+                                               QualType writtenTy,
+                                               SourceLocation tyBeginLoc,
                                                MultiExprArg Args,
                                                SourceLocation rParenLoc);
-                                               
+
   /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
   /// the default expr if needed.
   OwningExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
                                           FunctionDecl *FD,
                                           ParmVarDecl *Param);
-  
+
   /// FinalizeVarWithDestructor - Prepare for calling destructor on the
   /// constructed variable.
   void FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType);
-  
-  /// DefineImplicitDefaultConstructor - Checks for feasibility of 
+
+  /// DefineImplicitDefaultConstructor - Checks for feasibility of
   /// defining this constructor as the default constructor.
   void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
                                         CXXConstructorDecl *Constructor);
-  
-  /// DefineImplicitDestructor - Checks for feasibility of 
+
+  /// DefineImplicitDestructor - Checks for feasibility of
   /// defining this destructor as the default destructor.
   void DefineImplicitDestructor(SourceLocation CurrentLocation,
                                         CXXDestructorDecl *Destructor);
-  
-  /// DefineImplicitCopyConstructor - Checks for feasibility of 
+
+  /// DefineImplicitCopyConstructor - Checks for feasibility of
   /// defining this constructor as the copy constructor.
   void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
                                      CXXConstructorDecl *Constructor,
                                      unsigned TypeQuals);
-  
+
   /// DefineImplicitOverloadedAssign - Checks for feasibility of
   /// defining implicit this overloaded assignment operator.
-  void DefineImplicitOverloadedAssign(SourceLocation CurrentLocation, 
+  void DefineImplicitOverloadedAssign(SourceLocation CurrentLocation,
                                       CXXMethodDecl *MethodDecl);
-  
+
   /// getAssignOperatorMethod - Returns the default copy assignmment operator
   /// for the class.
   CXXMethodDecl *getAssignOperatorMethod(ParmVarDecl *Decl,
-                                         CXXRecordDecl *ClassDecl);  
+                                         CXXRecordDecl *ClassDecl);
 
   /// MaybeBindToTemporary - If the passed in expression has a record type with
   /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
   /// it simply returns the passed in expression.
   OwningExprResult MaybeBindToTemporary(Expr *E);
-  
+
   /// InitializationKind - Represents which kind of C++ initialization
   /// [dcl.init] a routine is to perform.
   enum InitializationKind {
@@ -1945,7 +1945,7 @@
                                SourceLocation PlacementLParen,
                                MultiExprArg PlacementArgs,
                                SourceLocation PlacementRParen,
-                               bool ParenTypeId, 
+                               bool ParenTypeId,
                                QualType AllocType,
                                SourceLocation TypeLoc,
                                SourceRange TypeRange,
@@ -1953,7 +1953,7 @@
                                SourceLocation ConstructorLParen,
                                MultiExprArg ConstructorArgs,
                                SourceLocation ConstructorRParen);
-  
+
   bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
                           SourceRange R);
   bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
@@ -1990,13 +1990,13 @@
                                                SourceLocation LParen,
                                                TypeTy *Ty,
                                                SourceLocation RParen);
-  
+
   virtual OwningExprResult ActOnStartCXXMemberReference(Scope *S,
                                                         ExprArg Base,
                                                         SourceLocation OpLoc,
                                                         tok::TokenKind OpKind,
                                                         TypeTy *&ObjectType);
-    
+
   virtual OwningExprResult
   ActOnDestructorReferenceExpr(Scope *S, ExprArg Base,
                                SourceLocation OpLoc,
@@ -2020,7 +2020,7 @@
                                        SourceLocation ClassNameLoc,
                                        TypeTy *Ty,
                                        const CXXScopeSpec *SS = 0);
-  
+
   virtual OwningExprResult
   ActOnMemberTemplateIdReferenceExpr(Scope *S, ExprArg Base,
                                      SourceLocation OpLoc,
@@ -2033,19 +2033,19 @@
                                      ASTTemplateArgsPtr TemplateArgs,
                                      SourceLocation *TemplateArgLocs,
                                      SourceLocation RAngleLoc);
-  
-  /// MaybeCreateCXXExprWithTemporaries - If the list of temporaries is 
+
+  /// MaybeCreateCXXExprWithTemporaries - If the list of temporaries is
   /// non-empty, will create a new CXXExprWithTemporaries expression.
   /// Otherwise, just returs the passed in expression.
   Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr,
                                           bool ShouldDestroyTemporaries);
-  
+
   virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr);
 
   bool RequireCompleteDeclContext(const CXXScopeSpec &SS);
-  
+
   DeclContext *computeDeclContext(QualType T);
-  DeclContext *computeDeclContext(const CXXScopeSpec &SS, 
+  DeclContext *computeDeclContext(const CXXScopeSpec &SS,
                                   bool EnteringContext = false);
   bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
   CXXRecordDecl *getCurrentInstantiationOf(NestedNameSpecifier *NNS);
@@ -2057,7 +2057,7 @@
                                                    SourceLocation CCLoc);
 
   NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS);
-  
+
 
   CXXScopeTy *BuildCXXNestedNameSpecifier(Scope *S,
                                           const CXXScopeSpec &SS,
@@ -2067,7 +2067,7 @@
                                           QualType ObjectType,
                                           NamedDecl *ScopeLookupResult,
                                           bool EnteringContext);
-  
+
   virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
                                                   const CXXScopeSpec &SS,
                                                   SourceLocation IdLoc,
@@ -2117,26 +2117,26 @@
   virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl);
 
   // ParseObjCStringLiteral - Parse Objective-C string literals.
-  virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, 
+  virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
                                             ExprTy **Strings,
                                             unsigned NumStrings);
-  
-  Expr *BuildObjCEncodeExpression(SourceLocation AtLoc, 
+
+  Expr *BuildObjCEncodeExpression(SourceLocation AtLoc,
                                   QualType EncodedType,
-                                  SourceLocation RParenLoc);                                    
+                                  SourceLocation RParenLoc);
   virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
                                                SourceLocation EncodeLoc,
                                                SourceLocation LParenLoc,
                                                TypeTy *Ty,
                                                SourceLocation RParenLoc);
-  
+
   // ParseObjCSelectorExpression - Build selector expression for @selector
   virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
                                                  SourceLocation AtLoc,
                                                  SourceLocation SelLoc,
                                                  SourceLocation LParenLoc,
                                                  SourceLocation RParenLoc);
-  
+
   // ParseObjCProtocolExpression - Build protocol expression for @protocol
   virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo * ProtocolName,
                                                  SourceLocation AtLoc,
@@ -2190,25 +2190,25 @@
                                      unsigned NumArgs, SourceLocation IdLoc,
                                      SourceLocation RParenLoc,
                                      CXXRecordDecl *ClassDecl);
-  
+
   void setBaseOrMemberInitializers(CXXConstructorDecl *Constructor,
                               CXXBaseOrMemberInitializer **Initializers,
                               unsigned NumInitializers,
                               llvm::SmallVectorImpl<CXXBaseSpecifier *>& Bases,
                               llvm::SmallVectorImpl<FieldDecl *>&Members);
-  
-  /// computeBaseOrMembersToDestroy - Compute information in current 
-  /// destructor decl's AST of bases and non-static data members which will be 
+
+  /// computeBaseOrMembersToDestroy - Compute information in current
+  /// destructor decl's AST of bases and non-static data members which will be
   /// implicitly destroyed. We are storing the destruction in the order that
   /// they should occur (which is the reverse of construction order).
   void computeBaseOrMembersToDestroy(CXXDestructorDecl *Destructor);
-  
+
   void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl);
 
-  virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl, 
+  virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
                                     SourceLocation ColonLoc,
                                     MemInitTy **MemInits, unsigned NumMemInits);
-  
+
   virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
                                                  DeclPtrTy TagDecl,
                                                  SourceLocation LBrac,
@@ -2221,10 +2221,10 @@
   virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
                                                       DeclPtrTy Method);
 
-  virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc, 
+  virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
                                                  ExprArg AssertExpr,
                                                  ExprArg AssertMessageExpr);
-  
+
   virtual DeclPtrTy ActOnFriendDecl(Scope *S,
                           llvm::PointerUnion<const DeclSpec*,Declarator*> D,
                                     bool IsDefinition);
@@ -2249,17 +2249,17 @@
   CXXBaseSpecifier *CheckBaseSpecifier(CXXRecordDecl *Class,
                                        SourceRange SpecifierRange,
                                        bool Virtual, AccessSpecifier Access,
-                                       QualType BaseType, 
+                                       QualType BaseType,
                                        SourceLocation BaseLoc);
-  virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl, 
+  virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
                                         SourceRange SpecifierRange,
                                         bool Virtual, AccessSpecifier Access,
-                                        TypeTy *basetype, SourceLocation 
+                                        TypeTy *basetype, SourceLocation
                                         BaseLoc);
 
   bool AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases,
                             unsigned NumBases);
-  virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases, 
+  virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
                                    unsigned NumBases);
 
   bool IsDerivedFrom(QualType Derived, QualType Base);
@@ -2273,9 +2273,9 @@
                                     unsigned AmbigiousBaseConvID,
                                     SourceLocation Loc, SourceRange Range,
                                     DeclarationName Name);
-  
+
   std::string getAmbiguousPathsDisplayString(BasePaths &Paths);
-  
+
   /// CheckOverridingFunctionReturnType - Checks whether the return types are
   /// covariant, according to C++ [class.virtual]p5.
   bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
@@ -2290,7 +2290,7 @@
   // C++ Access Control
   //
 
-  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, 
+  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
                                 NamedDecl *PrevMemberDecl,
                                 AccessSpecifier LexicalAS);
 
@@ -2311,12 +2311,12 @@
     AbstractVariableType,
     AbstractFieldType
   };
-  
+
   bool RequireNonAbstractType(SourceLocation Loc, QualType T,
                               const PartialDiagnostic &PD,
                               const CXXRecordDecl *CurrentRD = 0);
-  
-  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, 
+
+  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
                               AbstractDiagSelID SelID = AbstractNone,
                               const CXXRecordDecl *CurrentRD = 0);
 
@@ -2330,7 +2330,7 @@
   // C++ Templates [C++ 14]
   //
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const IdentifierInfo &II, 
+                                          const IdentifierInfo &II,
                                           SourceLocation IdLoc,
                                           const CXXScopeSpec *SS,
                                           TypeTy *ObjectType,
@@ -2339,13 +2339,13 @@
   bool DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl);
   TemplateDecl *AdjustDeclIfTemplate(DeclPtrTy &Decl);
 
-  virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis, 
+  virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
                                        SourceLocation EllipsisLoc,
                                        SourceLocation KeyLoc,
                                        IdentifierInfo *ParamName,
                                        SourceLocation ParamNameLoc,
                                        unsigned Depth, unsigned Position);
-  virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam, 
+  virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam,
                                          SourceLocation EqualLoc,
                                          SourceLocation DefaultLoc,
                                          TypeTy *Default);
@@ -2371,7 +2371,7 @@
   virtual TemplateParamsTy *
   ActOnTemplateParameterList(unsigned Depth,
                              SourceLocation ExportLoc,
-                             SourceLocation TemplateLoc, 
+                             SourceLocation TemplateLoc,
                              SourceLocation LAngleLoc,
                              DeclPtrTy *Params, unsigned NumParams,
                              SourceLocation RAngleLoc);
@@ -2382,7 +2382,7 @@
                                           const CXXScopeSpec &SS,
                                           TemplateParameterList **ParamLists,
                                           unsigned NumParamLists);
-                                                
+
   DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
                                 SourceLocation KWLoc, const CXXScopeSpec &SS,
                                 IdentifierInfo *Name, SourceLocation NameLoc,
@@ -2408,21 +2408,21 @@
                                             TagUseKind TUK,
                                             DeclSpec::TST TagSpec,
                                             SourceLocation TagLoc);
-    
+
   OwningExprResult BuildTemplateIdExpr(TemplateName Template,
                                        SourceLocation TemplateNameLoc,
                                        SourceLocation LAngleLoc,
                                        const TemplateArgument *TemplateArgs,
                                        unsigned NumTemplateArgs,
                                        SourceLocation RAngleLoc);
-  
+
   virtual OwningExprResult ActOnTemplateIdExpr(TemplateTy Template,
                                                SourceLocation TemplateNameLoc,
                                                SourceLocation LAngleLoc,
                                                ASTTemplateArgsPtr TemplateArgs,
                                                SourceLocation *TemplateArgLocs,
                                                SourceLocation RAngleLoc);
-    
+
   virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
                                                 const IdentifierInfo &Name,
                                                 SourceLocation NameLoc,
@@ -2443,7 +2443,7 @@
 
   virtual DeclResult
   ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                                   SourceLocation KWLoc, 
+                                   SourceLocation KWLoc,
                                    const CXXScopeSpec &SS,
                                    TemplateTy Template,
                                    SourceLocation TemplateNameLoc,
@@ -2454,19 +2454,19 @@
                                    AttributeList *Attr,
                                  MultiTemplateParamsArg TemplateParameterLists);
 
-  virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S, 
+  virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S,
                                   MultiTemplateParamsArg TemplateParameterLists,
                                             Declarator &D);
-  
-  virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, 
+
+  virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
                                                     MultiTemplateParamsArg TemplateParameterLists,
                                                     Declarator &D);
-  
+
   virtual DeclResult
-  ActOnExplicitInstantiation(Scope *S, 
+  ActOnExplicitInstantiation(Scope *S,
                              SourceLocation ExternLoc,
                              SourceLocation TemplateLoc,
-                             unsigned TagSpec, 
+                             unsigned TagSpec,
                              SourceLocation KWLoc,
                              const CXXScopeSpec &SS,
                              TemplateTy Template,
@@ -2478,10 +2478,10 @@
                              AttributeList *Attr);
 
   virtual DeclResult
-  ActOnExplicitInstantiation(Scope *S, 
+  ActOnExplicitInstantiation(Scope *S,
                              SourceLocation ExternLoc,
                              SourceLocation TemplateLoc,
-                             unsigned TagSpec, 
+                             unsigned TagSpec,
                              SourceLocation KWLoc,
                              const CXXScopeSpec &SS,
                              IdentifierInfo *Name,
@@ -2497,16 +2497,16 @@
                                  bool PartialTemplateArgs,
                                  TemplateArgumentListBuilder &Converted);
 
-  bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, 
+  bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param,
                                  const TemplateArgument &Arg,
                                  TemplateArgumentListBuilder &Converted);
 
   bool CheckTemplateArgument(TemplateTypeParmDecl *Param, QualType Arg,
                              SourceLocation ArgLoc);
-  bool CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg, 
+  bool CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg,
                                                       NamedDecl *&Entity);
   bool CheckTemplateArgumentPointerToMember(Expr *Arg, NamedDecl *&Member);
-  bool CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 
+  bool CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
                              QualType InstantiatedParamType, Expr *&Arg,
                              TemplateArgument &Converted);
   bool CheckTemplateArgument(TemplateTemplateParmDecl *Param, DeclRefExpr *Arg);
@@ -2516,7 +2516,7 @@
                                       bool IsTemplateTemplateParm = false,
                                       SourceLocation TemplateArgLoc
                                        = SourceLocation());
-  
+
   bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
 
   /// \brief Called when the parser has parsed a C++ typename
@@ -2531,7 +2531,7 @@
                     const IdentifierInfo &II, SourceLocation IdLoc);
 
   /// \brief Called when the parser has parsed a C++ typename
-  /// specifier that ends in a template-id, e.g., 
+  /// specifier that ends in a template-id, e.g.,
   /// "typename MetaFun::template apply<T1, T2>".
   ///
   /// \param TypenameLoc the location of the 'typename' keyword
@@ -2583,10 +2583,10 @@
     /// produces a type that does not match the original template
     /// arguments provided.
     TDK_NonDeducedMismatch,
-    /// \brief When performing template argument deduction for a function 
+    /// \brief When performing template argument deduction for a function
     /// template, there were too many call arguments.
     TDK_TooManyArguments,
-    /// \brief When performing template argument deduction for a function 
+    /// \brief When performing template argument deduction for a function
     /// template, there were too few call arguments.
     TDK_TooFewArguments,
     /// \brief The explicitly-specified template arguments were not valid
@@ -2617,7 +2617,7 @@
     }
 
     /// \brief Take ownership of the deduced template argument list.
-    TemplateArgumentList *take() { 
+    TemplateArgumentList *take() {
       TemplateArgumentList *Result = Deduced;
       Deduced = 0;
       return Result;
@@ -2670,7 +2670,7 @@
   DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
                           const TemplateArgumentList &TemplateArgs,
                           TemplateDeductionInfo &Info);
-          
+
   TemplateDeductionResult
   SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
                                 const TemplateArgument *ExplicitTemplateArgs,
@@ -2679,13 +2679,13 @@
                                  llvm::SmallVectorImpl<QualType> &ParamTypes,
                                       QualType *FunctionType,
                                       TemplateDeductionInfo &Info);
-                                      
-  TemplateDeductionResult 
+
+  TemplateDeductionResult
   FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
                              llvm::SmallVectorImpl<TemplateArgument> &Deduced,
                                   FunctionDecl *&Specialization,
                                   TemplateDeductionInfo &Info);
-  
+
   TemplateDeductionResult
   DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
                           bool HasExplicitTemplateArgs,
@@ -2703,7 +2703,7 @@
                           QualType ArgFunctionType,
                           FunctionDecl *&Specialization,
                           TemplateDeductionInfo &Info);
-  
+
   TemplateDeductionResult
   DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
                           QualType ToType,
@@ -2716,7 +2716,7 @@
 
   void MarkDeducedTemplateParameters(const TemplateArgumentList &TemplateArgs,
                                      llvm::SmallVectorImpl<bool> &Deduced);
-          
+
   //===--------------------------------------------------------------------===//
   // C++ Template Instantiation
   //
@@ -2743,10 +2743,10 @@
       /// provides the template arguments as specified.
       DefaultFunctionArgumentInstantiation,
 
-      /// We are substituting explicit template arguments provided for 
+      /// We are substituting explicit template arguments provided for
       /// a function template. The entity is a FunctionTemplateDecl.
       ExplicitTemplateArgumentSubstitution,
-      
+
       /// We are substituting template argument determined as part of
       /// template argument deduction for either a class template
       /// partial specialization or a function template. The
@@ -2793,7 +2793,7 @@
       case DeducedTemplateArgumentSubstitution:
       case DefaultFunctionArgumentInstantiation:
         return X.TemplateArgs == Y.TemplateArgs;
-          
+
       }
 
       return true;
@@ -2811,7 +2811,7 @@
   /// requires another template instantiation, additional
   /// instantiations are pushed onto the stack up to a
   /// user-configurable limit LangOptions::InstantiationDepth.
-  llvm::SmallVector<ActiveTemplateInstantiation, 16> 
+  llvm::SmallVector<ActiveTemplateInstantiation, 16>
     ActiveTemplateInstantiations;
 
   /// \brief The last template from which a template instantiation
@@ -2857,7 +2857,7 @@
                           unsigned NumTemplateArgs,
                           ActiveTemplateInstantiation::InstantiationKind Kind,
                           SourceRange InstantiationRange = SourceRange());
-    
+
     /// \brief Note that we are instantiating as part of template
     /// argument deduction for a class template partial
     /// specialization.
@@ -2891,7 +2891,7 @@
 
     InstantiatingTemplate(const InstantiatingTemplate&); // not implemented
 
-    InstantiatingTemplate& 
+    InstantiatingTemplate&
     operator=(const InstantiatingTemplate&); // not implemented
   };
 
@@ -2918,8 +2918,8 @@
     ~SFINAETrap() { SemaRef.NumSFINAEErrors = PrevSFINAEErrors; }
 
     /// \brief Determine whether any SFINAE errors have been trapped.
-    bool hasErrorOccurred() const { 
-      return SemaRef.NumSFINAEErrors > PrevSFINAEErrors; 
+    bool hasErrorOccurred() const {
+      return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
     }
   };
 
@@ -2961,7 +2961,7 @@
 
   public:
     LocalInstantiationScope(Sema &SemaRef)
-      : SemaRef(SemaRef), Outer(SemaRef.CurrentInstantiationScope) { 
+      : SemaRef(SemaRef), Outer(SemaRef.CurrentInstantiationScope) {
       SemaRef.CurrentInstantiationScope = this;
     }
 
@@ -2996,34 +2996,34 @@
 
   /// \brief An entity for which implicit template instantiation is required.
   ///
-  /// The source location associated with the declaration is the first place in 
+  /// The source location associated with the declaration is the first place in
   /// the source code where the declaration was "used". It is not necessarily
-  /// the point of instantiation (which will be either before or after the 
+  /// the point of instantiation (which will be either before or after the
   /// namespace-scope declaration that triggered this implicit instantiation),
   /// However, it is the location that diagnostics should generally refer to,
   /// because users will need to know what code triggered the instantiation.
   typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
-  
+
   /// \brief The queue of implicit template instantiations that are required
   /// but have not yet been performed.
   std::deque<PendingImplicitInstantiation> PendingImplicitInstantiations;
 
   void PerformPendingImplicitInstantiations();
-  
-  QualType SubstType(QualType T, 
+
+  QualType SubstType(QualType T,
                      const MultiLevelTemplateArgumentList &TemplateArgs,
                      SourceLocation Loc, DeclarationName Entity);
-  
-  OwningExprResult SubstExpr(Expr *E, 
+
+  OwningExprResult SubstExpr(Expr *E,
                             const MultiLevelTemplateArgumentList &TemplateArgs);
 
-  OwningStmtResult SubstStmt(Stmt *S, 
+  OwningStmtResult SubstStmt(Stmt *S,
                             const MultiLevelTemplateArgumentList &TemplateArgs);
 
   Decl *SubstDecl(Decl *D, DeclContext *Owner,
                   const MultiLevelTemplateArgumentList &TemplateArgs);
 
-  bool 
+  bool
   SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
                       CXXRecordDecl *Pattern,
                       const MultiLevelTemplateArgumentList &TemplateArgs);
@@ -3035,7 +3035,7 @@
                    TemplateSpecializationKind TSK,
                    bool Complain = true);
 
-  bool 
+  bool
   InstantiateClassTemplateSpecialization(
                            ClassTemplateSpecializationDecl *ClassTemplateSpec,
                            TemplateSpecializationKind TSK,
@@ -3073,10 +3073,10 @@
   void InstantiateMemInitializers(CXXConstructorDecl *New,
                                   const CXXConstructorDecl *Tmpl,
                             const MultiLevelTemplateArgumentList &TemplateArgs);
-  
+
   NamedDecl *FindInstantiatedDecl(NamedDecl *D);
   DeclContext *FindInstantiatedContext(DeclContext *DC);
-    
+
   // Objective-C declarations.
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
                                              IdentifierInfo *ClassName,
@@ -3087,7 +3087,7 @@
                                              unsigned NumProtoRefs,
                                              SourceLocation EndProtoLoc,
                                              AttributeList *AttrList);
-  
+
   virtual DeclPtrTy ActOnCompatiblityAlias(
                     SourceLocation AtCompatibilityAliasLoc,
                     IdentifierInfo *AliasName,  SourceLocation AliasLocation,
@@ -3097,14 +3097,14 @@
     IdentifierInfo *PName,
     SourceLocation &PLoc, SourceLocation PrevLoc,
     const ObjCList<ObjCProtocolDecl> &PList);
-                    
+
   virtual DeclPtrTy ActOnStartProtocolInterface(
                     SourceLocation AtProtoInterfaceLoc,
                     IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
                     const DeclPtrTy *ProtoRefNames, unsigned NumProtoRefs,
                     SourceLocation EndProtoLoc,
                     AttributeList *AttrList);
-  
+
   virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
                                                 IdentifierInfo *ClassName,
                                                 SourceLocation ClassLoc,
@@ -3113,82 +3113,82 @@
                                                 const DeclPtrTy *ProtoRefs,
                                                 unsigned NumProtoRefs,
                                                 SourceLocation EndProtoLoc);
-  
+
   virtual DeclPtrTy ActOnStartClassImplementation(
                     SourceLocation AtClassImplLoc,
                     IdentifierInfo *ClassName, SourceLocation ClassLoc,
-                    IdentifierInfo *SuperClassname, 
+                    IdentifierInfo *SuperClassname,
                     SourceLocation SuperClassLoc);
-  
+
   virtual DeclPtrTy ActOnStartCategoryImplementation(
                                                   SourceLocation AtCatImplLoc,
-                                                  IdentifierInfo *ClassName, 
+                                                  IdentifierInfo *ClassName,
                                                   SourceLocation ClassLoc,
                                                   IdentifierInfo *CatName,
                                                   SourceLocation CatLoc);
-  
+
   virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation Loc,
                                                IdentifierInfo **IdentList,
                                                unsigned NumElts);
-  
+
   virtual DeclPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
                                             const IdentifierLocPair *IdentList,
                                                   unsigned NumElts,
                                                   AttributeList *attrList);
-  
+
   virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
                                        const IdentifierLocPair *ProtocolId,
                                        unsigned NumProtocols,
                                    llvm::SmallVectorImpl<DeclPtrTy> &Protocols);
-  
-  /// Ensure attributes are consistent with type. 
+
+  /// Ensure attributes are consistent with type.
   /// \param [in, out] Attributes The attributes to check; they will
   /// be modified to be consistent with \arg PropertyTy.
-  void CheckObjCPropertyAttributes(QualType PropertyTy, 
+  void CheckObjCPropertyAttributes(QualType PropertyTy,
                                    SourceLocation Loc,
                                    unsigned &Attributes);
   void ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *DC);
-  void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, 
+  void DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
                                 ObjCPropertyDecl *SuperProperty,
                                 const IdentifierInfo *Name);
   void ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl);
-  
-  void CompareMethodParamsInBaseAndSuper(Decl *IDecl, 
+
+  void CompareMethodParamsInBaseAndSuper(Decl *IDecl,
                                          ObjCMethodDecl *MethodDecl,
                                          bool IsInstance);
-  
+
   void MergeProtocolPropertiesIntoClass(Decl *CDecl,
                                         DeclPtrTy MergeProtocols);
-  
-  void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, 
+
+  void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
                                         ObjCInterfaceDecl *ID);
-  
+
   void MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
                                            ObjCProtocolDecl *PDecl);
-  
+
   virtual void ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
                       DeclPtrTy *allMethods = 0, unsigned allNum = 0,
                       DeclPtrTy *allProperties = 0, unsigned pNum = 0,
                       DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0);
-  
+
   virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
                                   FieldDeclarator &FD, ObjCDeclSpec &ODS,
                                   Selector GetterSel, Selector SetterSel,
                                   DeclPtrTy ClassCategory,
                                   bool *OverridingProperty,
                                   tok::ObjCKeywordKind MethodImplKind);
-  
-  virtual DeclPtrTy ActOnPropertyImplDecl(SourceLocation AtLoc, 
+
+  virtual DeclPtrTy ActOnPropertyImplDecl(SourceLocation AtLoc,
                                           SourceLocation PropertyLoc,
                                           bool ImplKind,DeclPtrTy ClassImplDecl,
                                           IdentifierInfo *PropertyId,
                                           IdentifierInfo *PropertyIvar);
-  
+
   virtual DeclPtrTy ActOnMethodDeclaration(
     SourceLocation BeginLoc, // location of the + or -.
     SourceLocation EndLoc,   // location of the ; or {.
-    tok::TokenKind MethodType, 
-    DeclPtrTy ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType, 
+    tok::TokenKind MethodType,
+    DeclPtrTy ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType,
     Selector Sel,
     // optional arguments. The number of types/arguments is obtained
     // from the Sel.getNumArgs().
@@ -3201,24 +3201,24 @@
   // Will search "local" class/category implementations for a method decl.
   // Will also search in class's root looking for instance method.
   // Returns 0 if no method is found.
-  ObjCMethodDecl *LookupPrivateClassMethod(Selector Sel, 
+  ObjCMethodDecl *LookupPrivateClassMethod(Selector Sel,
                                            ObjCInterfaceDecl *CDecl);
   ObjCMethodDecl *LookupPrivateInstanceMethod(Selector Sel,
                                               ObjCInterfaceDecl *ClassDecl);
-  
+
   virtual OwningExprResult ActOnClassPropertyRefExpr(
     IdentifierInfo &receiverName,
     IdentifierInfo &propertyName,
     SourceLocation &receiverNameLoc,
     SourceLocation &propertyNameLoc);
-  
+
   // ActOnClassMessage - used for both unary and keyword messages.
   // ArgExprs is optional - if it is present, the number of expressions
   // is obtained from NumArgs.
   virtual ExprResult ActOnClassMessage(
     Scope *S,
-    IdentifierInfo *receivingClassName, Selector Sel, SourceLocation lbrac, 
-    SourceLocation receiverLoc, SourceLocation selectorLoc,SourceLocation rbrac, 
+    IdentifierInfo *receivingClassName, Selector Sel, SourceLocation lbrac,
+    SourceLocation receiverLoc, SourceLocation selectorLoc,SourceLocation rbrac,
     ExprTy **ArgExprs, unsigned NumArgs);
 
   // ActOnInstanceMessage - used for both unary and keyword messages.
@@ -3226,21 +3226,21 @@
   // is obtained from NumArgs.
   virtual ExprResult ActOnInstanceMessage(
     ExprTy *receiver, Selector Sel,
-    SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac, 
+    SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac,
     ExprTy **ArgExprs, unsigned NumArgs);
-  
+
   /// ActOnPragmaPack - Called on well formed #pragma pack(...).
   virtual void ActOnPragmaPack(PragmaPackKind Kind,
                                IdentifierInfo *Name,
                                ExprTy *Alignment,
-                               SourceLocation PragmaLoc, 
+                               SourceLocation PragmaLoc,
                                SourceLocation LParenLoc,
                                SourceLocation RParenLoc);
-  
+
   /// ActOnPragmaUnused - Called on well-formed '#pragma unused'.
   virtual void ActOnPragmaUnused(const Token *Identifiers,
                                  unsigned NumIdentifiers, Scope *curScope,
-                                 SourceLocation PragmaLoc, 
+                                 SourceLocation PragmaLoc,
                                  SourceLocation LParenLoc,
                                  SourceLocation RParenLoc);
 
@@ -3262,28 +3262,28 @@
   /// getPragmaPackAlignment() - Return the current alignment as specified by
   /// the current #pragma pack directive, or 0 if none is currently active.
   unsigned getPragmaPackAlignment() const;
-  
+
   /// FreePackedContext - Deallocate and null out PackContext.
   void FreePackedContext();
 
   /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
   /// cast.  If there is already an implicit cast, merge into the existing one.
   /// If isLvalue, the result of the cast is an lvalue.
-  void ImpCastExprToType(Expr *&Expr, QualType Type, 
-                         const CastExpr::CastInfo &Info = 
+  void ImpCastExprToType(Expr *&Expr, QualType Type,
+                         const CastExpr::CastInfo &Info =
                          CastExpr::CastInfo(CastExpr::CK_Unknown),
                          bool isLvalue = false);
 
   // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
   // functions and arrays to their respective pointers (C99 6.3.2.1).
-  Expr *UsualUnaryConversions(Expr *&expr); 
+  Expr *UsualUnaryConversions(Expr *&expr);
 
   // DefaultFunctionArrayConversion - converts functions and arrays
-  // to their respective pointers (C99 6.3.2.1). 
+  // to their respective pointers (C99 6.3.2.1).
   void DefaultFunctionArrayConversion(Expr *&expr);
-  
+
   // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
-  // do not have a prototype. Integer promotions are performed on each 
+  // do not have a prototype. Integer promotions are performed on each
   // argument, and arguments that have type float are promoted to double.
   void DefaultArgumentPromotion(Expr *&Expr);
 
@@ -3294,19 +3294,19 @@
     VariadicMethod,
     VariadicConstructor
   };
-  
+
   // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
   // will warn if the resulting type is not a POD type.
   bool DefaultVariadicArgumentPromotion(Expr *&Expr, VariadicCallType CT);
-  
+
   // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
   // operands and then handles various conversions that are common to binary
   // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
-  // routine returns the first non-arithmetic type found. The client is 
+  // routine returns the first non-arithmetic type found. The client is
   // responsible for emitting appropriate error diagnostics.
   QualType UsualArithmeticConversions(Expr *&lExpr, Expr *&rExpr,
                                       bool isCompAssign = false);
-  
+
   /// AssignConvertType - All of the 'assignment' semantic checks return this
   /// enum to indicate whether the assignment was allowed.  These checks are
   /// done for simple assignments, as well as initialization, return from
@@ -3315,15 +3315,15 @@
   enum AssignConvertType {
     /// Compatible - the types are compatible according to the standard.
     Compatible,
-    
+
     /// PointerToInt - The assignment converts a pointer to an int, which we
     /// accept as an extension.
     PointerToInt,
-    
+
     /// IntToPointer - The assignment converts an int to a pointer, which we
     /// accept as an extension.
     IntToPointer,
-    
+
     /// FunctionVoidPointer - The assignment is between a function pointer and
     /// void*, which the standard doesn't allow, but we accept as an extension.
     FunctionVoidPointer,
@@ -3345,25 +3345,25 @@
     /// IncompatibleVectors - The assignment is between two vector types that
     /// have the same size, which we accept as an extension.
     IncompatibleVectors,
-    
-    /// IntToBlockPointer - The assignment converts an int to a block 
+
+    /// IntToBlockPointer - The assignment converts an int to a block
     /// pointer. We disallow this.
     IntToBlockPointer,
 
-    /// IncompatibleBlockPointer - The assignment is between two block 
+    /// IncompatibleBlockPointer - The assignment is between two block
     /// pointers types that are not compatible.
     IncompatibleBlockPointer,
-    
+
     /// IncompatibleObjCQualifiedId - The assignment is between a qualified
     /// id type and something else (that is incompatible with it). For example,
     /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
     IncompatibleObjCQualifiedId,
-    
+
     /// Incompatible - We reject this conversion outright, it is invalid to
     /// represent it in the AST.
     Incompatible
   };
-  
+
   /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
   /// assignment conversion type specified by ConvTy.  This returns true if the
   /// conversion was invalid or false if the conversion was accepted.
@@ -3371,39 +3371,39 @@
                                 SourceLocation Loc,
                                 QualType DstType, QualType SrcType,
                                 Expr *SrcExpr, const char *Flavor);
-  
-  /// CheckAssignmentConstraints - Perform type checking for assignment, 
-  /// argument passing, variable initialization, and function return values. 
+
+  /// CheckAssignmentConstraints - Perform type checking for assignment,
+  /// argument passing, variable initialization, and function return values.
   /// This routine is only used by the following two methods. C99 6.5.16.
   AssignConvertType CheckAssignmentConstraints(QualType lhs, QualType rhs);
-  
-  // CheckSingleAssignmentConstraints - Currently used by 
-  // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking, 
+
+  // CheckSingleAssignmentConstraints - Currently used by
+  // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking,
   // this routine performs the default function/array converions.
-  AssignConvertType CheckSingleAssignmentConstraints(QualType lhs, 
+  AssignConvertType CheckSingleAssignmentConstraints(QualType lhs,
                                                      Expr *&rExpr);
 
   // \brief If the lhs type is a transparent union, check whether we
   // can initialize the transparent union with the given expression.
-  AssignConvertType CheckTransparentUnionArgumentConstraints(QualType lhs, 
+  AssignConvertType CheckTransparentUnionArgumentConstraints(QualType lhs,
                                                              Expr *&rExpr);
-  
+
   // Helper function for CheckAssignmentConstraints (C99 6.5.16.1p1)
-  AssignConvertType CheckPointerTypesForAssignment(QualType lhsType, 
+  AssignConvertType CheckPointerTypesForAssignment(QualType lhsType,
                                                    QualType rhsType);
-                                                   
+
   // Helper function for CheckAssignmentConstraints involving two
   // block pointer types.
-  AssignConvertType CheckBlockPointerTypesForAssignment(QualType lhsType, 
+  AssignConvertType CheckBlockPointerTypesForAssignment(QualType lhsType,
                                                         QualType rhsType);
 
   bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType);
 
-  bool PerformImplicitConversion(Expr *&From, QualType ToType, 
+  bool PerformImplicitConversion(Expr *&From, QualType ToType,
                                  const char *Flavor,
                                  bool AllowExplicit = false,
                                  bool Elidable = false);
-  bool PerformImplicitConversion(Expr *&From, QualType ToType, 
+  bool PerformImplicitConversion(Expr *&From, QualType ToType,
                                  const ImplicitConversionSequence& ICS,
                                  const char *Flavor);
   bool PerformImplicitConversion(Expr *&From, QualType ToType,
@@ -3450,7 +3450,7 @@
   inline QualType CheckVectorOperands(SourceLocation l, Expr *&lex, Expr *&rex);
   inline QualType CheckVectorCompareOperands(Expr *&lex, Expr *&rx,
                                              SourceLocation l, bool isRel);
-  
+
   /// type checking unary operators (subroutines of ActOnUnaryOp).
   /// C99 6.5.3.1, 6.5.3.2, 6.5.3.4
   QualType CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc,
@@ -3458,20 +3458,20 @@
   QualType CheckAddressOfOperand(Expr *op, SourceLocation OpLoc);
   QualType CheckIndirectionOperand(Expr *op, SourceLocation OpLoc);
   QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc, bool isReal);
-  
+
   /// type checking primary expressions.
   QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
-                                   const IdentifierInfo *Comp, 
+                                   const IdentifierInfo *Comp,
                                    SourceLocation CmpLoc);
-  
+
   /// type checking declaration initializers (C99 6.7.8)
-  
+
   bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType,
                              SourceLocation InitLoc,DeclarationName InitEntity,
                              bool DirectInit);
   bool CheckInitList(InitListExpr *&InitList, QualType &DeclType);
   bool CheckForConstantInitializer(Expr *e, QualType t);
-  
+
   bool CheckValueInitialization(QualType Type, SourceLocation Loc);
 
   // type checking C++ declaration initializers (C++ [dcl.init]).
@@ -3509,17 +3509,17 @@
   /// CheckCastTypes - Check type constraints for casting between types under
   /// C semantics, or forward to CXXCheckCStyleCast in C++.
   bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr,
-                      CastExpr::CastKind &Kind, 
+                      CastExpr::CastKind &Kind,
                       CXXMethodDecl *& ConversionDecl,
                       bool FunctionalStyle = false);
 
-  // CheckVectorCast - check type constraints for vectors. 
+  // CheckVectorCast - check type constraints for vectors.
   // Since vectors are an extension, there are no C standard reference for this.
   // We allow casting between vectors and integer datatypes of the same size.
   // returns true if the cast is invalid
   bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty);
-  
-  // CheckExtVectorCast - check type constraints for extended vectors. 
+
+  // CheckExtVectorCast - check type constraints for extended vectors.
   // Since vectors are an extension, there are no C standard reference for this.
   // We allow casting between vectors and integer datatypes of the same size,
   // or vectors and the element type of that vector.
@@ -3532,14 +3532,14 @@
                           CastExpr::CastKind &Kind, bool FunctionalStyle,
                           CXXMethodDecl *&ConversionDecl);
 
-  /// CheckMessageArgumentTypes - Check types in an Obj-C message send. 
+  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
   /// \param Method - May be null.
   /// \param [out] ReturnType - The return type of the send.
   /// \return true iff there were any incompatible types.
   bool CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, Selector Sel,
                                  ObjCMethodDecl *Method, bool isClassMessage,
                                  SourceLocation lbrac, SourceLocation rbrac,
-                                 QualType &ReturnType);  
+                                 QualType &ReturnType);
 
   /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
   bool CheckCXXBooleanCondition(Expr *&CondExpr);
@@ -3547,10 +3547,10 @@
   /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
   /// the specified width and sign.  If an overflow occurs, detect it and emit
   /// the specified diagnostic.
-  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, 
+  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
                                           unsigned NewWidth, bool NewSign,
                                           SourceLocation Loc, unsigned DiagID);
-  
+
   /// Checks that the Objective-C declaration is declared in the global scope.
   /// Emits an error and marks the declaration as invalid if it's not declared
   /// in the global scope.
@@ -3564,22 +3564,22 @@
   bool VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result = 0);
 
   /// VerifyBitField - verifies that a bit field expression is an ICE and has
-  /// the correct width, and that the field type is valid. 
+  /// the correct width, and that the field type is valid.
   /// Returns false on success.
   /// Can optionally return whether the bit-field is of width 0
-  bool VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, 
-                      QualType FieldTy, const Expr *BitWidth, 
+  bool VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
+                      QualType FieldTy, const Expr *BitWidth,
                       bool *ZeroWidth = 0);
 
   void DiagnoseMissingMember(SourceLocation MemberLoc, DeclarationName Member,
                              NestedNameSpecifier *NNS, SourceRange Range);
-  
+
   //===--------------------------------------------------------------------===//
   // Extra semantic analysis beyond the C type system
 private:
   bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall);
   bool CheckBlockCall(NamedDecl *NDecl, CallExpr *TheCall);
-  
+
   SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL,
                                                 unsigned ByteNo) const;
   bool CheckablePrintfAttr(const FormatAttr *Format, CallExpr *TheCall);
@@ -3597,7 +3597,7 @@
   Action::OwningExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
 
 private:
-  bool SemaBuiltinPrefetch(CallExpr *TheCall); 
+  bool SemaBuiltinPrefetch(CallExpr *TheCall);
   bool SemaBuiltinObjectSize(CallExpr *TheCall);
   bool SemaBuiltinLongjmp(CallExpr *TheCall);
   bool SemaBuiltinAtomicOverloaded(CallExpr *TheCall);
@@ -3607,9 +3607,9 @@
   void CheckPrintfString(const StringLiteral *FExpr, const Expr *OrigFormatExpr,
                          const CallExpr *TheCall, bool HasVAListArg,
                          unsigned format_idx, unsigned firstDataArg);
-  void CheckNonNullArguments(const NonNullAttr *NonNull, 
+  void CheckNonNullArguments(const NonNullAttr *NonNull,
                              const CallExpr *TheCall);
-  void CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg, 
+  void CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg,
                             unsigned format_idx, unsigned firstDataArg);
   void CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
                             SourceLocation ReturnLoc);
@@ -3623,12 +3623,12 @@
 class ExprOwningPtr : public Action::ExprArg {
 public:
   ExprOwningPtr(Sema *S, T *expr) : Action::ExprArg(*S, expr) {}
-  
+
   void reset(T* p) { Action::ExprArg::operator=(p); }
   T* get() const { return static_cast<T*>(Action::ExprArg::get()); }
   T* take() { return static_cast<T*>(Action::ExprArg::take()); }
   T* release() { return take(); }
-  
+
   T& operator*() const { return *get(); }
   T* operator->() const { return get(); }
 };

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Wed Sep  9 10:08:12 2009
@@ -19,7 +19,7 @@
 /// SetMemberAccessSpecifier - Set the access specifier of a member.
 /// Returns true on error (when the previous member decl access specifier
 /// is different from the new member decl access specifier).
-bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl, 
+bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl,
                                     NamedDecl *PrevMemberDecl,
                                     AccessSpecifier LexicalAS) {
   if (!PrevMemberDecl) {
@@ -27,18 +27,18 @@
     MemberDecl->setAccess(LexicalAS);
     return false;
   }
-  
+
   // C++ [class.access.spec]p3: When a member is redeclared its access
   // specifier must be same as its initial declaration.
   if (LexicalAS != AS_none && LexicalAS != PrevMemberDecl->getAccess()) {
-    Diag(MemberDecl->getLocation(), 
-         diag::err_class_redeclared_with_different_access) 
+    Diag(MemberDecl->getLocation(),
+         diag::err_class_redeclared_with_different_access)
       << MemberDecl << LexicalAS;
     Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
       << PrevMemberDecl << PrevMemberDecl->getAccess();
     return true;
   }
-  
+
   MemberDecl->setAccess(PrevMemberDecl->getAccess());
   return false;
 }
@@ -47,10 +47,9 @@
 /// inaccessible. If @p NoPrivileges is true, special access rights (members
 /// and friends) are not considered.
 const CXXBaseSpecifier *Sema::FindInaccessibleBase(
-    QualType Derived, QualType Base, BasePaths &Paths, bool NoPrivileges)
-{
+    QualType Derived, QualType Base, BasePaths &Paths, bool NoPrivileges) {
   Base = Context.getCanonicalType(Base).getUnqualifiedType();
-  assert(!Paths.isAmbiguous(Base) && 
+  assert(!Paths.isAmbiguous(Base) &&
          "Can't check base class access if set of paths is ambiguous");
   assert(Paths.isRecordingPaths() &&
          "Can't check base class access without recorded paths");
@@ -105,7 +104,7 @@
 
 /// CheckBaseClassAccess - Check that a derived class can access its base class
 /// and report an error if it can't. [class.access.base]
-bool Sema::CheckBaseClassAccess(QualType Derived, QualType Base, 
+bool Sema::CheckBaseClassAccess(QualType Derived, QualType Base,
                                 unsigned InaccessibleBaseID,
                                 BasePaths &Paths, SourceLocation AccessLoc,
                                 DeclarationName Name) {
@@ -116,7 +115,7 @@
                                                Derived, Base, Paths);
 
   if (InaccessibleBase) {
-    Diag(AccessLoc, InaccessibleBaseID) 
+    Diag(AccessLoc, InaccessibleBaseID)
       << Derived << Base << Name;
 
     AccessSpecifier AS = InaccessibleBase->getAccessSpecifierAsWritten();

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAttr.cpp Wed Sep  9 10:08:12 2009
@@ -32,8 +32,8 @@
     /// Stack - Entries in the #pragma pack stack, consisting of saved
     /// alignments and optional names.
     stack_ty Stack;
-    
-  public:  
+
+  public:
     PragmaPackStack() : Alignment(0) {}
 
     void setAlignment(unsigned A) { Alignment = A; }
@@ -56,14 +56,14 @@
 bool PragmaPackStack::pop(IdentifierInfo *Name) {
   if (Stack.empty())
     return false;
-  
+
   // If name is empty just pop top.
   if (!Name) {
     Alignment = Stack.back().first;
     Stack.pop_back();
     return true;
-  } 
-  
+  }
+
   // Otherwise, find the named record.
   for (unsigned i = Stack.size(); i != 0; ) {
     --i;
@@ -74,7 +74,7 @@
       return true;
     }
   }
-  
+
   return false;
 }
 
@@ -93,8 +93,8 @@
   return 0;
 }
 
-void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, 
-                           ExprTy *alignment, SourceLocation PragmaLoc, 
+void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name,
+                           ExprTy *alignment, SourceLocation PragmaLoc,
                            SourceLocation LParenLoc, SourceLocation RParenLoc) {
   Expr *Alignment = static_cast<Expr *>(alignment);
 
@@ -102,7 +102,7 @@
   unsigned AlignmentVal = 0;
   if (Alignment) {
     llvm::APSInt Val;
-    
+
     // pack(0) is like pack(), which just works out since that is what
     // we use 0 for in PackAttr.
     if (!Alignment->isIntegerConstantExpr(Val, Context) ||
@@ -115,12 +115,12 @@
 
     AlignmentVal = (unsigned) Val.getZExtValue();
   }
-  
+
   if (PackContext == 0)
     PackContext = new PragmaPackStack();
-  
+
   PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
-  
+
   switch (Kind) {
   case Action::PPK_Default: // pack([n])
     Context->setAlignment(AlignmentVal);
@@ -140,15 +140,15 @@
     Context->push(Name);
     // Set the new alignment if specified.
     if (Alignment)
-      Context->setAlignment(AlignmentVal);    
+      Context->setAlignment(AlignmentVal);
     break;
 
   case Action::PPK_Pop: // pack(pop [, id] [,  n])
     // MSDN, C/C++ Preprocessor Reference > Pragma Directives > pack:
     // "#pragma pack(pop, identifier, n) is undefined"
     if (Alignment && Name)
-      Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifer_and_alignment);    
-    
+      Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifer_and_alignment);
+
     // Do the pop.
     if (!Context->pop(Name)) {
       // If a name was specified then failure indicates the name
@@ -178,7 +178,7 @@
 
   for (unsigned i = 0; i < NumIdentifiers; ++i) {
     const Token &Tok = Identifiers[i];
-    IdentifierInfo *Name = Tok.getIdentifierInfo();    
+    IdentifierInfo *Name = Tok.getIdentifierInfo();
     const LookupResult &Lookup = LookupParsedName(curScope, NULL, Name,
                                                   LookupOrdinaryName,
                                                   false, true,
@@ -187,18 +187,18 @@
 
     NamedDecl *ND = Lookup.getAsDecl();
 
-    if (!ND) {      
+    if (!ND) {
       Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
         << Name << SourceRange(Tok.getLocation());
       continue;
     }
-      
+
     if (!isa<VarDecl>(ND) || !cast<VarDecl>(ND)->hasLocalStorage()) {
       Diag(PragmaLoc, diag::warn_pragma_unused_expected_localvar)
         << Name << SourceRange(Tok.getLocation());
       continue;
     }
-    
+
     ND->addAttr(::new (Context) UnusedAttr());
   }
 }

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Wed Sep  9 10:08:12 2009
@@ -47,7 +47,7 @@
                             CastExpr::CastKind &Kind);
 static void CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
                              const SourceRange &OpRange,
-                             const SourceRange &DestRange, 
+                             const SourceRange &DestRange,
                              CastExpr::CastKind &Kind);
 
 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType);
@@ -89,7 +89,7 @@
                                            CXXMethodDecl *&ConversionDecl);
 static TryCastResult TryStaticCast(Sema &Self, Expr *SrcExpr,
                                    QualType DestType, bool CStyle,
-                                   CastExpr::CastKind &Kind, 
+                                   CastExpr::CastKind &Kind,
                                    const SourceRange &OpRange,
                                    unsigned &msg,
                                    CXXMethodDecl *&ConversionDecl);
@@ -97,7 +97,7 @@
                                   bool CStyle, unsigned &msg);
 static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
                                         QualType DestType, bool CStyle,
-                                        CastExpr::CastKind &Kind, 
+                                        CastExpr::CastKind &Kind,
                                         const SourceRange &OpRange,
                                         unsigned &msg);
 
@@ -158,8 +158,7 @@
 /// the cast checkers.  Both arguments must denote pointer (possibly to member)
 /// types.
 bool
-CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType)
-{
+CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType) {
   // Casting away constness is defined in C++ 5.2.11p8 with reference to
   // C++ 4.4. We piggyback on Sema::IsQualificationConversion for this, since
   // the rules are non-trivial. So first we construct Tcv *...cv* as described
@@ -185,8 +184,7 @@
   QualType DestConstruct = Self.Context.VoidTy;
   for (llvm::SmallVector<unsigned, 8>::reverse_iterator i1 = cv1.rbegin(),
                                                         i2 = cv2.rbegin();
-       i1 != cv1.rend(); ++i1, ++i2)
-  {
+       i1 != cv1.rend(); ++i1, ++i2) {
     SrcConstruct = Self.Context.getPointerType(
       SrcConstruct.getQualifiedType(*i1));
     DestConstruct = Self.Context.getPointerType(
@@ -204,8 +202,7 @@
 static void
 CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
                  const SourceRange &OpRange,
-                 const SourceRange &DestRange, CastExpr::CastKind &Kind)
-{
+                 const SourceRange &DestRange, CastExpr::CastKind &Kind) {
   QualType OrigDestType = DestType, OrigSrcType = SrcExpr->getType();
   DestType = Self.Context.getCanonicalType(DestType);
 
@@ -325,8 +322,7 @@
 /// legacy_function(const_cast\<char*\>(str));
 void
 CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
-               const SourceRange &OpRange, const SourceRange &DestRange)
-{
+               const SourceRange &OpRange, const SourceRange &DestRange) {
   if (!DestType->isLValueReferenceType())
     Self.DefaultFunctionArrayConversion(SrcExpr);
 
@@ -344,8 +340,7 @@
 /// char *bytes = reinterpret_cast\<char*\>(int_ptr);
 void
 CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
-                     const SourceRange &OpRange, const SourceRange &DestRange)
-{
+                     const SourceRange &OpRange, const SourceRange &DestRange) {
   if (!DestType->isLValueReferenceType())
     Self.DefaultFunctionArrayConversion(SrcExpr);
 
@@ -364,8 +359,7 @@
 /// implicit conversions explicit and getting rid of data loss warnings.
 void
 CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
-                const SourceRange &OpRange, CastExpr::CastKind &Kind)
-{
+                const SourceRange &OpRange, CastExpr::CastKind &Kind) {
   // This test is outside everything else because it's the only case where
   // a non-lvalue-reference target type does not lead to decay.
   // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
@@ -378,7 +372,7 @@
 
   unsigned msg = diag::err_bad_cxx_cast_generic;
   CXXMethodDecl *ConversionDecl = 0;
-  if (TryStaticCast(Self, SrcExpr, DestType, /*CStyle*/false, Kind, 
+  if (TryStaticCast(Self, SrcExpr, DestType, /*CStyle*/false, Kind,
                     OpRange, msg, ConversionDecl)
       != TC_Success && msg != 0)
     Self.Diag(OpRange.getBegin(), msg) << CT_Static
@@ -390,10 +384,9 @@
 /// and casting away constness.
 static TryCastResult TryStaticCast(Sema &Self, Expr *SrcExpr,
                                    QualType DestType, bool CStyle,
-                                   CastExpr::CastKind &Kind, 
+                                   CastExpr::CastKind &Kind,
                                    const SourceRange &OpRange, unsigned &msg,
-                                   CXXMethodDecl *&ConversionDecl)
-{
+                                   CXXMethodDecl *&ConversionDecl) {
   // The order the tests is not entirely arbitrary. There is one conversion
   // that can be handled in two different ways. Given:
   // struct A {};
@@ -500,8 +493,7 @@
 /// Tests whether a conversion according to N2844 is valid.
 TryCastResult
 TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
-                      unsigned &msg)
-{
+                      unsigned &msg) {
   // N2844 5.2.9p3: An lvalue of type "cv1 T1" can be cast to type "rvalue
   //   reference to cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1".
   const RValueReferenceType *R = DestType->getAs<RValueReferenceType>();
@@ -531,8 +523,7 @@
 TryCastResult
 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
                            bool CStyle, const SourceRange &OpRange,
-                           unsigned &msg)
-{
+                           unsigned &msg) {
   // C++ 5.2.9p5: An lvalue of type "cv1 B", where B is a class type, can be
   //   cast to type "reference to cv2 D", where D is a class derived from B,
   //   if a valid standard conversion from "pointer to D" to "pointer to B"
@@ -562,8 +553,8 @@
 /// Tests whether a conversion according to C++ 5.2.9p8 is valid.
 TryCastResult
 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType,
-                         bool CStyle, const SourceRange &OpRange, unsigned &msg)
-{
+                         bool CStyle, const SourceRange &OpRange,
+                         unsigned &msg) {
   // C++ 5.2.9p8: An rvalue of type "pointer to cv1 B", where B is a class
   //   type, can be converted to an rvalue of type "pointer to cv2 D", where D
   //   is a class derived from B, if a valid standard conversion from "pointer
@@ -594,8 +585,7 @@
 TryCastResult
 TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType,
                   bool CStyle, const SourceRange &OpRange, QualType OrigSrcType,
-                  QualType OrigDestType, unsigned &msg)
-{
+                  QualType OrigDestType, unsigned &msg) {
   // Downcast can only happen in class hierarchies, so we need classes.
   if (!DestType->isRecordType() || !SrcType->isRecordType()) {
     return TC_NotApplicable;
@@ -614,7 +604,7 @@
   // struct B : virtual A {
   //   B(A&);
   // };
-  // 
+  //
   // void f()
   // {
   //   (void)static_cast<const B&>(*((A*)0));
@@ -691,8 +681,7 @@
 TryCastResult
 TryStaticMemberPointerUpcast(Sema &Self, QualType SrcType, QualType DestType,
                              bool CStyle, const SourceRange &OpRange,
-                             unsigned &msg)
-{
+                             unsigned &msg) {
   const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
   if (!DestMemPtr)
     return TC_NotApplicable;
@@ -757,8 +746,7 @@
 TryCastResult
 TryStaticImplicitCast(Sema &Self, Expr *SrcExpr, QualType DestType,
                       bool CStyle, const SourceRange &OpRange, unsigned &msg,
-                      CXXMethodDecl *&ConversionDecl)
-{
+                      CXXMethodDecl *&ConversionDecl) {
   if (DestType->isRecordType()) {
     if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
                                  diag::err_bad_dynamic_cast_incomplete)) {
@@ -766,7 +754,7 @@
       return TC_Failed;
     }
   }
-  
+
   if (DestType->isReferenceType()) {
     // At this point of CheckStaticCast, if the destination is a reference,
     // this has to work. There is no other way that works.
@@ -774,7 +762,7 @@
     // the reinterpret_cast way. In that case, we pass an ICS so we don't
     // get error messages.
     ImplicitConversionSequence ICS;
-    bool failed = Self.CheckReferenceInit(SrcExpr, DestType, 
+    bool failed = Self.CheckReferenceInit(SrcExpr, DestType,
                                           /*SuppressUserConversions=*/false,
                                           /*AllowExplicit=*/false,
                                           /*ForceRValue=*/false,
@@ -792,15 +780,15 @@
   // reimplement more of this.
   // FIXME: This does not actually perform the conversion, and thus does not
   // check for ambiguity or access.
-  ImplicitConversionSequence ICS = 
+  ImplicitConversionSequence ICS =
     Self.TryImplicitConversion(SrcExpr, DestType,
                                /*SuppressUserConversions=*/false,
                                /*AllowExplicit=*/true,
                                /*ForceRValue=*/false,
                                /*InOverloadResolution=*/false);
-  
+
   if (ICS.ConversionKind  == ImplicitConversionSequence::UserDefinedConversion)
-    if (CXXMethodDecl *MD = 
+    if (CXXMethodDecl *MD =
           dyn_cast<CXXMethodDecl>(ICS.UserDefined.ConversionFunction))
       ConversionDecl = MD;
   return ICS.ConversionKind == ImplicitConversionSequence::BadConversion ?
@@ -1032,8 +1020,7 @@
 
 bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
                               CastExpr::CastKind &Kind, bool FunctionalStyle,
-                              CXXMethodDecl *&ConversionDecl)
-{
+                              CXXMethodDecl *&ConversionDecl) {
   // This test is outside everything else because it's the only case where
   // a non-lvalue-reference target type does not lead to decay.
   // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
@@ -1067,7 +1054,7 @@
                         ConversionDecl);
     if (tcr == TC_NotApplicable) {
       // ... and finally a reinterpret_cast, ignoring const.
-      tcr = TryReinterpretCast(*this, CastExpr, CastTy, /*CStyle*/true, Kind, 
+      tcr = TryReinterpretCast(*this, CastExpr, CastTy, /*CStyle*/true, Kind,
                                R, msg);
     }
   }

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Wed Sep  9 10:08:12 2009
@@ -26,13 +26,13 @@
 ///
 /// \param T the type for which we are attempting to find a DeclContext.
 ///
-/// \returns the declaration context represented by the type T, 
+/// \returns the declaration context represented by the type T,
 /// or NULL if the declaration context cannot be computed (e.g., because it is
 /// dependent and not the current instantiation).
 DeclContext *Sema::computeDeclContext(QualType T) {
   if (const TagType *Tag = T->getAs<TagType>())
     return Tag->getDecl();
-  
+
   return 0;
 }
 
@@ -54,21 +54,21 @@
   if (!SS.isSet() || SS.isInvalid())
     return 0;
 
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   if (NNS->isDependent()) {
     // If this nested-name-specifier refers to the current
     // instantiation, return its DeclContext.
     if (CXXRecordDecl *Record = getCurrentInstantiationOf(NNS))
       return Record;
-    
+
     if (EnteringContext) {
       if (const TemplateSpecializationType *SpecType
             = dyn_cast_or_null<TemplateSpecializationType>(NNS->getAsType())) {
         // We are entering the context of the nested name specifier, so try to
         // match the nested name specifier to either a primary class template
         // or a class template partial specialization.
-        if (ClassTemplateDecl *ClassTemplate 
+        if (ClassTemplateDecl *ClassTemplate
               = dyn_cast_or_null<ClassTemplateDecl>(
                             SpecType->getTemplateName().getAsTemplateDecl())) {
           QualType ContextType
@@ -80,7 +80,7 @@
           QualType Injected = ClassTemplate->getInjectedClassNameType(Context);
           if (Context.hasSameType(Injected, ContextType))
             return ClassTemplate->getTemplatedDecl();
-                
+
           // If the type of the nested name specifier is the same as the
           // type of one of the class template's class template partial
           // specializations, we're entering into the definition of that
@@ -89,13 +89,13 @@
                 = ClassTemplate->findPartialSpecialization(ContextType))
             return PartialSpec;
         }
-      } else if (const RecordType *RecordT 
+      } else if (const RecordType *RecordT
                    = dyn_cast_or_null<RecordType>(NNS->getAsType())) {
         // The nested name specifier refers to a member of a class template.
         return RecordT->getDecl();
       }
     }
-    
+
     return 0;
   }
 
@@ -126,7 +126,7 @@
   if (!SS.isSet() || SS.isInvalid())
     return false;
 
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   return NNS->isDependent();
 }
@@ -138,7 +138,7 @@
   if (!isDependentScopeSpecifier(SS))
     return false;
 
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   return getCurrentInstantiationOf(NNS) == 0;
 }
@@ -154,7 +154,7 @@
 
   if (!NNS->getAsType())
     return 0;
-  
+
   QualType T = QualType(NNS->getAsType(), 0);
   // If the nested name specifier does not refer to a type, then it
   // does not refer to the current instantiation.
@@ -174,7 +174,7 @@
     if (!Record)
       continue;
 
-    // If this record type is not dependent, 
+    // If this record type is not dependent,
     if (!Record->isDependentType())
       return 0;
 
@@ -192,13 +192,13 @@
     //        enclosed in <>,
     //     -- in the definition of a nested class of a class template,
     //        the name of the nested class referenced as a member of
-    //        the current instantiation, or 
+    //        the current instantiation, or
     //     -- in the definition of a partial specialization, the name
     //        of the class template followed by the template argument
     //        list of the partial specialization enclosed in <>. If
     //        the nth template parameter is a parameter pack, the nth
     //        template argument is a pack expansion (14.6.3) whose
-    //        pattern is the name of the parameter pack. 
+    //        pattern is the name of the parameter pack.
     //        (FIXME: parameter packs)
     //
     // All of these options come down to having the
@@ -207,9 +207,9 @@
     // our context.
     if (Context.getCanonicalType(Context.getTypeDeclType(Record)) == T)
       return Record;
-    
+
     if (ClassTemplateDecl *Template = Record->getDescribedClassTemplate()) {
-      QualType InjectedClassName 
+      QualType InjectedClassName
         = Template->getInjectedClassNameType(Context);
       if (T == Context.getCanonicalType(InjectedClassName))
         return Template->getTemplatedDecl();
@@ -232,7 +232,7 @@
 bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) {
   if (!SS.isSet() || SS.isInvalid())
     return false;
-  
+
   DeclContext *DC = computeDeclContext(SS, true);
   if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
     // If we're currently defining this type, then lookup into the
@@ -263,14 +263,14 @@
 bool isAcceptableNestedNameSpecifier(ASTContext &Context, NamedDecl *SD) {
   if (!SD)
     return false;
-  
+
   // Namespace and namespace aliases are fine.
   if (isa<NamespaceDecl>(SD) || isa<NamespaceAliasDecl>(SD))
     return true;
-  
+
   if (!isa<TypeDecl>(SD))
     return false;
-  
+
   // Determine whether we have a class (or, in C++0x, an enum) or
   // a typedef thereof. If so, build the nested-name-specifier.
   QualType T = Context.getTypeDeclType(cast<TypeDecl>(SD));
@@ -278,10 +278,10 @@
     return true;
   else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
     if (TD->getUnderlyingType()->isRecordType() ||
-        (Context.getLangOptions().CPlusPlus0x && 
+        (Context.getLangOptions().CPlusPlus0x &&
          TD->getUnderlyingType()->isEnumeralType()))
       return true;
-  } else if (isa<RecordDecl>(SD) || 
+  } else if (isa<RecordDecl>(SD) ||
              (Context.getLangOptions().CPlusPlus0x && isa<EnumDecl>(SD)))
     return true;
 
@@ -289,27 +289,27 @@
 }
 
 /// \brief If the given nested-name-specifier begins with a bare identifier
-/// (e.g., Base::), perform name lookup for that identifier as a 
+/// (e.g., Base::), perform name lookup for that identifier as a
 /// nested-name-specifier within the given scope, and return the result of that
 /// name lookup.
 NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
   if (!S || !NNS)
     return 0;
-  
+
   while (NNS->getPrefix())
     NNS = NNS->getPrefix();
-  
+
   if (NNS->getKind() != NestedNameSpecifier::Identifier)
     return 0;
-  
-  LookupResult Found 
+
+  LookupResult Found
     = LookupName(S, NNS->getAsIdentifier(), LookupNestedNameSpecifierName);
   assert(!Found.isAmbiguous() && "Cannot handle ambiguities here yet");
 
   NamedDecl *Result = Found;
   if (isAcceptableNestedNameSpecifier(Context, Result))
     return Result;
-  
+
   return 0;
 }
 
@@ -328,9 +328,9 @@
                                                     QualType ObjectType,
                                                   NamedDecl *ScopeLookupResult,
                                                     bool EnteringContext) {
-  NestedNameSpecifier *Prefix 
+  NestedNameSpecifier *Prefix
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
-  
+
   // Determine where to perform name lookup
   DeclContext *LookupCtx = 0;
   bool isDependent = false;
@@ -346,70 +346,70 @@
     LookupCtx = computeDeclContext(SS, EnteringContext);
     isDependent = isDependentScopeSpecifier(SS);
   }
-  
+
   LookupResult Found;
   bool ObjectTypeSearchedInScope = false;
   if (LookupCtx) {
-    // Perform "qualified" name lookup into the declaration context we 
+    // Perform "qualified" name lookup into the declaration context we
     // computed, which is either the type of the base of a member access
-    // expression or the declaration context associated with a prior 
+    // expression or the declaration context associated with a prior
     // nested-name-specifier.
-    
+
     // The declaration context must be complete.
     if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(SS))
       return 0;
-    
+
     Found = LookupQualifiedName(LookupCtx, &II, LookupNestedNameSpecifierName,
                                 false);
-    
+
     if (!ObjectType.isNull() && Found.getKind() == LookupResult::NotFound) {
       // C++ [basic.lookup.classref]p4:
       //   If the id-expression in a class member access is a qualified-id of
-      //   the form 
+      //   the form
       //
       //        class-name-or-namespace-name::...
       //
-      //   the class-name-or-namespace-name following the . or -> operator is 
-      //   looked up both in the context of the entire postfix-expression and in 
+      //   the class-name-or-namespace-name following the . or -> operator is
+      //   looked up both in the context of the entire postfix-expression and in
       //   the scope of the class of the object expression. If the name is found
-      //   only in the scope of the class of the object expression, the name 
-      //   shall refer to a class-name. If the name is found only in the 
+      //   only in the scope of the class of the object expression, the name
+      //   shall refer to a class-name. If the name is found only in the
       //   context of the entire postfix-expression, the name shall refer to a
       //   class-name or namespace-name. [...]
       //
       // Qualified name lookup into a class will not find a namespace-name,
-      // so we do not need to diagnoste that case specifically. However, 
+      // so we do not need to diagnoste that case specifically. However,
       // this qualified name lookup may find nothing. In that case, perform
-      // unqualified name lookup in the given scope (if available) or 
+      // unqualified name lookup in the given scope (if available) or
       // reconstruct the result from when name lookup was performed at template
       // definition time.
       if (S)
         Found = LookupName(S, &II, LookupNestedNameSpecifierName);
       else
         Found = LookupResult::CreateLookupResult(Context, ScopeLookupResult);
-        
+
       ObjectTypeSearchedInScope = true;
     }
   } else if (isDependent) {
     // We were not able to compute the declaration context for a dependent
-    // base object type or prior nested-name-specifier, so this 
+    // base object type or prior nested-name-specifier, so this
     // nested-name-specifier refers to an unknown specialization. Just build
     // a dependent nested-name-specifier.
     if (!Prefix)
       return NestedNameSpecifier::Create(Context, &II);
-    
+
     return NestedNameSpecifier::Create(Context, Prefix, &II);
   } else {
     // Perform unqualified name lookup in the current scope.
     Found = LookupName(S, &II, LookupNestedNameSpecifierName);
   }
-  
+
   // FIXME: Deal with ambiguities cleanly.
   NamedDecl *SD = Found;
   if (isAcceptableNestedNameSpecifier(Context, SD)) {
     if (!ObjectType.isNull() && !ObjectTypeSearchedInScope) {
       // C++ [basic.lookup.classref]p4:
-      //   [...] If the name is found in both contexts, the 
+      //   [...] If the name is found in both contexts, the
       //   class-name-or-namespace-name shall refer to the same entity.
       //
       // We already found the name in the scope of the object. Now, look
@@ -420,9 +420,9 @@
       if (S)
         FoundOuter = LookupName(S, &II, LookupNestedNameSpecifierName);
       else
-        FoundOuter = LookupResult::CreateLookupResult(Context, 
+        FoundOuter = LookupResult::CreateLookupResult(Context,
                                                       ScopeLookupResult);
-      
+
       // FIXME: Handle ambiguities in FoundOuter!
       NamedDecl *OuterDecl = FoundOuter;
       if (isAcceptableNestedNameSpecifier(Context, OuterDecl) &&
@@ -436,50 +436,50 @@
              Diag(SD->getLocation(), diag::note_ambig_member_ref_object_type)
                << ObjectType;
              Diag(OuterDecl->getLocation(), diag::note_ambig_member_ref_scope);
-             
+
              // Fall through so that we'll pick the name we found in the object type,
              // since that's probably what the user wanted anyway.
            }
     }
-    
+
     if (NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(SD))
       return NestedNameSpecifier::Create(Context, Prefix, Namespace);
-    
+
     // FIXME: It would be nice to maintain the namespace alias name, then
     // see through that alias when resolving the nested-name-specifier down to
     // a declaration context.
     if (NamespaceAliasDecl *Alias = dyn_cast<NamespaceAliasDecl>(SD))
       return NestedNameSpecifier::Create(Context, Prefix,
-                                         
+
                                          Alias->getNamespace());
-    
+
     QualType T = Context.getTypeDeclType(cast<TypeDecl>(SD));
     return NestedNameSpecifier::Create(Context, Prefix, false,
                                        T.getTypePtr());
   }
-  
+
   // If we didn't find anything during our lookup, try again with
   // ordinary name lookup, which can help us produce better error
   // messages.
   if (!SD)
     SD = LookupName(S, &II, LookupOrdinaryName);
-  
+
   unsigned DiagID;
   if (SD)
     DiagID = diag::err_expected_class_or_namespace;
   else if (SS.isSet()) {
-    DiagnoseMissingMember(IdLoc, DeclarationName(&II), 
-                          (NestedNameSpecifier *)SS.getScopeRep(), 
+    DiagnoseMissingMember(IdLoc, DeclarationName(&II),
+                          (NestedNameSpecifier *)SS.getScopeRep(),
                           SS.getRange());
     return 0;
   } else
     DiagID = diag::err_undeclared_var_use;
-  
+
   if (SS.isSet())
     Diag(IdLoc, DiagID) << &II << SS.getRange();
   else
     Diag(IdLoc, DiagID) << &II;
-  
+
   return 0;
 }
 
@@ -496,7 +496,7 @@
                                                     IdentifierInfo &II,
                                                     TypeTy *ObjectTypePtr,
                                                     bool EnteringContext) {
-  return BuildCXXNestedNameSpecifier(S, SS, IdLoc, CCLoc, II, 
+  return BuildCXXNestedNameSpecifier(S, SS, IdLoc, CCLoc, II,
                                      QualType::getFromOpaquePtr(ObjectTypePtr),
                                      /*ScopeLookupResult=*/0, EnteringContext);
 }
@@ -506,7 +506,7 @@
                                                     TypeTy *Ty,
                                                     SourceRange TypeRange,
                                                     SourceLocation CCLoc) {
-  NestedNameSpecifier *Prefix 
+  NestedNameSpecifier *Prefix
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   QualType T = GetTypeFromParser(Ty);
   return NestedNameSpecifier::Create(Context, Prefix, /*FIXME:*/false,

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Sep  9 10:08:12 2009
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file implements extra semantic analysis beyond what is enforced 
+//  This file implements extra semantic analysis beyond what is enforced
 //  by the C type system.
 //
 //===----------------------------------------------------------------------===//
@@ -32,14 +32,14 @@
 SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL,
                                                     unsigned ByteNo) const {
   assert(!SL->isWide() && "This doesn't work for wide strings yet");
-  
+
   // Loop over all of the tokens in this string until we find the one that
   // contains the byte we're looking for.
   unsigned TokNo = 0;
   while (1) {
     assert(TokNo < SL->getNumConcatenated() && "Invalid byte number!");
     SourceLocation StrTokLoc = SL->getStrTokenLoc(TokNo);
-   
+
     // Get the spelling of the string so that we can get the data that makes up
     // the string literal, not the identifier for the macro it is potentially
     // expanded through.
@@ -51,33 +51,33 @@
     std::pair<const char *,const char *> Buffer =
       SourceMgr.getBufferData(LocInfo.first);
     const char *StrData = Buffer.first+LocInfo.second;
-    
+
     // Create a langops struct and enable trigraphs.  This is sufficient for
     // relexing tokens.
     LangOptions LangOpts;
     LangOpts.Trigraphs = true;
-    
+
     // Create a lexer starting at the beginning of this token.
     Lexer TheLexer(StrTokSpellingLoc, LangOpts, Buffer.first, StrData,
                    Buffer.second);
     Token TheTok;
     TheLexer.LexFromRawLexer(TheTok);
-    
+
     // Use the StringLiteralParser to compute the length of the string in bytes.
     StringLiteralParser SLP(&TheTok, 1, PP);
     unsigned TokNumBytes = SLP.GetStringLength();
-    
+
     // If the byte is in this token, return the location of the byte.
     if (ByteNo < TokNumBytes ||
         (ByteNo == TokNumBytes && TokNo == SL->getNumConcatenated())) {
-      unsigned Offset = 
+      unsigned Offset =
         StringLiteralParser::getOffsetOfStringByte(TheTok, ByteNo, PP);
-     
+
       // Now that we know the offset of the token in the spelling, use the
       // preprocessor to get the offset in the original source.
       return PP.AdvanceToTokenCharacter(StrTokLoc, Offset);
     }
-    
+
     // Move to the next string token.
     ++TokNo;
     ByteNo -= TokNumBytes;
@@ -174,7 +174,7 @@
       return ExprError();
     break;
   }
-  
+
   return move(TheCallResult);
 }
 
@@ -188,7 +188,7 @@
   // simple names (e.g., C++ conversion functions).
   if (!FnInfo)
     return false;
-  
+
   // FIXME: This mechanism should be abstracted to be less fragile and
   // more efficient. For example, just map function ids to custom
   // handlers.
@@ -198,7 +198,7 @@
     if (CheckablePrintfAttr(Format, TheCall)) {
       bool HasVAListArg = Format->getFirstArg() == 0;
       if (!HasVAListArg) {
-        if (const FunctionProtoType *Proto 
+        if (const FunctionProtoType *Proto
             = FDecl->getType()->getAsFunctionProtoType())
         HasVAListArg = !Proto->isVariadic();
       }
@@ -206,8 +206,8 @@
                            HasVAListArg ? 0 : Format->getFirstArg() - 1);
     }
   }
-  
-  for (const NonNullAttr *NonNull = FDecl->getAttr<NonNullAttr>(); NonNull; 
+
+  for (const NonNullAttr *NonNull = FDecl->getAttr<NonNullAttr>(); NonNull;
        NonNull = NonNull->getNext<NonNullAttr>())
     CheckNonNullArguments(NonNull, TheCall);
 
@@ -219,21 +219,21 @@
   const FormatAttr *Format = NDecl->getAttr<FormatAttr>();
   if (!Format)
     return false;
-  
+
   const VarDecl *V = dyn_cast<VarDecl>(NDecl);
   if (!V)
     return false;
-  
+
   QualType Ty = V->getType();
   if (!Ty->isBlockPointerType())
     return false;
-  
+
   if (!CheckablePrintfAttr(Format, TheCall))
     return false;
-  
+
   bool HasVAListArg = Format->getFirstArg() == 0;
   if (!HasVAListArg) {
-    const FunctionType *FT = 
+    const FunctionType *FT =
       Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
     if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT))
       HasVAListArg = !Proto->isVariadic();
@@ -260,7 +260,7 @@
   if (TheCall->getNumArgs() < 1)
     return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
               << 0 << TheCall->getCallee()->getSourceRange();
-  
+
   // Inspect the first argument of the atomic builtin.  This should always be
   // a pointer type, whose element is an integral scalar or pointer type.
   // Because it is a pointer type, we don't have to worry about any implicit
@@ -269,9 +269,9 @@
   if (!FirstArg->getType()->isPointerType())
     return Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
              << FirstArg->getType() << FirstArg->getSourceRange();
-  
+
   QualType ValType = FirstArg->getType()->getAs<PointerType>()->getPointeeType();
-  if (!ValType->isIntegerType() && !ValType->isPointerType() && 
+  if (!ValType->isIntegerType() && !ValType->isPointerType() &&
       !ValType->isBlockPointerType())
     return Diag(DRE->getLocStart(),
                 diag::err_atomic_builtin_must_be_pointer_intptr)
@@ -283,7 +283,7 @@
 #define BUILTIN_ROW(x) \
   { Builtin::BI##x##_1, Builtin::BI##x##_2, Builtin::BI##x##_4, \
     Builtin::BI##x##_8, Builtin::BI##x##_16 }
-  
+
   static const unsigned BuiltinIndices[][5] = {
     BUILTIN_ROW(__sync_fetch_and_add),
     BUILTIN_ROW(__sync_fetch_and_sub),
@@ -291,21 +291,21 @@
     BUILTIN_ROW(__sync_fetch_and_and),
     BUILTIN_ROW(__sync_fetch_and_xor),
     BUILTIN_ROW(__sync_fetch_and_nand),
-    
+
     BUILTIN_ROW(__sync_add_and_fetch),
     BUILTIN_ROW(__sync_sub_and_fetch),
     BUILTIN_ROW(__sync_and_and_fetch),
     BUILTIN_ROW(__sync_or_and_fetch),
     BUILTIN_ROW(__sync_xor_and_fetch),
     BUILTIN_ROW(__sync_nand_and_fetch),
-    
+
     BUILTIN_ROW(__sync_val_compare_and_swap),
     BUILTIN_ROW(__sync_bool_compare_and_swap),
     BUILTIN_ROW(__sync_lock_test_and_set),
     BUILTIN_ROW(__sync_lock_release)
   };
-#undef BUILTIN_ROW  
-  
+#undef BUILTIN_ROW
+
   // Determine the index of the size.
   unsigned SizeIndex;
   switch (Context.getTypeSize(ValType)/8) {
@@ -318,7 +318,7 @@
     return Diag(DRE->getLocStart(), diag::err_atomic_builtin_pointer_size)
              << FirstArg->getType() << FirstArg->getSourceRange();
   }
-  
+
   // Each of these builtins has one pointer argument, followed by some number of
   // values (0, 1 or 2) followed by a potentially empty varags list of stuff
   // that we ignore.  Find out which row of BuiltinIndices to read from as well
@@ -333,14 +333,14 @@
   case Builtin::BI__sync_fetch_and_and: BuiltinIndex = 3; break;
   case Builtin::BI__sync_fetch_and_xor: BuiltinIndex = 4; break;
   case Builtin::BI__sync_fetch_and_nand:BuiltinIndex = 5; break;
-      
+
   case Builtin::BI__sync_add_and_fetch: BuiltinIndex = 6; break;
   case Builtin::BI__sync_sub_and_fetch: BuiltinIndex = 7; break;
   case Builtin::BI__sync_and_and_fetch: BuiltinIndex = 8; break;
   case Builtin::BI__sync_or_and_fetch:  BuiltinIndex = 9; break;
   case Builtin::BI__sync_xor_and_fetch: BuiltinIndex =10; break;
   case Builtin::BI__sync_nand_and_fetch:BuiltinIndex =11; break;
-      
+
   case Builtin::BI__sync_val_compare_and_swap:
     BuiltinIndex = 12;
     NumFixed = 2;
@@ -355,37 +355,37 @@
     NumFixed = 0;
     break;
   }
-  
+
   // Now that we know how many fixed arguments we expect, first check that we
   // have at least that many.
   if (TheCall->getNumArgs() < 1+NumFixed)
     return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
             << 0 << TheCall->getCallee()->getSourceRange();
-  
-  
+
+
   // Get the decl for the concrete builtin from this, we can tell what the
   // concrete integer type we should convert to is.
   unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
   const char *NewBuiltinName = Context.BuiltinInfo.GetName(NewBuiltinID);
   IdentifierInfo *NewBuiltinII = PP.getIdentifierInfo(NewBuiltinName);
-  FunctionDecl *NewBuiltinDecl = 
+  FunctionDecl *NewBuiltinDecl =
     cast<FunctionDecl>(LazilyCreateBuiltin(NewBuiltinII, NewBuiltinID,
                                            TUScope, false, DRE->getLocStart()));
   const FunctionProtoType *BuiltinFT =
     NewBuiltinDecl->getType()->getAsFunctionProtoType();
   ValType = BuiltinFT->getArgType(0)->getAs<PointerType>()->getPointeeType();
-  
+
   // If the first type needs to be converted (e.g. void** -> int*), do it now.
   if (BuiltinFT->getArgType(0) != FirstArg->getType()) {
     ImpCastExprToType(FirstArg, BuiltinFT->getArgType(0), CastExpr::CK_Unknown,
                       /*isLvalue=*/false);
     TheCall->setArg(0, FirstArg);
   }
-  
+
   // Next, walk the valid ones promoting to the right type.
   for (unsigned i = 0; i != NumFixed; ++i) {
     Expr *Arg = TheCall->getArg(i+1);
-    
+
     // If the argument is an implicit cast, then there was a promotion due to
     // "...", just remove it now.
     if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
@@ -394,7 +394,7 @@
       ICE->Destroy(Context);
       TheCall->setArg(i+1, Arg);
     }
-    
+
     // GCC does an implicit conversion to the pointer or integer ValType.  This
     // can fail in some cases (1i -> int**), check for this error case now.
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
@@ -402,27 +402,27 @@
     if (CheckCastTypes(Arg->getSourceRange(), ValType, Arg, Kind,
                        ConversionDecl))
       return true;
-    
+
     // Okay, we have something that *can* be converted to the right type.  Check
     // to see if there is a potentially weird extension going on here.  This can
     // happen when you do an atomic operation on something like an char* and
     // pass in 42.  The 42 gets converted to char.  This is even more strange
     // for things like 45.123 -> char, etc.
-    // FIXME: Do this check.  
+    // FIXME: Do this check.
     ImpCastExprToType(Arg, ValType, Kind, /*isLvalue=*/false);
     TheCall->setArg(i+1, Arg);
   }
-  
+
   // Switch the DeclRefExpr to refer to the new decl.
   DRE->setDecl(NewBuiltinDecl);
   DRE->setType(NewBuiltinDecl->getType());
-  
+
   // Set the callee in the CallExpr.
   // FIXME: This leaks the original parens and implicit casts.
   Expr *PromotedCall = DRE;
   UsualUnaryConversions(PromotedCall);
   TheCall->setCallee(PromotedCall);
-  
+
 
   // Change the result type of the call to match the result type of the decl.
   TheCall->setType(NewBuiltinDecl->getResultType());
@@ -433,7 +433,7 @@
 /// CheckObjCString - Checks that the argument to the builtin
 /// CFString constructor is correct
 /// FIXME: GCC currently emits the following warning:
-/// "warning: input conversion stopped due to an input byte that does not 
+/// "warning: input conversion stopped due to an input byte that does not
 ///           belong to the input codeset UTF-8"
 /// Note: It might also make sense to do the UTF-16 conversion here (would
 /// simplify the backend).
@@ -446,10 +446,10 @@
       << Arg->getSourceRange();
     return true;
   }
-  
+
   const char *Data = Literal->getStrData();
   unsigned Length = Literal->getByteLength();
-  
+
   for (unsigned i = 0; i < Length; ++i) {
     if (!Data[i]) {
       Diag(getLocationOfStringLiteralByte(Literal, i),
@@ -458,7 +458,7 @@
       break;
     }
   }
-  
+
   return false;
 }
 
@@ -470,7 +470,7 @@
     Diag(TheCall->getArg(2)->getLocStart(),
          diag::err_typecheck_call_too_many_args)
       << 0 /*function call*/ << Fn->getSourceRange()
-      << SourceRange(TheCall->getArg(2)->getLocStart(), 
+      << SourceRange(TheCall->getArg(2)->getLocStart(),
                      (*(TheCall->arg_end()-1))->getLocEnd());
     return true;
   }
@@ -493,17 +493,17 @@
   } else {
     isVariadic = getCurMethodDecl()->isVariadic();
   }
-  
+
   if (!isVariadic) {
     Diag(Fn->getLocStart(), diag::err_va_start_used_in_non_variadic_function);
     return true;
   }
-  
+
   // Verify that the second argument to the builtin is the last argument of the
   // current function or method.
   bool SecondArgIsLastNamedArgument = false;
   const Expr *Arg = TheCall->getArg(1)->IgnoreParenCasts();
-  
+
   if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Arg)) {
     if (const ParmVarDecl *PV = dyn_cast<ParmVarDecl>(DR->getDecl())) {
       // FIXME: This isn't correct for methods (results in bogus warning).
@@ -518,9 +518,9 @@
       SecondArgIsLastNamedArgument = PV == LastArg;
     }
   }
-  
+
   if (!SecondArgIsLastNamedArgument)
-    Diag(TheCall->getArg(1)->getLocStart(), 
+    Diag(TheCall->getArg(1)->getLocStart(),
          diag::warn_second_parameter_of_va_start_not_last_named_argument);
   return false;
 }
@@ -532,12 +532,12 @@
     return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
       << 0 /*function call*/;
   if (TheCall->getNumArgs() > 2)
-    return Diag(TheCall->getArg(2)->getLocStart(), 
+    return Diag(TheCall->getArg(2)->getLocStart(),
                 diag::err_typecheck_call_too_many_args)
       << 0 /*function call*/
       << SourceRange(TheCall->getArg(2)->getLocStart(),
                      (*(TheCall->arg_end()-1))->getLocEnd());
-  
+
   Expr *OrigArg0 = TheCall->getArg(0);
   Expr *OrigArg1 = TheCall->getArg(1);
 
@@ -550,18 +550,18 @@
   // foo(...)".
   TheCall->setArg(0, OrigArg0);
   TheCall->setArg(1, OrigArg1);
-  
+
   if (OrigArg0->isTypeDependent() || OrigArg1->isTypeDependent())
     return false;
 
   // If the common type isn't a real floating type, then the arguments were
   // invalid for this operation.
   if (!Res->isRealFloatingType())
-    return Diag(OrigArg0->getLocStart(), 
+    return Diag(OrigArg0->getLocStart(),
                 diag::err_typecheck_call_invalid_ordered_compare)
       << OrigArg0->getType() << OrigArg1->getType()
       << SourceRange(OrigArg0->getLocStart(), OrigArg1->getLocEnd());
-  
+
   return false;
 }
 
@@ -572,23 +572,23 @@
     return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
       << 0 /*function call*/;
   if (TheCall->getNumArgs() > 1)
-    return Diag(TheCall->getArg(1)->getLocStart(), 
+    return Diag(TheCall->getArg(1)->getLocStart(),
                 diag::err_typecheck_call_too_many_args)
       << 0 /*function call*/
       << SourceRange(TheCall->getArg(1)->getLocStart(),
                      (*(TheCall->arg_end()-1))->getLocEnd());
 
   Expr *OrigArg = TheCall->getArg(0);
-  
+
   if (OrigArg->isTypeDependent())
     return false;
 
   // This operation requires a floating-point number
   if (!OrigArg->getType()->isRealFloatingType())
-    return Diag(OrigArg->getLocStart(), 
+    return Diag(OrigArg->getLocStart(),
                 diag::err_typecheck_call_invalid_unary_fp)
       << OrigArg->getType() << OrigArg->getSourceRange();
-  
+
   return false;
 }
 
@@ -600,7 +600,7 @@
       !TheCall->getArg(0)->isValueDependent() &&
       !TheCall->getArg(0)->isIntegerConstantExpr(Context, &Loc))
     return Diag(Loc, diag::err_stack_const_level) << TheCall->getSourceRange();
-  
+
   return false;
 }
 
@@ -617,18 +617,18 @@
       !TheCall->getArg(1)->isTypeDependent()) {
     QualType FAType = TheCall->getArg(0)->getType();
     QualType SAType = TheCall->getArg(1)->getType();
-    
+
     if (!FAType->isVectorType() || !SAType->isVectorType()) {
       Diag(TheCall->getLocStart(), diag::err_shufflevector_non_vector)
-        << SourceRange(TheCall->getArg(0)->getLocStart(), 
+        << SourceRange(TheCall->getArg(0)->getLocStart(),
                        TheCall->getArg(1)->getLocEnd());
       return ExprError();
     }
-    
+
     if (Context.getCanonicalType(FAType).getUnqualifiedType() !=
         Context.getCanonicalType(SAType).getUnqualifiedType()) {
       Diag(TheCall->getLocStart(), diag::err_shufflevector_incompatible_vector)
-        << SourceRange(TheCall->getArg(0)->getLocStart(), 
+        << SourceRange(TheCall->getArg(0)->getLocStart(),
                        TheCall->getArg(1)->getLocEnd());
       return ExprError();
     }
@@ -706,7 +706,7 @@
     if (!Arg->isIntegerConstantExpr(Result, Context))
       return Diag(TheCall->getLocStart(), diag::err_prefetch_invalid_argument)
         << SourceRange(Arg->getLocStart(), Arg->getLocEnd());
-    
+
     // FIXME: gcc issues a warning and rewrites these to 0. These
     // seems especially odd for the third argument since the default
     // is 3.
@@ -732,8 +732,8 @@
   if (Arg->isTypeDependent())
     return false;
 
-  QualType ArgType = Arg->getType();  
-  const BuiltinType *BT = ArgType->getAsBuiltinType();  
+  QualType ArgType = Arg->getType();
+  const BuiltinType *BT = ArgType->getAsBuiltinType();
   llvm::APSInt Result(32);
   if (!BT || BT->getKind() != BuiltinType::Int)
     return Diag(TheCall->getLocStart(), diag::err_object_size_invalid_argument)
@@ -797,10 +797,10 @@
     return SemaCheckStringLiteral(Expr->getSubExpr(), TheCall, HasVAListArg,
                                   format_idx, firstDataArg);
   }
-      
+
   case Stmt::DeclRefExprClass: {
     const DeclRefExpr *DR = cast<DeclRefExpr>(E);
-    
+
     // As an exception, do not flag errors for variables binding to
     // const string literals.
     if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
@@ -810,17 +810,17 @@
       if (const ArrayType *AT = Context.getAsArrayType(T)) {
         isConstant = AT->getElementType().isConstant(Context);
       } else if (const PointerType *PT = T->getAs<PointerType>()) {
-        isConstant = T.isConstant(Context) && 
+        isConstant = T.isConstant(Context) &&
                      PT->getPointeeType().isConstant(Context);
       }
-        
+
       if (isConstant) {
         const VarDecl *Def = 0;
         if (const Expr *Init = VD->getDefinition(Def))
           return SemaCheckStringLiteral(Init, TheCall,
                                         HasVAListArg, format_idx, firstDataArg);
       }
-      
+
       // For vprintf* functions (i.e., HasVAListArg==true), we add a
       // special check to see if the format string is a function parameter
       // of the function calling the printf function.  If the function
@@ -843,55 +843,55 @@
         if (isa<ParmVarDecl>(VD))
           return true;
     }
-        
+
     return false;
   }
 
   case Stmt::CallExprClass: {
     const CallExpr *CE = cast<CallExpr>(E);
-    if (const ImplicitCastExpr *ICE 
+    if (const ImplicitCastExpr *ICE
           = dyn_cast<ImplicitCastExpr>(CE->getCallee())) {
       if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr())) {
         if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(DRE->getDecl())) {
           if (const FormatArgAttr *FA = FD->getAttr<FormatArgAttr>()) {
             unsigned ArgIndex = FA->getFormatIdx();
             const Expr *Arg = CE->getArg(ArgIndex - 1);
-            
-            return SemaCheckStringLiteral(Arg, TheCall, HasVAListArg, 
+
+            return SemaCheckStringLiteral(Arg, TheCall, HasVAListArg,
                                           format_idx, firstDataArg);
           }
         }
       }
     }
-    
+
     return false;
   }
   case Stmt::ObjCStringLiteralClass:
   case Stmt::StringLiteralClass: {
     const StringLiteral *StrE = NULL;
-    
+
     if (const ObjCStringLiteral *ObjCFExpr = dyn_cast<ObjCStringLiteral>(E))
       StrE = ObjCFExpr->getString();
     else
       StrE = cast<StringLiteral>(E);
-    
+
     if (StrE) {
-      CheckPrintfString(StrE, E, TheCall, HasVAListArg, format_idx, 
+      CheckPrintfString(StrE, E, TheCall, HasVAListArg, format_idx,
                         firstDataArg);
       return true;
     }
-    
+
     return false;
   }
-      
+
   default:
     return false;
   }
 }
 
 void
-Sema::CheckNonNullArguments(const NonNullAttr *NonNull, const CallExpr *TheCall)
-{
+Sema::CheckNonNullArguments(const NonNullAttr *NonNull,
+                            const CallExpr *TheCall) {
   for (NonNullAttr::iterator i = NonNull->begin(), e = NonNull->end();
        i != e; ++i) {
     const Expr *ArgExpr = TheCall->getArg(*i);
@@ -902,7 +902,7 @@
 }
 
 /// CheckPrintfArguments - Check calls to printf (and similar functions) for
-/// correct use of format strings.  
+/// correct use of format strings.
 ///
 ///  HasVAListArg - A predicate indicating whether the printf-like
 ///    function is passed an explicit va_arg argument (e.g., vprintf)
@@ -951,30 +951,30 @@
 ///
 /// For now, we ONLY do (1), (3), (5), (6), (7), and (8).
 void
-Sema::CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg, 
+Sema::CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg,
                            unsigned format_idx, unsigned firstDataArg) {
   const Expr *Fn = TheCall->getCallee();
 
-  // CHECK: printf-like function is called with no format string.  
+  // CHECK: printf-like function is called with no format string.
   if (format_idx >= TheCall->getNumArgs()) {
     Diag(TheCall->getRParenLoc(), diag::warn_printf_missing_format_string)
       << Fn->getSourceRange();
     return;
   }
-  
+
   const Expr *OrigFormatExpr = TheCall->getArg(format_idx)->IgnoreParenCasts();
-  
+
   // CHECK: format string is not a string literal.
-  // 
+  //
   // Dynamically generated format strings are difficult to
   // automatically vet at compile time.  Requiring that format strings
   // are string literals: (1) permits the checking of format strings by
   // the compiler and thereby (2) can practically remove the source of
   // many format string exploits.
 
-  // Format string can be either ObjC string (e.g. @"%d") or 
+  // Format string can be either ObjC string (e.g. @"%d") or
   // C string (e.g. "%d")
-  // ObjC string uses the same format specifiers as C string, so we can use 
+  // ObjC string uses the same format specifiers as C string, so we can use
   // the same format string checking logic for both ObjC and C strings.
   if (SemaCheckStringLiteral(OrigFormatExpr, TheCall, HasVAListArg, format_idx,
                              firstDataArg))
@@ -983,11 +983,11 @@
   // If there are no arguments specified, warn with -Wformat-security, otherwise
   // warn only with -Wformat-nonliteral.
   if (TheCall->getNumArgs() == format_idx+1)
-    Diag(TheCall->getArg(format_idx)->getLocStart(), 
+    Diag(TheCall->getArg(format_idx)->getLocStart(),
          diag::warn_printf_nonliteral_noargs)
       << OrigFormatExpr->getSourceRange();
   else
-    Diag(TheCall->getArg(format_idx)->getLocStart(), 
+    Diag(TheCall->getArg(format_idx)->getLocStart(),
          diag::warn_printf_nonliteral)
            << OrigFormatExpr->getSourceRange();
 }
@@ -1013,7 +1013,7 @@
 
   // CHECK: empty format string?
   unsigned StrLen = FExpr->getByteLength();
-  
+
   if (StrLen == 0) {
     Diag(FExpr->getLocStart(), diag::warn_printf_empty_format_string)
       << OrigFormatExpr->getSourceRange();
@@ -1026,7 +1026,7 @@
     state_OrdChr,
     state_Conversion
   } CurrentState = state_OrdChr;
-  
+
   // numConversions - The number of conversions seen so far.  This is
   //  incremented as we traverse the format string.
   unsigned numConversions = 0;
@@ -1039,17 +1039,17 @@
 
   // Inspect the format string.
   unsigned StrIdx = 0;
-  
+
   // LastConversionIdx - Index within the format string where we last saw
   //  a '%' character that starts a new format conversion.
   unsigned LastConversionIdx = 0;
-  
+
   for (; StrIdx < StrLen; ++StrIdx) {
-    
+
     // Is the number of detected conversion conversions greater than
     // the number of matching data arguments?  If so, stop.
     if (!HasVAListArg && numConversions > numDataArgs) break;
-    
+
     // Handle "\0"
     if (Str[StrIdx] == '\0') {
       // The string returned by getStrData() is not null-terminated,
@@ -1059,7 +1059,7 @@
         <<  OrigFormatExpr->getSourceRange();
       return;
     }
-    
+
     // Ordinary characters (not processing a format conversion).
     if (CurrentState == state_OrdChr) {
       if (Str[StrIdx] == '%') {
@@ -1071,10 +1071,10 @@
 
     // Seen '%'.  Now processing a format conversion.
     switch (Str[StrIdx]) {
-    // Handle dynamic precision or width specifier.     
+    // Handle dynamic precision or width specifier.
     case '*': {
       ++numConversions;
-      
+
       if (!HasVAListArg) {
         if (numConversions > numDataArgs) {
           SourceLocation Loc = getLocationOfStringLiteralByte(FExpr, StrIdx);
@@ -1085,39 +1085,39 @@
           else
             Diag(Loc, diag::warn_printf_asterisk_width_missing_arg)
               << OrigFormatExpr->getSourceRange();
-          
+
           // Don't do any more checking.  We'll just emit spurious errors.
           return;
         }
-      
+
         // Perform type checking on width/precision specifier.
         const Expr *E = TheCall->getArg(format_idx+numConversions);
         if (const BuiltinType *BT = E->getType()->getAsBuiltinType())
           if (BT->getKind() == BuiltinType::Int)
             break;
-        
+
         SourceLocation Loc = getLocationOfStringLiteralByte(FExpr, StrIdx);
-        
+
         if (Str[StrIdx-1] == '.')
           Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type)
           << E->getType() << E->getSourceRange();
         else
           Diag(Loc, diag::warn_printf_asterisk_width_wrong_type)
           << E->getType() << E->getSourceRange();
-        
-        break;        
+
+        break;
       }
     }
-      
+
     // Characters which can terminate a format conversion
     // (e.g. "%d").  Characters that specify length modifiers or
     // other flags are handled by the default case below.
     //
-    // FIXME: additional checks will go into the following cases.                
+    // FIXME: additional checks will go into the following cases.
     case 'i':
     case 'd':
-    case 'o': 
-    case 'u': 
+    case 'o':
+    case 'u':
     case 'x':
     case 'X':
     case 'D':
@@ -1135,7 +1135,7 @@
     case 'C':
     case 'S':
     case 's':
-    case 'p': 
+    case 'p':
       ++numConversions;
       CurrentState = state_OrdChr;
       break;
@@ -1151,21 +1151,21 @@
       CurrentState = state_OrdChr;
       SourceLocation Loc = getLocationOfStringLiteralByte(FExpr,
                                                           LastConversionIdx);
-                                   
+
       Diag(Loc, diag::warn_printf_write_back)<<OrigFormatExpr->getSourceRange();
       break;
     }
-             
+
     // Handle "%@"
     case '@':
       // %@ is allowed in ObjC format strings only.
-      if(ObjCFExpr != NULL)
-        CurrentState = state_OrdChr; 
+      if (ObjCFExpr != NULL)
+        CurrentState = state_OrdChr;
       else {
         // Issue a warning: invalid format conversion.
-        SourceLocation Loc = 
+        SourceLocation Loc =
           getLocationOfStringLiteralByte(FExpr, LastConversionIdx);
-    
+
         Diag(Loc, diag::warn_printf_invalid_conversion)
           <<  std::string(Str+LastConversionIdx,
                           Str+std::min(LastConversionIdx+2, StrLen))
@@ -1173,7 +1173,7 @@
       }
       ++numConversions;
       break;
-    
+
     // Handle "%%"
     case '%':
       // Sanity check: Was the first "%" character the previous one?
@@ -1181,23 +1181,23 @@
       // conversion, and that the current "%" character is the start
       // of a new conversion.
       if (StrIdx - LastConversionIdx == 1)
-        CurrentState = state_OrdChr; 
+        CurrentState = state_OrdChr;
       else {
         // Issue a warning: invalid format conversion.
         SourceLocation Loc =
           getLocationOfStringLiteralByte(FExpr, LastConversionIdx);
-            
+
         Diag(Loc, diag::warn_printf_invalid_conversion)
           << std::string(Str+LastConversionIdx, Str+StrIdx)
           << OrigFormatExpr->getSourceRange();
-             
+
         // This conversion is broken.  Advance to the next format
         // conversion.
         LastConversionIdx = StrIdx;
         ++numConversions;
       }
       break;
-              
+
     default:
       // This case catches all other characters: flags, widths, etc.
       // We should eventually process those as well.
@@ -1209,21 +1209,21 @@
     // Issue a warning: invalid format conversion.
     SourceLocation Loc =
       getLocationOfStringLiteralByte(FExpr, LastConversionIdx);
-    
+
     Diag(Loc, diag::warn_printf_invalid_conversion)
       << std::string(Str+LastConversionIdx,
                      Str+std::min(LastConversionIdx+2, StrLen))
       << OrigFormatExpr->getSourceRange();
     return;
   }
-  
+
   if (!HasVAListArg) {
     // CHECK: Does the number of format conversions exceed the number
     //        of data arguments?
     if (numConversions > numDataArgs) {
       SourceLocation Loc =
         getLocationOfStringLiteralByte(FExpr, LastConversionIdx);
-                                   
+
       Diag(Loc, diag::warn_printf_insufficient_data_args)
         << OrigFormatExpr->getSourceRange();
     }
@@ -1246,13 +1246,13 @@
 void
 Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
                            SourceLocation ReturnLoc) {
-   
+
   // Perform checking for returned stack addresses.
   if (lhsType->isPointerType() || lhsType->isBlockPointerType()) {
     if (DeclRefExpr *DR = EvalAddr(RetValExp))
       Diag(DR->getLocStart(), diag::warn_ret_stack_addr)
        << DR->getDecl()->getDeclName() << RetValExp->getSourceRange();
-    
+
     // Skip over implicit cast expressions when checking for block expressions.
     RetValExp = RetValExp->IgnoreParenCasts();
 
@@ -1279,7 +1279,7 @@
 ///
 ///  EvalAddr processes expressions that are pointers that are used as
 ///  references (and not L-values).  EvalVal handles all other values.
-///  At the base case of the recursion is a check for a DeclRefExpr* in 
+///  At the base case of the recursion is a check for a DeclRefExpr* in
 ///  the refers to a stack variable.
 ///
 ///  This implementation handles:
@@ -1296,7 +1296,7 @@
           E->getType()->isBlockPointerType() ||
           E->getType()->isObjCQualifiedIdType()) &&
          "EvalAddr only works on pointers");
-    
+
   // Our "symbolic interpreter" is just a dispatch off the currently
   // viewed AST node.  We then recursively traverse the AST by calling
   // EvalAddr and EvalVal appropriately.
@@ -1309,28 +1309,28 @@
     // The only unary operator that make sense to handle here
     // is AddrOf.  All others don't make sense as pointers.
     UnaryOperator *U = cast<UnaryOperator>(E);
-    
+
     if (U->getOpcode() == UnaryOperator::AddrOf)
       return EvalVal(U->getSubExpr());
     else
       return NULL;
   }
-  
+
   case Stmt::BinaryOperatorClass: {
     // Handle pointer arithmetic.  All other binary operators are not valid
     // in this context.
     BinaryOperator *B = cast<BinaryOperator>(E);
     BinaryOperator::Opcode op = B->getOpcode();
-      
+
     if (op != BinaryOperator::Add && op != BinaryOperator::Sub)
       return NULL;
-      
+
     Expr *Base = B->getLHS();
 
     // Determine which argument is the real pointer base.  It could be
     // the RHS argument instead of the LHS.
     if (!Base->getType()->isPointerType()) Base = B->getRHS();
-      
+
     assert (Base->getType()->isPointerType());
     return EvalAddr(Base);
   }
@@ -1339,7 +1339,7 @@
   // valid DeclRefExpr*s.  If one of them is valid, we return it.
   case Stmt::ConditionalOperatorClass: {
     ConditionalOperator *C = cast<ConditionalOperator>(E);
-    
+
     // Handle the GNU extension for missing LHS.
     if (Expr *lhsExpr = C->getLHS())
       if (DeclRefExpr* LHS = EvalAddr(lhsExpr))
@@ -1347,7 +1347,7 @@
 
      return EvalAddr(C->getRHS());
   }
-    
+
   // For casts, we need to handle conversions from arrays to
   // pointer values, and pointer-to-pointer conversions.
   case Stmt::ImplicitCastExprClass:
@@ -1355,7 +1355,7 @@
   case Stmt::CXXFunctionalCastExprClass: {
     Expr* SubExpr = cast<CastExpr>(E)->getSubExpr();
     QualType T = SubExpr->getType();
-    
+
     if (SubExpr->getType()->isPointerType() ||
         SubExpr->getType()->isBlockPointerType() ||
         SubExpr->getType()->isObjCQualifiedIdType())
@@ -1365,7 +1365,7 @@
     else
       return 0;
   }
-    
+
   // C++ casts.  For dynamic casts, static casts, and const casts, we
   // are always converting from a pointer-to-pointer, so we just blow
   // through the cast.  In the case the dynamic cast doesn't fail (and
@@ -1373,9 +1373,9 @@
   // where we return the address of a stack variable.  For Reinterpre
   // FIXME: The comment about is wrong; we're not always converting
   // from pointer to pointer. I'm guessing that this code should also
-  // handle references to objects.  
-  case Stmt::CXXStaticCastExprClass: 
-  case Stmt::CXXDynamicCastExprClass: 
+  // handle references to objects.
+  case Stmt::CXXStaticCastExprClass:
+  case Stmt::CXXDynamicCastExprClass:
   case Stmt::CXXConstCastExprClass:
   case Stmt::CXXReinterpretCastExprClass: {
       Expr *S = cast<CXXNamedCastExpr>(E)->getSubExpr();
@@ -1384,62 +1384,62 @@
       else
         return NULL;
   }
-    
+
   // Everything else: we simply don't reason about them.
   default:
     return NULL;
   }
 }
-  
+
 
 ///  EvalVal - This function is complements EvalAddr in the mutual recursion.
 ///   See the comments for EvalAddr for more details.
 static DeclRefExpr* EvalVal(Expr *E) {
-  
+
   // We should only be called for evaluating non-pointer expressions, or
   // expressions with a pointer type that are not used as references but instead
   // are l-values (e.g., DeclRefExpr with a pointer type).
-    
+
   // Our "symbolic interpreter" is just a dispatch off the currently
   // viewed AST node.  We then recursively traverse the AST by calling
   // EvalAddr and EvalVal appropriately.
   switch (E->getStmtClass()) {
-  case Stmt::DeclRefExprClass: 
+  case Stmt::DeclRefExprClass:
   case Stmt::QualifiedDeclRefExprClass: {
     // DeclRefExpr: the base case.  When we hit a DeclRefExpr we are looking
     //  at code that refers to a variable's name.  We check if it has local
     //  storage within the function, and if so, return the expression.
     DeclRefExpr *DR = cast<DeclRefExpr>(E);
-      
+
     if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl()))
-      if(V->hasLocalStorage() && !V->getType()->isReferenceType()) return DR;
-      
+      if (V->hasLocalStorage() && !V->getType()->isReferenceType()) return DR;
+
     return NULL;
   }
-        
+
   case Stmt::ParenExprClass:
     // Ignore parentheses.
     return EvalVal(cast<ParenExpr>(E)->getSubExpr());
-  
+
   case Stmt::UnaryOperatorClass: {
     // The only unary operator that make sense to handle here
     // is Deref.  All others don't resolve to a "name."  This includes
     // handling all sorts of rvalues passed to a unary operator.
     UnaryOperator *U = cast<UnaryOperator>(E);
-              
+
     if (U->getOpcode() == UnaryOperator::Deref)
       return EvalAddr(U->getSubExpr());
 
     return NULL;
   }
-  
+
   case Stmt::ArraySubscriptExprClass: {
     // Array subscripts are potential references to data on the stack.  We
     // retrieve the DeclRefExpr* for the array variable if it indeed
     // has local storage.
     return EvalAddr(cast<ArraySubscriptExpr>(E)->getBase());
   }
-    
+
   case Stmt::ConditionalOperatorClass: {
     // For conditional operators we need to see if either the LHS or RHS are
     // non-NULL DeclRefExpr's.  If one is non-NULL, we return it.
@@ -1452,18 +1452,18 @@
 
     return EvalVal(C->getRHS());
   }
-  
+
   // Accesses to members are potential references to data on the stack.
   case Stmt::MemberExprClass: {
     MemberExpr *M = cast<MemberExpr>(E);
-      
+
     // Check for indirect access.  We only want direct field accesses.
     if (!M->isArrow())
       return EvalVal(M->getBase());
     else
       return NULL;
   }
-    
+
   // Everything else: we simply don't reason about them.
   default:
     return NULL;
@@ -1477,7 +1477,7 @@
 /// to do what the programmer intended.
 void Sema::CheckFloatComparison(SourceLocation loc, Expr* lex, Expr *rex) {
   bool EmitWarning = true;
-  
+
   Expr* LeftExprSansParen = lex->IgnoreParens();
   Expr* RightExprSansParen = rex->IgnoreParens();
 
@@ -1487,8 +1487,8 @@
     if (DeclRefExpr* DRR = dyn_cast<DeclRefExpr>(RightExprSansParen))
       if (DRL->getDecl() == DRR->getDecl())
         EmitWarning = false;
-  
-  
+
+
   // Special case: check for comparisons against literals that can be exactly
   //  represented by APFloat.  In such cases, do not emit a warning.  This
   //  is a heuristic: often comparison against such literals are used to
@@ -1504,18 +1504,18 @@
           EmitWarning = false;
     }
   }
-  
+
   // Check for comparisons with builtin types.
   if (EmitWarning)
     if (CallExpr* CL = dyn_cast<CallExpr>(LeftExprSansParen))
       if (CL->isBuiltinCall(Context))
         EmitWarning = false;
-  
+
   if (EmitWarning)
     if (CallExpr* CR = dyn_cast<CallExpr>(RightExprSansParen))
       if (CR->isBuiltinCall(Context))
         EmitWarning = false;
-  
+
   // Emit the diagnostic.
   if (EmitWarning)
     Diag(loc, diag::warn_floatingpoint_eq)

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Sep  9 10:08:12 2009
@@ -28,7 +28,7 @@
 #include "clang/Basic/TargetInfo.h"
 // FIXME: layering (ideally, Sema shouldn't be dependent on Lex API's)
 #include "clang/Lex/Preprocessor.h"
-#include "clang/Lex/HeaderSearch.h" 
+#include "clang/Lex/HeaderSearch.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include <algorithm>
@@ -37,7 +37,7 @@
 using namespace clang;
 
 /// getDeclName - Return a pretty name for the specified decl if possible, or
-/// an empty string if not.  This is used for pretty crash reporting. 
+/// an empty string if not.  This is used for pretty crash reporting.
 std::string Sema::getDeclName(DeclPtrTy d) {
   Decl *D = d.getAs<Decl>();
   if (NamedDecl *DN = dyn_cast_or_null<NamedDecl>(D))
@@ -75,16 +75,16 @@
   if (SS && isUnknownSpecialization(*SS)) {
     if (!isClassName)
       return 0;
-    
-    // We know from the grammar that this name refers to a type, so build a 
+
+    // We know from the grammar that this name refers to a type, so build a
     // TypenameType node to describe the type.
     // FIXME: Record somewhere that this TypenameType node has no "typename"
     // keyword associated with it.
     return CheckTypenameType((NestedNameSpecifier *)SS->getScopeRep(),
                              II, SS->getRange()).getAsOpaquePtr();
   }
-  
-  LookupResult Result 
+
+  LookupResult Result
     = LookupParsedName(S, SS, &II, LookupOrdinaryName, false, false);
 
   NamedDecl *IIDecl = 0;
@@ -100,8 +100,8 @@
     for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end();
          Res != ResEnd; ++Res) {
       if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res)) {
-        if (!IIDecl || 
-            (*Res)->getLocation().getRawEncoding() < 
+        if (!IIDecl ||
+            (*Res)->getLocation().getRawEncoding() <
               IIDecl->getLocation().getRawEncoding())
           IIDecl = *Res;
       }
@@ -133,11 +133,11 @@
 
   if (IIDecl) {
     QualType T;
-  
+
     if (TypeDecl *TD = dyn_cast<TypeDecl>(IIDecl)) {
       // Check whether we can use this type
       (void)DiagnoseUseOfDecl(IIDecl, NameLoc);
-  
+
       if (getLangOptions().CPlusPlus) {
         // C++ [temp.local]p2:
         //   Within the scope of a class template specialization or
@@ -157,7 +157,7 @@
     } else if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(IIDecl)) {
       // Check whether we can use this interface.
       (void)DiagnoseUseOfDecl(IIDecl, NameLoc);
-      
+
       T = Context.getObjCInterfaceType(IDecl);
     } else
       return 0;
@@ -188,7 +188,7 @@
       case TagDecl::TK_enum:   return DeclSpec::TST_enum;
       }
     }
-  
+
   return DeclSpec::TST_unspecified;
 }
 
@@ -284,7 +284,7 @@
   // Move up the scope chain until we find the nearest enclosing
   // non-transparent context. The declaration will be introduced into this
   // scope.
-  while (S->getEntity() && 
+  while (S->getEntity() &&
          ((DeclContext *)S->getEntity())->isTransparentContext())
     S = S->getParent();
 
@@ -304,7 +304,7 @@
   //   in this case the class name or enumeration name is hidden.
   if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
     // We are pushing the name of a tag (enum or class).
-    if (CurContext->getLookupContext() 
+    if (CurContext->getLookupContext()
           == TD->getDeclContext()->getLookupContext()) {
       // We're pushing the tag into the current context, which might
       // require some reshuffling in the identifier resolver.
@@ -313,7 +313,7 @@
         IEnd = IdResolver.end();
       if (I != IEnd && isDeclInScope(*I, CurContext, S)) {
         NamedDecl *PrevDecl = *I;
-        for (; I != IEnd && isDeclInScope(*I, CurContext, S); 
+        for (; I != IEnd && isDeclInScope(*I, CurContext, S);
              PrevDecl = *I, ++I) {
           if (TD->declarationReplaces(*I)) {
             // This is a redeclaration. Remove it from the chain and
@@ -336,7 +336,7 @@
         // before we find the new declaration, so insert the new
         // declaration at the end of the chain.
         IdResolver.AddShadowedDecl(TD, PrevDecl);
-        
+
         return;
       }
     }
@@ -360,7 +360,7 @@
   } else if (isa<ObjCInterfaceDecl>(D)) {
     // We're pushing an Objective-C interface into the current
     // context. If there is already an alias declaration, remove it first.
-    for (IdentifierResolver::iterator 
+    for (IdentifierResolver::iterator
            I = IdResolver.begin(D->getDeclName()), IEnd = IdResolver.end();
          I != IEnd; ++I) {
       if (isa<ObjCCompatibleAliasDecl>(*I)) {
@@ -377,7 +377,7 @@
 void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
   if (S->decl_empty()) return;
   assert((S->getFlags() & (Scope::DeclScope | Scope::TemplateParamScope)) &&
-	 "Scope shouldn't contain decls!");
+         "Scope shouldn't contain decls!");
 
   for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
        I != E; ++I) {
@@ -400,7 +400,7 @@
   // The third "scope" argument is 0 since we aren't enabling lazy built-in
   // creation from this context.
   NamedDecl *IDecl = LookupName(TUScope, Id, LookupOrdinaryName);
-  
+
   return dyn_cast_or_null<ObjCInterfaceDecl>(IDecl);
 }
 
@@ -413,7 +413,7 @@
 /// struct S6 {
 ///   enum { BAR } e;
 /// };
-/// 
+///
 /// void test_S6() {
 ///   struct S6 a;
 ///   a.e = BAR;
@@ -429,7 +429,7 @@
 /// contain non-field names.
 Scope *Sema::getNonFieldDeclScope(Scope *S) {
   while (((S->getFlags() & Scope::DeclScope) == 0) ||
-         (S->getEntity() && 
+         (S->getEntity() &&
           ((DeclContext *)S->getEntity())->isTransparentContext()) ||
          (S->isClassScope() && !getLangOptions().CPlusPlus))
     S = S->getParent();
@@ -439,7 +439,7 @@
 void Sema::InitBuiltinVaListType() {
   if (!Context.getBuiltinVaListType().isNull())
     return;
-  
+
   IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
   NamedDecl *VaDecl = LookupName(TUScope, VaIdent, LookupOrdinaryName);
   TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
@@ -459,7 +459,7 @@
     InitBuiltinVaListType();
 
   ASTContext::GetBuiltinTypeError Error;
-  QualType R = Context.GetBuiltinType(BID, Error);  
+  QualType R = Context.GetBuiltinType(BID, Error);
   switch (Error) {
   case ASTContext::GE_None:
     // Okay
@@ -507,9 +507,9 @@
                                            VarDecl::None, 0));
     New->setParams(Context, Params.data(), Params.size());
   }
-  
-  AddKnownFunctionAttributes(New);  
-  
+
+  AddKnownFunctionAttributes(New);
+
   // TUScope is the translation-unit scope to insert this function into.
   // FIXME: This is hideous. We need to teach PushOnScopeChains to
   // relate Scopes to DeclContexts, and probably eliminate CurContext
@@ -543,14 +543,14 @@
   // don't bother doing any merging checks.
   if (New->isInvalidDecl() || OldD->isInvalidDecl())
     return New->setInvalidDecl();
-  
+
   // Allow multiple definitions for ObjC built-in typedefs.
   // FIXME: Verify the underlying types are equivalent!
   if (getLangOptions().ObjC1) {
     const IdentifierInfo *TypeID = New->getIdentifier();
     switch (TypeID->getLength()) {
     default: break;
-    case 2: 
+    case 2:
       if (!TypeID->isStr("id"))
         break;
       Context.ObjCIdRedefinitionType = New->getUnderlyingType();
@@ -580,14 +580,14 @@
   // Verify the old decl was also a type.
   TypeDecl *Old = dyn_cast<TypeDecl>(OldD);
   if (!Old) {
-    Diag(New->getLocation(), diag::err_redefinition_different_kind) 
+    Diag(New->getLocation(), diag::err_redefinition_different_kind)
       << New->getDeclName();
     if (OldD->getLocation().isValid())
       Diag(OldD->getLocation(), diag::note_previous_definition);
     return New->setInvalidDecl();
   }
 
-  // Determine the "old" type we'll use for checking and diagnostics.  
+  // Determine the "old" type we'll use for checking and diagnostics.
   QualType OldType;
   if (TypedefDecl *OldTypedef = dyn_cast<TypedefDecl>(Old))
     OldType = OldTypedef->getUnderlyingType();
@@ -597,8 +597,8 @@
   // If the typedef types are not identical, reject them in all languages and
   // with any extensions enabled.
 
-  if (OldType != New->getUnderlyingType() && 
-      Context.getCanonicalType(OldType) != 
+  if (OldType != New->getUnderlyingType() &&
+      Context.getCanonicalType(OldType) !=
       Context.getCanonicalType(New->getUnderlyingType())) {
     Diag(New->getLocation(), diag::err_redefinition_different_typedef)
       << New->getUnderlyingType() << OldType;
@@ -606,7 +606,7 @@
       Diag(Old->getLocation(), diag::note_previous_definition);
     return New->setInvalidDecl();
   }
-  
+
   if (getLangOptions().Microsoft)
     return;
 
@@ -631,7 +631,7 @@
       (Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
        Context.getSourceManager().isInSystemHeader(New->getLocation())))
     return;
-  
+
   Diag(New->getLocation(), diag::warn_redefinition_of_typedef)
     << New->getDeclName();
   Diag(Old->getLocation(), diag::note_previous_definition);
@@ -640,7 +640,7 @@
 
 /// DeclhasAttr - returns true if decl Declaration already has the target
 /// attribute.
-static bool 
+static bool
 DeclHasAttr(const Decl *decl, const Attr *target) {
   for (const Attr *attr = decl->getAttrs(); attr; attr = attr->getNext())
     if (attr->getKind() == target->getKind())
@@ -680,15 +680,15 @@
 ///
 /// Returns true if there was an error, false otherwise.
 bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
-  assert(!isa<OverloadedFunctionDecl>(OldD) && 
+  assert(!isa<OverloadedFunctionDecl>(OldD) &&
          "Cannot merge with an overloaded function declaration");
 
   // Verify the old decl was also a function.
   FunctionDecl *Old = 0;
-  if (FunctionTemplateDecl *OldFunctionTemplate 
+  if (FunctionTemplateDecl *OldFunctionTemplate
         = dyn_cast<FunctionTemplateDecl>(OldD))
     Old = OldFunctionTemplate->getTemplatedDecl();
-  else 
+  else
     Old = dyn_cast<FunctionDecl>(OldD);
   if (!Old) {
     Diag(New->getLocation(), diag::err_redefinition_different_kind)
@@ -704,12 +704,12 @@
     PrevDiag = diag::note_previous_definition;
   else if (Old->isImplicit())
     PrevDiag = diag::note_previous_implicit_declaration;
-  else 
+  else
     PrevDiag = diag::note_previous_declaration;
-  
+
   QualType OldQType = Context.getCanonicalType(Old->getType());
   QualType NewQType = Context.getCanonicalType(New->getType());
-  
+
   if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) &&
       New->getStorageClass() == FunctionDecl::Static &&
       Old->getStorageClass() != FunctionDecl::Static) {
@@ -722,11 +722,11 @@
   if (getLangOptions().CPlusPlus) {
     // (C++98 13.1p2):
     //   Certain function declarations cannot be overloaded:
-    //     -- Function declarations that differ only in the return type 
+    //     -- Function declarations that differ only in the return type
     //        cannot be overloaded.
-    QualType OldReturnType 
+    QualType OldReturnType
       = cast<FunctionType>(OldQType.getTypePtr())->getResultType();
-    QualType NewReturnType 
+    QualType NewReturnType
       = cast<FunctionType>(NewQType.getTypePtr())->getResultType();
     if (OldReturnType != NewReturnType) {
       Diag(New->getLocation(), diag::err_ovl_diff_return_type);
@@ -738,8 +738,8 @@
     const CXXMethodDecl* NewMethod = dyn_cast<CXXMethodDecl>(New);
     if (OldMethod && NewMethod && !NewMethod->getFriendObjectKind() &&
         NewMethod->getLexicalDeclContext()->isRecord()) {
-      //    -- Member function declarations with the same name and the 
-      //       same parameter types cannot be overloaded if any of them 
+      //    -- Member function declarations with the same name and the
+      //       same parameter types cannot be overloaded if any of them
       //       is a static member function declaration.
       if (OldMethod->isStatic() || NewMethod->isStatic()) {
         Diag(New->getLocation(), diag::err_ovl_static_nonstatic_member);
@@ -760,7 +760,7 @@
         NewDiag = diag::err_conv_function_redeclared;
       else
         NewDiag = diag::err_member_redeclared;
-      
+
       Diag(New->getLocation(), NewDiag);
       Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
     }
@@ -797,8 +797,8 @@
 
       // Synthesize a parameter for each argument type.
       llvm::SmallVector<ParmVarDecl*, 16> Params;
-      for (FunctionProtoType::arg_type_iterator 
-             ParamType = OldProto->arg_type_begin(), 
+      for (FunctionProtoType::arg_type_iterator
+             ParamType = OldProto->arg_type_begin(),
              ParamEnd = OldProto->arg_type_end();
            ParamType != ParamEnd; ++ParamType) {
         ParmVarDecl *Param = ParmVarDecl::Create(Context, New,
@@ -810,7 +810,7 @@
       }
 
       New->setParams(Context, Params.data(), Params.size());
-    } 
+    }
 
     return MergeCompatibleFunctionDecls(New, Old);
   }
@@ -832,25 +832,25 @@
       Old->getNumParams() == New->getNumParams()) {
     llvm::SmallVector<QualType, 16> ArgTypes;
     llvm::SmallVector<GNUCompatibleParamWarning, 16> Warnings;
-    const FunctionProtoType *OldProto 
+    const FunctionProtoType *OldProto
       = Old->getType()->getAsFunctionProtoType();
-    const FunctionProtoType *NewProto 
+    const FunctionProtoType *NewProto
       = New->getType()->getAsFunctionProtoType();
-    
+
     // Determine whether this is the GNU C extension.
     QualType MergedReturn = Context.mergeTypes(OldProto->getResultType(),
                                                NewProto->getResultType());
     bool LooseCompatible = !MergedReturn.isNull();
-    for (unsigned Idx = 0, End = Old->getNumParams(); 
+    for (unsigned Idx = 0, End = Old->getNumParams();
          LooseCompatible && Idx != End; ++Idx) {
       ParmVarDecl *OldParm = Old->getParamDecl(Idx);
       ParmVarDecl *NewParm = New->getParamDecl(Idx);
-      if (Context.typesAreCompatible(OldParm->getType(), 
+      if (Context.typesAreCompatible(OldParm->getType(),
                                      NewProto->getArgType(Idx))) {
         ArgTypes.push_back(NewParm->getType());
       } else if (Context.typesAreCompatible(OldParm->getType(),
                                             NewParm->getType())) {
-        GNUCompatibleParamWarning Warn 
+        GNUCompatibleParamWarning Warn
           = { OldParm, NewParm, NewProto->getArgType(Idx) };
         Warnings.push_back(Warn);
         ArgTypes.push_back(NewParm->getType());
@@ -864,7 +864,7 @@
              diag::ext_param_promoted_not_compatible_with_prototype)
           << Warnings[Warn].PromotedType
           << Warnings[Warn].OldParm->getType();
-        Diag(Warnings[Warn].OldParm->getLocation(), 
+        Diag(Warnings[Warn].OldParm->getLocation(),
              diag::note_previous_declaration);
       }
 
@@ -904,7 +904,7 @@
 }
 
 /// \brief Completes the merge of two function declarations that are
-/// known to be compatible. 
+/// known to be compatible.
 ///
 /// This routine handles the merging of attributes and other
 /// properties of function declarations form the old declaration to
@@ -931,7 +931,7 @@
     New->setC99InlineDefinition(false);
   else if (Old->isC99InlineDefinition() && !New->isC99InlineDefinition()) {
     // Mark all preceding definitions as not being C99 inline definitions.
-    for (const FunctionDecl *Prev = Old; Prev; 
+    for (const FunctionDecl *Prev = Old; Prev;
          Prev = Prev->getPreviousDeclaration())
       const_cast<FunctionDecl *>(Prev)->setC99InlineDefinition(false);
   }
@@ -943,7 +943,7 @@
   // Merge the "deleted" flag.
   if (Old->isDeleted())
     New->setDeleted();
-  
+
   if (getLangOptions().CPlusPlus)
     return MergeCXXFunctionDecl(New, Old);
 
@@ -954,16 +954,16 @@
 /// and scope as a previous declaration 'Old'.  Figure out how to resolve this
 /// situation, merging decls or emitting diagnostics as appropriate.
 ///
-/// Tentative definition rules (C99 6.9.2p2) are checked by 
-/// FinalizeDeclaratorGroup. Unfortunately, we can't analyze tentative 
+/// Tentative definition rules (C99 6.9.2p2) are checked by
+/// FinalizeDeclaratorGroup. Unfortunately, we can't analyze tentative
 /// definitions here, since the initializer hasn't been attached.
-/// 
+///
 void Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
   // If either decl is invalid, make sure the new one is marked invalid and
   // don't do any other checking.
   if (New->isInvalidDecl() || OldD->isInvalidDecl())
     return New->setInvalidDecl();
-  
+
   // Verify the old decl was also a variable.
   VarDecl *Old = dyn_cast<VarDecl>(OldD);
   if (!Old) {
@@ -981,14 +981,14 @@
     if (Context.hasSameType(New->getType(), Old->getType()))
       MergedT = New->getType();
     // C++ [basic.types]p7:
-    //   [...] The declared type of an array object might be an array of 
-    //   unknown size and therefore be incomplete at one point in a 
+    //   [...] The declared type of an array object might be an array of
+    //   unknown size and therefore be incomplete at one point in a
     //   translation unit and complete later on; [...]
-    else if (Old->getType()->isIncompleteArrayType() && 
+    else if (Old->getType()->isIncompleteArrayType() &&
              New->getType()->isArrayType()) {
-      CanQual<ArrayType> OldArray 
+      CanQual<ArrayType> OldArray
         = Context.getCanonicalType(Old->getType())->getAs<ArrayType>();
-      CanQual<ArrayType> NewArray 
+      CanQual<ArrayType> NewArray
         = Context.getCanonicalType(New->getType())->getAs<ArrayType>();
       if (OldArray->getElementType() == NewArray->getElementType())
         MergedT = New->getType();
@@ -997,7 +997,7 @@
     MergedT = Context.mergeTypes(New->getType(), Old->getType());
   }
   if (MergedT.isNull()) {
-    Diag(New->getLocation(), diag::err_redefinition_different_type) 
+    Diag(New->getLocation(), diag::err_redefinition_different_type)
       << New->getDeclName();
     Diag(Old->getLocation(), diag::note_previous_definition);
     return New->setInvalidDecl();
@@ -1011,7 +1011,7 @@
     Diag(Old->getLocation(), diag::note_previous_definition);
     return New->setInvalidDecl();
   }
-  // C99 6.2.2p4: 
+  // C99 6.2.2p4:
   //   For an identifier declared with the storage-class specifier
   //   extern in a scope in which a prior declaration of that
   //   identifier is visible,23) if the prior declaration specifies
@@ -1030,7 +1030,7 @@
   }
 
   // Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
-  
+
   // FIXME: The test for external storage here seems wrong? We still
   // need to check for mismatches.
   if (!New->hasExternalStorage() && !New->isFileVarDecl() &&
@@ -1063,7 +1063,7 @@
 /// that functions not marked noreturn will return.
 Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) {
   llvm::OwningPtr<CFG> cfg (CFG::buildCFG(Root, &Context));
-  
+
   // FIXME: They should never return 0, fix that, delete this code.
   if (cfg == 0)
     return NeverFallThrough;
@@ -1175,7 +1175,7 @@
     if (MD->hasAttr<NoReturnAttr>())
       HasNoReturn = true;
   }
-    
+
   // Short circuit for compilation speed.
   if ((Diags.getDiagnosticLevel(diag::warn_maybe_falloff_nonvoid_function)
        == Diagnostic::Ignored || ReturnsVoid)
@@ -1228,7 +1228,7 @@
     if (FT->getNoReturnAttr())
       HasNoReturn = true;
   }
-    
+
   // Short circuit for compilation speed.
   if (ReturnsVoid
       && !HasNoReturn
@@ -1279,10 +1279,10 @@
       Param->setInvalidDecl();
       HasInvalidParm = true;
     }
-    
+
     // C99 6.9.1p5: If the declarator includes a parameter type list, the
     // declaration of each parameter shall include an identifier.
-    if (Param->getIdentifier() == 0 && 
+    if (Param->getIdentifier() == 0 &&
         !Param->isImplicit() &&
         !getLangOptions().CPlusPlus)
       Diag(Param->getLocation(), diag::err_parameter_name_omitted);
@@ -1333,7 +1333,7 @@
       return DeclPtrTy::make(Tag);
   }
 
-  if (!DS.isMissingDeclaratorOk() && 
+  if (!DS.isMissingDeclaratorOk() &&
       DS.getTypeSpecType() != DeclSpec::TST_error) {
     // Warn about typedefs of enums without names, since this is an
     // extension in both Microsoft an GNU.
@@ -1348,7 +1348,7 @@
       << DS.getSourceRange();
     return DeclPtrTy();
   }
-  
+
   return DeclPtrTy::make(Tag);
 }
 
@@ -1382,7 +1382,7 @@
         //   The names of the members of an anonymous union shall be
         //   distinct from the names of any other entity in the
         //   scope in which the anonymous union is declared.
-        unsigned diagKind 
+        unsigned diagKind
           = AnonRecord->isUnion()? diag::err_anonymous_union_member_redecl
                                  : diag::err_anonymous_struct_member_redecl;
         Diag((*F)->getLocation(), diagKind)
@@ -1403,7 +1403,7 @@
                  = (*F)->getType()->getAs<RecordType>()) {
       RecordDecl *InnerRecord = InnerRecordType->getDecl();
       if (InnerRecord->isAnonymousStructOrUnion())
-        Invalid = Invalid || 
+        Invalid = Invalid ||
           InjectAnonymousStructOrUnionMembers(S, Owner, InnerRecord);
     }
   }
@@ -1414,7 +1414,7 @@
 /// ActOnAnonymousStructOrUnion - Handle the declaration of an
 /// anonymous structure or union. Anonymous unions are a C++ feature
 /// (C++ [class.union]) and a GNU C extension; anonymous structures
-/// are a GNU C and GNU C++ extension. 
+/// are a GNU C and GNU C++ extension.
 Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
                                                   RecordDecl *Record) {
   DeclContext *Owner = Record->getDeclContext();
@@ -1424,7 +1424,7 @@
     Diag(Record->getLocation(), diag::ext_anonymous_union);
   else if (!Record->isUnion())
     Diag(Record->getLocation(), diag::ext_anonymous_struct);
-  
+
   // C and C++ require different kinds of checks for anonymous
   // structs/unions.
   bool Invalid = false;
@@ -1436,7 +1436,7 @@
     //   global namespace shall be declared static.
     if (DS.getStorageClassSpec() != DeclSpec::SCS_static &&
         (isa<TranslationUnitDecl>(Owner) ||
-         (isa<NamespaceDecl>(Owner) && 
+         (isa<NamespaceDecl>(Owner) &&
           cast<NamespaceDecl>(Owner)->getDeclName()))) {
       Diag(Record->getLocation(), diag::err_anonymous_union_not_static);
       Invalid = true;
@@ -1444,13 +1444,13 @@
       // Recover by adding 'static'.
       DS.SetStorageClassSpec(DeclSpec::SCS_static, SourceLocation(),
                              PrevSpec, DiagID);
-    } 
+    }
     // C++ [class.union]p3:
     //   A storage class is not allowed in a declaration of an
     //   anonymous union in a class scope.
     else if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified &&
              isa<RecordDecl>(Owner)) {
-      Diag(DS.getStorageClassSpecLoc(), 
+      Diag(DS.getStorageClassSpecLoc(),
            diag::err_anonymous_union_with_storage_spec);
       Invalid = true;
 
@@ -1459,7 +1459,7 @@
                              PrevSpec, DiagID);
     }
 
-    // C++ [class.union]p2: 
+    // C++ [class.union]p2:
     //   The member-specification of an anonymous union shall only
     //   define non-static data members. [Note: nested types and
     //   functions cannot be declared within an anonymous union. ]
@@ -1505,7 +1505,7 @@
           Invalid = true;
       }
     }
-  } 
+  }
 
   if (!Record->isUnion() && !Owner->isRecord()) {
     Diag(Record->getLocation(), diag::err_anonymous_struct_not_member)
@@ -1513,11 +1513,11 @@
     Invalid = true;
   }
 
-  // Create a declaration for this anonymous struct/union. 
+  // Create a declaration for this anonymous struct/union.
   NamedDecl *Anon = 0;
   if (RecordDecl *OwningClass = dyn_cast<RecordDecl>(Owner)) {
     Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(),
-                             /*IdentifierInfo=*/0, 
+                             /*IdentifierInfo=*/0,
                              Context.getTypeDeclType(Record),
                              // FIXME: Type source info.
                              /*DInfo=*/0,
@@ -1545,7 +1545,7 @@
     }
 
     Anon = VarDecl::Create(Context, Owner, Record->getLocation(),
-                           /*IdentifierInfo=*/0, 
+                           /*IdentifierInfo=*/0,
                            Context.getTypeDeclType(Record),
                            // FIXME: Type source info.
                            /*DInfo=*/0,
@@ -1569,7 +1569,7 @@
   // members of this anonymous struct/union type, because otherwise
   // the members could be injected twice: once by DeclContext when it
   // builds its lookup table, and once by
-  // InjectAnonymousStructOrUnionMembers. 
+  // InjectAnonymousStructOrUnionMembers.
   Record->setAnonymousStructOrUnion(true);
 
   if (Invalid)
@@ -1643,8 +1643,8 @@
   return true;
 }
 
-Sema::DeclPtrTy 
-Sema::HandleDeclarator(Scope *S, Declarator &D, 
+Sema::DeclPtrTy
+Sema::HandleDeclarator(Scope *S, Declarator &D,
                        MultiTemplateParamsArg TemplateParamLists,
                        bool IsFunctionDefinition) {
   DeclarationName Name = GetNameForDeclarator(D);
@@ -1658,13 +1658,13 @@
         << D.getDeclSpec().getSourceRange() << D.getSourceRange();
     return DeclPtrTy();
   }
-   
+
   // The scope passed in may not be a decl scope.  Zip up the scope tree until
   // we find one that is.
   while ((S->getFlags() & Scope::DeclScope) == 0 ||
          (S->getFlags() & Scope::TemplateParamScope) != 0)
     S = S->getParent();
-  
+
   // If this is an out-of-line definition of a member of a class template
   // or class template partial specialization, we may need to rebuild the
   // type specifier in the declarator. See RebuildTypeInCurrentInstantiation()
@@ -1689,7 +1689,7 @@
       DS.UpdateTypeRep(T.getAsOpaquePtr());
     }
   }
-  
+
   DeclContext *DC;
   NamedDecl *PrevDecl;
   NamedDecl *New;
@@ -1721,24 +1721,24 @@
       NameKind = LookupRedeclarationWithLinkage;
 
     DC = CurContext;
-    PrevDecl = LookupName(S, Name, NameKind, true, 
+    PrevDecl = LookupName(S, Name, NameKind, true,
                           NameKind == LookupRedeclarationWithLinkage,
                           D.getIdentifierLoc());
   } else { // Something like "int foo::x;"
     DC = computeDeclContext(D.getCXXScopeSpec(), true);
-    
+
     if (!DC) {
       // If we could not compute the declaration context, it's because the
       // declaration context is dependent but does not refer to a class,
       // class template, or class template partial specialization. Complain
       // and return early, to avoid the coming semantic disaster.
-      Diag(D.getIdentifierLoc(), 
+      Diag(D.getIdentifierLoc(),
            diag::err_template_qualified_declarator_no_match)
         << (NestedNameSpecifier*)D.getCXXScopeSpec().getScopeRep()
         << D.getCXXScopeSpec().getRange();
       return DeclPtrTy();
     }
-    
+
     PrevDecl = LookupQualifiedName(DC, Name, LookupOrdinaryName, true);
 
     // C++ 7.3.1.2p2:
@@ -1762,11 +1762,11 @@
     //
     // In this case, PrevDecl will point to the overload set
     // containing the two f's declared in X, but neither of them
-    // matches. 
+    // matches.
 
     // First check whether we named the global scope.
     if (isa<TranslationUnitDecl>(DC)) {
-      Diag(D.getIdentifierLoc(), diag::err_invalid_declarator_global_scope) 
+      Diag(D.getIdentifierLoc(), diag::err_invalid_declarator_global_scope)
         << Name << D.getCXXScopeSpec().getRange();
     } else if (!CurContext->Encloses(DC)) {
       // The qualifying scope doesn't enclose the original declaration.
@@ -1775,7 +1775,7 @@
       SourceRange R = D.getCXXScopeSpec().getRange();
       if (isa<FunctionDecl>(CurContext))
         Diag(L, diag::err_invalid_declarator_in_function) << Name << R;
-      else 
+      else
         Diag(L, diag::err_invalid_declarator_scope)
           << Name << cast<NamedDecl>(DC) << R;
       D.setInvalidType();
@@ -1784,10 +1784,10 @@
 
   if (PrevDecl && PrevDecl->isTemplateParameter()) {
     // Maybe we will complain about the shadowed template parameter.
-    if (!D.isInvalidType()) 
+    if (!D.isInvalidType())
       if (DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl))
         D.setInvalidType();
-    
+
     // Just pretend that we didn't see the previous declaration.
     PrevDecl = 0;
   }
@@ -1806,26 +1806,26 @@
       Diag(D.getIdentifierLoc(), diag::err_template_typedef);
       return DeclPtrTy();
     }
-      
+
     New = ActOnTypedefDeclarator(S, D, DC, R, DInfo, PrevDecl, Redeclaration);
   } else if (R->isFunctionType()) {
-    New = ActOnFunctionDeclarator(S, D, DC, R, DInfo, PrevDecl, 
+    New = ActOnFunctionDeclarator(S, D, DC, R, DInfo, PrevDecl,
                                   move(TemplateParamLists),
                                   IsFunctionDefinition, Redeclaration);
   } else {
-    New = ActOnVariableDeclarator(S, D, DC, R, DInfo, PrevDecl, 
+    New = ActOnVariableDeclarator(S, D, DC, R, DInfo, PrevDecl,
                                   move(TemplateParamLists),
                                   Redeclaration);
   }
 
   if (New == 0)
     return DeclPtrTy();
-  
+
   // If this has an identifier and is not an invalid redeclaration,
   // add it to the scope stack.
   if (Name && !(Redeclaration && New->isInvalidDecl()))
     PushOnScopeChains(New, S);
-  
+
   return DeclPtrTy::make(New);
 }
 
@@ -1857,7 +1857,7 @@
   // FIXME: We should probably handle this case
   if (VLATy->getElementType()->isVariablyModifiedType())
     return QualType();
-  
+
   Expr::EvalResult EvalResult;
   if (!VLATy->getSizeExpr() ||
       !VLATy->getSizeExpr()->Evaluate(EvalResult, Context) ||
@@ -1884,7 +1884,7 @@
 
 /// \brief Register the given locally-scoped external C declaration so
 /// that it can be found later for redeclarations
-void 
+void
 Sema::RegisterLocallyScopedExternCDecl(NamedDecl *ND, NamedDecl *PrevDecl,
                                        Scope *S) {
   assert(ND->getLexicalDeclContext()->isFunctionOrMethod() &&
@@ -1915,15 +1915,15 @@
   // FIXME: We should probably indicate the identifier in question to avoid
   // confusion for constructs like "inline int a(), b;"
   if (D.getDeclSpec().isInlineSpecified())
-    Diag(D.getDeclSpec().getInlineSpecLoc(), 
+    Diag(D.getDeclSpec().getInlineSpecLoc(),
          diag::err_inline_non_function);
 
   if (D.getDeclSpec().isVirtualSpecified())
-    Diag(D.getDeclSpec().getVirtualSpecLoc(), 
+    Diag(D.getDeclSpec().getVirtualSpecLoc(),
          diag::err_virtual_non_function);
 
   if (D.getDeclSpec().isExplicitSpecified())
-    Diag(D.getDeclSpec().getExplicitSpecLoc(), 
+    Diag(D.getDeclSpec().getExplicitSpecLoc(),
          diag::err_explicit_non_function);
 }
 
@@ -1952,7 +1952,7 @@
 
   TypedefDecl *NewTD = ParseTypedefDecl(S, D, R);
   if (!NewTD) return 0;
-  
+
   if (D.isInvalidType())
     NewTD->setInvalidDecl();
 
@@ -1970,7 +1970,7 @@
   QualType T = NewTD->getUnderlyingType();
   if (T->isVariablyModifiedType()) {
     CurFunctionNeedsScopeChecking = true;
-  
+
     if (S->getFnParent() == 0) {
       bool SizeIsNegative;
       QualType FixedTy =
@@ -2017,13 +2017,13 @@
 ///
 /// \param PrevDecl the previous declaration found by name
 /// lookup
-/// 
+///
 /// \param DC the context in which the new declaration is being
 /// declared.
 ///
 /// \returns true if PrevDecl is an out-of-scope previous declaration
 /// for a new delcaration with the same name.
-static bool 
+static bool
 isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC,
                                 ASTContext &Context) {
   if (!PrevDecl)
@@ -2057,10 +2057,10 @@
           OuterContext = OuterContext->getParent();
         while (!PrevOuterContext->isFileContext())
           PrevOuterContext = PrevOuterContext->getParent();
-          
+
         // The previous declaration is in a different namespace, so it
         // isn't the same function.
-        if (OuterContext->getPrimaryContext() != 
+        if (OuterContext->getPrimaryContext() !=
             PrevOuterContext->getPrimaryContext())
           return false;
       }
@@ -2114,7 +2114,7 @@
     // C99 6.9p2: The storage-class specifiers auto and register shall not
     // appear in the declaration specifiers in an external declaration.
     if (SC == VarDecl::Auto || SC == VarDecl::Register) {
-      
+
       // If this is a register variable with an asm label specified, then this
       // is a GNU extension.
       if (SC == VarDecl::Register && D.getAsmLabel())
@@ -2127,7 +2127,7 @@
   if (DC->isRecord() && !CurContext->isRecord()) {
     // This is an out-of-line definition of a static data member.
     if (SC == VarDecl::Static) {
-      Diag(D.getDeclSpec().getStorageClassSpecLoc(), 
+      Diag(D.getDeclSpec().getStorageClassSpecLoc(),
            diag::err_static_out_of_line)
         << CodeModificationHint::CreateRemoval(
                        SourceRange(D.getDeclSpec().getStorageClassSpecLoc()));
@@ -2137,12 +2137,12 @@
   if (SC == VarDecl::Static) {
     if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC)) {
       if (RD->isLocalClass())
-        Diag(D.getIdentifierLoc(), 
+        Diag(D.getIdentifierLoc(),
              diag::err_static_data_member_not_allowed_in_local_class)
           << Name << RD->getDeclName();
     }
   }
-        
+
   // Match up the template parameter lists with the scope specifier, then
   // determine whether we have a template or a template specialization.
   if (TemplateParameterList *TemplateParams
@@ -2161,20 +2161,20 @@
     } else {
       // There is an extraneous 'template<>' for this variable. Complain
       // about it, but allow the declaration of the variable.
-      Diag(TemplateParams->getTemplateLoc(), 
+      Diag(TemplateParams->getTemplateLoc(),
            diag::err_template_variable_noparams)
         << II
         << SourceRange(TemplateParams->getTemplateLoc(),
-                       TemplateParams->getRAngleLoc());          
+                       TemplateParams->getRAngleLoc());
     }
-  }        
-  
-  NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(), 
+  }
+
+  NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(),
                           II, R, DInfo, SC);
 
   if (D.isInvalidType())
     NewVD->setInvalidDecl();
-  
+
   if (D.getDeclSpec().isThreadSpecified()) {
     if (NewVD->hasLocalStorage())
       Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_thread_non_global);
@@ -2194,7 +2194,7 @@
   // Handle GNU asm-label extension (encoded as an attribute).
   if (Expr *E = (Expr*) D.getAsmLabel()) {
     // The parser guarantees this is a string.
-    StringLiteral *SE = cast<StringLiteral>(E);  
+    StringLiteral *SE = cast<StringLiteral>(E);
     NewVD->addAttr(::new (Context) AsmLabelAttr(std::string(SE->getStrData(),
                                                         SE->getByteLength())));
   }
@@ -2205,7 +2205,7 @@
   if (PrevDecl && !isDeclInScope(PrevDecl, DC, S) &&
       !(NewVD->hasLinkage() &&
         isOutOfScopePreviousDeclaration(PrevDecl, DC, Context)))
-    PrevDecl = 0;     
+    PrevDecl = 0;
 
   // Merge the decl with the existing one if appropriate.
   if (PrevDecl) {
@@ -2219,9 +2219,9 @@
     }
   } else if (D.getCXXScopeSpec().isSet()) {
     // No previous declaration in the qualifying scope.
-    NestedNameSpecifier *NNS = 
+    NestedNameSpecifier *NNS =
       (NestedNameSpecifier *)D.getCXXScopeSpec().getScopeRep();
-    DiagnoseMissingMember(D.getIdentifierLoc(), Name, NNS, 
+    DiagnoseMissingMember(D.getIdentifierLoc(), Name, NNS,
                           D.getCXXScopeSpec().getRange());
     NewVD->setInvalidDecl();
   }
@@ -2261,17 +2261,17 @@
   // If the decl is already known invalid, don't check it.
   if (NewVD->isInvalidDecl())
     return;
-  
+
   QualType T = NewVD->getType();
 
   if (T->isObjCInterfaceType()) {
     Diag(NewVD->getLocation(), diag::err_statically_allocated_object);
     return NewVD->setInvalidDecl();
   }
-  
+
   // The variable can not have an abstract class type.
   if (RequireNonAbstractType(NewVD->getLocation(), T,
-                             diag::err_abstract_type_in_decl, 
+                             diag::err_abstract_type_in_decl,
                              AbstractVariableType))
     return NewVD->setInvalidDecl();
 
@@ -2292,19 +2292,19 @@
   if (isVM || NewVD->hasAttr<CleanupAttr>() ||
       NewVD->hasAttr<BlocksAttr>())
     CurFunctionNeedsScopeChecking = true;
-  
+
   if ((isVM && NewVD->hasLinkage()) ||
       (T->isVariableArrayType() && NewVD->hasGlobalStorage())) {
     bool SizeIsNegative;
     QualType FixedTy =
         TryToFixInvalidVariablyModifiedType(T, Context, SizeIsNegative);
-    
+
     if (FixedTy.isNull() && T->isVariableArrayType()) {
       const VariableArrayType *VAT = Context.getAsVariableArrayType(T);
-      // FIXME: This won't give the correct result for 
-      // int a[10][n];      
+      // FIXME: This won't give the correct result for
+      // int a[10][n];
       SourceRange SizeRange = VAT->getSizeExpr()->getSourceRange();
-      
+
       if (NewVD->isFileVarDecl())
         Diag(NewVD->getLocation(), diag::err_vla_decl_in_file_scope)
         << SizeRange;
@@ -2315,8 +2315,8 @@
         Diag(NewVD->getLocation(), diag::err_vla_decl_has_extern_linkage)
         << SizeRange;
       return NewVD->setInvalidDecl();
-    } 
-    
+    }
+
     if (FixedTy.isNull()) {
       if (NewVD->isFileVarDecl())
         Diag(NewVD->getLocation(), diag::err_vm_decl_in_file_scope);
@@ -2324,7 +2324,7 @@
         Diag(NewVD->getLocation(), diag::err_vm_decl_has_extern_linkage);
       return NewVD->setInvalidDecl();
     }
-    
+
     Diag(NewVD->getLocation(), diag::warn_illegal_constant_array_size);
     NewVD->setType(FixedTy);
   }
@@ -2349,7 +2349,7 @@
     Diag(NewVD->getLocation(), diag::err_block_on_nonlocal);
     return NewVD->setInvalidDecl();
   }
-    
+
   if (isVM && NewVD->hasAttr<BlocksAttr>()) {
     Diag(NewVD->getLocation(), diag::err_block_on_vm);
     return NewVD->setInvalidDecl();
@@ -2365,7 +2365,7 @@
   return isa<UsingDecl>(D) || isa<UnresolvedUsingDecl>(D);
 }
 
-NamedDecl* 
+NamedDecl*
 Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
                               QualType R, DeclaratorInfo *DInfo,
                               NamedDecl* PrevDecl,
@@ -2380,7 +2380,7 @@
   case DeclSpec::SCS_auto:
   case DeclSpec::SCS_register:
   case DeclSpec::SCS_mutable:
-    Diag(D.getDeclSpec().getStorageClassSpecLoc(), 
+    Diag(D.getDeclSpec().getStorageClassSpecLoc(),
          diag::err_typecheck_sclass_func);
     D.setInvalidType();
     break;
@@ -2393,11 +2393,11 @@
       //   block scope shall have no explicit storage-class specifier
       //   other than extern
       // See also (C++ [dcl.stc]p4).
-      Diag(D.getDeclSpec().getStorageClassSpecLoc(), 
+      Diag(D.getDeclSpec().getStorageClassSpecLoc(),
            diag::err_static_block_func);
       SC = FunctionDecl::None;
     } else
-      SC = FunctionDecl::Static; 
+      SC = FunctionDecl::Static;
     break;
   }
   case DeclSpec::SCS_private_extern: SC = FunctionDecl::PrivateExtern;break;
@@ -2413,14 +2413,14 @@
 
   // Check that the return type is not an abstract class type.
   // For record types, this is done by the AbstractClassUsageDiagnoser once
-  // the class has been completely parsed. 
+  // the class has been completely parsed.
   if (!DC->isRecord() &&
-      RequireNonAbstractType(D.getIdentifierLoc(), 
+      RequireNonAbstractType(D.getIdentifierLoc(),
                              R->getAsFunctionType()->getResultType(),
-                             diag::err_abstract_type_in_decl, 
+                             diag::err_abstract_type_in_decl,
                              AbstractReturnType))
     D.setInvalidType();
-  
+
   // Do not allow returning a objc interface by-value.
   if (R->getAsFunctionType()->getResultType()->isObjCInterfaceType()) {
     Diag(D.getIdentifierLoc(),
@@ -2451,7 +2451,7 @@
     R = CheckConstructorDeclarator(D, R, SC);
 
     // Create the new declaration
-    NewFD = CXXConstructorDecl::Create(Context, 
+    NewFD = CXXConstructorDecl::Create(Context,
                                        cast<CXXRecordDecl>(DC),
                                        D.getIdentifierLoc(), Name, R, DInfo,
                                        isExplicit, isInline,
@@ -2460,10 +2460,10 @@
     // This is a C++ destructor declaration.
     if (DC->isRecord()) {
       R = CheckDestructorDeclarator(D, SC);
-      
+
       NewFD = CXXDestructorDecl::Create(Context,
                                         cast<CXXRecordDecl>(DC),
-                                        D.getIdentifierLoc(), Name, R, 
+                                        D.getIdentifierLoc(), Name, R,
                                         isInline,
                                         /*isImplicitlyDeclared=*/false);
 
@@ -2474,7 +2474,7 @@
       // Create a FunctionDecl to satisfy the function definition parsing
       // code path.
       NewFD = FunctionDecl::Create(Context, DC, D.getIdentifierLoc(),
-                                   Name, R, DInfo, SC, isInline, 
+                                   Name, R, DInfo, SC, isInline,
                                    /*hasPrototype=*/true);
       D.setInvalidType();
     }
@@ -2484,26 +2484,26 @@
            diag::err_conv_function_not_member);
       return 0;
     }
-    
+
     CheckConversionDeclarator(D, R, SC);
     NewFD = CXXConversionDecl::Create(Context, cast<CXXRecordDecl>(DC),
                                       D.getIdentifierLoc(), Name, R, DInfo,
                                       isInline, isExplicit);
-      
+
     isVirtualOkay = true;
   } else if (DC->isRecord()) {
     // If the of the function is the same as the name of the record, then this
-    // must be an invalid constructor that has a return type. 
-    // (The parser checks for a return type and makes the declarator a 
+    // must be an invalid constructor that has a return type.
+    // (The parser checks for a return type and makes the declarator a
     // constructor if it has no return type).
-    // must have an invalid constructor that has a return type 
+    // must have an invalid constructor that has a return type
     if (Name.getAsIdentifierInfo() == cast<CXXRecordDecl>(DC)->getIdentifier()){
       Diag(D.getIdentifierLoc(), diag::err_constructor_return_type)
         << SourceRange(D.getDeclSpec().getTypeSpecTypeLoc())
         << SourceRange(D.getIdentifierLoc());
       return 0;
     }
-    
+
     // This is a C++ method declaration.
     NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC),
                                   D.getIdentifierLoc(), Name, R, DInfo,
@@ -2517,11 +2517,11 @@
     //   - there is a prototype in the declarator, or
     //   - the type R of the function is some kind of typedef or other reference
     //     to a type name (which eventually refers to a function type).
-    bool HasPrototype = 
+    bool HasPrototype =
        getLangOptions().CPlusPlus ||
        (D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype) ||
        (!isa<FunctionType>(R.getTypePtr()) && R->isFunctionProtoType());
-    
+
     NewFD = FunctionDecl::Create(Context, DC,
                                  D.getIdentifierLoc(),
                                  Name, R, DInfo, SC, isInline, HasPrototype);
@@ -2529,7 +2529,7 @@
 
   if (D.isInvalidType())
     NewFD->setInvalidDecl();
-  
+
   // Set the lexical context. If the declarator has a C++
   // scope specifier, or is the object of a friend declaration, the
   // lexical context will be different from the semantic context.
@@ -2549,11 +2549,11 @@
                                                   TemplateParamLists.size())) {
     if (TemplateParams->size() > 0) {
       // This is a function template
-      
+
       // Check that we can declare a template here.
       if (CheckTemplateDeclScope(S, TemplateParams))
         return 0;
-      
+
       FunctionTemplate = FunctionTemplateDecl::Create(Context, DC,
                                                       NewFD->getLocation(),
                                                       Name, TemplateParams,
@@ -2563,11 +2563,11 @@
     } else {
       // FIXME: Handle function template specializations
     }
-          
+
     // FIXME: Free this memory properly.
     TemplateParamLists.release();
-  }        
-  
+  }
+
   // C++ [dcl.fct.spec]p5:
   //   The virtual specifier shall only be used in declarations of
   //   nonstatic class member functions that appear within a
@@ -2575,7 +2575,7 @@
   //
   if (isVirtual && !NewFD->isInvalidDecl()) {
     if (!isVirtualOkay) {
-       Diag(D.getDeclSpec().getVirtualSpecLoc(), 
+       Diag(D.getDeclSpec().getVirtualSpecLoc(),
            diag::err_virtual_non_function);
     } else if (!CurContext->isRecord()) {
       // 'virtual' was specified outside of the class.
@@ -2600,9 +2600,9 @@
     // Look for virtual methods in base classes that this method might override.
 
     BasePaths Paths;
-    if (LookupInBases(cast<CXXRecordDecl>(DC), 
+    if (LookupInBases(cast<CXXRecordDecl>(DC),
                       MemberLookupCriteria(NewMD), Paths)) {
-      for (BasePaths::decl_iterator I = Paths.found_decls_begin(), 
+      for (BasePaths::decl_iterator I = Paths.found_decls_begin(),
            E = Paths.found_decls_end(); I != E; ++I) {
         if (CXXMethodDecl *OldMD = dyn_cast<CXXMethodDecl>(*I)) {
           if (!CheckOverridingFunctionReturnType(NewMD, OldMD) &&
@@ -2612,8 +2612,8 @@
       }
     }
   }
-  
-  if (SC == FunctionDecl::Static && isa<CXXMethodDecl>(NewFD) && 
+
+  if (SC == FunctionDecl::Static && isa<CXXMethodDecl>(NewFD) &&
       !CurContext->isRecord()) {
     // C++ [class.static]p1:
     //   A data or function member of a class may be declared static
@@ -2622,7 +2622,7 @@
 
     // Complain about the 'static' specifier if it's on an out-of-line
     // member function definition.
-    Diag(D.getDeclSpec().getStorageClassSpecLoc(), 
+    Diag(D.getDeclSpec().getStorageClassSpecLoc(),
          diag::err_static_out_of_line)
       << CodeModificationHint::CreateRemoval(
                       SourceRange(D.getDeclSpec().getStorageClassSpecLoc()));
@@ -2631,7 +2631,7 @@
   // Handle GNU asm-label extension (encoded as an attribute).
   if (Expr *E = (Expr*) D.getAsmLabel()) {
     // The parser guarantees this is a string.
-    StringLiteral *SE = cast<StringLiteral>(E);  
+    StringLiteral *SE = cast<StringLiteral>(E);
     NewFD->addAttr(::new (Context) AsmLabelAttr(std::string(SE->getStrData(),
                                                         SE->getByteLength())));
   }
@@ -2667,7 +2667,7 @@
         Params.push_back(Param);
       }
     }
-  
+
   } else if (const FunctionProtoType *FT = R->getAsFunctionProtoType()) {
     // When we're declaring a function with a typedef, typeof, etc as in the
     // following example, we'll need to synthesize (unnamed)
@@ -2677,7 +2677,7 @@
     // typedef void fn(int);
     // fn f;
     // @endcode
-    
+
     // Synthesize a parameter for each argument type.
     for (FunctionProtoType::arg_type_iterator AI = FT->arg_type_begin(),
          AE = FT->arg_type_end(); AI != AE; ++AI) {
@@ -2694,7 +2694,7 @@
   }
   // Finally, we know we have the right number of parameters, install them.
   NewFD->setParams(Context, Params.data(), Params.size());
-    
+
   // If name lookup finds a previous declaration that is not in the
   // same scope as the new declaration, this may still be an
   // acceptable redeclaration.
@@ -2718,12 +2718,12 @@
     } else if (!Redeclaration && (!PrevDecl || !isUsingDecl(PrevDecl))) {
       // The user tried to provide an out-of-line definition for a
       // function that is a member of a class or namespace, but there
-      // was no such member function declared (C++ [class.mfct]p2, 
+      // was no such member function declared (C++ [class.mfct]p2,
       // C++ [namespace.memdef]p2). For example:
-      // 
+      //
       // class X {
       //   void f() const;
-      // }; 
+      // };
       //
       // void X::f() { } // ill-formed
       //
@@ -2733,10 +2733,10 @@
       Diag(D.getIdentifierLoc(), diag::err_member_def_does_not_match)
         << cast<NamedDecl>(DC) << D.getCXXScopeSpec().getRange();
       NewFD->setInvalidDecl();
-      
-      LookupResult Prev = LookupQualifiedName(DC, Name, LookupOrdinaryName, 
+
+      LookupResult Prev = LookupQualifiedName(DC, Name, LookupOrdinaryName,
                                               true);
-      assert(!Prev.isAmbiguous() && 
+      assert(!Prev.isAmbiguous() &&
              "Cannot have an ambiguity in previous-declaration lookup");
       for (LookupResult::iterator Func = Prev.begin(), FuncEnd = Prev.end();
            Func != FuncEnd; ++Func) {
@@ -2744,7 +2744,7 @@
             isNearlyMatchingFunction(Context, cast<FunctionDecl>(*Func), NewFD))
           Diag((*Func)->getLocation(), diag::note_member_def_close_match);
       }
-      
+
       PrevDecl = 0;
     }
   }
@@ -2772,7 +2772,7 @@
     Diag(NewFD->getLocation(), diag::err_attribute_overloadable_missing)
       << Redeclaration << NewFD;
     if (PrevDecl)
-      Diag(PrevDecl->getLocation(), 
+      Diag(PrevDecl->getLocation(),
            diag::note_attribute_overloadable_prev_overload);
     NewFD->addAttr(::new (Context) OverloadableAttr());
   }
@@ -2788,10 +2788,10 @@
 
   if (FunctionTemplate && NewFD->isInvalidDecl())
     FunctionTemplate->setInvalidDecl();
-  
+
   if (FunctionTemplate)
     return FunctionTemplate;
-  
+
   return NewFD;
 }
 
@@ -2831,27 +2831,27 @@
       CXXRecordDecl *Record = cast<CXXRecordDecl>(NewFD->getParent());
       QualType ClassType = Context.getTypeDeclType(Record);
       if (!ClassType->isDependentType()) {
-        DeclarationName Name 
+        DeclarationName Name
           = Context.DeclarationNames.getCXXDestructorName(
                                         Context.getCanonicalType(ClassType));
         if (NewFD->getDeclName() != Name) {
           Diag(NewFD->getLocation(), diag::err_destructor_name);
-          return NewFD->setInvalidDecl();  
+          return NewFD->setInvalidDecl();
         }
       }
       Record->setUserDeclaredDestructor(true);
       // C++ [class]p4: A POD-struct is an aggregate class that has [...] no
       // user-defined destructor.
       Record->setPOD(false);
-      
+
       // C++ [class.dtor]p3: A destructor is trivial if it is an implicitly-
       // declared destructor.
       // FIXME: C++0x: don't do this for "= default" destructors
       Record->setHasTrivialDestructor(false);
-    } else if (CXXConversionDecl *Conversion 
+    } else if (CXXConversionDecl *Conversion
                = dyn_cast<CXXConversionDecl>(NewFD))
       ActOnConversionDeclarator(Conversion);
-    
+
     // Extra checking for C++ overloaded operators (C++ [over.oper]).
     if (NewFD->isOverloadedOperator() &&
         CheckOverloadedOperatorDeclaration(NewFD))
@@ -2871,7 +2871,7 @@
   // Here we determine whether this function, in isolation, would be a
   // C99 inline definition. MergeCompatibleFunctionDecls looks at
   // previous declarations.
-  if (NewFD->isInline() && getLangOptions().C99 && 
+  if (NewFD->isInline() && getLangOptions().C99 &&
       NewFD->getStorageClass() == FunctionDecl::None &&
       NewFD->getDeclContext()->getLookupContext()->isTranslationUnit())
     NewFD->setC99InlineDefinition(true);
@@ -2917,7 +2917,7 @@
     }
 
     if (PrevDecl &&
-        (!AllowOverloadingOfFunction(PrevDecl, Context) || 
+        (!AllowOverloadingOfFunction(PrevDecl, Context) ||
          !IsOverload(NewFD, PrevDecl, MatchedDecl)) && !isUsingDecl(PrevDecl)) {
       Redeclaration = true;
       Decl *OldDecl = PrevDecl;
@@ -2928,7 +2928,7 @@
         OldDecl = *MatchedDecl;
 
       // NewFD and OldDecl represent declarations that need to be
-      // merged. 
+      // merged.
       if (MergeFunctionDecl(NewFD, OldDecl))
         return NewFD->setInvalidDecl();
 
@@ -2970,7 +2970,7 @@
   QualType T = FD->getType();
   assert(T->isFunctionType() && "function decl is not of function type");
   const FunctionType* FT = T->getAsFunctionType();
-  
+
   if (!Context.hasSameUnqualifiedType(FT->getResultType(), Context.IntTy)) {
     // TODO: add a replacement fixit to turn the return type into 'int'.
     Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint);
@@ -3061,7 +3061,7 @@
   // the initializer.
   if (RealDecl == 0)
     return;
-  
+
   if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(RealDecl)) {
     // With declarators parsed the way they are, the parser cannot
     // distinguish between a normal initializer and a pure-specifier.
@@ -3110,7 +3110,7 @@
 
   const VarDecl *Def = 0;
   if (VDecl->getDefinition(Def)) {
-    Diag(VDecl->getLocation(), diag::err_redefinition) 
+    Diag(VDecl->getLocation(), diag::err_redefinition)
       << VDecl->getDeclName();
     Diag(Def->getLocation(), diag::note_previous_definition);
     VDecl->setInvalidDecl();
@@ -3133,7 +3133,7 @@
       if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
                                 VDecl->getDeclName(), DirectInit))
         VDecl->setInvalidDecl();
-      
+
       // C++ 3.6.2p2, allow dynamic initialization of static initializers.
       // Don't check invalid declarations to avoid emitting useless diagnostics.
       if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl()) {
@@ -3141,7 +3141,7 @@
           CheckForConstantInitializer(Init, DclT);
       }
     }
-  } else if (VDecl->isStaticDataMember() && 
+  } else if (VDecl->isStaticDataMember() &&
              VDecl->getLexicalDeclContext()->isRecord()) {
     // This is an in-class initialization for a static data member, e.g.,
     //
@@ -3157,7 +3157,7 @@
     //   if it declares a static member (9.4) of const integral or
     //   const enumeration type, see 9.4.2.
     QualType T = VDecl->getType();
-    if (!T->isDependentType() && 
+    if (!T->isDependentType() &&
         (!Context.getCanonicalType(T).isConstQualified() ||
          !T->isIntegralType())) {
       Diag(VDecl->getLocation(), diag::err_member_initialization)
@@ -3172,7 +3172,7 @@
       if (!Init->isTypeDependent() &&
           !Init->getType()->isIntegralType()) {
         // We have a non-dependent, non-integral or enumeration type.
-        Diag(Init->getSourceRange().getBegin(), 
+        Diag(Init->getSourceRange().getBegin(),
              diag::err_in_class_initializer_non_integral_type)
           << Init->getType() << Init->getSourceRange();
         VDecl->setInvalidDecl();
@@ -3195,7 +3195,7 @@
       if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
                                 VDecl->getDeclName(), DirectInit))
         VDecl->setInvalidDecl();
-    
+
     // C++ 3.6.2p2, allow dynamic initialization of static initializers.
     // Don't check invalid declarations to avoid emitting useless diagnostics.
     if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl()) {
@@ -3204,15 +3204,15 @@
     }
   }
   // If the type changed, it means we had an incomplete type that was
-  // completed by the initializer. For example: 
+  // completed by the initializer. For example:
   //   int ary[] = { 1, 3, 5 };
   // "ary" transitions from a VariableArrayType to a ConstantArrayType.
   if (!VDecl->isInvalidDecl() && (DclT != SavT)) {
     VDecl->setType(DclT);
     Init->setType(DclT);
   }
-    
-  Init = MaybeCreateCXXExprWithTemporaries(Init, 
+
+  Init = MaybeCreateCXXExprWithTemporaries(Init,
                                            /*ShouldDestroyTemporaries=*/true);
   // Attach the initializer to the decl.
   VDecl->setInit(Context, Init);
@@ -3228,7 +3228,7 @@
   return;
 }
 
-void Sema::ActOnUninitializedDecl(DeclPtrTy dcl, 
+void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
                                   bool TypeContainsUndeducedAuto) {
   Decl *RealDecl = dcl.getAs<Decl>();
 
@@ -3242,9 +3242,9 @@
     // Record tentative definitions.
     if (Var->isTentativeDefinition(Context)) {
       std::pair<llvm::DenseMap<DeclarationName, VarDecl *>::iterator, bool>
-        InsertPair = 
+        InsertPair =
            TentativeDefinitions.insert(std::make_pair(Var->getDeclName(), Var));
-      
+
       // Keep the latest definition in the map.  If we see 'int i; int i;' we
       // want the second one in the map.
       InsertPair.first->second = Var;
@@ -3276,7 +3276,7 @@
       Var->setInvalidDecl();
       return;
     }
-    
+
     // C++ [dcl.init]p9:
     //
     //   If no initializer is specified for an object, and the object
@@ -3290,13 +3290,13 @@
         InitType = Array->getElementType();
       if ((!Var->hasExternalStorage() && !Var->isExternC(Context)) &&
           InitType->isRecordType() && !InitType->isDependentType()) {
-        CXXRecordDecl *RD = 
+        CXXRecordDecl *RD =
           cast<CXXRecordDecl>(InitType->getAs<RecordType>()->getDecl());
         CXXConstructorDecl *Constructor = 0;
-        if (!RequireCompleteType(Var->getLocation(), InitType, 
+        if (!RequireCompleteType(Var->getLocation(), InitType,
                                     diag::err_invalid_incomplete_type_use))
           Constructor
-            = PerformInitializationByConstructor(InitType, 0, 0, 
+            = PerformInitializationByConstructor(InitType, 0, 0,
                                                  Var->getLocation(),
                                                SourceRange(Var->getLocation(),
                                                            Var->getLocation()),
@@ -3304,13 +3304,13 @@
                                                  IK_Default);
         if (!Constructor)
           Var->setInvalidDecl();
-        else { 
+        else {
           if (!RD->hasTrivialConstructor() || !RD->hasTrivialDestructor()) {
-            if (InitializeVarWithConstructor(Var, Constructor, InitType, 
+            if (InitializeVarWithConstructor(Var, Constructor, InitType,
                                              MultiExprArg(*this)))
               Var->setInvalidDecl();
           }
-          
+
           FinalizeVarWithDestructor(Var, InitType);
         }
       }
@@ -3318,7 +3318,7 @@
 
 #if 0
     // FIXME: Temporarily disabled because we are not properly parsing
-    // linkage specifications on declarations, e.g., 
+    // linkage specifications on declarations, e.g.,
     //
     //   extern "C" const CGPoint CGPointerZero;
     //
@@ -3360,7 +3360,7 @@
   for (unsigned i = 0; i != NumDecls; ++i)
     if (Decl *D = Group[i].getAs<Decl>())
       Decls.push_back(D);
-  
+
   // Perform semantic analysis that depends on having fully processed both
   // the declarator and initializer.
   for (unsigned i = 0, e = Decls.size(); i != e; ++i) {
@@ -3368,12 +3368,12 @@
     if (!IDecl)
       continue;
     QualType T = IDecl->getType();
-    
+
     // Block scope. C99 6.7p7: If an identifier for an object is declared with
     // no linkage (C99 6.2.2p6), the type for the object shall be complete...
     if (IDecl->isBlockVarDecl() && !IDecl->hasExternalStorage()) {
       if (!IDecl->isInvalidDecl() &&
-          RequireCompleteType(IDecl->getLocation(), T, 
+          RequireCompleteType(IDecl->getLocation(), T,
                               diag::err_typecheck_decl_incomplete_type))
         IDecl->setInvalidDecl();
     }
@@ -3412,7 +3412,7 @@
 
 /// ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator()
 /// to introduce parameters into function prototype scope.
-Sema::DeclPtrTy 
+Sema::DeclPtrTy
 Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
   const DeclSpec &DS = D.getDeclSpec();
 
@@ -3435,12 +3435,12 @@
   // parameter (C++ only).
   if (getLangOptions().CPlusPlus)
     CheckExtraCXXDefaultArguments(D);
- 
+
   DeclaratorInfo *DInfo = 0;
   TagDecl *OwnedDecl = 0;
   QualType parmDeclType = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0,
                                                &OwnedDecl);
-  
+
   if (getLangOptions().CPlusPlus && OwnedDecl && OwnedDecl->isDefinition()) {
     // C++ [dcl.fct]p6:
     //   Types shall not be defined in return or parameter types.
@@ -3471,26 +3471,26 @@
 
   // Parameters can not be abstract class types.
   // For record types, this is done by the AbstractClassUsageDiagnoser once
-  // the class has been completely parsed. 
-  if (!CurContext->isRecord() && 
-      RequireNonAbstractType(D.getIdentifierLoc(), parmDeclType, 
+  // the class has been completely parsed.
+  if (!CurContext->isRecord() &&
+      RequireNonAbstractType(D.getIdentifierLoc(), parmDeclType,
                              diag::err_abstract_type_in_decl,
                              AbstractParamType))
     D.setInvalidType(true);
 
   QualType T = adjustParameterType(parmDeclType);
-  
+
   ParmVarDecl *New;
   if (T == parmDeclType) // parameter type did not need adjustment
-    New = ParmVarDecl::Create(Context, CurContext, 
+    New = ParmVarDecl::Create(Context, CurContext,
                               D.getIdentifierLoc(), II,
-                              parmDeclType, DInfo, StorageClass, 
+                              parmDeclType, DInfo, StorageClass,
                               0);
   else // keep track of both the adjusted and unadjusted types
-    New = OriginalParmVarDecl::Create(Context, CurContext, 
+    New = OriginalParmVarDecl::Create(Context, CurContext,
                                       D.getIdentifierLoc(), II, T, DInfo,
                                       parmDeclType, StorageClass, 0);
-  
+
   if (D.isInvalidType())
     New->setInvalidDecl();
 
@@ -3501,7 +3501,7 @@
          diag::err_object_cannot_be_passed_returned_by_value) << 1 << T;
     New->setInvalidDecl();
   }
-  
+
   // Parameter declarators cannot be qualified (C++ [dcl.meaning]p1).
   if (D.getCXXScopeSpec().isSet()) {
     Diag(D.getIdentifierLoc(), diag::err_qualified_param_declarator)
@@ -3546,14 +3546,14 @@
         DeclSpec DS;
         const char* PrevSpec; // unused
         unsigned DiagID; // unused
-        DS.SetTypeSpecType(DeclSpec::TST_int, FTI.ArgInfo[i].IdentLoc, 
+        DS.SetTypeSpecType(DeclSpec::TST_int, FTI.ArgInfo[i].IdentLoc,
                            PrevSpec, DiagID);
         Declarator ParamD(DS, Declarator::KNRTypeListContext);
         ParamD.SetIdentifier(FTI.ArgInfo[i].Ident, FTI.ArgInfo[i].IdentLoc);
         FTI.ArgInfo[i].Param = ActOnParamDeclarator(S, ParamD);
       }
     }
-  } 
+  }
 }
 
 Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope,
@@ -3564,12 +3564,12 @@
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
 
   if (FTI.hasPrototype) {
-    // FIXME: Diagnose arguments without names in C. 
+    // FIXME: Diagnose arguments without names in C.
   }
-  
+
   Scope *ParentScope = FnBodyScope->getParent();
 
-  DeclPtrTy DP = HandleDeclarator(ParentScope, D, 
+  DeclPtrTy DP = HandleDeclarator(ParentScope, D,
                                   MultiTemplateParamsArg(*this),
                                   /*IsFunctionDefinition=*/true);
   return ActOnStartOfFunctionDef(FnBodyScope, DP);
@@ -3579,15 +3579,15 @@
   if (!D)
     return D;
   FunctionDecl *FD = 0;
-  
-  if (FunctionTemplateDecl *FunTmpl 
+
+  if (FunctionTemplateDecl *FunTmpl
         = dyn_cast<FunctionTemplateDecl>(D.getAs<Decl>()))
     FD = FunTmpl->getTemplatedDecl();
   else
     FD = cast<FunctionDecl>(D.getAs<Decl>());
 
   CurFunctionNeedsScopeChecking = false;
-  
+
   // See if this is a redefinition.
   const FunctionDecl *Definition;
   if (FD->getBody(Definition)) {
@@ -3653,7 +3653,7 @@
 
   // Checking attributes of current function definition
   // dllimport attribute.
-  if (FD->getAttr<DLLImportAttr>() && 
+  if (FD->getAttr<DLLImportAttr>() &&
       (!FD->getAttr<DLLExportAttr>())) {
     // dllimport attribute cannot be applied to definition.
     if (!(FD->getAttr<DLLImportAttr>())->isInherited()) {
@@ -3698,23 +3698,23 @@
       FD->setHasImplicitReturnZero(true);
     else
       CheckFallThroughForFunctionDef(FD, Body);
-    
+
     if (!FD->isInvalidDecl())
       DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
-    
+
     // C++ [basic.def.odr]p2:
     //   [...] A virtual member function is used if it is not pure. [...]
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FD))
       if (Method->isVirtual() && !Method->isPure())
         MarkDeclarationReferenced(Method->getLocation(), Method);
-    
+
     assert(FD == getCurFunctionDecl() && "Function parsing confused");
   } else if (ObjCMethodDecl *MD = dyn_cast_or_null<ObjCMethodDecl>(dcl)) {
     assert(MD == getCurMethodDecl() && "Method parsing confused");
     MD->setBody(Body);
     CheckFallThroughForFunctionDef(MD, Body);
     MD->setEndLoc(Body->getLocEnd());
-    
+
     if (!MD->isInvalidDecl())
       DiagnoseUnusedParameters(MD->param_begin(), MD->param_end());
   } else {
@@ -3727,21 +3727,21 @@
   // Verify and clean out per-function state.
 
   assert(&getLabelMap() == &FunctionLabelMap && "Didn't pop block right?");
-  
+
   // Check goto/label use.
   for (llvm::DenseMap<IdentifierInfo*, LabelStmt*>::iterator
        I = FunctionLabelMap.begin(), E = FunctionLabelMap.end(); I != E; ++I) {
     LabelStmt *L = I->second;
-    
+
     // Verify that we have no forward references left.  If so, there was a goto
     // or address of a label taken, but no definition of it.  Label fwd
     // definitions are indicated with a null substmt.
     if (L->getSubStmt() != 0)
       continue;
-    
+
     // Emit error.
     Diag(L->getIdentLoc(), diag::err_undeclared_label_use) << L->getName();
-    
+
     // At this point, we have gotos that use the bogus label.  Stitch it into
     // the function body so that they aren't leaked and that the AST is well
     // formed.
@@ -3750,7 +3750,7 @@
       L->Destroy(Context);
       continue;
     }
-    
+
     // Otherwise, the body is valid: we want to stitch the label decl into the
     // function somewhere so that it is properly owned and so that the goto
     // has a valid target.  Do this by creating a new compound stmt with the
@@ -3773,13 +3773,13 @@
   // Verify that that gotos and switch cases don't jump into scopes illegally.
   if (CurFunctionNeedsScopeChecking)
     DiagnoseInvalidJumps(Body);
-  
-  // C++ constructors that have function-try-blocks can't have return 
-  // statements in the handlers of that block. (C++ [except.handle]p14) 
+
+  // C++ constructors that have function-try-blocks can't have return
+  // statements in the handlers of that block. (C++ [except.handle]p14)
   // Verify this.
   if (FD && isa<CXXConstructorDecl>(FD) && isa<CXXTryStmt>(Body))
     DiagnoseReturnInConstructorExceptionHandler(cast<CXXTryStmt>(Body));
-  
+
   if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl))
     computeBaseOrMembersToDestroy(Destructor);
   return D;
@@ -3787,7 +3787,7 @@
 
 /// ImplicitlyDefineFunction - An undeclared identifier was used in a function
 /// call, forming a call to an implicitly defined function (per C99 6.5.1p2).
-NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, 
+NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
                                           IdentifierInfo &II, Scope *S) {
   // Before we produce a declaration for an implicitly defined
   // function, see whether there was a locally-scoped declaration of
@@ -3806,7 +3806,7 @@
     Diag(Loc, diag::ext_implicit_function_decl) << &II;
   else
     Diag(Loc, diag::warn_implicit_function_decl) << &II;
-  
+
   // FIXME: handle stuff like:
   // void foo() { extern float X(); }
   // void bar() { X(); }  <-- implicit decl for X in another scope.
@@ -3829,8 +3829,8 @@
 
   DeclContext *PrevDC = CurContext;
   CurContext = Context.getTranslationUnitDecl();
- 
-  FunctionDecl *FD = 
+
+  FunctionDecl *FD =
  dyn_cast<FunctionDecl>(ActOnDeclarator(TUScope, D).getAs<Decl>());
   FD->setImplicit();
 
@@ -3879,10 +3879,10 @@
   IdentifierInfo *Name = FD->getIdentifier();
   if (!Name)
     return;
-  if ((!getLangOptions().CPlusPlus && 
+  if ((!getLangOptions().CPlusPlus &&
        FD->getDeclContext()->isTranslationUnit()) ||
       (isa<LinkageSpecDecl>(FD->getDeclContext()) &&
-       cast<LinkageSpecDecl>(FD->getDeclContext())->getLanguage() == 
+       cast<LinkageSpecDecl>(FD->getDeclContext())->getLanguage() ==
        LinkageSpecDecl::lang_c)) {
     // Okay: this could be a libc/libm/Objective-C function we know
     // about.
@@ -3894,12 +3894,12 @@
     if (const FormatAttr *Format = FD->getAttr<FormatAttr>()) {
       // FIXME: We known better than our headers.
       const_cast<FormatAttr *>(Format)->setType("printf");
-    } else 
+    } else
       FD->addAttr(::new (Context) FormatAttr("printf", 1,
                                              Name->isStr("NSLogv") ? 0 : 2));
   } else if (Name->isStr("asprintf") || Name->isStr("vasprintf")) {
     // FIXME: asprintf and vasprintf aren't C99 functions. Should they be
-    // target-specific builtins, perhaps? 
+    // target-specific builtins, perhaps?
     if (!FD->getAttr<FormatAttr>())
       FD->addAttr(::new (Context) FormatAttr("printf", 2,
                                              Name->isStr("vasprintf") ? 0 : 3));
@@ -3909,16 +3909,16 @@
 TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T) {
   assert(D.getIdentifier() && "Wrong callback for declspec without declarator");
   assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
-  
+
   // Scope manipulation handled by caller.
   TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext,
                                            D.getIdentifierLoc(),
-                                           D.getIdentifier(), 
+                                           D.getIdentifier(),
                                            T);
-  
+
   if (const TagType *TT = T->getAs<TagType>()) {
     TagDecl *TD = TT->getDecl();
-    
+
     // If the TagDecl that the TypedefDecl points to is an anonymous decl
     // keep track of the TypedefDecl.
     if (!TD->getIdentifier() && !TD->getTypedefForAnonDecl())
@@ -3935,7 +3935,7 @@
 /// as a redeclaration of the given tag declaration.
 ///
 /// \returns true if the new tag kind is acceptable, false otherwise.
-bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous, 
+bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous,
                                         TagDecl::TagKind NewTag,
                                         SourceLocation NewTagLoc,
                                         const IdentifierInfo &Name) {
@@ -3955,7 +3955,7 @@
   TagDecl::TagKind OldTag = Previous->getTagKind();
   if (OldTag == NewTag)
     return true;
- 
+
   if ((OldTag == TagDecl::TK_struct || OldTag == TagDecl::TK_class) &&
       (NewTag == TagDecl::TK_struct || NewTag == TagDecl::TK_class)) {
     // Warn about the struct/class tag mismatch.
@@ -3990,7 +3990,7 @@
 
   OwnedDecl = false;
   TagDecl::TagKind Kind = TagDecl::getTagKindForTypeSpec(TagSpec);
-  
+
   if (TUK != TUK_Reference) {
     if (TemplateParameterList *TemplateParams
           = MatchTemplateParametersToScopeSpecifier(KWLoc, SS,
@@ -4011,9 +4011,9 @@
         // slightly better in ParseTemplate.cpp from bogus template
         // parameters.
       }
-    }        
-  }  
-  
+    }
+  }
+
   DeclContext *SearchDC = CurContext;
   DeclContext *DC = CurContext;
   NamedDecl *PrevDecl = 0;
@@ -4035,7 +4035,7 @@
     DC = computeDeclContext(SS, true);
     SearchDC = DC;
     // Look-up name inside 'foo::'.
-    PrevDecl 
+    PrevDecl
       = dyn_cast_or_null<TagDecl>(
                LookupQualifiedName(DC, Name, LookupTagName, true).getAsDecl());
 
@@ -4087,7 +4087,7 @@
   if (PrevDecl) {
     // Check whether the previous declaration is usable.
     (void)DiagnoseUseOfDecl(PrevDecl, NameLoc);
-    
+
     if (TagDecl *PrevTagDecl = dyn_cast<TagDecl>(PrevDecl)) {
       // If this is a use of a previous tag, or if the tag is already declared
       // in the same scope (so that the definition/declaration completes or
@@ -4097,11 +4097,11 @@
         // Make sure that this wasn't declared as an enum and now used as a
         // struct or something similar.
         if (!isAcceptableTagRedeclaration(PrevTagDecl, Kind, KWLoc, *Name)) {
-          bool SafeToContinue 
+          bool SafeToContinue
             = (PrevTagDecl->getTagKind() != TagDecl::TK_enum &&
                Kind != TagDecl::TK_enum);
           if (SafeToContinue)
-            Diag(KWLoc, diag::err_use_with_wrong_tag) 
+            Diag(KWLoc, diag::err_use_with_wrong_tag)
               << Name
               << CodeModificationHint::CreateReplacement(SourceRange(KWLoc),
                                                   PrevTagDecl->getKindName());
@@ -4109,7 +4109,7 @@
             Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
           Diag(PrevDecl->getLocation(), diag::note_previous_use);
 
-          if (SafeToContinue) 
+          if (SafeToContinue)
             Kind = PrevTagDecl->getTagKind();
           else {
             // Recover by making this an anonymous redefinition.
@@ -4151,7 +4151,7 @@
               TagType *Tag = cast<TagType>(Context.getTagDeclType(PrevTagDecl));
               if (Tag->isBeingDefined()) {
                 Diag(NameLoc, diag::err_nested_redefinition) << Name;
-                Diag(PrevTagDecl->getLocation(), 
+                Diag(PrevTagDecl->getLocation(),
                      diag::note_previous_definition);
                 Name = 0;
                 PrevDecl = 0;
@@ -4168,7 +4168,7 @@
 
       } else {
         // If we get here, this is a definition of a new tag type in a nested
-        // scope, e.g. "struct foo; void bar() { struct foo; }", just create a 
+        // scope, e.g. "struct foo; void bar() { struct foo; }", just create a
         // new decl/type.  We set PrevDecl to NULL so that the entities
         // have distinct types.
         PrevDecl = 0;
@@ -4196,7 +4196,7 @@
   } else if (TUK == TUK_Reference && SS.isEmpty() && Name &&
              (Kind != TagDecl::TK_enum || !getLangOptions().CPlusPlus)) {
     // C++ [basic.scope.pdecl]p5:
-    //   -- for an elaborated-type-specifier of the form 
+    //   -- for an elaborated-type-specifier of the form
     //
     //          class-key identifier
     //
@@ -4217,15 +4217,15 @@
     //
     // Find the context where we'll be declaring the tag.
     // FIXME: We would like to maintain the current DeclContext as the
-    // lexical context, 
+    // lexical context,
     while (SearchDC->isRecord())
       SearchDC = SearchDC->getParent();
 
     // Find the scope where we'll be declaring the tag.
-    while (S->isClassScope() || 
+    while (S->isClassScope() ||
            (getLangOptions().CPlusPlus && S->isFunctionPrototypeScope()) ||
            ((S->getFlags() & Scope::DeclScope) == 0) ||
-           (S->getEntity() && 
+           (S->getEntity() &&
             ((DeclContext *)S->getEntity())->isTransparentContext()))
       S = S->getParent();
 
@@ -4243,12 +4243,12 @@
   }
 
 CreateNewDecl:
-  
+
   // If there is an identifier, use the location of the identifier as the
   // location of the decl, otherwise use the location of the struct/union
   // keyword.
   SourceLocation Loc = NameLoc.isValid() ? NameLoc : KWLoc;
-  
+
   // Otherwise, create a new declaration. If there is a previous
   // declaration of the same entity, the two will be linked via
   // PrevDecl.
@@ -4342,7 +4342,7 @@
 
   if (TUK == TUK_Definition)
     New->startDefinition();
-  
+
   // If this has an identifier, add it to the scope stack.
   if (TUK == TUK_Friend) {
     // We might be replacing an existing declaration in the lookup tables;
@@ -4370,7 +4370,7 @@
         New->getDeclContext()->getLookupContext()->isTranslationUnit() &&
         II->isStr("FILE"))
       Context.setFILEDecl(New);
-  
+
   OwnedDecl = true;
   return DeclPtrTy::make(New);
 }
@@ -4386,7 +4386,7 @@
     FieldCollector->StartClass();
 
     if (Record->getIdentifier()) {
-      // C++ [class]p2: 
+      // C++ [class]p2:
       //   [...] The class-name is also inserted into the scope of the
       //   class itself; this is known as the injected-class-name. For
       //   purposes of access checking, the injected-class-name is treated
@@ -4402,7 +4402,7 @@
       if (ClassTemplateDecl *Template = Record->getDescribedClassTemplate())
         InjectedClassName->setDescribedClassTemplate(Template);
       PushOnScopeChains(InjectedClassName, S);
-      assert(InjectedClassName->isInjectedClassName() && 
+      assert(InjectedClassName->isInjectedClassName() &&
              "Broken injected-class-name");
     }
   }
@@ -4425,7 +4425,7 @@
 }
 
 // Note that FieldName may be null for anonymous bitfields.
-bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, 
+bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
                           QualType FieldTy, const Expr *BitWidth,
                           bool *ZeroWidth) {
   // Default to true; that shouldn't confuse checks for emptiness
@@ -4460,10 +4460,10 @@
   // Zero-width bitfield is ok for anonymous field.
   if (Value == 0 && FieldName)
     return Diag(FieldLoc, diag::err_bitfield_has_zero_width) << FieldName;
-  
+
   if (Value.isSigned() && Value.isNegative()) {
     if (FieldName)
-      return Diag(FieldLoc, diag::err_bitfield_has_negative_width) 
+      return Diag(FieldLoc, diag::err_bitfield_has_negative_width)
                << FieldName << Value.toString(10);
     return Diag(FieldLoc, diag::err_anon_bitfield_has_negative_width)
       << Value.toString(10);
@@ -4486,7 +4486,7 @@
 /// ActOnField - Each field of a struct/union/class is passed into this in order
 /// to create a FieldDecl object for it.
 Sema::DeclPtrTy Sema::ActOnField(Scope *S, DeclPtrTy TagD,
-                                 SourceLocation DeclStart, 
+                                 SourceLocation DeclStart,
                                  Declarator &D, ExprTy *BitfieldWidth) {
   FieldDecl *Res = HandleField(S, cast_or_null<RecordDecl>(TagD.getAs<Decl>()),
                                DeclStart, D, static_cast<Expr*>(BitfieldWidth),
@@ -4503,7 +4503,7 @@
   IdentifierInfo *II = D.getIdentifier();
   SourceLocation Loc = DeclStart;
   if (II) Loc = D.getIdentifierLoc();
- 
+
   DeclaratorInfo *DInfo = 0;
   QualType T = GetTypeForDeclarator(D, S, &DInfo);
   if (getLangOptions().CPlusPlus)
@@ -4552,11 +4552,11 @@
 ///
 /// \returns a new FieldDecl.
 ///
-/// \todo The Declarator argument is a hack. It will be removed once 
+/// \todo The Declarator argument is a hack. It will be removed once
 FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
-                                DeclaratorInfo *DInfo, 
+                                DeclaratorInfo *DInfo,
                                 RecordDecl *Record, SourceLocation Loc,
-                                bool Mutable, Expr *BitWidth, 
+                                bool Mutable, Expr *BitWidth,
                                 SourceLocation TSSL,
                                 AccessSpecifier AS, NamedDecl *PrevDecl,
                                 Declarator *D) {
@@ -4588,12 +4588,12 @@
       InvalidDecl = true;
     }
   }
-  
+
   // Fields can not have abstract class types
-  if (RequireNonAbstractType(Loc, T, diag::err_abstract_type_in_decl, 
+  if (RequireNonAbstractType(Loc, T, diag::err_abstract_type_in_decl,
                              AbstractFieldType))
     InvalidDecl = true;
-  
+
   bool ZeroWidth = false;
   // If this is declared as a bit-field, check the bit-field.
   if (BitWidth && VerifyBitField(Loc, II, T, BitWidth, &ZeroWidth)) {
@@ -4602,7 +4602,7 @@
     BitWidth = 0;
     ZeroWidth = false;
   }
-  
+
   FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, DInfo,
                                        BitWidth, Mutable);
   if (InvalidDecl)
@@ -4771,7 +4771,7 @@
       }
     }
   }
-  
+
   bool (CXXRecordDecl::*hasTrivial)() const;
   switch (member) {
   case CXXDefaultConstructor:
@@ -4798,7 +4798,7 @@
       return;
     }
   }
-  
+
   // Check for nontrivial members (and recurse).
   typedef RecordDecl::field_iterator field_iter;
   for (field_iter fi = RD->field_begin(), fe = RD->field_end(); fi != fe;
@@ -4819,7 +4819,7 @@
   assert(0 && "found no explanation for non-trivial member");
 }
 
-/// TranslateIvarVisibility - Translate visibility from a token ID to an 
+/// TranslateIvarVisibility - Translate visibility from a token ID to an
 ///  AST enum value.
 static ObjCIvarDecl::AccessControl
 TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility) {
@@ -4832,25 +4832,25 @@
   }
 }
 
-/// ActOnIvar - Each ivar field of an objective-c class is passed into this 
+/// ActOnIvar - Each ivar field of an objective-c class is passed into this
 /// in order to create an IvarDecl object for it.
 Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
-                                SourceLocation DeclStart, 
+                                SourceLocation DeclStart,
                                 DeclPtrTy IntfDecl,
                                 Declarator &D, ExprTy *BitfieldWidth,
                                 tok::ObjCKeywordKind Visibility) {
-  
+
   IdentifierInfo *II = D.getIdentifier();
   Expr *BitWidth = (Expr*)BitfieldWidth;
   SourceLocation Loc = DeclStart;
   if (II) Loc = D.getIdentifierLoc();
-  
+
   // FIXME: Unnamed fields can be handled in various different ways, for
   // example, unnamed unions inject all members into the struct namespace!
-  
+
   DeclaratorInfo *DInfo = 0;
   QualType T = GetTypeForDeclarator(D, S, &DInfo);
-  
+
   if (BitWidth) {
     // 6.7.2.1p3, 6.7.2.1p4
     if (VerifyBitField(Loc, II, T, BitWidth)) {
@@ -4860,26 +4860,26 @@
     }
   } else {
     // Not a bitfield.
-    
+
     // validate II.
-    
+
   }
-  
+
   // C99 6.7.2.1p8: A member of a structure or union may have any type other
   // than a variably modified type.
   if (T->isVariablyModifiedType()) {
     Diag(Loc, diag::err_typecheck_ivar_variable_size);
     D.setInvalidType();
   }
-  
+
   // Get the visibility (access control) for this ivar.
-  ObjCIvarDecl::AccessControl ac = 
+  ObjCIvarDecl::AccessControl ac =
     Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility)
                                         : ObjCIvarDecl::None;
   // Must set ivar's DeclContext to its enclosing interface.
   Decl *EnclosingDecl = IntfDecl.getAs<Decl>();
   DeclContext *EnclosingContext;
-  if (ObjCImplementationDecl *IMPDecl = 
+  if (ObjCImplementationDecl *IMPDecl =
       dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
     // Case of ivar declared in an implementation. Context is that of its class.
     ObjCInterfaceDecl* IDecl = IMPDecl->getClassInterface();
@@ -4888,12 +4888,12 @@
   } else
     EnclosingContext = dyn_cast<DeclContext>(EnclosingDecl);
   assert(EnclosingContext && "null DeclContext for ivar - ActOnIvar");
-  
+
   // Construct the decl.
-  ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, 
+  ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context,
                                              EnclosingContext, Loc, II, T,
                                              DInfo, ac, (Expr *)BitfieldWidth);
-  
+
   if (II) {
     NamedDecl *PrevDecl = LookupName(S, II, LookupMemberName, true);
     if (PrevDecl && isDeclInScope(PrevDecl, EnclosingContext, S)
@@ -4906,7 +4906,7 @@
 
   // Process attributes attached to the ivar.
   ProcessDeclAttributes(S, NewID, D);
-  
+
   if (D.isInvalidType())
     NewID->setInvalidDecl();
 
@@ -4927,7 +4927,7 @@
                        AttributeList *Attr) {
   Decl *EnclosingDecl = RecDecl.getAs<Decl>();
   assert(EnclosingDecl && "missing record or interface decl");
-  
+
   // If the decl this is being inserted into is invalid, then it may be a
   // redeclaration or some other bogus case.  Don't try to add fields to it.
   if (EnclosingDecl->isInvalidDecl()) {
@@ -4935,7 +4935,7 @@
     return;
   }
 
-  
+
   // Verify that all the fields are okay.
   unsigned NumNamedMembers = 0;
   llvm::SmallVector<FieldDecl*, 32> RecFields;
@@ -4943,7 +4943,7 @@
   RecordDecl *Record = dyn_cast<RecordDecl>(EnclosingDecl);
   for (unsigned i = 0; i != NumFields; ++i) {
     FieldDecl *FD = cast<FieldDecl>(Fields[i].getAs<Decl>());
-    
+
     // Get the type for the field.
     Type *FDTy = FD->getType().getTypePtr();
 
@@ -4951,12 +4951,12 @@
       // Remember all fields written by the user.
       RecFields.push_back(FD);
     }
-    
+
     // If the field is already invalid for some reason, don't emit more
     // diagnostics about it.
     if (FD->isInvalidDecl())
       continue;
-      
+
     // C99 6.7.2.1p2:
     //   A structure or union shall not contain a member with
     //   incomplete or function type (hence, a structure shall not
@@ -4988,7 +4988,7 @@
       if (Record)
         Record->setHasFlexibleArrayMember(true);
     } else if (!FDTy->isDependentType() &&
-               RequireCompleteType(FD->getLocation(), FD->getType(), 
+               RequireCompleteType(FD->getLocation(), FD->getType(),
                                    diag::err_field_incomplete)) {
       // Incomplete type
       FD->setInvalidDecl();
@@ -5052,7 +5052,7 @@
       // Must enforce the rule that ivars in the base classes may not be
       // duplicates.
       if (ID->getSuperClass()) {
-        for (ObjCInterfaceDecl::ivar_iterator IVI = ID->ivar_begin(), 
+        for (ObjCInterfaceDecl::ivar_iterator IVI = ID->ivar_begin(),
              IVE = ID->ivar_end(); IVI != IVE; ++IVI) {
           ObjCIvarDecl* Ivar = (*IVI);
 
@@ -5066,7 +5066,7 @@
           }
         }
       }
-    } else if (ObjCImplementationDecl *IMPDecl = 
+    } else if (ObjCImplementationDecl *IMPDecl =
                   dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
       assert(IMPDecl && "ActOnFields - missing ObjCImplementationDecl");
       for (unsigned I = 0, N = RecFields.size(); I != N; ++I)
@@ -5107,7 +5107,7 @@
       EltTy = Val->getType();
     }
   }
-  
+
   if (!Val) {
     if (LastEnumConst) {
       // Assign the last value + 1.
@@ -5117,7 +5117,7 @@
       // Check for overflow on increment.
       if (EnumVal < LastEnumConst->getInitVal())
         Diag(IdLoc, diag::warn_enum_value_overflow);
-      
+
       EltTy = LastEnumConst->getType();
     } else {
       // First value, set to zero.
@@ -5125,10 +5125,10 @@
       EnumVal.zextOrTrunc(static_cast<uint32_t>(Context.getTypeSize(EltTy)));
     }
   }
-  
+
   val.release();
   return EnumConstantDecl::Create(Context, Enum, IdLoc, Id, EltTy,
-                                  Val, EnumVal);  
+                                  Val, EnumVal);
 }
 
 
@@ -5145,7 +5145,7 @@
   // The scope passed in may not be a decl scope.  Zip up the scope tree until
   // we find one that is.
   S = getNonFieldDeclScope(S);
-  
+
   // Verify that there isn't already something declared with this name in this
   // scope.
   NamedDecl *PrevDecl = LookupName(S, Id, LookupOrdinaryName);
@@ -5191,27 +5191,27 @@
 
   if (Attr)
     ProcessDeclAttributeList(S, Enum, Attr);
-  
+
   // TODO: If the result value doesn't fit in an int, it must be a long or long
   // long value.  ISO C does not support this, but GCC does as an extension,
   // emit a warning.
   unsigned IntWidth = Context.Target.getIntWidth();
   unsigned CharWidth = Context.Target.getCharWidth();
   unsigned ShortWidth = Context.Target.getShortWidth();
-  
+
   // Verify that all the values are okay, compute the size of the values, and
   // reverse the list.
   unsigned NumNegativeBits = 0;
   unsigned NumPositiveBits = 0;
-  
+
   // Keep track of whether all elements have type int.
   bool AllElementsInt = true;
-  
+
   for (unsigned i = 0; i != NumElements; ++i) {
     EnumConstantDecl *ECD =
       cast_or_null<EnumConstantDecl>(Elements[i].getAs<Decl>());
     if (!ECD) continue;  // Already issued a diagnostic.
-    
+
     // If the enum value doesn't fit in an int, emit an extension warning.
     const llvm::APSInt &InitVal = ECD->getInitVal();
     assert(InitVal.getBitWidth() >= IntWidth &&
@@ -5224,7 +5224,7 @@
         Diag(ECD->getLocation(), diag::ext_enum_value_not_int)
           << InitVal.toString(10);
     }
-    
+
     // Keep track of the size of positive and negative values.
     if (InitVal.isUnsigned() || InitVal.isNonNegative())
       NumPositiveBits = std::max(NumPositiveBits,
@@ -5235,9 +5235,9 @@
 
     // Keep track of whether every enum element has type int (very commmon).
     if (AllElementsInt)
-      AllElementsInt = ECD->getType() == Context.IntTy; 
+      AllElementsInt = ECD->getType() == Context.IntTy;
   }
-  
+
   // Figure out the type that should be used for this enum.
   // FIXME: Support -fshort-enums.
   QualType BestType;
@@ -5246,13 +5246,13 @@
   bool Packed = Enum->getAttr<PackedAttr>() ? true : false;
 
   if (NumNegativeBits) {
-    // If there is a negative value, figure out the smallest integer type (of 
+    // If there is a negative value, figure out the smallest integer type (of
     // int/long/longlong) that fits.
     // If it's packed, check also if it fits a char or a short.
     if (Packed && NumNegativeBits <= CharWidth && NumPositiveBits < CharWidth) {
         BestType = Context.SignedCharTy;
         BestWidth = CharWidth;
-    } else if (Packed && NumNegativeBits <= ShortWidth && 
+    } else if (Packed && NumNegativeBits <= ShortWidth &&
                NumPositiveBits < ShortWidth) {
         BestType = Context.ShortTy;
         BestWidth = ShortWidth;
@@ -5262,12 +5262,12 @@
       BestWidth = IntWidth;
     } else {
       BestWidth = Context.Target.getLongWidth();
-      
+
       if (NumNegativeBits <= BestWidth && NumPositiveBits < BestWidth)
         BestType = Context.LongTy;
       else {
         BestWidth = Context.Target.getLongLongWidth();
-        
+
         if (NumNegativeBits > BestWidth || NumPositiveBits >= BestWidth)
           Diag(Enum->getLocation(), diag::warn_enum_too_large);
         BestType = Context.LongLongTy;
@@ -5297,7 +5297,7 @@
       BestType = Context.UnsignedLongLongTy;
     }
   }
-  
+
   // Loop over all of the enumerator constants, changing their types to match
   // the type of the enum if needed.
   for (unsigned i = 0; i != NumElements; ++i) {
@@ -5319,7 +5319,7 @@
       if (getLangOptions().CPlusPlus)
         // C++ [dcl.enum]p4: Following the closing brace of an
         // enum-specifier, each enumerator has the type of its
-        // enumeration. 
+        // enumeration.
         ECD->setType(EnumType);
       continue;  // Already int type.
     }
@@ -5346,7 +5346,7 @@
       if (getLangOptions().CPlusPlus)
         // C++ [dcl.enum]p4: Following the closing brace of an
         // enum-specifier, each enumerator has the type of its
-        // enumeration. 
+        // enumeration.
         ECD->setType(EnumType);
       continue;
     } else {
@@ -5359,22 +5359,22 @@
     InitVal.extOrTrunc(NewWidth);
     InitVal.setIsSigned(NewSign);
     ECD->setInitVal(InitVal);
-    
+
     // Adjust the Expr initializer and type.
     if (ECD->getInitExpr())
-      ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy, 
-                                                      CastExpr::CK_Unknown, 
-                                                      ECD->getInitExpr(), 
+      ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy,
+                                                      CastExpr::CK_Unknown,
+                                                      ECD->getInitExpr(),
                                                       /*isLvalue=*/false));
     if (getLangOptions().CPlusPlus)
       // C++ [dcl.enum]p4: Following the closing brace of an
       // enum-specifier, each enumerator has the type of its
-      // enumeration. 
+      // enumeration.
       ECD->setType(EnumType);
     else
       ECD->setType(NewTy);
   }
-  
+
   Enum->completeDefinition(Context, BestType);
 }
 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Sep  9 10:08:12 2009
@@ -437,9 +437,9 @@
     S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
     return;
   }
-  
+
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(d)) {
-    QualType RetTy = FD->getResultType();  
+    QualType RetTy = FD->getResultType();
     if (RetTy->isAnyPointerType() || RetTy->isBlockPointerType()) {
       d->addAttr(::new (S.Context) MallocAttr());
       return;
@@ -989,7 +989,7 @@
     S.Diag(ArgExpr->getLocStart(), diag::err_attribute_not_string) << "section";
     return;
   }
-  
+
   std::string SectionStr(SE->getStrData(), SE->getByteLength());
 
   // If the target wants to validate the section specifier, make it happen.
@@ -998,10 +998,10 @@
     D->addAttr(::new (S.Context) SectionAttr(SectionStr));
     return;
   }
-  
+
   S.Diag(SE->getLocStart(), diag::err_attribute_section_invalid_for_target)
     << Error;
-  
+
 }
 
 static void HandleStdCallAttr(Decl *d, const AttributeList &Attr, Sema &S) {
@@ -1277,7 +1277,7 @@
       NumArgs++;
     }
   }
-  
+
   if (Idx.getZExtValue() < FirstIdx || Idx.getZExtValue() > NumArgs) {
     S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
       << "format" << 2 << IdxExpr->getSourceRange();
@@ -1288,7 +1288,7 @@
   unsigned ArgIdx = Idx.getZExtValue() - 1;
 
   if (HasImplicitThisParam) ArgIdx--;
-  
+
   // make sure the format string is really a string
   QualType Ty = getFunctionOrMethodArgType(d, ArgIdx);
 
@@ -1867,8 +1867,7 @@
 
 /// DeclClonePragmaWeak - clone existing decl (maybe definition),
 /// #pragma weak needs a non-definition decl and source may not have one
-NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II)
-{
+NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) {
   assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND));
   NamedDecl *NewD = 0;
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {





More information about the cfe-commits mailing list