[cfe-commits] r81346 [2/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/include/clang/Lex/LiteralSupport.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/LiteralSupport.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/LiteralSupport.h (original)
+++ cfe/trunk/include/clang/Lex/LiteralSupport.h Wed Sep  9 10:08:12 2009
@@ -32,22 +32,22 @@
 class Token;
 class SourceLocation;
 class TargetInfo;
-    
+
 /// NumericLiteralParser - This performs strict semantic analysis of the content
 /// of a ppnumber, classifying it as either integer, floating, or erroneous,
 /// determines the radix of the value and can convert it to a useful value.
 class NumericLiteralParser {
   Preprocessor &PP; // needed for diagnostics
-  
+
   const char *const ThisTokBegin;
   const char *const ThisTokEnd;
   const char *DigitsBegin, *SuffixBegin; // markers
   const char *s; // cursor
-  
+
   unsigned radix;
-  
+
   bool saw_exponent, saw_period;
-  
+
 public:
   NumericLiteralParser(const char *begin, const char *end,
                        SourceLocation Loc, Preprocessor &PP);
@@ -57,8 +57,8 @@
   bool isLongLong;
   bool isFloat;       // 1.0f
   bool isImaginary;   // 1.0i
-  
-  bool isIntegerLiteral() const { 
+
+  bool isIntegerLiteral() const {
     return !saw_period && !saw_exponent;
   }
   bool isFloatingLiteral() const {
@@ -67,27 +67,27 @@
   bool hasSuffix() const {
     return SuffixBegin != ThisTokEnd;
   }
-  
+
   unsigned getRadix() const { return radix; }
-  
+
   /// GetIntegerValue - Convert this numeric literal value to an APInt that
   /// matches Val's input width.  If there is an overflow (i.e., if the unsigned
   /// value read is larger than the APInt's bits will hold), set Val to the low
   /// bits of the result and return true.  Otherwise, return false.
   bool GetIntegerValue(llvm::APInt &Val);
-  
+
   /// GetFloatValue - Convert this numeric literal to a floating value, using
   /// the specified APFloat fltSemantics (specifying float, double, etc).
   /// The optional bool isExact (passed-by-reference) has its value
   /// set to true if the returned APFloat can represent the number in the
   /// literal exactly, and false otherwise.
-  llvm::APFloat GetFloatValue(const llvm::fltSemantics &Format, 
+  llvm::APFloat GetFloatValue(const llvm::fltSemantics &Format,
                               bool* isExact = NULL);
 
-private:  
- 
+private:
+
   void ParseNumberStartingWithZero(SourceLocation TokLoc);
-  
+
   /// SkipHexDigits - Read and skip over any hex digits, up to End.
   /// Return a pointer to the first non-hex digit or End.
   const char *SkipHexDigits(const char *ptr) {
@@ -95,7 +95,7 @@
       ptr++;
     return ptr;
   }
-  
+
   /// SkipOctalDigits - Read and skip over any octal digits, up to End.
   /// Return a pointer to the first non-hex digit or End.
   const char *SkipOctalDigits(const char *ptr) {
@@ -103,7 +103,7 @@
       ptr++;
     return ptr;
   }
-  
+
   /// SkipDigits - Read and skip over any digits, up to End.
   /// Return a pointer to the first non-hex digit or End.
   const char *SkipDigits(const char *ptr) {
@@ -111,7 +111,7 @@
       ptr++;
     return ptr;
   }
-  
+
   /// SkipBinaryDigits - Read and skip over any binary digits, up to End.
   /// Return a pointer to the first non-binary digit or End.
   const char *SkipBinaryDigits(const char *ptr) {
@@ -119,7 +119,7 @@
       ptr++;
     return ptr;
   }
-  
+
 };
 
 /// CharLiteralParser - Perform interpretation and semantic analysis of a
@@ -144,7 +144,7 @@
 /// literals) (C99 5.1.1.2p1).
 class StringLiteralParser {
   Preprocessor &PP;
-  
+
   unsigned MaxTokenLength;
   unsigned SizeBound;
   unsigned wchar_tByteWidth;
@@ -156,7 +156,7 @@
   bool hadError;
   bool AnyWide;
   bool Pascal;
-  
+
   const char *GetString() { return &ResultBuf[0]; }
   unsigned GetStringLength() const { return ResultPtr-&ResultBuf[0]; }
 
@@ -164,14 +164,14 @@
     if (AnyWide)
       return GetStringLength() / wchar_tByteWidth;
     return GetStringLength();
-  }  
+  }
   /// getOffsetOfStringByte - This function returns the offset of the
   /// specified byte of the string data represented by Token.  This handles
   /// advancing over escape sequences in the string.
   static unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo,
                                         Preprocessor &PP);
 };
-  
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/trunk/include/clang/Lex/MacroInfo.h Wed Sep  9 10:08:12 2009
@@ -22,7 +22,7 @@
 
 namespace clang {
   class Preprocessor;
-    
+
 /// MacroInfo - Each identifier that is #define'd has an instance of this class
 /// associated with it, used to implement macro expansion.
 class MacroInfo {
@@ -39,7 +39,7 @@
   /// includes the __VA_ARGS__ identifier on the list.
   IdentifierInfo **ArgumentList;
   unsigned NumArguments;
-  
+
   /// ReplacementTokens - This is the list of tokens that the macro is defined
   /// to.
   llvm::SmallVector<Token, 8> ReplacementTokens;
@@ -47,21 +47,21 @@
   /// IsFunctionLike - True if this macro is a function-like macro, false if it
   /// is an object-like macro.
   bool IsFunctionLike : 1;
-  
+
   /// IsC99Varargs - True if this macro is of the form "#define X(...)" or
   /// "#define X(Y,Z,...)".  The __VA_ARGS__ token should be replaced with the
   /// contents of "..." in an invocation.
   bool IsC99Varargs : 1;
-  
+
   /// IsGNUVarargs -  True if this macro is of the form "#define X(a...)".  The
   /// "a" identifier in the replacement list will be replaced with all arguments
   /// of the macro starting with the specified one.
   bool IsGNUVarargs : 1;
-  
+
   /// IsBuiltinMacro - True if this is a builtin macro, such as __LINE__, and if
   /// it has not yet been redefined or undefined.
   bool IsBuiltinMacro : 1;
-  
+
 private:
   //===--------------------------------------------------------------------===//
   // State that changes as the macro is used.
@@ -70,19 +70,19 @@
   /// This disbles recursive expansion, which would be quite bad for things like
   /// #define A A.
   bool IsDisabled : 1;
-  
+
   /// IsUsed - True if this macro is either defined in the main file and has
-  /// been used, or if it is not defined in the main file.  This is used to 
+  /// been used, or if it is not defined in the main file.  This is used to
   /// emit -Wunused-macros diagnostics.
   bool IsUsed : 1;
-  
+
   ~MacroInfo() {
     assert(ArgumentList == 0 && "Didn't call destroy before dtor!");
   }
-  
+
 public:
   MacroInfo(SourceLocation DefLoc);
-  
+
   /// FreeArgumentList - Free the argument list of the macro, restoring it to a
   /// state where it can be reused for other devious purposes.
   void FreeArgumentList(llvm::BumpPtrAllocator &PPAllocator) {
@@ -90,13 +90,13 @@
     ArgumentList = 0;
     NumArguments = 0;
   }
-  
+
   /// Destroy - destroy this MacroInfo object.
   void Destroy(llvm::BumpPtrAllocator &PPAllocator) {
     FreeArgumentList(PPAllocator);
     this->~MacroInfo();
   }
-  
+
   /// getDefinitionLoc - Return the location that the macro was defined at.
   ///
   SourceLocation getDefinitionLoc() const { return Location; }
@@ -112,13 +112,13 @@
   /// this macro in spelling, arguments, and whitespace.  This is used to emit
   /// duplicate definition warnings.  This implements the rules in C99 6.10.3.
   bool isIdenticalTo(const MacroInfo &Other, Preprocessor &PP) const;
-  
+
   /// setIsBuiltinMacro - Set or clear the isBuiltinMacro flag.
   ///
   void setIsBuiltinMacro(bool Val = true) {
     IsBuiltinMacro = Val;
   }
-  
+
   /// setIsUsed - Set the value of the IsUsed flag.
   ///
   void setIsUsed(bool Val) {
@@ -132,13 +132,13 @@
     assert(ArgumentList == 0 && NumArguments == 0 &&
            "Argument list already set!");
     if (NumArgs == 0) return;
-    
+
     NumArguments = NumArgs;
     ArgumentList = PPAllocator.Allocate<IdentifierInfo*>(NumArgs);
     for (unsigned i = 0; i != NumArgs; ++i)
       ArgumentList[i] = List[i];
   }
-  
+
   /// Arguments - The list of arguments for a function-like macro.  This can be
   /// empty, for, e.g. "#define X()".
   typedef IdentifierInfo* const *arg_iterator;
@@ -146,7 +146,7 @@
   arg_iterator arg_begin() const { return ArgumentList; }
   arg_iterator arg_end() const { return ArgumentList+NumArguments; }
   unsigned getNumArgs() const { return NumArguments; }
-  
+
   /// getArgumentNum - Return the argument number of the specified identifier,
   /// or -1 if the identifier is not a formal argument identifier.
   int getArgumentNum(IdentifierInfo *Arg) const {
@@ -154,20 +154,20 @@
       if (*I == Arg) return I-arg_begin();
     return -1;
   }
-  
+
   /// Function/Object-likeness.  Keep track of whether this macro has formal
   /// parameters.
   void setIsFunctionLike() { IsFunctionLike = true; }
   bool isFunctionLike() const { return IsFunctionLike; }
   bool isObjectLike() const { return !IsFunctionLike; }
-  
+
   /// Varargs querying methods.  This can only be set for function-like macros.
   void setIsC99Varargs() { IsC99Varargs = true; }
   void setIsGNUVarargs() { IsGNUVarargs = true; }
   bool isC99Varargs() const { return IsC99Varargs; }
   bool isGNUVarargs() const { return IsGNUVarargs; }
   bool isVariadic() const { return IsC99Varargs | IsGNUVarargs; }
-  
+
   /// isBuiltinMacro - Return true if this macro is a builtin macro, such as
   /// __LINE__, which requires processing before expansion.
   bool isBuiltinMacro() const { return IsBuiltinMacro; }
@@ -175,7 +175,7 @@
   /// isUsed - Return false if this macro is defined in the main file and has
   /// not yet been used.
   bool isUsed() const { return IsUsed; }
-  
+
   /// getNumTokens - Return the number of tokens that this macro expands to.
   ///
   unsigned getNumTokens() const {
@@ -186,22 +186,22 @@
     assert(Tok < ReplacementTokens.size() && "Invalid token #");
     return ReplacementTokens[Tok];
   }
-  
+
   typedef llvm::SmallVector<Token, 8>::const_iterator tokens_iterator;
   tokens_iterator tokens_begin() const { return ReplacementTokens.begin(); }
   tokens_iterator tokens_end() const { return ReplacementTokens.end(); }
   bool tokens_empty() const { return ReplacementTokens.empty(); }
-  
+
   /// AddTokenToBody - Add the specified token to the replacement text for the
   /// macro.
   void AddTokenToBody(const Token &Tok) {
     ReplacementTokens.push_back(Tok);
   }
-  
+
   /// isEnabled - Return true if this macro is enabled: in other words, that we
   /// are not currently in an expansion of this macro.
   bool isEnabled() const { return !IsDisabled; }
-  
+
   void EnableMacro() {
     assert(IsDisabled && "Cannot enable an already-enabled macro!");
     IsDisabled = false;
@@ -212,7 +212,7 @@
     IsDisabled = true;
   }
 };
-    
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Lex/MultipleIncludeOpt.h (original)
+++ cfe/trunk/include/clang/Lex/MultipleIncludeOpt.h Wed Sep  9 10:08:12 2009
@@ -36,7 +36,7 @@
   /// to false, that way any tokens before the first #ifdef or after the last
   /// #endif can be easily detected.
   bool DidMacroExpansion;
-  
+
   /// TheMacro - The controlling macro for a file, if valid.
   ///
   const IdentifierInfo *TheMacro;
@@ -46,7 +46,7 @@
     DidMacroExpansion = false;
     TheMacro = 0;
   }
-  
+
   /// Invalidate - Permenantly mark this file as not being suitable for the
   /// include-file optimization.
   void Invalidate() {
@@ -55,19 +55,19 @@
     ReadAnyTokens = true;
     TheMacro = 0;
   }
-  
+
   /// getHasReadAnyTokensVal - This is used for the #ifndef hande-shake at the
   /// top of the file when reading preprocessor directives.  Otherwise, reading
   /// the "ifndef x" would count as reading tokens.
   bool getHasReadAnyTokensVal() const { return ReadAnyTokens; }
-  
+
   // If a token is read, remember that we have seen a side-effect in this file.
   void ReadToken() { ReadAnyTokens = true; }
-  
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }
-  
+
   /// EnterTopLevelIFNDEF - When entering a top-level #ifndef directive (or the
   /// "#if !defined" equivalent) without any preceding tokens, this method is
   /// called.
@@ -80,14 +80,14 @@
     // If the macro is already set, this is after the top-level #endif.
     if (TheMacro)
       return Invalidate();
-    
+
     // If we have already expanded a macro by the end of the #ifndef line, then
     // there is a macro expansion *in* the #ifndef line.  This means that the
     // condition could evaluate differently when subsequently #included.  Reject
     // this.
     if (DidMacroExpansion)
       return Invalidate();
-    
+
     // Remember that we're in the #if and that we have the macro.
     ReadAnyTokens = true;
     TheMacro = M;
@@ -100,7 +100,7 @@
     /// there is a chunk of the file not guarded by the controlling macro.
     Invalidate();
   }
-  
+
   /// ExitTopLevelConditional - This method is called when the lexer exits the
   /// top-level conditional.
   void ExitTopLevelConditional() {
@@ -108,12 +108,12 @@
     // back to "not having read any tokens" so we can detect anything after the
     // #endif.
     if (!TheMacro) return Invalidate();
-    
+
     // At this point, we haven't "read any tokens" but we do have a controlling
     // macro.
     ReadAnyTokens = false;
   }
-  
+
   /// GetControllingMacroAtEndOfFile - Once the entire file has been lexed, if
   /// there is a controlling macro, return it.
   const IdentifierInfo *GetControllingMacroAtEndOfFile() const {

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

==============================================================================
--- cfe/trunk/include/clang/Lex/PPCallbacks.h (original)
+++ cfe/trunk/include/clang/Lex/PPCallbacks.h Wed Sep  9 10:08:12 2009
@@ -23,18 +23,18 @@
   class Token;
   class IdentifierInfo;
   class MacroInfo;
-    
+
 /// PPCallbacks - This interface provides a way to observe the actions of the
 /// preprocessor as it does its thing.  Clients can define their hooks here to
 /// implement preprocessor level tools.
 class PPCallbacks {
 public:
   virtual ~PPCallbacks();
-  
+
   enum FileChangeReason {
     EnterFile, ExitFile, SystemHeaderPragma, RenameFile
   };
-  
+
   /// FileChanged - This callback is invoked whenever a source file is
   /// entered or exited.  The SourceLocation indicates the new location, and
   /// EnteringFile indicates whether this is because we are entering a new
@@ -43,25 +43,25 @@
   virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason,
                            SrcMgr::CharacteristicKind FileType) {
   }
-  
+
   /// Ident - This callback is invoked when a #ident or #sccs directive is read.
   ///
   virtual void Ident(SourceLocation Loc, const std::string &str) {
   }
-  
+
   /// PragmaComment - This callback is invoked when a #pragma comment directive
   /// is read.
   ///
-  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, 
+  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
                              const std::string &Str) {
   }
-  
+
   /// MacroExpands - This is called by
   /// Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is
   /// found.
   virtual void MacroExpands(const Token &Id, const MacroInfo* MI) {
   }
-  
+
   /// MacroDefined - This hook is called whenever a macro definition is seen.
   virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) {
   }
@@ -76,7 +76,7 @@
 class PPChainedCallbacks : public PPCallbacks {
   PPCallbacks *First, *Second;
 
-public:  
+public:
   PPChainedCallbacks(PPCallbacks *_First, PPCallbacks *_Second)
     : First(_First), Second(_Second) {}
   ~PPChainedCallbacks() {
@@ -89,23 +89,23 @@
     First->FileChanged(Loc, Reason, FileType);
     Second->FileChanged(Loc, Reason, FileType);
   }
-  
+
   virtual void Ident(SourceLocation Loc, const std::string &str) {
     First->Ident(Loc, str);
     Second->Ident(Loc, str);
   }
-  
-  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, 
+
+  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
                              const std::string &Str) {
     First->PragmaComment(Loc, Kind, Str);
     Second->PragmaComment(Loc, Kind, Str);
   }
-  
+
   virtual void MacroExpands(const Token &Id, const MacroInfo* MI) {
     First->MacroExpands(Id, MI);
     Second->MacroExpands(Id, MI);
   }
-  
+
   virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) {
     First->MacroDefined(II, MI);
     Second->MacroDefined(II, MI);

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

==============================================================================
--- cfe/trunk/include/clang/Lex/PTHLexer.h (original)
+++ cfe/trunk/include/clang/Lex/PTHLexer.h Wed Sep  9 10:08:12 2009
@@ -18,42 +18,42 @@
 #include <vector>
 
 namespace clang {
-  
+
 class PTHManager;
 class PTHSpellingSearch;
-  
+
 class PTHLexer : public PreprocessorLexer {
   SourceLocation FileStartLoc;
-  
+
   /// TokBuf - Buffer from PTH file containing raw token data.
   const unsigned char* TokBuf;
-  
+
   /// CurPtr - Pointer into current offset of the token buffer where
   ///  the next token will be read.
   const unsigned char* CurPtr;
-    
+
   /// LastHashTokPtr - Pointer into TokBuf of the last processed '#'
   ///  token that appears at the start of a line.
   const unsigned char* LastHashTokPtr;
-  
+
   /// PPCond - Pointer to a side table in the PTH file that provides a
   ///  a consise summary of the preproccessor conditional block structure.
   ///  This is used to perform quick skipping of conditional blocks.
   const unsigned char* PPCond;
-  
+
   /// CurPPCondPtr - Pointer inside PPCond that refers to the next entry
   ///  to process when doing quick skipping of preprocessor blocks.
   const unsigned char* CurPPCondPtr;
 
   PTHLexer(const PTHLexer&);  // DO NOT IMPLEMENT
   void operator=(const PTHLexer&); // DO NOT IMPLEMENT
-  
+
   /// ReadToken - Used by PTHLexer to read tokens TokBuf.
   void ReadToken(Token& T);
 
   /// PTHMgr - The PTHManager object that created this PTHLexer.
   PTHManager& PTHMgr;
-  
+
   Token EofToken;
 
 protected:
@@ -62,19 +62,19 @@
   /// Create a PTHLexer for the specified token stream.
   PTHLexer(Preprocessor& pp, FileID FID, const unsigned char *D,
            const unsigned char* ppcond, PTHManager &PM);
-public:  
+public:
 
   ~PTHLexer() {}
-    
+
   /// Lex - Return the next token.
   void Lex(Token &Tok);
-  
+
   void getEOF(Token &Tok);
-  
+
   /// DiscardToEndOfLine - Read the rest of the current preprocessor line as an
   /// uninterpreted string.  This switches the lexer out of directive mode.
   void DiscardToEndOfLine();
-  
+
   /// isNextPPTokenLParen - Return 1 if the next unexpanded token will return a
   /// tok::l_paren token, 0 if it is something else and 2 if there are no more
   /// tokens controlled by this lexer.
@@ -85,12 +85,12 @@
     // its kind.
     tok::TokenKind x = (tok::TokenKind)*CurPtr;
     return x == tok::eof ? 2 : x == tok::l_paren;
-  }    
+  }
 
   /// IndirectLex - An indirect call to 'Lex' that can be invoked via
   ///  the PreprocessorLexer interface.
   void IndirectLex(Token &Result) { Lex(Result); }
-  
+
   /// getSourceLocation - Return a source location for the token in
   /// the current file.
   SourceLocation getSourceLocation();

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

==============================================================================
--- cfe/trunk/include/clang/Lex/PTHManager.h (original)
+++ cfe/trunk/include/clang/Lex/PTHManager.h Wed Sep  9 10:08:12 2009
@@ -32,29 +32,29 @@
 class PTHLexer;
 class Diagnostic;
 class StatSysCallCache;
-  
+
 class PTHManager : public IdentifierInfoLookup {
   friend class PTHLexer;
-  
+
   /// The memory mapped PTH file.
   const llvm::MemoryBuffer* Buf;
 
   /// Alloc - Allocator used for IdentifierInfo objects.
   llvm::BumpPtrAllocator Alloc;
-  
+
   /// IdMap - A lazily generated cache mapping from persistent identifiers to
   ///  IdentifierInfo*.
   IdentifierInfo** PerIDCache;
-  
+
   /// FileLookup - Abstract data structure used for mapping between files
   ///  and token data in the PTH file.
   void* FileLookup;
-  
+
   /// IdDataTable - Array representing the mapping from persistent IDs to the
   ///  data offset within the PTH file containing the information to
   ///  reconsitute an IdentifierInfo.
   const unsigned char* const IdDataTable;
-  
+
   /// SortedIdTable - Abstract data structure mapping from strings to
   ///  persistent IDs.  This is used by get().
   void* StringIdLookup;
@@ -65,15 +65,15 @@
   /// PP - The Preprocessor object that will use this PTHManager to create
   ///  PTHLexer objects.
   Preprocessor* PP;
-  
-  /// SpellingBase - The base offset within the PTH memory buffer that 
+
+  /// SpellingBase - The base offset within the PTH memory buffer that
   ///  contains the cached spellings for literals.
   const unsigned char* const SpellingBase;
-  
+
   /// OriginalSourceFile - A null-terminated C-string that specifies the name
   ///  if the file (if any) that was to used to generate the PTH cache.
   const char* OriginalSourceFile;
-  
+
   /// This constructor is intended to only be called by the static 'Create'
   /// method.
   PTHManager(const llvm::MemoryBuffer* buf, void* fileLookup,
@@ -84,11 +84,11 @@
   // Do not implement.
   PTHManager();
   void operator=(const PTHManager&);
-  
-  /// getSpellingAtPTHOffset - Used by PTHLexer classes to get the cached 
+
+  /// getSpellingAtPTHOffset - Used by PTHLexer classes to get the cached
   ///  spelling for a token.
   unsigned getSpellingAtPTHOffset(unsigned PTHOffset, const char*& Buffer);
-  
+
   /// GetIdentifierInfo - Used to reconstruct IdentifierInfo objects from the
   ///  PTH file.
   inline IdentifierInfo* GetIdentifierInfo(unsigned PersistentID) {
@@ -98,44 +98,44 @@
     return LazilyCreateIdentifierInfo(PersistentID);
   }
   IdentifierInfo* LazilyCreateIdentifierInfo(unsigned PersistentID);
-  
+
 public:
   // The current PTH version.
   enum { Version = 9 };
 
   ~PTHManager();
-  
+
   /// getOriginalSourceFile - Return the full path to the original header
   ///  file name that was used to generate the PTH cache.
   const char* getOriginalSourceFile() const {
     return OriginalSourceFile;
   }
-  
+
   /// get - Return the identifier token info for the specified named identifier.
   ///  Unlike the version in IdentifierTable, this returns a pointer instead
   ///  of a reference.  If the pointer is NULL then the IdentifierInfo cannot
   ///  be found.
   IdentifierInfo *get(const char *NameStart, const char *NameEnd);
-  
+
   /// Create - This method creates PTHManager objects.  The 'file' argument
   ///  is the name of the PTH file.  This method returns NULL upon failure.
   static PTHManager *Create(const std::string& file, Diagnostic* Diags = 0,
                             Diagnostic::Level failureLevel=Diagnostic::Warning);
 
-  void setPreprocessor(Preprocessor *pp) { PP = pp; }    
-  
+  void setPreprocessor(Preprocessor *pp) { PP = pp; }
+
   /// CreateLexer - Return a PTHLexer that "lexes" the cached tokens for the
   ///  specified file.  This method returns NULL if no cached tokens exist.
   ///  It is the responsibility of the caller to 'delete' the returned object.
-  PTHLexer *CreateLexer(FileID FID);  
-  
+  PTHLexer *CreateLexer(FileID FID);
+
   /// createStatCache - Returns a StatSysCallCache object for use with
   ///  FileManager objects.  These objects use the PTH data to speed up
   ///  calls to stat by memoizing their results from when the PTH file
   ///  was generated.
   StatSysCallCache *createStatCache();
 };
-  
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Lex/Pragma.h (original)
+++ cfe/trunk/include/clang/Lex/Pragma.h Wed Sep  9 10:08:12 2009
@@ -37,10 +37,10 @@
 public:
   PragmaHandler(const IdentifierInfo *name) : Name(name) {}
   virtual ~PragmaHandler();
-  
+
   const IdentifierInfo *getName() const { return Name; }
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken) = 0;
-  
+
   /// getIfNamespace - If this is a namespace, return it.  This is equivalent to
   /// using a dynamic_cast, but doesn't require RTTI.
   virtual PragmaNamespace *getIfNamespace() { return 0; }
@@ -57,14 +57,14 @@
 public:
   PragmaNamespace(const IdentifierInfo *Name) : PragmaHandler(Name) {}
   virtual ~PragmaNamespace();
-  
+
   /// FindHandler - Check to see if there is already a handler for the
   /// specified name.  If not, return the handler for the null identifier if it
   /// exists, otherwise return null.  If IgnoreNull is true (the default) then
   /// the null handler isn't returned on failure to match.
   PragmaHandler *FindHandler(const IdentifierInfo *Name,
                              bool IgnoreNull = true) const;
-  
+
   /// AddPragma - Add a pragma to this namespace.
   ///
   void AddPragma(PragmaHandler *Handler) {
@@ -75,12 +75,12 @@
   /// namespace.
   void RemovePragmaHandler(PragmaHandler *Handler);
 
-  bool IsEmpty() { 
-    return Handlers.empty(); 
+  bool IsEmpty() {
+    return Handlers.empty();
   }
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
-  
+
   virtual PragmaNamespace *getIfNamespace() { return this; }
 };
 

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

==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Sep  9 10:08:12 2009
@@ -29,7 +29,7 @@
 #include <vector>
 
 namespace clang {
-  
+
 class SourceManager;
 class FileManager;
 class FileEntry;
@@ -41,7 +41,7 @@
 class TargetInfo;
 class PPCallbacks;
 class DirectoryLookup;
-  
+
 /// Preprocessor - This object engages in a tight little dance with the lexer to
 /// efficiently preprocess tokens.  Lexers know only about tokens within a
 /// single source file, and don't know anything about preprocessor-level issues
@@ -55,15 +55,15 @@
   SourceManager     &SourceMgr;
   ScratchBuffer     *ScratchBuf;
   HeaderSearch      &HeaderInfo;
-  
+
   /// PTH - An optional PTHManager object used for getting tokens from
   ///  a token cache rather than lexing the original source file.
   llvm::OwningPtr<PTHManager> PTH;
-  
+
   /// BP - A BumpPtrAllocator object used to quickly allocate and release
   ///  objects internal to the Preprocessor.
   llvm::BumpPtrAllocator BP;
-    
+
   /// Identifiers for builtin macros and other builtins.
   IdentifierInfo *Ident__LINE__, *Ident__FILE__;   // __LINE__, __FILE__
   IdentifierInfo *Ident__DATE__, *Ident__TIME__;   // __DATE__, __TIME__
@@ -74,7 +74,7 @@
   IdentifierInfo *Ident_Pragma, *Ident__VA_ARGS__; // _Pragma, __VA_ARGS__
   IdentifierInfo *Ident__has_feature;              // __has_feature
   IdentifierInfo *Ident__has_builtin;              // __has_builtin
-  
+
   SourceLocation DATELoc, TIMELoc;
   unsigned CounterValue;  // Next __COUNTER__ value.
 
@@ -86,7 +86,7 @@
   // State that is set before the preprocessor begins.
   bool KeepComments : 1;
   bool KeepMacroComments : 1;
-  
+
   // State that changes while the preprocessor runs:
   bool DisableMacroExpansion : 1;  // True if macro expansion is disabled.
   bool InMacroArgs : 1;            // True if parsing fn macro invocation args.
@@ -94,42 +94,42 @@
   /// Identifiers - This is mapping/lookup information for all identifiers in
   /// the program, including program keywords.
   IdentifierTable Identifiers;
-  
+
   /// Selectors - This table contains all the selectors in the program. Unlike
   /// IdentifierTable above, this table *isn't* populated by the preprocessor.
-  /// It is declared/instantiated here because it's role/lifetime is 
+  /// It is declared/instantiated here because it's role/lifetime is
   /// conceptually similar the IdentifierTable. In addition, the current control
-  /// flow (in clang::ParseAST()), make it convenient to put here. 
+  /// flow (in clang::ParseAST()), make it convenient to put here.
   /// FIXME: Make sure the lifetime of Identifiers/Selectors *isn't* tied to
   /// the lifetime fo the preprocessor.
   SelectorTable Selectors;
 
   /// BuiltinInfo - Information about builtins.
   Builtin::Context BuiltinInfo;
-  
+
   /// PragmaHandlers - This tracks all of the pragmas that the client registered
   /// with this preprocessor.
   PragmaNamespace *PragmaHandlers;
-  
-  /// \brief Tracks all of the comment handlers that the client registered 
+
+  /// \brief Tracks all of the comment handlers that the client registered
   /// with this preprocessor.
   std::vector<CommentHandler *> CommentHandlers;
-  
+
   /// CurLexer - This is the current top of the stack that we're lexing from if
   /// not expanding a macro and we are lexing directly from source code.
   ///  Only one of CurLexer, CurPTHLexer, or CurTokenLexer will be non-null.
   llvm::OwningPtr<Lexer> CurLexer;
-  
+
   /// CurPTHLexer - This is the current top of stack that we're lexing from if
   ///  not expanding from a macro and we are lexing from a PTH cache.
   ///  Only one of CurLexer, CurPTHLexer, or CurTokenLexer will be non-null.
   llvm::OwningPtr<PTHLexer> CurPTHLexer;
-  
+
   /// CurPPLexer - This is the current top of the stack what we're lexing from
   ///  if not expanding a macro.  This is an alias for either CurLexer or
   ///  CurPTHLexer.
   PreprocessorLexer* CurPPLexer;
-  
+
   /// CurLookup - The DirectoryLookup structure used to find the current
   /// FileEntry, if CurLexer is non-null and if applicable.  This allows us to
   /// implement #include_next and find directory-specific properties.
@@ -138,7 +138,7 @@
   /// CurTokenLexer - This is the current macro we are expanding, if we are
   /// expanding a macro.  One of CurLexer and CurTokenLexer must be null.
   llvm::OwningPtr<TokenLexer> CurTokenLexer;
-  
+
   /// IncludeMacroStack - This keeps track of the stack of files currently
   /// #included, and macros currently being expanded from, not counting
   /// CurLexer/CurTokenLexer.
@@ -146,7 +146,7 @@
     Lexer                 *TheLexer;
     PTHLexer              *ThePTHLexer;
     PreprocessorLexer     *ThePPLexer;
-    TokenLexer            *TheTokenLexer;    
+    TokenLexer            *TheTokenLexer;
     const DirectoryLookup *TheDirLookup;
 
     IncludeStackInfo(Lexer *L, PTHLexer* P, PreprocessorLexer* PPL,
@@ -155,19 +155,19 @@
         TheDirLookup(D) {}
   };
   std::vector<IncludeStackInfo> IncludeMacroStack;
-  
+
   /// Callbacks - These are actions invoked when some preprocessor activity is
   /// encountered (e.g. a file is #included, etc).
   PPCallbacks *Callbacks;
-  
+
   /// Macros - For each IdentifierInfo with 'HasMacro' set, we keep a mapping
   /// to the actual definition of the macro.
   llvm::DenseMap<IdentifierInfo*, MacroInfo*> Macros;
-  
+
   /// MICache - A "freelist" of MacroInfo objects that can be reused for quick
   ///  allocation.
   std::vector<MacroInfo*> MICache;
-  
+
   // Various statistics we track for performance analysis.
   unsigned NumDirectives, NumIncluded, NumDefined, NumUndefined, NumPragma;
   unsigned NumIf, NumElse, NumEndif;
@@ -175,11 +175,11 @@
   unsigned NumMacroExpanded, NumFnMacroExpanded, NumBuiltinMacroExpanded;
   unsigned NumFastMacroExpanded, NumTokenPaste, NumFastTokenPaste;
   unsigned NumSkipped;
-  
+
   /// Predefines - This string is the predefined macros that preprocessor
   /// should use from the command line etc.
   std::string Predefines;
-  
+
   /// TokenLexerCache - Cache macro expanders to reduce malloc traffic.
   enum { TokenLexerCacheSize = 8 };
   unsigned NumCachedTokenLexers;
@@ -223,9 +223,9 @@
   SelectorTable &getSelectorTable() { return Selectors; }
   Builtin::Context &getBuiltinInfo() { return BuiltinInfo; }
   llvm::BumpPtrAllocator &getPreprocessorAllocator() { return BP; }
-    
+
   void setPTHManager(PTHManager* pm);
-  
+
   PTHManager *getPTHManager() { return PTH.get(); }
 
   /// SetCommentRetentionState - Control whether or not the preprocessor retains
@@ -234,20 +234,20 @@
     this->KeepComments = KeepComments | KeepMacroComments;
     this->KeepMacroComments = KeepMacroComments;
   }
-  
+
   bool getCommentRetentionState() const { return KeepComments; }
-  
+
   /// isCurrentLexer - Return true if we are lexing directly from the specified
   /// lexer.
   bool isCurrentLexer(const PreprocessorLexer *L) const {
     return CurPPLexer == L;
   }
-  
+
   /// getCurrentLexer - Return the current file lexer being lexed from.  Note
   /// that this ignores any potentially active macro expansions and _Pragma
   /// expansions going on at the time.
   PreprocessorLexer *getCurrentFileLexer() const;
-  
+
   /// getPPCallbacks/setPPCallbacks - Accessors for preprocessor callbacks.
   /// Note that this class takes ownership of any PPCallbacks object given to
   /// it.
@@ -257,32 +257,32 @@
       C = new PPChainedCallbacks(C, Callbacks);
     Callbacks = C;
   }
-  
+
   /// getMacroInfo - Given an identifier, return the MacroInfo it is #defined to
   /// or null if it isn't #define'd.
   MacroInfo *getMacroInfo(IdentifierInfo *II) const {
     return II->hasMacroDefinition() ? Macros.find(II)->second : 0;
   }
-  
+
   /// setMacroInfo - Specify a macro for this identifier.
   ///
   void setMacroInfo(IdentifierInfo *II, MacroInfo *MI);
-  
+
   /// macro_iterator/macro_begin/macro_end - This allows you to walk the current
   /// state of the macro table.  This visits every currently-defined macro.
-  typedef llvm::DenseMap<IdentifierInfo*, 
+  typedef llvm::DenseMap<IdentifierInfo*,
                          MacroInfo*>::const_iterator macro_iterator;
   macro_iterator macro_begin() const { return Macros.begin(); }
   macro_iterator macro_end() const { return Macros.end(); }
-  
-  
-  
+
+
+
   const std::string &getPredefines() const { return Predefines; }
   /// setPredefines - Set the predefines for this Preprocessor.  These
   /// predefines are automatically injected when parsing the main file.
   void setPredefines(const char *P) { Predefines = P; }
   void setPredefines(const std::string &P) { Predefines = P; }
-  
+
   /// getIdentifierInfo - Return information about the specified preprocessor
   /// identifier token.  The version of this method that takes two character
   /// pointers is preferred unless the identifier is already available as a
@@ -295,7 +295,7 @@
   IdentifierInfo *getIdentifierInfo(const char *NameStr) {
     return getIdentifierInfo(NameStr, NameStr+strlen(NameStr));
   }
-  
+
   /// 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".
@@ -309,16 +309,16 @@
 
   /// \brief Add the specified comment handler to the preprocessor.
   void AddCommentHandler(CommentHandler *Handler);
-  
+
   /// \brief Remove the specified comment handler.
   ///
   /// It is an error to remove a handler that has not been registered.
   void RemoveCommentHandler(CommentHandler *Handler);
-  
+
   /// EnterMainSourceFile - Enter the specified FileID as the main source file,
   /// which implicitly adds the builtin defines etc.
-  void EnterMainSourceFile();  
-  
+  void EnterMainSourceFile();
+
   /// EnterSourceFile - Add a source file to the top of the include stack and
   /// start lexing tokens from it instead of the current buffer.  If isMainFile
   /// is true, this is the main file for the translation unit.
@@ -331,7 +331,7 @@
   /// ILEnd specifies the location of the ')' for a function-like macro or the
   /// identifier for an object-like macro.
   void EnterMacro(Token &Identifier, SourceLocation ILEnd, MacroArgs *Args);
-  
+
   /// EnterTokenStream - Add a "macro" context to the top of the include stack,
   /// which will cause the lexer to start returning the specified tokens.
   ///
@@ -346,7 +346,7 @@
   ///
   void EnterTokenStream(const Token *Toks, unsigned NumToks,
                         bool DisableMacroExpansion, bool OwnsTokens);
-  
+
   /// RemoveTopOfLexerStack - Pop the current lexer/macro exp off the top of the
   /// lexer stack.  This should only be used in situations where the current
   /// state of the top-of-stack lexer is known.
@@ -371,7 +371,7 @@
   void CommitBacktrackedTokens();
 
   /// Backtrack - Make Preprocessor re-lex the tokens that were lexed since
-  /// EnableBacktrackAtThisPos() was previously called. 
+  /// EnableBacktrackAtThisPos() was previously called.
   void Backtrack();
 
   /// isBacktrackEnabled - True if EnableBacktrackAtThisPos() was called and
@@ -390,7 +390,7 @@
     else
       CachingLex(Result);
   }
-  
+
   /// LexNonComment - Lex a token.  If it's a comment, keep lexing until we get
   /// something not a comment.  This is useful in -E -C mode where comments
   /// would foul up preprocessor directive handling.
@@ -408,11 +408,11 @@
     DisableMacroExpansion = true;
     // Lex the token.
     Lex(Result);
-    
+
     // Reenable it.
     DisableMacroExpansion = OldVal;
   }
-  
+
   /// LookAhead - This peeks ahead N tokens and returns that token without
   /// consuming any tokens.  LookAhead(0) returns the next token that would be
   /// returned by Lex(), LookAhead(1) returns the token after it, etc.  This
@@ -461,7 +461,7 @@
       AnnotatePreviousCachedTokens(Tok);
   }
 
-  /// \brief Replace the last token with an annotation token. 
+  /// \brief Replace the last token with an annotation token.
   ///
   /// Like AnnotateCachedTokens(), this routine replaces an
   /// already-parsed (and resolved) token with an annotation
@@ -481,19 +481,19 @@
   DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) {
     return Diags->Report(FullSourceLoc(Loc, getSourceManager()), DiagID);
   }
-  
+
   DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) {
     return Diags->Report(FullSourceLoc(Tok.getLocation(), getSourceManager()),
                          DiagID);
   }
-  
+
   /// getSpelling() - Return the 'spelling' of the Tok token.  The spelling of a
   /// token is the characters used to represent the token in the source file
   /// after trigraph expansion and escaped-newline folding.  In particular, this
   /// wants to get the true, uncanonicalized, spelling of things like digraphs
   /// UCNs, etc.
   std::string getSpelling(const Token &Tok) const;
-  
+
   /// getSpelling - This method is used to get the spelling of a token into a
   /// preallocated buffer, instead of as an std::string.  The caller is required
   /// to allocate enough space for the token, which is guaranteed to be at least
@@ -521,7 +521,7 @@
     // works.
     return *SourceMgr.getCharacterData(Tok.getLocation());
   }
-  
+
   /// CreateString - Plop the specified string into a scratch buffer and set the
   /// specified token's location and length to it.  If specified, the source
   /// location provides a location of the instantiation point of the token.
@@ -539,35 +539,35 @@
   /// it points into a macro), this routine returns an invalid
   /// source location.
   SourceLocation getLocForEndOfToken(SourceLocation Loc);
-    
+
   /// DumpToken - Print the token to stderr, used for debugging.
   ///
   void DumpToken(const Token &Tok, bool DumpFlags = false) const;
   void DumpLocation(SourceLocation Loc) const;
   void DumpMacro(const MacroInfo &MI) const;
-  
+
   /// AdvanceToTokenCharacter - Given a location that specifies the start of a
   /// token, return a new location that specifies a character within the token.
   SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart,unsigned Char);
-  
+
   /// IncrementPasteCounter - Increment the counters for the number of token
   /// paste operations performed.  If fast was specified, this is a 'fast paste'
   /// case we handled.
-  /// 
+  ///
   void IncrementPasteCounter(bool isFast) {
     if (isFast)
       ++NumFastTokenPaste;
     else
       ++NumTokenPaste;
   }
-  
+
   void PrintStats();
 
   /// HandleMicrosoftCommentPaste - When the macro expander pastes together a
   /// comment (/##/) in microsoft mode, this method handles updating the current
   /// state, returning the token on the next source line.
   void HandleMicrosoftCommentPaste(Token &Tok);
-  
+
   //===--------------------------------------------------------------------===//
   // Preprocessor callback methods.  These are invoked by a lexer as various
   // directives and events are found.
@@ -576,26 +576,26 @@
   /// identifier information for the token and install it into the token.
   IdentifierInfo *LookUpIdentifierInfo(Token &Identifier,
                                        const char *BufPtr = 0);
-  
+
   /// HandleIdentifier - This callback is invoked when the lexer reads an
   /// identifier and has filled in the tokens IdentifierInfo member.  This
   /// callback potentially macro expands it or turns it into a named token (like
   /// 'for').
   void HandleIdentifier(Token &Identifier);
 
-  
+
   /// HandleEndOfFile - This callback is invoked when the lexer hits the end of
   /// the current file.  This either returns the EOF token and returns true, or
   /// pops a level off the include stack and returns false, at which point the
   /// client should call lex again.
   bool HandleEndOfFile(Token &Result, bool isEndOfMacro = false);
-  
+
   /// HandleEndOfTokenLexer - This callback is invoked when the current
   /// TokenLexer hits the end of its token stream.
   bool HandleEndOfTokenLexer(Token &Result);
-  
+
   /// 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 HandleDirective(Token &Result);
@@ -604,11 +604,11 @@
   /// not, emit a diagnostic and consume up until the eom.  If EnableMacros is
   /// true, then we consider macros that expand to zero tokens as being ok.
   void CheckEndOfDirective(const char *Directive, bool EnableMacros = false);
-  
+
   /// DiscardUntilEndOfDirective - Read and discard all tokens remaining on the
   /// current line until the tok::eom token is found.
   void DiscardUntilEndOfDirective();
-  
+
   /// SawDateOrTime - This returns true if the preprocessor has seen a use of
   /// __DATE__ or __TIME__ in the file so far.
   bool SawDateOrTime() const {
@@ -616,13 +616,13 @@
   }
   unsigned getCounterValue() const { return CounterValue; }
   void setCounterValue(unsigned V) { CounterValue = V; }
-  
+
   /// AllocateMacroInfo - Allocate a new MacroInfo object with the provide
   ///  SourceLocation.
   MacroInfo* AllocateMacroInfo(SourceLocation L);
-  
+
 private:
-  
+
   void PushIncludeMacroStack() {
     IncludeMacroStack.push_back(IncludeStackInfo(CurLexer.take(),
                                                  CurPTHLexer.take(),
@@ -631,7 +631,7 @@
                                                  CurDirLookup));
     CurPPLexer = 0;
   }
-  
+
   void PopIncludeMacroStack() {
     CurLexer.reset(IncludeMacroStack.back().TheLexer);
     CurPTHLexer.reset(IncludeMacroStack.back().ThePTHLexer);
@@ -640,11 +640,11 @@
     CurDirLookup  = IncludeMacroStack.back().TheDirLookup;
     IncludeMacroStack.pop_back();
   }
-  
+
   /// ReleaseMacroInfo - Release the specified MacroInfo.  This memory will
   ///  be reused for allocating new MacroInfo objects.
   void ReleaseMacroInfo(MacroInfo* MI);
-  
+
   /// isInPrimaryFile - Return true if we're in the top-level file, not in a
   /// #include.
   bool isInPrimaryFile() const;
@@ -653,13 +653,13 @@
   /// #define or #undef.  This emits a diagnostic, sets the token kind to eom,
   /// and discards the rest of the macro line if the macro name is invalid.
   void ReadMacroName(Token &MacroNameTok, char isDefineUndef = 0);
-  
+
   /// ReadMacroDefinitionArgList - The ( starting an argument list of a macro
   /// definition has just been read.  Lex the rest of the arguments and the
   /// closing ), updating MI with what we learn.  Return true if an error occurs
   /// parsing the arg list.
   bool ReadMacroDefinitionArgList(MacroInfo *MI);
-  
+
   /// SkipExcludedConditionalBlock - We just read a #if or related directive and
   /// decided that the subsequent tokens are in the #if'd out portion of the
   /// file.  Lex the rest of the file, until we see an #endif.  If
@@ -670,34 +670,34 @@
   /// the caller can lex the first valid token.
   void SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
                                     bool FoundNonSkipPortion, bool FoundElse);
-  
+
   /// PTHSkipExcludedConditionalBlock - A fast PTH version of
   ///  SkipExcludedConditionalBlock.
   void PTHSkipExcludedConditionalBlock();
-  
+
   /// EvaluateDirectiveExpression - Evaluate an integer constant expression that
   /// may occur after a #if or #elif directive and return it as a bool.  If the
   /// expression is equivalent to "!defined(X)" return X in IfNDefMacro.
   bool EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro);
-  
+
   /// RegisterBuiltinPragmas - Install the standard preprocessor pragmas:
   /// #pragma GCC poison/system_header/dependency and #pragma once.
   void RegisterBuiltinPragmas();
-  
+
   /// RegisterBuiltinMacros - Register builtin macros, such as __LINE__ with the
   /// identifier table.
   void RegisterBuiltinMacros();
-  
+
   /// HandleMacroExpandedIdentifier - If an identifier token is read that is to
   /// be expanded as a macro, handle it and return the next token as 'Tok'.  If
   /// the macro should not be expanded return true, otherwise return false.
   bool HandleMacroExpandedIdentifier(Token &Tok, MacroInfo *MI);
-  
+
   /// isNextPPTokenLParen - Determine whether the next preprocessor token to be
   /// lexed is a '('.  If so, consume the token and return true, if not, this
   /// method should have no observable side-effect on the lexed tokens.
   bool isNextPPTokenLParen();
-  
+
   /// ReadFunctionLikeMacroArgs - After reading "MACRO(", this method is
   /// invoked to read all of the formal arguments specified for the macro
   /// invocation.  This returns null on error.
@@ -707,12 +707,12 @@
   /// ExpandBuiltinMacro - If an identifier token is read that is to be expanded
   /// as a builtin macro, handle it and return the next token as 'Tok'.
   void ExpandBuiltinMacro(Token &Tok);
-  
+
   /// Handle_Pragma - Read a _Pragma directive, slice it up, process it, then
   /// return the first token after the directive.  The _Pragma token has just
   /// been read into 'Tok'.
   void Handle_Pragma(Token &Tok);
-  
+
   /// EnterSourceFileWithLexer - Add a lexer to the top of the include stack and
   /// start lexing tokens from it instead of the current buffer.
   void EnterSourceFileWithLexer(Lexer *TheLexer, const DirectoryLookup *Dir);
@@ -720,7 +720,7 @@
   /// EnterSourceFileWithPTH - Add a lexer to the top of the include stack and
   /// start getting tokens from it using the PTH cache.
   void EnterSourceFileWithPTH(PTHLexer *PL, const DirectoryLookup *Dir);
-  
+
   /// GetIncludeFilenameSpelling - Turn the specified lexer token into a fully
   /// checked and spelled filename, e.g. as an operand of #include. This returns
   /// true if the input filename was in <>'s or false if it were in ""'s.  The
@@ -729,7 +729,7 @@
   /// this method decides to use a different buffer.
   bool GetIncludeFilenameSpelling(SourceLocation Loc,
                                   const char *&BufStart, const char *&BufEnd);
-  
+
   /// LookupFile - Given a "foo" or <foo> reference, look up the indicated file,
   /// return null on failure.  isAngled indicates whether the file reference is
   /// for system #include's or not (i.e. using <> instead of "").
@@ -737,7 +737,7 @@
                               bool isAngled, const DirectoryLookup *FromDir,
                               const DirectoryLookup *&CurDir);
 
-  
+
 
   /// IsFileLexer - Returns true if we are lexing from a file and not a
   ///  pragma or a macro.
@@ -752,7 +752,7 @@
   bool IsFileLexer() const {
     return IsFileLexer(CurLexer.get(), CurPPLexer);
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Caching stuff.
   void CachingLex(Token &Result);
@@ -773,7 +773,7 @@
   void HandleDigitDirective(Token &Tok);
   void HandleUserDiagnosticDirective(Token &Tok, bool isWarning);
   void HandleIdentSCCSDirective(Token &Tok);
-  
+
   // File inclusion.
   void HandleIncludeDirective(Token &Tok,
                               const DirectoryLookup *LookupFrom = 0,
@@ -781,13 +781,13 @@
   void HandleIncludeNextDirective(Token &Tok);
   void HandleIncludeMacrosDirective(Token &Tok);
   void HandleImportDirective(Token &Tok);
-  
+
   // Macro handling.
   void HandleDefineDirective(Token &Tok);
   void HandleUndefDirective(Token &Tok);
   // HandleAssertDirective(Token &Tok);
   // HandleUnassertDirective(Token &Tok);
-  
+
   // Conditional Inclusion.
   void HandleIfdefDirective(Token &Tok, bool isIfndef,
                             bool ReadAnyTokensBeforeDirective);
@@ -795,7 +795,7 @@
   void HandleEndifDirective(Token &Tok);
   void HandleElseDirective(Token &Tok);
   void HandleElifDirective(Token &Tok);
-  
+
   // Pragmas.
   void HandlePragmaDirective();
 public:
@@ -813,18 +813,18 @@
 class PreprocessorFactory {
 public:
   virtual ~PreprocessorFactory();
-  virtual Preprocessor* CreatePreprocessor() = 0;  
+  virtual Preprocessor* CreatePreprocessor() = 0;
 };
-  
-/// \brief Abstract base class that describes a handler that will receive 
+
+/// \brief Abstract base class that describes a handler that will receive
 /// source ranges for each of the comments encountered in the source file.
 class CommentHandler {
 public:
   virtual ~CommentHandler();
-  
+
   virtual void HandleComment(Preprocessor &PP, SourceRange Comment) = 0;
 };
-  
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Lex/PreprocessorLexer.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessorLexer.h Wed Sep  9 10:08:12 2009
@@ -29,19 +29,19 @@
 
   /// The SourceManager FileID corresponding to the file being lexed.
   const FileID FID;
-  
+
   //===--------------------------------------------------------------------===//
   // Context-specific lexing flags set by the preprocessor.
   //===--------------------------------------------------------------------===//
-  
+
   /// ParsingPreprocessorDirective - This is true when parsing #XXX.  This turns
   /// '\n' into a tok::eom token.
   bool ParsingPreprocessorDirective;
-  
+
   /// ParsingFilename - True after #include: this turns <xx> into a
   /// tok::angle_string_literal token.
   bool ParsingFilename;
-  
+
   /// LexingRawMode - True if in raw mode:  This flag disables interpretation of
   /// tokens and is a far faster mode to lex in than non-raw-mode.  This flag:
   ///  1. If EOF of the current lexer is found, the include stack isn't popped.
@@ -54,40 +54,40 @@
   ///
   /// Note that in raw mode that the PP pointer may be null.
   bool LexingRawMode;
-  
-  /// MIOpt - This is a state machine that detects the #ifndef-wrapping a file 
+
+  /// MIOpt - This is a state machine that detects the #ifndef-wrapping a file
   /// idiom for the multiple-include optimization.
   MultipleIncludeOpt MIOpt;
-  
+
   /// ConditionalStack - Information about the set of #if/#ifdef/#ifndef blocks
   /// we are currently in.
   llvm::SmallVector<PPConditionalInfo, 4> ConditionalStack;
-  
+
   PreprocessorLexer(const PreprocessorLexer&);          // DO NOT IMPLEMENT
   void operator=(const PreprocessorLexer&); // DO NOT IMPLEMENT
   friend class Preprocessor;
-  
+
   PreprocessorLexer(Preprocessor *pp, FileID fid)
     : PP(pp), FID(fid), ParsingPreprocessorDirective(false),
       ParsingFilename(false), LexingRawMode(false) {}
-  
+
   PreprocessorLexer()
-    : PP(0), 
+    : PP(0),
       ParsingPreprocessorDirective(false),
       ParsingFilename(false),
       LexingRawMode(false) {}
-  
+
   virtual ~PreprocessorLexer() {}
-  
+
   virtual void IndirectLex(Token& Result) = 0;
-  
+
   /// getSourceLocation - Return the source location for the next observable
   ///  location.
   virtual SourceLocation getSourceLocation() = 0;
-  
+
   //===--------------------------------------------------------------------===//
   // #if directive handling.
-  
+
   /// pushConditionalLevel - When we enter a #if directive, this keeps track of
   /// what we are currently in for diagnostic emission (e.g. #if with missing
   /// #endif).
@@ -102,8 +102,8 @@
   }
   void pushConditionalLevel(const PPConditionalInfo &CI) {
     ConditionalStack.push_back(CI);
-  }    
-  
+  }
+
   /// popConditionalLevel - Remove an entry off the top of the conditional
   /// stack, returning information about it.  If the conditional stack is empty,
   /// this returns true and does not fill in the arguments.
@@ -113,44 +113,44 @@
     ConditionalStack.pop_back();
     return false;
   }
-  
+
   /// peekConditionalLevel - Return the top of the conditional stack.  This
   /// requires that there be a conditional active.
   PPConditionalInfo &peekConditionalLevel() {
     assert(!ConditionalStack.empty() && "No conditionals active!");
     return ConditionalStack.back();
   }
-  
-  unsigned getConditionalStackDepth() const { return ConditionalStack.size(); } 
+
+  unsigned getConditionalStackDepth() const { return ConditionalStack.size(); }
 
 public:
-  
+
   //===--------------------------------------------------------------------===//
   // Misc. lexing methods.
-  
+
   /// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
   /// (potentially) macro expand the filename.  If the sequence parsed is not
   /// lexically legal, emit a diagnostic and return a result EOM token.
   void LexIncludeFilename(Token &Result);
-  
+
   /// setParsingPreprocessorDirective - Inform the lexer whether or not
   ///  we are currently lexing a preprocessor directive.
   void setParsingPreprocessorDirective(bool f) {
     ParsingPreprocessorDirective = f;
   }
-  
+
   /// isLexingRawMode - Return true if this lexer is in raw mode or not.
   bool isLexingRawMode() const { return LexingRawMode; }
 
   /// getPP - Return the preprocessor object for this lexer.
   Preprocessor *getPP() const { return PP; }
-  
-  FileID getFileID() const { 
+
+  FileID getFileID() const {
     assert(PP &&
       "PreprocessorLexer::getFileID() should only be used with a Preprocessor");
     return FID;
   }
-  
+
   /// getFileEntry - Return the FileEntry corresponding to this FileID.  Like
   /// getFileID(), this only works for lexers with attached preprocessors.
   const FileEntry *getFileEntry() const;

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

==============================================================================
--- cfe/trunk/include/clang/Lex/ScratchBuffer.h (original)
+++ cfe/trunk/include/clang/Lex/ScratchBuffer.h Wed Sep  9 10:08:12 2009
@@ -29,13 +29,13 @@
   unsigned BytesUsed;
 public:
   ScratchBuffer(SourceManager &SM);
-  
+
   /// getToken - Splat the specified text into a temporary MemoryBuffer and
   /// return a SourceLocation that refers to the token.  This is just like the
   /// previous method, but returns a location that indicates the physloc of the
   /// token.
   SourceLocation getToken(const char *Buf, unsigned Len, const char *&DestPtr);
-                          
+
 private:
   void AllocScratchBuffer(unsigned RequestLen);
 };

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

==============================================================================
--- cfe/trunk/include/clang/Lex/Token.h (original)
+++ cfe/trunk/include/clang/Lex/Token.h Wed Sep  9 10:08:12 2009
@@ -62,14 +62,14 @@
 
   /// Kind - The actual flavor of token this is.
   ///
-  unsigned Kind : 8;  // DON'T make Kind a 'tok::TokenKind'; 
+  unsigned Kind : 8;  // DON'T make Kind a 'tok::TokenKind';
                       // MSVC will treat it as a signed char and
                       // TokenKinds > 127 won't be handled correctly.
-  
+
   /// Flags - Bits we track about this token, members of the TokenFlags enum.
   unsigned Flags : 8;
 public:
-    
+
   // Various flags set per token:
   enum TokenFlags {
     StartOfLine   = 0x01,  // At start of line or only after whitespace.
@@ -80,7 +80,7 @@
 
   tok::TokenKind getKind() const { return (tok::TokenKind)Kind; }
   void setKind(tok::TokenKind K) { Kind = K; }
-  
+
   /// is/isNot - Predicates to check if this token is a specific kind, as in
   /// "if (Tok.is(tok::l_brace)) {...}".
   bool is(tok::TokenKind K) const { return Kind == (unsigned) K; }
@@ -94,12 +94,12 @@
            is(tok::angle_string_literal);
   }
 
-  bool isAnnotation() const { 
-    return is(tok::annot_typename) || 
+  bool isAnnotation() const {
+    return is(tok::annot_typename) ||
            is(tok::annot_cxxscope) ||
            is(tok::annot_template_id);
   }
-  
+
   /// getLocation - Return a source location identifier for the specified
   /// offset in the current file.
   SourceLocation getLocation() const { return Loc; }
@@ -132,11 +132,11 @@
     setLocation(R.getBegin());
     setAnnotationEndLoc(R.getEnd());
   }
-  
+
   const char *getName() const {
     return tok::getTokenName( (tok::TokenKind) Kind);
   }
-  
+
   /// startToken - Reset all flags to cleared.
   ///
   void startToken() {
@@ -145,7 +145,7 @@
     PtrData = 0;
     Loc = SourceLocation();
   }
-  
+
   IdentifierInfo *getIdentifierInfo() const {
     assert(!isAnnotation() && "Used IdentInfo on annotation token!");
     if (isLiteral()) return 0;
@@ -154,7 +154,7 @@
   void setIdentifierInfo(IdentifierInfo *II) {
     PtrData = (void*) II;
   }
-  
+
   /// getLiteralData - For a literal token (numeric constant, string, etc), this
   /// returns a pointer to the start of it in the text buffer if known, null
   /// otherwise.
@@ -166,7 +166,7 @@
     assert(isLiteral() && "Cannot set literal data of non-literal");
     PtrData = (void*)Ptr;
   }
-  
+
   void *getAnnotationValue() const {
     assert(isAnnotation() && "Used AnnotVal on non-annotation token");
     return PtrData;
@@ -175,17 +175,17 @@
     assert(isAnnotation() && "Used AnnotVal on non-annotation token");
     PtrData = val;
   }
-  
+
   /// setFlag - Set the specified flag.
   void setFlag(TokenFlags Flag) {
     Flags |= Flag;
   }
-  
+
   /// clearFlag - Unset the specified flag.
   void clearFlag(TokenFlags Flag) {
     Flags &= ~Flag;
   }
-  
+
   /// getFlags - Return the internal represtation of the flags.
   ///  Only intended for low-level operations such as writing tokens to
   //   disk.
@@ -195,32 +195,32 @@
 
   /// setFlagValue - Set a flag to either true or false.
   void setFlagValue(TokenFlags Flag, bool Val) {
-    if (Val) 
+    if (Val)
       setFlag(Flag);
     else
       clearFlag(Flag);
   }
-  
+
   /// isAtStartOfLine - Return true if this token is at the start of a line.
   ///
   bool isAtStartOfLine() const { return (Flags & StartOfLine) ? true : false; }
-  
+
   /// hasLeadingSpace - Return true if this token has whitespace before it.
   ///
   bool hasLeadingSpace() const { return (Flags & LeadingSpace) ? true : false; }
-  
+
   /// isExpandDisabled - Return true if this identifier token should never
   /// be expanded in the future, due to C99 6.10.3.4p2.
   bool isExpandDisabled() const {
     return (Flags & DisableExpand) ? true : false;
   }
-  
-  /// isObjCAtKeyword - Return true if we have an ObjC keyword identifier. 
+
+  /// isObjCAtKeyword - Return true if we have an ObjC keyword identifier.
   bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const;
-  
+
   /// getObjCKeywordID - Return the ObjC keyword kind.
   tok::ObjCKeywordKind getObjCKeywordID() const;
-  
+
   /// needsCleaning - Return true if this token has trigraphs or escaped
   /// newlines in it.
   ///
@@ -233,15 +233,15 @@
   /// IfLoc - Location where the conditional started.
   ///
   SourceLocation IfLoc;
-  
+
   /// WasSkipping - True if this was contained in a skipping directive, e.g.
   /// in a "#if 0" block.
   bool WasSkipping;
-  
+
   /// FoundNonSkip - True if we have emitted tokens already, and now we're in
   /// an #else block or something.  Only useful in Skipping blocks.
   bool FoundNonSkip;
-  
+
   /// FoundElse - True if we've seen a #else in this block.  If so,
   /// #elif/#else directives are not allowed.
   bool FoundElse;
@@ -263,41 +263,41 @@
 
   /// The declaration of the template corresponding to the
   /// template-name. This is an Action::DeclTy*.
-  void *Template; 
+  void *Template;
 
   /// The kind of template that Template refers to.
   TemplateNameKind Kind;
 
   /// The location of the '<' before the template argument
-  /// list. 
+  /// list.
   SourceLocation LAngleLoc;
 
   /// The location of the '>' after the template argument
-  /// list. 
+  /// list.
   SourceLocation RAngleLoc;
 
   /// NumArgs - The number of template arguments.
-  unsigned NumArgs; 
+  unsigned NumArgs;
 
   /// \brief Retrieves a pointer to the template arguments
   void **getTemplateArgs() { return (void **)(this + 1); }
 
   /// \brief Retrieves a pointer to the array of template argument
   /// locations.
-  SourceLocation *getTemplateArgLocations() { 
+  SourceLocation *getTemplateArgLocations() {
     return (SourceLocation *)(getTemplateArgs() + NumArgs);
   }
 
   /// \brief Retrieves a pointer to the array of flags that states
   /// whether the template arguments are types.
-  bool *getTemplateArgIsType() { 
+  bool *getTemplateArgIsType() {
     return (bool *)(getTemplateArgLocations() + NumArgs);
   }
 
   static TemplateIdAnnotation* Allocate(unsigned NumArgs) {
-    TemplateIdAnnotation *TemplateId 
-      = (TemplateIdAnnotation *)std::malloc(sizeof(TemplateIdAnnotation) + 
-                                            sizeof(void*) * NumArgs + 
+    TemplateIdAnnotation *TemplateId
+      = (TemplateIdAnnotation *)std::malloc(sizeof(TemplateIdAnnotation) +
+                                            sizeof(void*) * NumArgs +
                                             sizeof(SourceLocation) * NumArgs +
                                             sizeof(bool) * NumArgs);
     TemplateId->NumArgs = NumArgs;

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

==============================================================================
--- cfe/trunk/include/clang/Lex/TokenConcatenation.h (original)
+++ cfe/trunk/include/clang/Lex/TokenConcatenation.h Wed Sep  9 10:08:12 2009
@@ -19,7 +19,7 @@
 namespace clang {
   class Preprocessor;
   class Token;
-  
+
   /// TokenConcatenation class, which answers the question of
   ///   "Is it safe to emit two tokens without a whitespace between them, or
   ///    would that cause implicit concatenation of the tokens?"
@@ -30,40 +30,40 @@
   ///
   class TokenConcatenation {
     Preprocessor &PP;
-    
+
     enum AvoidConcatInfo {
       /// By default, a token never needs to avoid concatenation.  Most tokens
       /// (e.g. ',', ')', etc) don't cause a problem when concatenated.
       aci_never_avoid_concat = 0,
-      
+
       /// aci_custom_firstchar - AvoidConcat contains custom code to handle this
       /// token's requirements, and it needs to know the first character of the
       /// token.
       aci_custom_firstchar = 1,
-      
+
       /// aci_custom - AvoidConcat contains custom code to handle this token's
       /// requirements, but it doesn't need to know the first character of the
       /// token.
       aci_custom = 2,
-      
+
       /// aci_avoid_equal - Many tokens cannot be safely followed by an '='
       /// character.  For example, "<<" turns into "<<=" when followed by an =.
       aci_avoid_equal = 4
     };
-    
+
     /// TokenInfo - This array contains information for each token on what
     /// action to take when avoiding concatenation of tokens in the AvoidConcat
     /// method.
     char TokenInfo[tok::NUM_TOKENS];
   public:
     TokenConcatenation(Preprocessor &PP);
-    
+
     bool AvoidConcat(const Token &PrevTok, const Token &Tok) const;
 
   private:
     /// StartsWithL - Return true if the spelling of this token starts with 'L'.
     bool StartsWithL(const Token &Tok) const;
-    
+
     /// IsIdentifierL - Return true if the spelling of this token is literally
     /// 'L'.
     bool IsIdentifierL(const Token &Tok) const;

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

==============================================================================
--- cfe/trunk/include/clang/Lex/TokenLexer.h (original)
+++ cfe/trunk/include/clang/Lex/TokenLexer.h Wed Sep  9 10:08:12 2009
@@ -21,7 +21,7 @@
   class Preprocessor;
   class Token;
   class MacroArgs;
-  
+
 /// TokenLexer - This implements a lexer that returns token from a macro body
 /// or token stream instead of lexing from a character buffer.  This is used for
 /// macro expansion and _Pragma handling, for example.
@@ -47,34 +47,34 @@
   /// the preprocessor's bump pointer allocator, or some other buffer that we
   /// may or may not own (depending on OwnsTokens).
   const Token *Tokens;
-  
+
   /// NumTokens - This is the length of the Tokens array.
   ///
   unsigned NumTokens;
-  
+
   /// CurToken - This is the next token that Lex will return.
   ///
   unsigned CurToken;
-  
+
   /// InstantiateLocStart/End - The source location range where this macro was
   /// instantiated.
   SourceLocation InstantiateLocStart, InstantiateLocEnd;
-  
+
   /// Lexical information about the expansion point of the macro: the identifier
   /// that the macro expanded from had these properties.
   bool AtStartOfLine : 1;
   bool HasLeadingSpace : 1;
-  
+
   /// OwnsTokens - This is true if this TokenLexer allocated the Tokens
   /// array, and thus needs to free it when destroyed.  For simple object-like
   /// macros (for example) we just point into the token buffer of the macro
   /// definition, we don't make a copy of it.
   bool OwnsTokens : 1;
-  
+
   /// DisableMacroExpansion - This is true when tokens lexed from the TokenLexer
   /// should not be subject to further macro expansion.
   bool DisableMacroExpansion : 1;
-  
+
   TokenLexer(const TokenLexer&);  // DO NOT IMPLEMENT
   void operator=(const TokenLexer&); // DO NOT IMPLEMENT
 public:
@@ -87,13 +87,13 @@
     : Macro(0), ActualArgs(0), PP(pp), OwnsTokens(false) {
     Init(Tok, ILEnd, ActualArgs);
   }
-  
+
   /// Init - Initialize this TokenLexer to expand from the specified macro
   /// with the specified argument information.  Note that this ctor takes
   /// ownership of the ActualArgs pointer.  ILEnd specifies the location of the
   /// ')' for a function-like macro or the identifier for an object-like macro.
   void Init(Token &Tok, SourceLocation ILEnd, MacroArgs *ActualArgs);
-  
+
   /// Create a TokenLexer for the specified token stream.  If 'OwnsTokens' is
   /// specified, this takes ownership of the tokens and delete[]'s them when
   /// the token lexer is empty.
@@ -102,45 +102,45 @@
     : Macro(0), ActualArgs(0), PP(pp), OwnsTokens(false) {
     Init(TokArray, NumToks, DisableExpansion, ownsTokens);
   }
-  
+
   /// Init - Initialize this TokenLexer with the specified token stream.
   /// This does not take ownership of the specified token vector.
   ///
-  /// DisableExpansion is true when macro expansion of tokens lexed from this 
+  /// DisableExpansion is true when macro expansion of tokens lexed from this
   /// stream should be disabled.
   void Init(const Token *TokArray, unsigned NumToks,
             bool DisableMacroExpansion, bool OwnsTokens);
-  
+
   ~TokenLexer() { destroy(); }
-  
+
   /// isNextTokenLParen - If the next token lexed will pop this macro off the
   /// expansion stack, return 2.  If the next unexpanded token is a '(', return
   /// 1, otherwise return 0.
   unsigned isNextTokenLParen() const;
-  
+
   /// Lex - Lex and return a token from this macro stream.
   void Lex(Token &Tok);
-  
+
 private:
   void destroy();
-  
+
   /// isAtEnd - Return true if the next lex call will pop this macro off the
   /// include stack.
   bool isAtEnd() const {
     return CurToken == NumTokens;
   }
-  
+
   /// PasteTokens - Tok is the LHS of a ## operator, and CurToken is the ##
   /// operator.  Read the ## and RHS, and paste the LHS/RHS together.  If there
   /// are is another ## after it, chomp it iteratively.  Return the result as
   /// Tok.  If this returns true, the caller should immediately return the
   /// token.
   bool PasteTokens(Token &Tok);
-  
+
   /// Expand the arguments of a function-like macro so that we can quickly
   /// return preexpanded tokens from Tokens.
   void ExpandFunctionArguments();
-  
+
   /// HandleMicrosoftCommentPaste - In microsoft compatibility mode, /##/ pastes
   /// together to form a comment that comments out everything in the current
   /// macro, other active macros, and anything left on the current physical

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Wed Sep  9 10:08:12 2009
@@ -50,7 +50,7 @@
   template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;};
   template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;};
   template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;};
-  
+
 /// Action - As the parser reads the input file and recognizes the productions
 /// of the grammar, it invokes methods on this class to turn the parsed input
 /// into something useful: e.g. a parse tree.
@@ -103,22 +103,22 @@
   typedef ASTMultiPtr<&ActionBase::DeleteStmt> MultiStmtArg;
   typedef ASTMultiPtr<&ActionBase::DeleteTemplateParams> MultiTemplateParamsArg;
 
-  class FullExprArg {    
+  class FullExprArg {
   public:
     // FIXME: The const_cast here is ugly. RValue references would make this
-    // much nicer (or we could duplicate a bunch of the move semantics 
+    // much nicer (or we could duplicate a bunch of the move semantics
     // emulation code from Ownership.h).
     FullExprArg(const FullExprArg& Other)
       : Expr(move(const_cast<FullExprArg&>(Other).Expr)) {}
-    
+
     OwningExprResult release() {
       return move(Expr);
     }
-    
+
     ExprArg* operator->() {
       return &Expr;
     }
-    
+
   private:
     // FIXME: No need to make the entire Action class a friend when it's just
     // Action::FullExpr that needs access to the constructor below.
@@ -129,7 +129,7 @@
 
     ExprArg Expr;
   };
-  
+
   template<typename T>
   FullExprArg FullExpr(T &Arg) {
       return FullExprArg(ActOnFinishFullExpr(move(Arg)));
@@ -150,24 +150,24 @@
   virtual void PrintStats() const {}
 
   /// 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) { return ""; }
-  
+
   /// \brief Invoked for each comment in the source code, providing the source
   /// range that contains the comment.
   virtual void ActOnComment(SourceRange Comment) { }
-  
+
   //===--------------------------------------------------------------------===//
   // Declaration Tracking Callbacks.
   //===--------------------------------------------------------------------===//
-  
+
   /// ConvertDeclToDeclGroup - If the parser has one decl in a context where it
   /// needs a decl group, it calls this to convert between the two
   /// representations.
   virtual DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr) {
     return DeclGroupPtrTy();
   }
-  
+
   /// getTypeName - Return non-null if the specified identifier is a type name
   /// in the current scope.
   ///
@@ -177,13 +177,13 @@
   ///
   /// \param S the scope in which this name lookup occurs
   ///
-  /// \param SS if non-NULL, the C++ scope specifier that precedes the 
+  /// \param SS if non-NULL, the C++ scope specifier that precedes the
   /// identifier
   ///
-  /// \param isClassName whether this is a C++ class-name production, in 
-  /// which we can end up referring to a member of an unknown specialization 
+  /// \param isClassName whether this is a C++ class-name production, in
+  /// which we can end up referring to a member of an unknown specialization
   /// that we know (from the grammar) is supposed to be a type. For example,
-  /// this occurs when deriving from "std::vector<T>::allocator_type", where T 
+  /// this occurs when deriving from "std::vector<T>::allocator_type", where T
   /// is a template parameter.
   ///
   /// \returns the type referred to by this identifier, or NULL if the type
@@ -200,7 +200,7 @@
   virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S) {
     return DeclSpec::TST_unspecified;
   }
-  
+
   /// isCurrentClassName - Return true if the specified name is the
   /// name of the innermost C++ class type currently being defined.
   virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
@@ -227,7 +227,7 @@
   ///
   /// \returns the kind of template that this name refers to.
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const IdentifierInfo &II, 
+                                          const IdentifierInfo &II,
                                           SourceLocation IdLoc,
                                           const CXXScopeSpec *SS,
                                           TypeTy *ObjectType,
@@ -253,18 +253,18 @@
   /// \param IdLoc the location of the identifier we have just parsed (e.g.,
   /// the "bar" in "foo::bar::".
   ///
-  /// \param CCLoc the location of the '::' at the end of the 
+  /// \param CCLoc the location of the '::' at the end of the
   /// nested-name-specifier.
   ///
-  /// \param II the identifier that represents the scope that this 
+  /// \param II the identifier that represents the scope that this
   /// nested-name-specifier refers to, e.g., the "bar" in "foo::bar::".
   ///
-  /// \param ObjectType if this nested-name-specifier occurs as part of a 
+  /// \param ObjectType if this nested-name-specifier occurs as part of a
   /// C++ member access expression such as "x->Base::f", the type of the base
   /// object (e.g., *x in the example, if "x" were a pointer).
-  /// 
+  ///
   /// \param EnteringContext if true, then we intend to immediately enter the
-  /// context of this nested-name-specifier, e.g., for an out-of-line 
+  /// context of this nested-name-specifier, e.g., for an out-of-line
   /// definition of a class member.
   ///
   /// \returns a CXXScopeTy* object representing the C++ scope.
@@ -291,7 +291,7 @@
                                                   TypeTy *Type,
                                                   SourceRange TypeRange,
                                                   SourceLocation CCLoc) {
-    return 0; 
+    return 0;
   }
 
   /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
@@ -340,12 +340,12 @@
     return DeclPtrTy();
   }
 
-  /// AddInitializerToDecl - This action is called immediately after 
-  /// ActOnDeclarator (when an initializer is present). The code is factored 
+  /// AddInitializerToDecl - This action is called immediately after
+  /// ActOnDeclarator (when an initializer is present). The code is factored
   /// this way to make sure we are able to handle the following:
   ///   void func() { int xx = xx; }
   /// This allows ActOnDeclarator to register "xx" prior to parsing the
-  /// initializer. The declaration above should still result in a warning, 
+  /// initializer. The declaration above should still result in a warning,
   /// since the reference to "xx" is uninitialized.
   virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) {
     return;
@@ -363,7 +363,7 @@
   /// ActOnDeclarator (when an initializer is *not* present).
   /// If TypeContainsUndeducedAuto is true, then the type of the declarator
   /// has an undeduced 'auto' type somewhere.
-  virtual void ActOnUninitializedDecl(DeclPtrTy Dcl, 
+  virtual void ActOnUninitializedDecl(DeclPtrTy Dcl,
                                       bool TypeContainsUndeducedAuto) {
     return;
   }
@@ -376,7 +376,7 @@
     return DeclGroupPtrTy();
   }
 
-  
+
   /// @brief Indicates that all K&R-style parameter declarations have
   /// been parsed prior to a function definition.
   /// @param S  The function prototype scope.
@@ -414,7 +414,7 @@
                                           ExprArg AsmString) {
     return DeclPtrTy();
   }
-  
+
   /// ActOnPopScope - This callback is called immediately before the specified
   /// scope is popped and deleted.
   virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {}
@@ -422,7 +422,7 @@
   /// ActOnTranslationUnitScope - This callback is called once, immediately
   /// after creating the translation unit scope (in Parser::Initialize).
   virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {}
-    
+
   /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
   /// no declarator (e.g. "struct foo;") is parsed.
   virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
@@ -459,7 +459,7 @@
   /// translation unit when EOF is reached and all but the top-level scope is
   /// popped.
   virtual void ActOnEndOfTranslationUnit() {}
-  
+
   //===--------------------------------------------------------------------===//
   // Type Parsing Callbacks.
   //===--------------------------------------------------------------------===//
@@ -468,7 +468,7 @@
   virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
     return TypeResult();
   }
-  
+
   enum TagUseKind {
     TUK_Reference,   // Reference to a tag:  'struct foo *X;'
     TUK_Declaration, // Fwd decl of a tag:   'struct foo;'
@@ -481,7 +481,7 @@
   ///
   /// \param S the scope in which this tag occurs.
   ///
-  /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag 
+  /// \param TagSpec an instance of DeclSpec::TST, indicating what kind of tag
   /// this is (struct/union/enum/class).
   ///
   /// \param TUK how the tag we have encountered is being used, which
@@ -489,7 +489,7 @@
   /// declaration of that tag, or the beginning of a definition of
   /// that tag.
   ///
-  /// \param KWLoc the location of the "struct", "class", "union", or "enum" 
+  /// \param KWLoc the location of the "struct", "class", "union", or "enum"
   /// keyword.
   ///
   /// \param SS C++ scope specifier that precedes the name of the tag, e.g.,
@@ -502,12 +502,12 @@
   ///
   /// \param Attr the set of attributes that appertain to the tag.
   ///
-  /// \param AS when this tag occurs within a C++ class, provides the 
-  /// current access specifier (AS_public, AS_private, AS_protected). 
+  /// \param AS when this tag occurs within a C++ class, provides the
+  /// current access specifier (AS_public, AS_private, AS_protected).
   /// Otherwise, it will be AS_none.
   ///
-  /// \param TemplateParameterLists the set of C++ template parameter lists 
-  /// that apply to this tag, if the tag is a declaration or definition (see 
+  /// \param TemplateParameterLists the set of C++ template parameter lists
+  /// that apply to this tag, if the tag is a declaration or definition (see
   /// the \p TK parameter). The action module is responsible for determining,
   /// based on the template parameter lists and the scope specifier, whether
   /// the declared tag is a class template or not.
@@ -525,9 +525,9 @@
                              bool &OwnedDecl) {
     return DeclPtrTy();
   }
-  
+
   /// Act on @defs() element found when parsing a structure.  ClassName is the
-  /// name of the referenced class.   
+  /// name of the referenced class.
   virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
                          IdentifierInfo *ClassName,
                          llvm::SmallVectorImpl<DeclPtrTy> &Decls) {}
@@ -536,19 +536,19 @@
                                Declarator &D, ExprTy *BitfieldWidth) {
     return DeclPtrTy();
   }
-  
+
   virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
                               DeclPtrTy IntfDecl,
                               Declarator &D, ExprTy *BitfieldWidth,
                               tok::ObjCKeywordKind visibility) {
     return DeclPtrTy();
   }
-  
+
   virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
-                           DeclPtrTy *Fields, unsigned NumFields, 
+                           DeclPtrTy *Fields, unsigned NumFields,
                            SourceLocation LBrac, SourceLocation RBrac,
                            AttributeList *AttrList) {}
-  
+
   /// ActOnTagStartDefinition - Invoked when we have entered the
   /// scope of a tag's definition (e.g., for an enumeration, class,
   /// struct, or union).
@@ -602,10 +602,10 @@
                                          SourceLocation ColonLoc) {
     return StmtEmpty();
   }
-  
+
   /// ActOnCaseStmtBody - This installs a statement as the body of a case.
   virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt) {}
-  
+
   virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
                                             SourceLocation ColonLoc,
                                             StmtArg SubStmt, Scope *CurScope){
@@ -619,8 +619,8 @@
     return StmtEmpty();
   }
 
-  virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc, 
-                                       FullExprArg CondVal, StmtArg ThenVal, 
+  virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
+                                       FullExprArg CondVal, StmtArg ThenVal,
                                        SourceLocation ElseLoc,
                                        StmtArg ElseVal) {
     return StmtEmpty();
@@ -635,12 +635,12 @@
     return StmtEmpty();
   }
 
-  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, 
+  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
                                           FullExprArg Cond, StmtArg Body) {
     return StmtEmpty();
   }
   virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
-                                       SourceLocation WhileLoc, 
+                                       SourceLocation WhileLoc,
                                        SourceLocation CondLParen,
                                        ExprArg Cond,
                                        SourceLocation CondRParen) {
@@ -682,7 +682,7 @@
     return StmtEmpty();
   }
   virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
-                                        bool IsSimple,                                  
+                                        bool IsSimple,
                                         bool IsVolatile,
                                         unsigned NumOutputs,
                                         unsigned NumInputs,
@@ -753,15 +753,15 @@
     /// \brief The current expression and its subexpressions occur within an
     /// unevaluated operand (C++0x [expr]p8), such as a constant expression
     /// or the subexpression of \c sizeof, where the type or the value of the
-    /// expression may be significant but no code will be generated to evaluate 
+    /// expression may be significant but no code will be generated to evaluate
     /// the value of the expression at run time.
     Unevaluated,
-    
-    /// \brief The current expression is potentially evaluated at run time, 
-    /// which means that code may be generated to evaluate the value of the 
+
+    /// \brief The current expression is potentially evaluated at run time,
+    /// which means that code may be generated to evaluate the value of the
     /// expression at run time.
     PotentiallyEvaluated,
-    
+
     /// \brief The current expression may be potentially evaluated or it may
     /// be unevaluated, but it is impossible to tell from the lexical context.
     /// This evaluation context is used primary for the operand of the C++
@@ -769,17 +769,17 @@
     /// it is an lvalue of polymorphic class type (C++ [basic.def.odr]p2).
     PotentiallyPotentiallyEvaluated
   };
-  
+
   /// \brief The parser is entering a new expression evaluation context.
   ///
   /// \param NewContext is the new expression evaluation context.
   ///
   /// \returns the previous expression evaluation context.
-  virtual ExpressionEvaluationContext 
+  virtual ExpressionEvaluationContext
   PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) {
     return PotentiallyEvaluated;
   }
-  
+
   /// \brief The parser is existing an expression evaluation context.
   ///
   /// \param OldContext the expression evaluation context that the parser is
@@ -787,10 +787,10 @@
   ///
   /// \param NewContext the expression evaluation context that the parser is
   /// returning to.
-  virtual void 
+  virtual void
   PopExpressionEvaluationContext(ExpressionEvaluationContext OldContext,
                                  ExpressionEvaluationContext NewContext) { }
-  
+
   // Primary Expressions.
 
   /// \brief Retrieve the source range that corresponds to the given
@@ -862,12 +862,12 @@
     return move(Val);  // Default impl returns operand.
   }
 
-  virtual OwningExprResult ActOnParenListExpr(SourceLocation L, 
-                                              SourceLocation R, 
+  virtual OwningExprResult ActOnParenListExpr(SourceLocation L,
+                                              SourceLocation R,
                                               MultiExprArg Val) {
     return ExprEmpty();
   }
-  
+
   // Postfix Expressions.
   virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
                                                tok::TokenKind Kind,
@@ -924,8 +924,8 @@
                                          SourceLocation RParenLoc) {
     return ExprEmpty();
   }
-  /// @brief Parsed a C99 designated initializer. 
-  /// 
+  /// @brief Parsed a C99 designated initializer.
+  ///
   /// @param Desig Contains the designation with one or more designators.
   ///
   /// @param Loc The location of the '=' or ':' prior to the
@@ -945,11 +945,11 @@
   }
 
   virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
-                                         TypeTy *Ty, SourceLocation RParenLoc, 
+                                         TypeTy *Ty, SourceLocation RParenLoc,
                                          ExprArg Op) {
     return ExprEmpty();
   }
-    
+
   virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
                                       tok::TokenKind Kind,
                                       ExprArg LHS, ExprArg RHS) {
@@ -999,13 +999,13 @@
   }
 
   // __builtin_types_compatible_p(type1, type2)
-  virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, 
+  virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
                                                     TypeTy *arg1, TypeTy *arg2,
                                                     SourceLocation RPLoc) {
     return ExprEmpty();
   }
   // __builtin_choose_expr(constExpr, expr1, expr2)
-  virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, 
+  virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
                                            ExprArg cond, ExprArg expr1,
                                            ExprArg expr2, SourceLocation RPLoc){
     return ExprEmpty();
@@ -1093,7 +1093,7 @@
                                           OverloadedOperatorKind Op,
                                           AttributeList *AttrList,
                                           bool IsTypeName);
-                                         
+
   /// ActOnParamDefaultArgument - Parse default argument for function parameter
   virtual void ActOnParamDefaultArgument(DeclPtrTy param,
                                          SourceLocation EqualLoc,
@@ -1104,7 +1104,7 @@
   /// argument for a function parameter, but we can't parse it yet
   /// because we're inside a class definition. Note that this default
   /// argument will be parsed later.
-  virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param, 
+  virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
                                                  SourceLocation EqualLoc,
                                                  SourceLocation ArgLoc) { }
 
@@ -1112,7 +1112,7 @@
   /// the default argument for the parameter param failed.
   virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) { }
 
-  /// 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,
@@ -1286,7 +1286,7 @@
     return ExprEmpty();
   }
 
-  /// \brief Invoked when the parser is starting to parse a C++ member access 
+  /// \brief Invoked when the parser is starting to parse a C++ member access
   /// expression such as x.f or x->f.
   ///
   /// \param S the scope in which the member access expression occurs.
@@ -1299,7 +1299,7 @@
   /// \param OpKind the kind of member access operator ("." or "->")
   ///
   /// \param ObjectType originally NULL. The action should fill in this type
-  /// with the type into which name lookup should look to find the member in 
+  /// with the type into which name lookup should look to find the member in
   /// the member access expression.
   ///
   /// \returns the (possibly modified) \p Base expression
@@ -1310,7 +1310,7 @@
                                                         TypeTy *&ObjectType) {
     return ExprEmpty();
   }
-  
+
   /// ActOnDestructorReferenceExpr - Parsed a destructor reference, for example:
   ///
   /// t->~T();
@@ -1352,10 +1352,10 @@
                                        const CXXScopeSpec *SS = 0) {
     return ExprEmpty();
   }
-  
+
   /// \brief Parsed a reference to a member template-id.
   ///
-  /// This callback will occur instead of ActOnMemberReferenceExpr() when the 
+  /// This callback will occur instead of ActOnMemberReferenceExpr() when the
   /// member in question is a template for which the code provides an
   /// explicitly-specified template argument list, e.g.,
   ///
@@ -1371,7 +1371,7 @@
   ///
   /// \param OpKind the kind of operator, which will be "." or "->".
   ///
-  /// \param SS the scope specifier that precedes the template-id in, e.g., 
+  /// \param SS the scope specifier that precedes the template-id in, e.g.,
   /// \c x.Base::f<int>().
   ///
   /// \param Template the declaration of the template that is being referenced.
@@ -1399,7 +1399,7 @@
                                      SourceLocation RAngleLoc) {
     return ExprEmpty();
   }
-  
+
   /// ActOnFinishFullExpr - Called whenever a full expression has been parsed.
   /// (C++ [intro.execution]p12).
   virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr) {
@@ -1408,18 +1408,18 @@
 
   //===---------------------------- C++ Classes ---------------------------===//
   /// ActOnBaseSpecifier - Parsed a base specifier
-  virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl, 
+  virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
                                         SourceRange SpecifierRange,
                                         bool Virtual, AccessSpecifier Access,
-                                        TypeTy *basetype, 
+                                        TypeTy *basetype,
                                         SourceLocation BaseLoc) {
     return BaseResult();
   }
 
-  virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases, 
+  virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
                                    unsigned NumBases) {
   }
-                                   
+
   /// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
   /// declarator is parsed. 'AS' is the access specifier, 'BitfieldWidth'
   /// specifies the bitfield width if there is one and 'Init' specifies the
@@ -1452,12 +1452,12 @@
   /// is the function declaration (which will be a C++ constructor in
   /// a well-formed program), ColonLoc is the location of the ':' that
   /// starts the constructor initializer, and MemInit/NumMemInits
-  /// contains the individual member (and base) initializers. 
-  virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl, 
+  /// contains the individual member (and base) initializers.
+  virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
                                     SourceLocation ColonLoc,
                                     MemInitTy **MemInits, unsigned NumMemInits){
   }
- 
+
  virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {}
 
   /// ActOnFinishCXXMemberSpecification - Invoked after all member declarators
@@ -1473,17 +1473,17 @@
   /// ActOnTypeParameter - Called when a C++ template type parameter
   /// (e.g., "typename T") has been parsed. Typename specifies whether
   /// the keyword "typename" was used to declare the type parameter
-  /// (otherwise, "class" was used), ellipsis specifies whether this is a 
+  /// (otherwise, "class" was used), ellipsis specifies whether this is a
   /// C++0x parameter pack, EllipsisLoc specifies the start of the ellipsis,
-  /// and KeyLoc is the location of the "class" or "typename" keyword. 
-  //  ParamName is the name of the parameter (NULL indicates an unnamed template 
+  /// and KeyLoc is the location of the "class" or "typename" keyword.
+  //  ParamName is the name of the parameter (NULL indicates an unnamed template
   //  parameter) and ParamNameLoc is the location of the parameter name (if any)
   /// If the type parameter has a default argument, it will be added
   /// later via ActOnTypeParameterDefault. Depth and Position provide
   /// the number of enclosing templates (see
   /// ActOnTemplateParameterList) and the number of previous
   /// parameters within this template parameter list.
-  virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis, 
+  virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
                                        SourceLocation EllipsisLoc,
                                        SourceLocation KeyLoc,
                                        IdentifierInfo *ParamName,
@@ -1493,8 +1493,8 @@
   }
 
   /// ActOnTypeParameterDefault - Adds a default argument (the type
-  /// Default) to the given template type parameter (TypeParam). 
-  virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam, 
+  /// Default) to the given template type parameter (TypeParam).
+  virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam,
                                          SourceLocation EqualLoc,
                                          SourceLocation DefaultLoc,
                                          TypeTy *Default) {
@@ -1508,7 +1508,7 @@
   /// ActOnTemplateParameterList) and the number of previous
   /// parameters within this template parameter list.
   virtual DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
-                                                  unsigned Depth, 
+                                                  unsigned Depth,
                                                   unsigned Position) {
     return DeclPtrTy();
   }
@@ -1566,7 +1566,7 @@
   /// @endcode
   ///
   /// ExportLoc, if valid, is the position of the "export"
-  /// keyword. Otherwise, "export" was not specified. 
+  /// keyword. Otherwise, "export" was not specified.
   /// TemplateLoc is the position of the template keyword, LAngleLoc
   /// is the position of the left angle bracket, and RAngleLoc is the
   /// position of the corresponding right angle bracket.
@@ -1575,7 +1575,7 @@
   virtual TemplateParamsTy *
   ActOnTemplateParameterList(unsigned Depth,
                              SourceLocation ExportLoc,
-                             SourceLocation TemplateLoc, 
+                             SourceLocation TemplateLoc,
                              SourceLocation LAngleLoc,
                              DeclPtrTy *Params, unsigned NumParams,
                              SourceLocation RAngleLoc) {
@@ -1607,7 +1607,7 @@
   /// \param TUK Either TUK_Reference or TUK_Friend.  Declarations and
   /// definitions are interpreted as explicit instantiations or
   /// specializations.
-  /// 
+  ///
   /// \param TagSpec The tag keyword that was provided as part of the
   /// elaborated-type-specifier;  either class, struct, union, or enum.
   ///
@@ -1636,7 +1636,7 @@
                                                SourceLocation RAngleLoc) {
     return ExprError();
   }
-  
+
   /// \brief Form a dependent template name.
   ///
   /// This action forms a dependent template name given the template
@@ -1653,10 +1653,10 @@
   ///
   /// \param SS the nested-name-specifier that precedes the "template" keyword
   /// or the template name. FIXME: If the dependent template name occurs in
-  /// a member access expression, e.g., "x.template f<T>", this 
+  /// a member access expression, e.g., "x.template f<T>", this
   /// nested-name-specifier will be empty.
   ///
-  /// \param ObjectType if this dependent template name occurs in the 
+  /// \param ObjectType if this dependent template name occurs in the
   /// context of a member access expression, the type of the object being
   /// accessed.
   virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
@@ -1695,7 +1695,7 @@
   /// (template)
   ///
   /// \param TUK whether this is a declaration or a definition
-  /// 
+  ///
   /// \param KWLoc the location of the 'class', 'struct', or 'union'
   /// keyword.
   ///
@@ -1715,7 +1715,7 @@
   /// specialization); the parser does not check this condition.
   virtual DeclResult
   ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                                   SourceLocation KWLoc, 
+                                   SourceLocation KWLoc,
                                    const CXXScopeSpec &SS,
                                    TemplateTy Template,
                                    SourceLocation TemplateNameLoc,
@@ -1732,22 +1732,22 @@
   /// lists has been parsed.
   ///
   /// This action is similar to ActOnDeclarator(), except that the declaration
-  /// being created somehow involves a template, e.g., it is a template 
+  /// being created somehow involves a template, e.g., it is a template
   /// declaration or specialization.
-  virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S, 
+  virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S,
                               MultiTemplateParamsArg TemplateParameterLists,
                                             Declarator &D) {
     return DeclPtrTy();
   }
-  
+
   /// \brief Invoked when the parser is beginning to parse a function template
   /// or function template specialization definition.
-  virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, 
+  virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
                                 MultiTemplateParamsArg TemplateParameterLists,
                                                     Declarator &D) {
     return DeclPtrTy();
   }
-  
+
   /// \brief Process the explicit instantiation of a class template
   /// specialization.
   ///
@@ -1791,10 +1791,10 @@
   ///
   /// \param Attr attributes that apply to this instantiation.
   virtual DeclResult
-  ActOnExplicitInstantiation(Scope *S, 
+  ActOnExplicitInstantiation(Scope *S,
                              SourceLocation ExternLoc,
                              SourceLocation TemplateLoc,
-                             unsigned TagSpec, 
+                             unsigned TagSpec,
                              SourceLocation KWLoc,
                              const CXXScopeSpec &SS,
                              TemplateTy Template,
@@ -1806,7 +1806,7 @@
                              AttributeList *Attr) {
     return DeclResult();
   }
-                             
+
   /// \brief Process the explicit instantiation of a member class of a
   /// class template specialization.
   ///
@@ -1851,10 +1851,10 @@
   ///
   /// \param Attr attributes that apply to this instantiation.
   virtual DeclResult
-  ActOnExplicitInstantiation(Scope *S, 
+  ActOnExplicitInstantiation(Scope *S,
                              SourceLocation ExternLoc,
                              SourceLocation TemplateLoc,
-                             unsigned TagSpec, 
+                             unsigned TagSpec,
                              SourceLocation KWLoc,
                              const CXXScopeSpec &SS,
                              IdentifierInfo *Name,
@@ -1877,7 +1877,7 @@
   }
 
   /// \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
@@ -1891,22 +1891,22 @@
   }
 
   //===----------------------- Obj-C Declarations -------------------------===//
-  
+
   // ActOnStartClassInterface - this action is called immediately after parsing
-  // the prologue for a class interface (before parsing the instance 
+  // the prologue for a class interface (before parsing the instance
   // variables). Instance variables are processed by ActOnFields().
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
-                                             IdentifierInfo *ClassName, 
+                                             IdentifierInfo *ClassName,
                                              SourceLocation ClassLoc,
-                                             IdentifierInfo *SuperName, 
+                                             IdentifierInfo *SuperName,
                                              SourceLocation SuperLoc,
-                                             const DeclPtrTy *ProtoRefs, 
+                                             const DeclPtrTy *ProtoRefs,
                                              unsigned NumProtoRefs,
                                              SourceLocation EndProtoLoc,
                                              AttributeList *AttrList) {
     return DeclPtrTy();
   }
-  
+
   /// ActOnCompatiblityAlias - this action is called after complete parsing of
   /// @compaatibility_alias declaration. It sets up the alias relationships.
   virtual DeclPtrTy ActOnCompatiblityAlias(
@@ -1915,11 +1915,11 @@
     IdentifierInfo *ClassName, SourceLocation ClassLocation) {
     return DeclPtrTy();
   }
-  
+
   // ActOnStartProtocolInterface - this action is called immdiately after
   // parsing the prologue for a protocol interface.
   virtual DeclPtrTy ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
-                                                IdentifierInfo *ProtocolName, 
+                                                IdentifierInfo *ProtocolName,
                                                 SourceLocation ProtocolLoc,
                                                 const DeclPtrTy *ProtoRefs,
                                                 unsigned NumProtoRefs,
@@ -1930,9 +1930,9 @@
   // ActOnStartCategoryInterface - this action is called immdiately after
   // parsing the prologue for a category interface.
   virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
-                                                IdentifierInfo *ClassName, 
+                                                IdentifierInfo *ClassName,
                                                 SourceLocation ClassLoc,
-                                                IdentifierInfo *CategoryName, 
+                                                IdentifierInfo *CategoryName,
                                                 SourceLocation CategoryLoc,
                                                 const DeclPtrTy *ProtoRefs,
                                                 unsigned NumProtoRefs,
@@ -1940,13 +1940,13 @@
     return DeclPtrTy();
   }
   // ActOnStartClassImplementation - this action is called immdiately after
-  // parsing the prologue for a class implementation. Instance variables are 
+  // parsing the prologue for a class implementation. Instance variables are
   // processed by ActOnFields().
   virtual DeclPtrTy ActOnStartClassImplementation(
     SourceLocation AtClassImplLoc,
-    IdentifierInfo *ClassName, 
+    IdentifierInfo *ClassName,
     SourceLocation ClassLoc,
-    IdentifierInfo *SuperClassname, 
+    IdentifierInfo *SuperClassname,
     SourceLocation SuperClassLoc) {
     return DeclPtrTy();
   }
@@ -1954,12 +1954,12 @@
   // parsing the prologue for a category implementation.
   virtual DeclPtrTy ActOnStartCategoryImplementation(
     SourceLocation AtCatImplLoc,
-    IdentifierInfo *ClassName, 
+    IdentifierInfo *ClassName,
     SourceLocation ClassLoc,
     IdentifierInfo *CatName,
     SourceLocation CatLoc) {
     return DeclPtrTy();
-  }  
+  }
   // ActOnPropertyImplDecl - called for every property implementation
   virtual DeclPtrTy ActOnPropertyImplDecl(
    SourceLocation AtLoc,              // location of the @synthesize/@dynamic
@@ -1971,7 +1971,7 @@
    IdentifierInfo *propertyIvar) {    // name of the ivar
     return DeclPtrTy();
   }
-  
+
   struct ObjCArgInfo {
     IdentifierInfo *Name;
     SourceLocation NameLoc;
@@ -1979,12 +1979,12 @@
     // in this case.
     TypeTy *Type;
     ObjCDeclSpec DeclSpec;
-    
+
     /// ArgAttrs - Attribute list for this argument.
     AttributeList *ArgAttrs;
   };
 
-  // ActOnMethodDeclaration - called for all method declarations. 
+  // ActOnMethodDeclaration - called for all method declarations.
   virtual DeclPtrTy ActOnMethodDeclaration(
     SourceLocation BeginLoc,   // location of the + or -.
     SourceLocation EndLoc,     // location of the ; or {.
@@ -1996,20 +1996,20 @@
     ObjCArgInfo *ArgInfo,      // ArgInfo: Has 'Sel.getNumArgs()' entries.
     llvm::SmallVectorImpl<Declarator> &Cdecls, // c-style args
     AttributeList *MethodAttrList, // optional
-    // tok::objc_not_keyword, tok::objc_optional, tok::objc_required    
+    // tok::objc_not_keyword, tok::objc_optional, tok::objc_required
     tok::ObjCKeywordKind impKind,
     bool isVariadic = false) {
     return DeclPtrTy();
   }
   // ActOnAtEnd - called to mark the @end. For declarations (interfaces,
-  // protocols, categories), the parser passes all methods/properties. 
+  // protocols, categories), the parser passes all methods/properties.
   // For class implementations, these values default to 0. For implementations,
   // methods are processed incrementally (by ActOnMethodDeclaration above).
-  virtual void ActOnAtEnd(SourceLocation AtEndLoc, 
+  virtual void ActOnAtEnd(SourceLocation AtEndLoc,
                           DeclPtrTy classDecl,
-                          DeclPtrTy *allMethods = 0, 
+                          DeclPtrTy *allMethods = 0,
                           unsigned allNum = 0,
-                          DeclPtrTy *allProperties = 0, 
+                          DeclPtrTy *allProperties = 0,
                           unsigned pNum = 0,
                           DeclGroupPtrTy *allTUVars = 0,
                           unsigned tuvNum = 0) {
@@ -2023,7 +2023,7 @@
                                   tok::ObjCKeywordKind MethodImplKind) {
     return DeclPtrTy();
   }
-                                     
+
   virtual OwningExprResult ActOnClassPropertyRefExpr(
     IdentifierInfo &receiverName,
     IdentifierInfo &propertyName,
@@ -2031,17 +2031,17 @@
     SourceLocation &propertyNameLoc) {
     return ExprEmpty();
   }
-  
+
   // 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, 
+    IdentifierInfo *receivingClassName,
     Selector Sel,
     SourceLocation lbrac, SourceLocation receiverLoc,
     SourceLocation selectorLoc,
-    SourceLocation rbrac, 
+    SourceLocation rbrac,
     ExprTy **ArgExprs, unsigned NumArgs) {
     return ExprResult();
   }
@@ -2050,7 +2050,7 @@
   // is obtained from NumArgs.
   virtual ExprResult ActOnInstanceMessage(
     ExprTy *receiver, Selector Sel,
-    SourceLocation lbrac, SourceLocation selectorLoc, SourceLocation rbrac, 
+    SourceLocation lbrac, SourceLocation selectorLoc, SourceLocation rbrac,
     ExprTy **ArgExprs, unsigned NumArgs) {
     return ExprResult();
   }
@@ -2067,7 +2067,7 @@
     AttributeList *AttrList) {
     return DeclPtrTy();
   }
-  
+
   /// FindProtocolDeclaration - This routine looks up protocols and
   /// issues error if they are not declared. It returns list of valid
   /// protocols found.
@@ -2079,7 +2079,7 @@
 
   //===----------------------- Obj-C Expressions --------------------------===//
 
-  virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, 
+  virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
                                             ExprTy **Strings,
                                             unsigned NumStrings) {
     return ExprResult();
@@ -2092,7 +2092,7 @@
                                                SourceLocation RParenLoc) {
     return ExprResult();
   }
-  
+
   virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
                                                  SourceLocation AtLoc,
                                                  SourceLocation SelLoc,
@@ -2100,38 +2100,38 @@
                                                  SourceLocation RParenLoc) {
     return ExprResult();
   }
-  
+
   virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
                                                  SourceLocation AtLoc,
                                                  SourceLocation ProtoLoc,
                                                  SourceLocation LParenLoc,
                                                  SourceLocation RParenLoc) {
     return ExprResult();
-  } 
+  }
 
   //===---------------------------- Pragmas -------------------------------===//
 
   enum PragmaPackKind {
-    PPK_Default, // #pragma pack([n]) 
+    PPK_Default, // #pragma pack([n])
     PPK_Show,    // #pragma pack(show), only supported by MSVC.
     PPK_Push,    // #pragma pack(push, [identifier], [n])
     PPK_Pop      // #pragma pack(pop, [identifier], [n])
   };
-  
+
   /// ActOnPragmaPack - Called on well formed #pragma pack(...).
   virtual void ActOnPragmaPack(PragmaPackKind Kind,
                                IdentifierInfo *Name,
                                ExprTy *Alignment,
-                               SourceLocation PragmaLoc, 
+                               SourceLocation PragmaLoc,
                                SourceLocation LParenLoc,
                                SourceLocation RParenLoc) {
     return;
   }
-  
+
   /// 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) {
     return;
@@ -2181,13 +2181,13 @@
   ///
   /// \param S the scope in which this name lookup occurs
   ///
-  /// \param SS if non-NULL, the C++ scope specifier that precedes the 
+  /// \param SS if non-NULL, the C++ scope specifier that precedes the
   /// identifier
   ///
-  /// \param isClassName whether this is a C++ class-name production, in 
-  /// which we can end up referring to a member of an unknown specialization 
+  /// \param isClassName whether this is a C++ class-name production, in
+  /// which we can end up referring to a member of an unknown specialization
   /// that we know (from the grammar) is supposed to be a type. For example,
-  /// this occurs when deriving from "std::vector<T>::allocator_type", where T 
+  /// this occurs when deriving from "std::vector<T>::allocator_type", where T
   /// is a template parameter.
   ///
   /// \returns the type referred to by this identifier, or NULL if the type
@@ -2202,10 +2202,10 @@
                                   const CXXScopeSpec *SS);
 
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const IdentifierInfo &II, 
+                                          const IdentifierInfo &II,
                                           SourceLocation IdLoc,
                                           const CXXScopeSpec *SS,
-                                          TypeTy *ObjectType,                              
+                                          TypeTy *ObjectType,
                                           bool EnteringContext,
                                           TemplateTy &Template);
 
@@ -2213,22 +2213,22 @@
   /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
   /// popped.
   virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D);
-  
-  /// ActOnPopScope - When a scope is popped, if any typedefs are now 
+
+  /// ActOnPopScope - When a scope is popped, if any typedefs are now
   /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field.
   virtual void ActOnPopScope(SourceLocation Loc, Scope *S);
   virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S);
-  
+
   virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                                  IdentifierInfo **IdentList,
                                                  unsigned NumElts);
-  
+
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation interLoc,
                                              IdentifierInfo *ClassName,
                                              SourceLocation ClassLoc,
                                              IdentifierInfo *SuperName,
                                              SourceLocation SuperLoc,
-                                             const DeclPtrTy *ProtoRefs, 
+                                             const DeclPtrTy *ProtoRefs,
                                              unsigned NumProtoRefs,
                                              SourceLocation EndProtoLoc,
                                              AttributeList *AttrList);
@@ -2248,15 +2248,15 @@
                               Action &actions, SourceManager &sm,
                               const char *Msg)
   : TheDecl(Decl), Loc(L), Actions(actions), SM(sm), Message(Msg) {}
-  
+
   virtual void print(llvm::raw_ostream &OS) const;
-};  
-  
+};
+
 /// \brief RAII object that enters a new expression evaluation context.
-class EnterExpressionEvaluationContext {    
+class EnterExpressionEvaluationContext {
   /// \brief The action object.
   Action &Actions;
-  
+
   /// \brief The previous expression evaluation context.
   Action::ExpressionEvaluationContext PrevContext;
 
@@ -2265,16 +2265,16 @@
 
 public:
   EnterExpressionEvaluationContext(Action &Actions,
-                              Action::ExpressionEvaluationContext NewContext) 
-    : Actions(Actions), CurContext(NewContext) { 
+                              Action::ExpressionEvaluationContext NewContext)
+    : Actions(Actions), CurContext(NewContext) {
       PrevContext = Actions.PushExpressionEvaluationContext(NewContext);
   }
-    
+
   ~EnterExpressionEvaluationContext() {
     Actions.PopExpressionEvaluationContext(CurContext, PrevContext);
   }
 };
-  
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Parse/AttributeList.h (original)
+++ cfe/trunk/include/clang/Parse/AttributeList.h Wed Sep  9 10:08:12 2009
@@ -21,7 +21,7 @@
 namespace clang {
   class IdentifierInfo;
   class Action;
-  
+
 /// AttributeList - Represents GCC's __attribute__ declaration. There are
 /// 4 forms of this construct...they are:
 ///
@@ -47,7 +47,7 @@
                 ActionBase::ExprTy **args, unsigned numargs,
                 AttributeList *Next, bool declspec = false);
   ~AttributeList();
-  
+
   enum Kind {              // Please keep this list alphabetized.
     AT_IBOutlet,          // Clang-specific.
     AT_address_space,
@@ -102,57 +102,57 @@
     IgnoredAttribute,
     UnknownAttribute
   };
-  
+
   IdentifierInfo *getName() const { return AttrName; }
   SourceLocation getLoc() const { return AttrLoc; }
   IdentifierInfo *getParameterName() const { return ParmName; }
   bool isDeclspecAttribute() const { return DeclspecAttribute; }
-  
+
   Kind getKind() const { return getKind(getName()); }
   static Kind getKind(const IdentifierInfo *Name);
-  
+
   AttributeList *getNext() const { return Next; }
   void setNext(AttributeList *N) { Next = N; }
 
   /// getNumArgs - Return the number of actual arguments to this attribute.
   unsigned getNumArgs() const { return NumArgs; }
-  
+
   /// getArg - Return the specified argument.
   ActionBase::ExprTy *getArg(unsigned Arg) const {
     assert(Arg < NumArgs && "Arg access out of range!");
     return Args[Arg];
   }
-  
+
   class arg_iterator {
     ActionBase::ExprTy** X;
     unsigned Idx;
   public:
-    arg_iterator(ActionBase::ExprTy** x, unsigned idx) : X(x), Idx(idx) {}    
+    arg_iterator(ActionBase::ExprTy** x, unsigned idx) : X(x), Idx(idx) {}
 
     arg_iterator& operator++() {
       ++Idx;
       return *this;
     }
-    
+
     bool operator==(const arg_iterator& I) const {
       assert (X == I.X &&
               "compared arg_iterators are for different argument lists");
       return Idx == I.Idx;
     }
-    
+
     bool operator!=(const arg_iterator& I) const {
       return !operator==(I);
     }
-    
+
     ActionBase::ExprTy* operator*() const {
       return X[Idx];
     }
-    
+
     unsigned getArgNum() const {
       return Idx+1;
     }
   };
-  
+
   arg_iterator arg_begin() const {
     return arg_iterator(Args, 0);
   }

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

==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Parse/DeclSpec.h Wed Sep  9 10:08:12 2009
@@ -25,7 +25,7 @@
   class IdentifierInfo;
   class Preprocessor;
   class Declarator;
-  
+
 /// DeclSpec - This class captures information about "declaration specifiers",
 /// which encompasses storage-class-specifiers, type-specifiers,
 /// type-qualifiers, and function-specifiers.
@@ -42,7 +42,7 @@
     SCS_private_extern,
     SCS_mutable
   };
-  
+
   // type-specifier
   enum TSW {
     TSW_unspecified,
@@ -50,19 +50,19 @@
     TSW_long,
     TSW_longlong
   };
-  
+
   enum TSC {
     TSC_unspecified,
     TSC_imaginary,
     TSC_complex
   };
-  
+
   enum TSS {
     TSS_unspecified,
     TSS_signed,
     TSS_unsigned
   };
-  
+
   enum TST {
     TST_unspecified,
     TST_void,
@@ -88,7 +88,7 @@
     TST_auto,         // C++0x auto
     TST_error         // erroneous type
   };
-  
+
   // type-qualifiers
   enum TQ {   // NOTE: These flags must be kept in sync with QualType::TQ.
     TQ_unspecified = 0,
@@ -106,9 +106,9 @@
     PQ_TypeQualifier         = 4,
     PQ_FunctionSpecifier     = 8
   };
-  
+
 private:
-    
+
   // storage-class-specifier
   /*SCS*/unsigned StorageClassSpec : 3;
   bool SCS_thread_specified : 1;
@@ -122,43 +122,43 @@
 
   // type-qualifiers
   unsigned TypeQualifiers : 3;  // Bitwise OR of TQ.
-  
+
   // function-specifier
   bool FS_inline_specified : 1;
   bool FS_virtual_specified : 1;
   bool FS_explicit_specified : 1;
-  
+
   // friend-specifier
   bool Friend_specified : 1;
-  
+
   /// TypeRep - This contains action-specific information about a specific TST.
   /// For example, for a typedef or struct, it might contain the declaration for
   /// these.
-  void *TypeRep;  
-  
+  void *TypeRep;
+
   // attributes.
   AttributeList *AttrList;
-  
-  // List of protocol qualifiers for objective-c classes.  Used for 
+
+  // List of protocol qualifiers for objective-c classes.  Used for
   // protocol-qualified interfaces "NString<foo>" and protocol-qualified id
   // "id<foo>".
   const ActionBase::DeclPtrTy *ProtocolQualifiers;
   unsigned NumProtocolQualifiers;
-  
+
   // SourceLocation info.  These are null if the item wasn't specified or if
   // the setting was synthesized.
   SourceRange Range;
-  
+
   SourceLocation StorageClassSpecLoc, SCS_threadLoc;
   SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc;
   SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc;
   SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc;
   SourceLocation FriendLoc;
-  
+
   DeclSpec(const DeclSpec&);       // DO NOT IMPLEMENT
   void operator=(const DeclSpec&); // DO NOT IMPLEMENT
-public:  
-  
+public:
+
   DeclSpec()
     : StorageClassSpec(SCS_unspecified),
       SCS_thread_specified(false),
@@ -184,17 +184,17 @@
   // storage-class-specifier
   SCS getStorageClassSpec() const { return (SCS)StorageClassSpec; }
   bool isThreadSpecified() const { return SCS_thread_specified; }
-  
+
   SourceLocation getStorageClassSpecLoc() const { return StorageClassSpecLoc; }
   SourceLocation getThreadSpecLoc() const { return SCS_threadLoc; }
-  
+
   void ClearStorageClassSpecs() {
     StorageClassSpec     = DeclSpec::SCS_unspecified;
     SCS_thread_specified = false;
     StorageClassSpecLoc  = SourceLocation();
     SCS_threadLoc        = SourceLocation();
   }
-  
+
   // type-specifier
   TSW getTypeSpecWidth() const { return (TSW)TypeSpecWidth; }
   TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
@@ -202,13 +202,13 @@
   TST getTypeSpecType() const { return (TST)TypeSpecType; }
   bool isTypeSpecOwned() const { return TypeSpecOwned; }
   void *getTypeRep() const { return TypeRep; }
-  
+
   const SourceRange &getSourceRange() const { return Range; }
   SourceLocation getTypeSpecWidthLoc() const { return TSWLoc; }
   SourceLocation getTypeSpecComplexLoc() const { return TSCLoc; }
   SourceLocation getTypeSpecSignLoc() const { return TSSLoc; }
   SourceLocation getTypeSpecTypeLoc() const { return TSTLoc; }
-  
+
   /// getSpecifierName - Turn a type-specifier-type into a string like "_Bool"
   /// or "union".
   static const char *getSpecifierName(DeclSpec::TST T);
@@ -217,7 +217,7 @@
   static const char *getSpecifierName(DeclSpec::TSC C);
   static const char *getSpecifierName(DeclSpec::TSW W);
   static const char *getSpecifierName(DeclSpec::SCS S);
-  
+
   // type-qualifiers
 
   /// getTypeQualifiers - Return a set of TQs.
@@ -225,7 +225,7 @@
   SourceLocation getConstSpecLoc() const { return TQ_constLoc; }
   SourceLocation getRestrictSpecLoc() const { return TQ_restrictLoc; }
   SourceLocation getVolatileSpecLoc() const { return TQ_volatileLoc; }
-  
+
   // function-specifier
   bool isInlineSpecified() const { return FS_inline_specified; }
   SourceLocation getInlineSpecLoc() const { return FS_inlineLoc; }
@@ -244,7 +244,7 @@
     FS_explicit_specified = false;
     FS_explicitLoc = SourceLocation();
   }
-  
+
   /// hasTypeSpecifier - Return true if any type-specifier has been found.
   bool hasTypeSpecifier() const {
     return getTypeSpecType() != DeclSpec::TST_unspecified ||
@@ -252,21 +252,21 @@
            getTypeSpecComplex() != DeclSpec::TSC_unspecified ||
            getTypeSpecSign() != DeclSpec::TSS_unspecified;
   }
-  
+
   /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
   /// DeclSpec includes.
   ///
   unsigned getParsedSpecifiers() const;
-  
+
   /// isEmpty - Return true if this declaration specifier is completely empty:
   /// no tokens were parsed in the production of it.
   bool isEmpty() const {
     return getParsedSpecifiers() == DeclSpec::PQ_None;
   }
-  
+
   void SetRangeStart(SourceLocation Loc) { Range.setBegin(Loc); }
   void SetRangeEnd(SourceLocation Loc) { Range.setEnd(Loc); }
-  
+
   /// These methods set the specified attribute of the DeclSpec and
   /// return false if there was no error.  If an error occurs (for
   /// example, if we tried to set "auto" on a spec with "extern"
@@ -291,42 +291,42 @@
                        unsigned &DiagID, void *Rep = 0, bool Owned = false);
   bool SetTypeSpecError();
   void UpdateTypeRep(void *Rep) { TypeRep = Rep; }
-                  
+
   bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
                    unsigned &DiagID, const LangOptions &Lang);
-  
+
   bool SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
                              unsigned &DiagID);
   bool SetFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec,
                               unsigned &DiagID);
   bool SetFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec,
                                unsigned &DiagID);
-  
+
   bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
                      unsigned &DiagID);
 
   bool isFriendSpecified() const { return Friend_specified; }
   SourceLocation getFriendSpecLoc() const { return FriendLoc; }
 
-  /// AddAttributes - contatenates two attribute lists. 
+  /// AddAttributes - contatenates two attribute lists.
   /// The GCC attribute syntax allows for the following:
   ///
-  /// short __attribute__(( unused, deprecated )) 
+  /// short __attribute__(( unused, deprecated ))
   /// int __attribute__(( may_alias, aligned(16) )) var;
   ///
   /// This declares 4 attributes using 2 lists. The following syntax is
   /// also allowed and equivalent to the previous declaration.
   ///
-  /// short __attribute__((unused)) __attribute__((deprecated)) 
+  /// short __attribute__((unused)) __attribute__((deprecated))
   /// int __attribute__((may_alias)) __attribute__((aligned(16))) var;
-  /// 
+  ///
   void AddAttributes(AttributeList *alist) {
     AttrList = addAttributeLists(AttrList, alist);
   }
   void SetAttributes(AttributeList *AL) { AttrList = AL; }
   const AttributeList *getAttributes() const { return AttrList; }
   AttributeList *getAttributes() { return AttrList; }
-  
+
   /// TakeAttributes - Return the current attribute list and remove them from
   /// the DeclSpec so that it doesn't own them.
   AttributeList *TakeAttributes() {
@@ -334,7 +334,7 @@
     AttrList = 0;
     return AL;
   }
-  
+
   typedef const ActionBase::DeclPtrTy *ProtocolQualifierListTy;
   ProtocolQualifierListTy getProtocolQualifiers() const {
     return ProtocolQualifiers;
@@ -348,7 +348,7 @@
     memcpy((void*)ProtocolQualifiers, Protos, sizeof(ActionBase::DeclPtrTy)*NP);
     NumProtocolQualifiers = NP;
   }
-  
+
   /// Finish - This does final analysis of the declspec, issuing diagnostics for
   /// things like "_Imaginary" (lacking an FP type).  After calling this method,
   /// DeclSpec is guaranteed self-consistent, even if an error occurred.
@@ -359,7 +359,7 @@
   bool isMissingDeclaratorOk();
 };
 
-/// ObjCDeclSpec - This class captures information about 
+/// ObjCDeclSpec - This class captures information about
 /// "declaration specifiers" specific to objective-c
 class ObjCDeclSpec {
 public:
@@ -373,47 +373,46 @@
     DQ_Byref = 0x10,
     DQ_Oneway = 0x20
   };
-  
+
   /// PropertyAttributeKind - list of property attributes.
-  enum ObjCPropertyAttributeKind { DQ_PR_noattr = 0x0, 
-    DQ_PR_readonly = 0x01, 
-    DQ_PR_getter = 0x02, 
-    DQ_PR_assign = 0x04, 
-    DQ_PR_readwrite = 0x08, 
+  enum ObjCPropertyAttributeKind { DQ_PR_noattr = 0x0,
+    DQ_PR_readonly = 0x01,
+    DQ_PR_getter = 0x02,
+    DQ_PR_assign = 0x04,
+    DQ_PR_readwrite = 0x08,
     DQ_PR_retain = 0x10,
-    DQ_PR_copy = 0x20, 
+    DQ_PR_copy = 0x20,
     DQ_PR_nonatomic = 0x40,
     DQ_PR_setter = 0x80
   };
-  
-  
+
+
   ObjCDeclSpec() : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
-  GetterName(0), SetterName(0)
-  {}
+  GetterName(0), SetterName(0) { }
   ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; }
-  void setObjCDeclQualifier(ObjCDeclQualifier DQVal) 
+  void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
     { objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal); }
-  
-  ObjCPropertyAttributeKind getPropertyAttributes() const 
+
+  ObjCPropertyAttributeKind getPropertyAttributes() const
     { return ObjCPropertyAttributeKind(PropertyAttributes); }
-  void setPropertyAttributes(ObjCPropertyAttributeKind PRVal) { 
-    PropertyAttributes = 
+  void setPropertyAttributes(ObjCPropertyAttributeKind PRVal) {
+    PropertyAttributes =
       (ObjCPropertyAttributeKind) (PropertyAttributes | PRVal);
   }
-  
+
   const IdentifierInfo *getGetterName() const { return GetterName; }
   IdentifierInfo *getGetterName() { return GetterName; }
   void setGetterName(IdentifierInfo *name) { GetterName = name; }
-  
+
   const IdentifierInfo *getSetterName() const { return SetterName; }
   IdentifierInfo *getSetterName() { return SetterName; }
   void setSetterName(IdentifierInfo *name) { SetterName = name; }
 private:
-  // FIXME: These two are unrelated and mutially exclusive. So perhaps 
+  // FIXME: These two are unrelated and mutially exclusive. So perhaps
   // we can put them in a union to reflect their mutual exclusiveness
   // (space saving is negligible).
   ObjCDeclQualifier objcDeclQualifier : 6;
-  
+
   // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttributeKind
   unsigned PropertyAttributes : 8;
   IdentifierInfo *GetterName;    // getter name of NULL if no getter
@@ -453,7 +452,7 @@
     ScopeRep = 0;
   }
 };
-  
+
 /// CachedTokens - A set of tokens that has been cached for later
 /// parsing.
 typedef llvm::SmallVector<Token, 4> CachedTokens;
@@ -471,7 +470,7 @@
   SourceLocation Loc;
   /// EndLoc - If valid, the place where this chunck ends.
   SourceLocation EndLoc;
-  
+
   struct PointerTypeInfo {
     /// The type qualifiers: const/volatile/restrict.
     unsigned TypeQuals : 3;
@@ -495,20 +494,20 @@
   struct ArrayTypeInfo {
     /// The type qualifiers for the array: const/volatile/restrict.
     unsigned TypeQuals : 3;
-    
+
     /// True if this dimension included the 'static' keyword.
     bool hasStatic : 1;
-    
+
     /// True if this dimension was [*].  In this case, NumElts is null.
     bool isStar : 1;
-    
+
     /// This is the size of the array, or null if [] or [*] was specified.
     /// Since the parser is multi-purpose, and we don't want to impose a root
     /// expression class on all clients, NumElts is untyped.
     ActionBase::ExprTy *NumElts;
     void destroy() {}
   };
-  
+
   /// ParamInfo - An array of paraminfo objects is allocated whenever a function
   /// declarator is parsed.  There are two interesting styles of arguments here:
   /// K&R-style identifier lists and parameter type lists.  K&R-style identifier
@@ -531,7 +530,7 @@
     ParamInfo(IdentifierInfo *ident, SourceLocation iloc,
               ActionBase::DeclPtrTy param,
               CachedTokens *DefArgTokens = 0)
-      : Ident(ident), IdentLoc(iloc), Param(param), 
+      : Ident(ident), IdentLoc(iloc), Param(param),
         DefaultArgTokens(DefArgTokens) {}
   };
 
@@ -552,7 +551,7 @@
     bool isVariadic : 1;
 
     /// The type qualifiers: const/volatile/restrict.
-    /// The qualifier bitmask values are the same as in QualType. 
+    /// The qualifier bitmask values are the same as in QualType.
     unsigned TypeQuals : 3;
 
     /// hasExceptionSpec - True if the function has an exception specification.
@@ -692,7 +691,7 @@
     I.Ptr.AttrList  = AL;
     return I;
   }
-  
+
   /// getReference - Return a DeclaratorChunk for a reference.
   ///
   static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc,
@@ -705,7 +704,7 @@
     I.Ref.AttrList  = AL;
     return I;
   }
-  
+
   /// getArray - Return a DeclaratorChunk for an array.
   ///
   static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic,
@@ -721,7 +720,7 @@
     I.Arr.NumElts   = NumElts;
     return I;
   }
-  
+
   /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
   /// "TheDeclarator" is the declarator that this will be added to.
   static DeclaratorChunk getFunction(bool hasProto, bool isVariadic,
@@ -735,7 +734,7 @@
                                      unsigned NumExceptions,
                                      SourceLocation LPLoc, SourceLocation RPLoc,
                                      Declarator &TheDeclarator);
-  
+
   /// getBlockPointer - Return a DeclaratorChunk for a block.
   ///
   static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc,
@@ -791,11 +790,11 @@
   /// DeclaratorKind - The kind of declarator this represents.
   enum DeclaratorKind {
     DK_Abstract,         // An abstract declarator (has no identifier)
-    DK_Normal,           // A normal declarator (has an identifier). 
+    DK_Normal,           // A normal declarator (has an identifier).
     DK_Constructor,      // A C++ constructor (identifier is the class name)
     DK_Destructor,       // A C++ destructor  (identifier is ~class name)
     DK_Operator,         // A C++ overloaded operator name
-    DK_Conversion        // A C++ conversion function (identifier is 
+    DK_Conversion        // A C++ conversion function (identifier is
                          // "operator " then the type name)
   };
 
@@ -810,7 +809,7 @@
   ///
   TheContext Context;
 
-  /// Kind - What kind of declarator this is.  
+  /// Kind - What kind of declarator this is.
   DeclaratorKind Kind;
 
   /// DeclTypeInfo - This holds each type that the declarator includes as it is
@@ -827,7 +826,7 @@
 
   /// AttrList - Attributes.
   AttributeList *AttrList;
-  
+
   /// AsmLabel - The asm label, if specified.
   ActionBase::ExprTy *AsmLabel;
 
@@ -861,7 +860,7 @@
       GroupingParens(false), AttrList(0), AsmLabel(0), Type(0),
       InlineParamsUsed(false), Extension(false) {
   }
-  
+
   ~Declarator() {
     clear();
   }
@@ -869,7 +868,7 @@
   /// getDeclSpec - Return the declaration-specifier that this declarator was
   /// declared with.
   const DeclSpec &getDeclSpec() const { return DS; }
-  
+
   /// getMutableDeclSpec - Return a non-const version of the DeclSpec.  This
   /// should be used with extreme care: declspecs can often be shared between
   /// multiple declarators, so mutating the DeclSpec affects all of the
@@ -928,9 +927,9 @@
     Type = 0;
     InlineParamsUsed = false;
   }
-  
+
   /// mayOmitIdentifier - Return true if the identifier is either optional or
-  /// not allowed.  This is true for typenames, prototypes, and template 
+  /// not allowed.  This is true for typenames, prototypes, and template
   /// parameter lists.
   bool mayOmitIdentifier() const {
     return Context == TypeNameContext || Context == PrototypeContext ||
@@ -953,7 +952,7 @@
             Context == BlockContext ||
             Context == ForContext);
   }
-  
+
   /// isPastIdentifier - Return true if we have parsed beyond the point where
   /// the
   bool isPastIdentifier() const { return IdentifierLoc.isValid(); }
@@ -965,7 +964,7 @@
 
   IdentifierInfo *getIdentifier() const { return Identifier; }
   SourceLocation getIdentifierLoc() const { return IdentifierLoc; }
-  
+
   void SetIdentifier(IdentifierInfo *ID, SourceLocation Loc) {
     Identifier = ID;
     IdentifierLoc = Loc;
@@ -975,7 +974,7 @@
       Kind = DK_Abstract;
     SetRangeEnd(Loc);
   }
-  
+
   /// setConstructor - Set this declarator to be a C++ constructor
   /// declarator. Also extends the range.
   void setConstructor(ActionBase::TypeTy *Ty, SourceLocation Loc) {
@@ -1035,7 +1034,7 @@
   /// getNumTypeObjects() - Return the number of types applied to this
   /// declarator.
   unsigned getNumTypeObjects() const { return DeclTypeInfo.size(); }
-  
+
   /// Return the specified TypeInfo from this declarator.  TypeInfo #0 is
   /// closest to the identifier.
   const DeclaratorChunk &getTypeObject(unsigned i) const {
@@ -1046,14 +1045,14 @@
     assert(i < DeclTypeInfo.size() && "Invalid type chunk");
     return DeclTypeInfo[i];
   }
-  
+
   /// isFunctionDeclarator - Once this declarator is fully parsed and formed,
   /// this method returns true if the identifier is a function declarator.
   bool isFunctionDeclarator() const {
     return !DeclTypeInfo.empty() &&
            DeclTypeInfo[0].Kind == DeclaratorChunk::Function;
   }
-  
+
   /// AddAttributes - simply adds the attribute list to the Declarator.
   /// These examples both add 3 attributes to "var":
   ///  short int var __attribute__((aligned(16),common,deprecated));
@@ -1061,13 +1060,13 @@
   ///                                 __attribute__((common,deprecated));
   ///
   /// Also extends the range of the declarator.
-  void AddAttributes(AttributeList *alist, SourceLocation LastLoc) { 
+  void AddAttributes(AttributeList *alist, SourceLocation LastLoc) {
     AttrList = addAttributeLists(AttrList, alist);
 
     if (!LastLoc.isInvalid())
       SetRangeEnd(LastLoc);
   }
-  
+
   const AttributeList *getAttributes() const { return AttrList; }
   AttributeList *getAttributes() { return AttrList; }
 
@@ -1091,8 +1090,8 @@
   OverloadedOperatorKind getOverloadedOperator() const { return OperatorKind; }
 
   void setInvalidType(bool Val = true) { InvalidType = Val; }
-  bool isInvalidType() const { 
-    return InvalidType || DS.getTypeSpecType() == DeclSpec::TST_error; 
+  bool isInvalidType() const {
+    return InvalidType || DS.getTypeSpecType() == DeclSpec::TST_error;
   }
 
   void setGroupingParens(bool flag) { GroupingParens = flag; }

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Designator.h (original)
+++ cfe/trunk/include/clang/Parse/Designator.h Wed Sep  9 10:08:12 2009
@@ -18,7 +18,7 @@
 #include "clang/Parse/Action.h"
 
 namespace clang {
-  
+
 /// Designator - This class is a discriminated union which holds the various
 /// different sorts of designators possible.  A Designation is an array of
 /// these.  An example of a designator are things like this:
@@ -34,7 +34,7 @@
   };
 private:
   DesignatorKind Kind;
-  
+
   struct FieldDesignatorInfo {
     const IdentifierInfo *II;
     unsigned DotLoc;
@@ -50,15 +50,15 @@
     unsigned LBracketLoc, EllipsisLoc;
     mutable unsigned RBracketLoc;
   };
-  
+
   union {
     FieldDesignatorInfo FieldInfo;
     ArrayDesignatorInfo ArrayInfo;
     ArrayRangeDesignatorInfo ArrayRangeInfo;
   };
-  
+
 public:
-  
+
   DesignatorKind getKind() const { return Kind; }
   bool isFieldDesignator() const { return Kind == FieldDesignator; }
   bool isArrayDesignator() const { return Kind == ArrayDesignator; }
@@ -78,7 +78,7 @@
     assert(isFieldDesignator() && "Invalid accessor");
     return SourceLocation::getFromRawEncoding(FieldInfo.NameLoc);
   }
-  
+
   ActionBase::ExprTy *getArrayIndex() const {
     assert(isArrayDesignator() && "Invalid accessor");
     return ArrayInfo.Index;
@@ -92,22 +92,22 @@
     assert(isArrayRangeDesignator() && "Invalid accessor");
     return ArrayRangeInfo.End;
   }
-  
+
   SourceLocation getLBracketLoc() const {
-    assert((isArrayDesignator() || isArrayRangeDesignator()) && 
+    assert((isArrayDesignator() || isArrayRangeDesignator()) &&
            "Invalid accessor");
     if (isArrayDesignator())
       return SourceLocation::getFromRawEncoding(ArrayInfo.LBracketLoc);
-    else 
+    else
       return SourceLocation::getFromRawEncoding(ArrayRangeInfo.LBracketLoc);
   }
 
   SourceLocation getRBracketLoc() const {
-    assert((isArrayDesignator() || isArrayRangeDesignator()) && 
+    assert((isArrayDesignator() || isArrayRangeDesignator()) &&
            "Invalid accessor");
     if (isArrayDesignator())
       return SourceLocation::getFromRawEncoding(ArrayInfo.RBracketLoc);
-    else 
+    else
       return SourceLocation::getFromRawEncoding(ArrayRangeInfo.RBracketLoc);
   }
 
@@ -135,10 +135,10 @@
     D.ArrayInfo.RBracketLoc = 0;
     return D;
   }
-  
+
   static Designator getArrayRange(ActionBase::ExprTy *Start,
                                   ActionBase::ExprTy *End,
-                                  SourceLocation LBracketLoc, 
+                                  SourceLocation LBracketLoc,
                                   SourceLocation EllipsisLoc) {
     Designator D;
     D.Kind = ArrayRangeDesignator;
@@ -151,14 +151,14 @@
   }
 
   void setRBracketLoc(SourceLocation RBracketLoc) const {
-    assert((isArrayDesignator() || isArrayRangeDesignator()) && 
+    assert((isArrayDesignator() || isArrayRangeDesignator()) &&
            "Invalid accessor");
     if (isArrayDesignator())
       ArrayInfo.RBracketLoc = RBracketLoc.getRawEncoding();
     else
       ArrayRangeInfo.RBracketLoc = RBracketLoc.getRawEncoding();
   }
-  
+
   /// ClearExprs - Null out any expression references, which prevents them from
   /// being 'delete'd later.
   void ClearExprs(Action &Actions) {
@@ -173,7 +173,7 @@
       return;
     }
   }
-  
+
   /// FreeExprs - Release any unclaimed memory for the expressions in this
   /// designator.
   void FreeExprs(Action &Actions) {
@@ -190,7 +190,7 @@
   }
 };
 
-  
+
 /// Designation - Represent a full designation, which is a sequence of
 /// designators.  This class is mostly a helper for InitListDesignations.
 class Designation {
@@ -198,10 +198,10 @@
   /// example, if the initializer were "{ A, .foo=B, C }" a Designation would
   /// exist with InitIndex=1, because element #1 has a designation.
   unsigned InitIndex;
-  
+
   /// Designators - The actual designators for this initializer.
   llvm::SmallVector<Designator, 2> Designators;
-  
+
   Designation(unsigned Idx) : InitIndex(Idx) {}
 public:
   Designation() : InitIndex(4000) {}
@@ -218,14 +218,14 @@
     assert(Idx < Designators.size());
     return Designators[Idx];
   }
-  
+
   /// ClearExprs - Null out any expression references, which prevents them from
   /// being 'delete'd later.
   void ClearExprs(Action &Actions) {
     for (unsigned i = 0, e = Designators.size(); i != e; ++i)
       Designators[i].ClearExprs(Actions);
   }
-  
+
   /// FreeExprs - Release any unclaimed memory for the expressions in this
   /// designation.
   void FreeExprs(Action &Actions) {
@@ -233,7 +233,7 @@
       Designators[i].FreeExprs(Actions);
   }
 };
-   
+
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Ownership.h (original)
+++ cfe/trunk/include/clang/Parse/Ownership.h Wed Sep  9 10:08:12 2009
@@ -23,7 +23,7 @@
 
 namespace clang {
   class ActionBase;
-  
+
   /// OpaquePtr - This is a very simple POD type that wraps a pointer that the
   /// Parser doesn't know about but that Sema or another client does.  The UID
   /// template argument is used to make sure that "Decl" pointers are not
@@ -33,29 +33,29 @@
     void *Ptr;
   public:
     OpaquePtr() : Ptr(0) {}
-    
+
     template <typename T>
     T* getAs() const {
       return llvm::PointerLikeTypeTraits<T*>::getFromVoidPointer(Ptr);
     }
-    
+
     template <typename T>
     T getAsVal() const {
       return llvm::PointerLikeTypeTraits<T>::getFromVoidPointer(Ptr);
     }
-    
+
     void *get() const { return Ptr; }
-    
+
     template<typename T>
     static OpaquePtr make(T P) {
       OpaquePtr R; R.set(P); return R;
     }
-    
+
     template<typename T>
     void set(T P) {
       Ptr = llvm::PointerLikeTypeTraits<T>::getAsVoidPointer(P);
     }
-    
+
     operator bool() const { return Ptr != 0; }
   };
 }
@@ -218,7 +218,7 @@
     /// expressions, stmts, etc.  It encapsulates both the object returned by
     /// the action, plus a sense of whether or not it is valid.
     /// When CompressInvalid is true, the "invalid" flag will be
-    /// stored in the low bit of the Val pointer. 
+    /// stored in the low bit of the Val pointer.
     template<unsigned UID,
              typename PtrTy = void*,
              bool CompressInvalid = IsResultPtrLowBitFree<UID>::value>
@@ -252,7 +252,7 @@
       uintptr_t PtrWithInvalid;
       typedef llvm::PointerLikeTypeTraits<PtrTy> PtrTraits;
     public:
-      ActionResult(bool Invalid = false) 
+      ActionResult(bool Invalid = false)
         : PtrWithInvalid(static_cast<uintptr_t>(Invalid)) { }
 
       template<typename ActualExprTy>
@@ -262,17 +262,17 @@
         PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
         assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
       }
-      
+
       ActionResult(PtrTy V) {
         void *VP = PtrTraits::getAsVoidPointer(V);
         PtrWithInvalid = reinterpret_cast<uintptr_t>(VP);
         assert((PtrWithInvalid & 0x01) == 0 && "Badly aligned pointer");
       }
-      
+
       ActionResult(const DiagnosticBuilder &) : PtrWithInvalid(0x01) { }
 
       PtrTy get() const {
-        void *VP = reinterpret_cast<void *>(PtrWithInvalid & ~0x01); 
+        void *VP = reinterpret_cast<void *>(PtrWithInvalid & ~0x01);
         return PtrTraits::getFromVoidPointer(VP);
       }
 
@@ -326,8 +326,7 @@
     /// Move emulation helper for ASTOwningResult. NEVER EVER use this class
     /// directly if you don't know what you're doing.
     template <ASTDestroyer Destroyer>
-    class ASTResultMover
-    {
+    class ASTResultMover {
       ASTOwningResult<Destroyer> &Moved;
 
     public:
@@ -339,8 +338,7 @@
     /// Move emulation helper for ASTMultiPtr. NEVER EVER use this class
     /// directly if you don't know what you're doing.
     template <ASTDestroyer Destroyer>
-    class ASTMultiMover
-    {
+    class ASTMultiMover {
       ASTMultiPtr<Destroyer> &Moved;
 
     public:
@@ -357,8 +355,7 @@
   /// Kept only as a type-safe wrapper for a void pointer, when smart pointers
   /// are disabled. When they are enabled, ASTOwningResult takes over.
   template <ASTDestroyer Destroyer>
-  class ASTOwningPtr
-  {
+  class ASTOwningPtr {
     void *Node;
 
   public:
@@ -400,8 +397,7 @@
 
 #if !defined(DISABLE_SMART_POINTERS)
   template <ASTDestroyer Destroyer>
-  class ASTOwningResult
-  {
+  class ASTOwningResult {
     llvm::PointerIntPair<ActionBase*, 1, bool> ActionInv;
     void *Ptr;
 
@@ -505,8 +501,7 @@
   };
 #else
   template <ASTDestroyer Destroyer>
-  class ASTOwningResult
-  {
+  class ASTOwningResult {
   public:
     typedef ActionBase::ActionResult<DestroyerToUID<Destroyer>::UID> DumbResult;
 
@@ -522,8 +517,7 @@
     ASTOwningResult(const ASTOwningPtr<Destroyer> &o) : Result(o.get()) { }
 
     /// Assignment from a raw pointer. Takes ownership - beware!
-    ASTOwningResult & operator =(void *raw)
-    {
+    ASTOwningResult & operator =(void *raw) {
       Result = raw;
       return *this;
     }
@@ -563,8 +557,7 @@
 #endif
 
   template <ASTDestroyer Destroyer>
-  class ASTMultiPtr
-  {
+  class ASTMultiPtr {
 #if !defined(DISABLE_SMART_POINTERS)
     ActionBase &Actions;
 #endif
@@ -608,7 +601,7 @@
     /// Move constructor
     ASTMultiPtr(moving::ASTMultiMover<Destroyer> mover)
 #if defined(_MSC_VER)
-    //  Apply the visual C++ hack supplied above.  
+    //  Apply the visual C++ hack supplied above.
     //  Last tested with Visual Studio 2008.
       : Actions(hack(mover)->Actions), Nodes(hack(mover)->Nodes), Count(hack(mover)->Count) {
 #else
@@ -660,7 +653,7 @@
     }
 #endif
   };
-  
+
   class ASTTemplateArgsPtr {
 #if !defined(DISABLE_SMART_POINTERS)
     ActionBase &Actions;
@@ -668,7 +661,7 @@
     void **Args;
     bool *ArgIsType;
     mutable unsigned Count;
-    
+
 #if !defined(DISABLE_SMART_POINTERS)
     void destroy() {
       if (!Count)
@@ -684,16 +677,16 @@
 
   public:
     ASTTemplateArgsPtr(ActionBase &actions, void **args, bool *argIsType,
-                       unsigned count) : 
+                       unsigned count) :
 #if !defined(DISABLE_SMART_POINTERS)
-      Actions(actions), 
+      Actions(actions),
 #endif
       Args(args), ArgIsType(argIsType), Count(count) { }
 
     // FIXME: Lame, not-fully-type-safe emulation of 'move semantics'.
-    ASTTemplateArgsPtr(ASTTemplateArgsPtr &Other) : 
+    ASTTemplateArgsPtr(ASTTemplateArgsPtr &Other) :
 #if !defined(DISABLE_SMART_POINTERS)
-      Actions(Other.Actions), 
+      Actions(Other.Actions),
 #endif
       Args(Other.Args), ArgIsType(Other.ArgIsType), Count(Other.Count) {
 #if !defined(DISABLE_SMART_POINTERS)
@@ -734,7 +727,7 @@
 
     void *operator[](unsigned Arg) const { return Args[Arg]; }
 
-    void **release() const { 
+    void **release() const {
 #if !defined(DISABLE_SMART_POINTERS)
       Count = 0;
 #endif
@@ -754,7 +747,7 @@
     ASTOwningVector &operator=(ASTOwningVector &); // do not implement
 
   public:
-    explicit ASTOwningVector(ActionBase &Actions) 
+    explicit ASTOwningVector(ActionBase &Actions)
 #if !defined(DISABLE_SMART_POINTERS)
       : Actions(Actions), Owned(true)
 #endif
@@ -825,8 +818,7 @@
 
   template <ASTDestroyer Destroyer> inline
   ASTOwningPtr<Destroyer>::ASTOwningPtr(const ASTOwningResult<Destroyer> &o)
-    : Node(o.get())
-  {}
+    : Node(o.get()) { }
 
   // These versions are hopefully no-ops.
   template <ASTDestroyer Destroyer> inline

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

==============================================================================
--- cfe/trunk/include/clang/Parse/ParseDiagnostic.h (original)
+++ cfe/trunk/include/clang/Parse/ParseDiagnostic.h Wed Sep  9 10:08:12 2009
@@ -13,7 +13,7 @@
 #include "clang/Basic/Diagnostic.h"
 
 namespace clang {
-  namespace diag { 
+  namespace diag {
     enum {
 #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE) ENUM,
 #define PARSESTART

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Wed Sep  9 10:08:12 2009
@@ -38,8 +38,8 @@
   PrettyStackTraceParserEntry(const Parser &p) : P(p) {}
   virtual void print(llvm::raw_ostream &OS) const;
 };
-  
-  
+
+
 /// Parser - This implements a parser for the C family of languages.  After
 /// parsing units of the grammar, productions are invoked to handle whatever has
 /// been read.
@@ -47,13 +47,13 @@
 class Parser {
   friend class PragmaUnusedHandler;
   PrettyStackTraceParserEntry CrashInfo;
-  
+
   Preprocessor &PP;
-  
+
   /// Tok - The current token we are peeking ahead.  All parsing methods assume
   /// that this is valid.
   Token Tok;
-  
+
   // PrevTokLocation - The location of the token we previously
   // consumed. This token is used for diagnostics where we expected to
   // see a token following another token (e.g., the ';' at the end of
@@ -66,10 +66,10 @@
   /// in the file.  This refers to the common base class between MinimalActions
   /// and SemaActions for those uses that don't matter.
   Action &Actions;
-  
+
   Scope *CurScope;
   Diagnostic &Diags;
-  
+
   /// ScopeCache - Cache scopes to reduce malloc traffic.
   enum { ScopeCacheSize = 16 };
   unsigned NumCachedScopes;
@@ -83,7 +83,7 @@
   llvm::OwningPtr<PragmaHandler> UnusedHandler;
   llvm::OwningPtr<PragmaHandler> WeakHandler;
   llvm::OwningPtr<clang::CommentHandler> CommentHandler;
-  
+
   /// Whether the '>' token acts as an operator or not. This will be
   /// true except when we are parsing an expression within a C++
   /// template argument list, where the '>' closes the template
@@ -92,15 +92,15 @@
 
   /// The "depth" of the template parameters currently being parsed.
   unsigned TemplateParameterDepth;
-  
+
   /// \brief RAII object that makes '>' behave either as an operator
   /// or as the closing angle bracket for a template argument list.
   struct GreaterThanIsOperatorScope {
     bool &GreaterThanIsOperator;
     bool OldGreaterThanIsOperator;
-   
+
     GreaterThanIsOperatorScope(bool &GTIO, bool Val)
-      : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) { 
+      : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) {
       GreaterThanIsOperator = Val;
     }
 
@@ -108,7 +108,7 @@
       GreaterThanIsOperator = OldGreaterThanIsOperator;
     }
   };
-  
+
 public:
   Parser(Preprocessor &PP, Action &Actions);
   ~Parser();
@@ -117,9 +117,9 @@
   TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); }
   Preprocessor &getPreprocessor() const { return PP; }
   Action &getActions() const { return Actions; }
-  
+
   const Token &getCurToken() const { return Tok; }
-  
+
   // Type forwarding.  All of these are statically 'void*', but they may all be
   // different actual classes based on the actions in place.
   typedef Action::ExprTy ExprTy;
@@ -166,24 +166,24 @@
   OwningExprResult ExprEmpty() { return OwningExprResult(Actions, false); }
 
   // Parsing methods.
-  
+
   /// ParseTranslationUnit - All in one method that initializes parses, and
   /// shuts down the parser.
   void ParseTranslationUnit();
-  
+
   /// Initialize - Warm up the parser.
   ///
   void Initialize();
-  
-  /// ParseTopLevelDecl - Parse one top-level declaration. Returns true if 
+
+  /// ParseTopLevelDecl - Parse one top-level declaration. Returns true if
   /// the EOF was encountered.
   bool ParseTopLevelDecl(DeclGroupPtrTy &Result);
-  
+
 private:
   //===--------------------------------------------------------------------===//
   // Low-Level token peeking and consumption methods.
   //
-  
+
   /// isTokenParen - Return true if the cur token is '(' or ')'.
   bool isTokenParen() const {
     return Tok.getKind() == tok::l_paren || Tok.getKind() == tok::r_paren;
@@ -196,7 +196,7 @@
   bool isTokenBrace() const {
     return Tok.getKind() == tok::l_brace || Tok.getKind() == tok::r_brace;
   }
-  
+
   /// isTokenStringLiteral - True if this token is a string-literal.
   ///
   bool isTokenStringLiteral() const {
@@ -216,7 +216,7 @@
     PP.Lex(Tok);
     return PrevTokLocation;
   }
-  
+
   /// ConsumeAnyToken - Dispatch to the right Consume* method based on the
   /// current token type.  This should only be used in cases where the type of
   /// the token really isn't known, e.g. in error recovery.
@@ -232,7 +232,7 @@
     else
       return ConsumeToken();
   }
-  
+
   /// ConsumeParen - This consume method keeps the paren count up-to-date.
   ///
   SourceLocation ConsumeParen() {
@@ -245,7 +245,7 @@
     PP.Lex(Tok);
     return PrevTokLocation;
   }
-  
+
   /// ConsumeBracket - This consume method keeps the bracket count up-to-date.
   ///
   SourceLocation ConsumeBracket() {
@@ -254,12 +254,12 @@
       ++BracketCount;
     else if (BracketCount)
       --BracketCount;     // Don't let unbalanced ]'s drive the count negative.
-    
+
     PrevTokLocation = Tok.getLocation();
     PP.Lex(Tok);
     return PrevTokLocation;
   }
-      
+
   /// ConsumeBrace - This consume method keeps the brace count up-to-date.
   ///
   SourceLocation ConsumeBrace() {
@@ -268,12 +268,12 @@
       ++BraceCount;
     else if (BraceCount)
       --BraceCount;     // Don't let unbalanced }'s drive the count negative.
-    
+
     PrevTokLocation = Tok.getLocation();
     PP.Lex(Tok);
     return PrevTokLocation;
   }
-  
+
   /// ConsumeStringToken - Consume the current 'peek token', lexing a new one
   /// and returning the token kind.  This method is specific to strings, as it
   /// handles string literal concatenation, as per C99 5.1.1.2, translation
@@ -285,7 +285,7 @@
     PP.Lex(Tok);
     return PrevTokLocation;
   }
-  
+
   /// GetLookAheadToken - This peeks ahead N tokens and returns that token
   /// without consuming any tokens.  LookAhead(0) returns 'Tok', LookAhead(1)
   /// returns the token after Tok, etc.
@@ -362,8 +362,8 @@
       assert(!isActive && "Forgot to call Commit or Revert!");
     }
   };
-  
-  
+
+
   /// MatchRHSPunctuation - For punctuation with a LHS and RHS (e.g. '['/']'),
   /// this helper function matches and consumes the specified RHS token if
   /// present.  If not present, it emits the specified diagnostic indicating
@@ -372,7 +372,7 @@
   /// of the consumed token.
   SourceLocation MatchRHSPunctuation(tok::TokenKind RHSTok,
                                      SourceLocation LHSLoc);
-  
+
   /// ExpectAndConsume - The parser expects that 'ExpectedTok' is next in the
   /// input.  If so, it is consumed and false is returned.
   ///
@@ -385,7 +385,7 @@
 
   //===--------------------------------------------------------------------===//
   // Scope manipulation
-  
+
   /// ParseScope - Introduces a new scope for parsing. The kind of
   /// scope is determined by ScopeFlags. Objects of this type should
   /// be created on the stack to coincide with the position where the
@@ -402,7 +402,7 @@
     // parser Self where the new Scope is created with the flags
     // ScopeFlags, but only when ManageScope is true (the default). If
     // ManageScope is false, this object does nothing.
-    ParseScope(Parser *Self, unsigned ScopeFlags, bool ManageScope = true) 
+    ParseScope(Parser *Self, unsigned ScopeFlags, bool ManageScope = true)
       : Self(Self) {
       if (ManageScope)
         Self->EnterScope(ScopeFlags);
@@ -426,7 +426,7 @@
 
   /// EnterScope - Start a new scope.
   void EnterScope(unsigned ScopeFlags);
-  
+
   /// ExitScope - Pop a scope off the scope stack.
   void ExitScope();
 
@@ -436,7 +436,7 @@
   DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID);
   DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID);
 
-  void SuggestParentheses(SourceLocation Loc, unsigned DK, 
+  void SuggestParentheses(SourceLocation Loc, unsigned DK,
                           SourceRange ParenRange);
 
   /// SkipUntil - Read tokens until we get to the specified token, then consume
@@ -444,9 +444,9 @@
   /// token will ever occur, this skips to the next token, or to some likely
   /// good stopping point.  If StopAtSemi is true, skipping will stop at a ';'
   /// character.
-  /// 
+  ///
   /// If SkipUntil finds the specified token, it returns true, otherwise it
-  /// returns false.  
+  /// returns false.
   bool SkipUntil(tok::TokenKind T, bool StopAtSemi = true,
                  bool DontConsume = false) {
     return SkipUntil(&T, 1, StopAtSemi, DontConsume);
@@ -479,7 +479,7 @@
   /// occurs within a member function declaration inside the class
   /// (C++ [class.mem]p2).
   struct LateParsedDefaultArgument {
-    explicit LateParsedDefaultArgument(Action::DeclPtrTy P, 
+    explicit LateParsedDefaultArgument(Action::DeclPtrTy P,
                                        CachedTokens *Toks = 0)
       : Param(P), Toks(Toks) { }
 
@@ -492,13 +492,13 @@
     /// default argument.
     CachedTokens *Toks;
   };
-  
+
   /// LateParsedMethodDeclaration - A method declaration inside a class that
   /// contains at least one entity whose parsing needs to be delayed
   /// until the class itself is completely-defined, such as a default
   /// argument (C++ [class.mem]p2).
   struct LateParsedMethodDeclaration {
-    explicit LateParsedMethodDeclaration(Action::DeclPtrTy M) 
+    explicit LateParsedMethodDeclaration(Action::DeclPtrTy M)
       : Method(M), TemplateScope(false) { }
 
     /// Method - The method declaration.
@@ -508,12 +508,12 @@
     /// scope. When true, D is a template declaration.
     /// othewise, it is a member function declaration.
     bool TemplateScope;
-    
+
     /// DefaultArgs - Contains the parameters of the function and
     /// their default arguments. At least one of the parameters will
     /// have a default argument, but all of the parameters of the
     /// method will be stored so that they can be reintroduced into
-    /// scope at the appropriate times. 
+    /// scope at the appropriate times.
     llvm::SmallVector<LateParsedDefaultArgument, 8> DefaultArgs;
   };
 
@@ -533,8 +533,8 @@
   /// any member function declarations or definitions that need to be
   /// parsed after the corresponding top-level class is complete.
   struct ParsingClass {
-    ParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass) 
-      : TopLevelClass(TopLevelClass), TemplateScope(false), 
+    ParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass)
+      : TopLevelClass(TopLevelClass), TemplateScope(false),
         TagOrTemplate(TagOrTemplate) { }
 
     /// \brief Whether this is a "top-level" class, meaning that it is
@@ -571,27 +571,27 @@
     return *ClassStack.top();
   }
 
-  /// \brief RAII object used to 
+  /// \brief RAII object used to
   class ParsingClassDefinition {
     Parser &P;
     bool Popped;
 
   public:
-    ParsingClassDefinition(Parser &P, DeclPtrTy TagOrTemplate, bool TopLevelClass) 
-      : P(P), Popped(false) { 
+    ParsingClassDefinition(Parser &P, DeclPtrTy TagOrTemplate, bool TopLevelClass)
+      : P(P), Popped(false) {
       P.PushParsingClass(TagOrTemplate, TopLevelClass);
     }
 
     /// \brief Pop this class of the stack.
-    void Pop() { 
+    void Pop() {
       assert(!Popped && "Nested class has already been popped");
       Popped = true;
       P.PopParsingClass();
     }
 
-    ~ParsingClassDefinition() { 
+    ~ParsingClassDefinition() {
       if (!Popped)
-        P.PopParsingClass(); 
+        P.PopParsingClass();
     }
   };
 
@@ -599,7 +599,7 @@
   /// information that has been parsed prior to parsing declaration
   /// specifiers.
   struct ParsedTemplateInfo {
-    ParsedTemplateInfo() 
+    ParsedTemplateInfo()
       : Kind(NonTemplate), TemplateParams(0), TemplateLoc() { }
 
     ParsedTemplateInfo(TemplateParameterLists *TemplateParams,
@@ -609,7 +609,7 @@
 
     explicit ParsedTemplateInfo(SourceLocation ExternLoc,
                                 SourceLocation TemplateLoc)
-      : Kind(ExplicitInstantiation), TemplateParams(0), 
+      : Kind(ExplicitInstantiation), TemplateParams(0),
         ExternLoc(ExternLoc), TemplateLoc(TemplateLoc) { }
 
     /// \brief The kind of template we are parsing.
@@ -631,12 +631,12 @@
     /// \brief The location of the 'extern' keyword, if any, for an explicit
     /// instantiation
     SourceLocation ExternLoc;
-    
+
     /// \brief The location of the 'template' keyword, for an explicit
     /// instantiation.
     SourceLocation TemplateLoc;
   };
-  
+
   void PushParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass);
   void DeallocateParsedClasses(ParsingClass *Class);
   void PopParsingClass();
@@ -645,7 +645,7 @@
                                     const ParsedTemplateInfo &TemplateInfo);
   void ParseLexedMethodDeclarations(ParsingClass &Class);
   void ParseLexedMethodDefs(ParsingClass &Class);
-  bool ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2, 
+  bool ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2,
                             CachedTokens &Toks,
                             tok::TokenKind EarlyAbortIf = tok::unknown,
                             bool ConsumeFinalToken = true);
@@ -657,7 +657,7 @@
   bool isStartOfFunctionDefinition();
   DeclGroupPtrTy ParseDeclarationOrFunctionDefinition(
             AccessSpecifier AS = AS_none);
-                                               
+
   DeclPtrTy ParseFunctionDefinition(Declarator &D,
                  const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
   void ParseKNRParamDeclarations(Declarator &D);
@@ -667,20 +667,20 @@
   OwningExprResult ParseAsmStringLiteral();
 
   // Objective-C External Declarations
-  DeclPtrTy ParseObjCAtDirectives(); 
+  DeclPtrTy ParseObjCAtDirectives();
   DeclPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc);
-  DeclPtrTy ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, 
+  DeclPtrTy ParseObjCAtInterfaceDeclaration(SourceLocation atLoc,
                                           AttributeList *prefixAttrs = 0);
-  void ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl, 
+  void ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
                                        SourceLocation atLoc);
   bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &P,
-                                   bool WarnOnDeclarations, 
+                                   bool WarnOnDeclarations,
                                    SourceLocation &EndProtoLoc);
   void ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
                                   tok::ObjCKeywordKind contextKey);
   DeclPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
                                            AttributeList *prefixAttrs = 0);
-  
+
   DeclPtrTy ObjCImpDecl;
 
   DeclPtrTy ParseObjCAtImplementationDeclaration(SourceLocation atLoc);
@@ -688,7 +688,7 @@
   DeclPtrTy ParseObjCAtAliasDeclaration(SourceLocation atLoc);
   DeclPtrTy ParseObjCPropertySynthesize(SourceLocation atLoc);
   DeclPtrTy ParseObjCPropertyDynamic(SourceLocation atLoc);
-  
+
   IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation);
   // Definitions for Objective-c context sensitive keywords recognition.
   enum ObjCTypeQual {
@@ -696,7 +696,7 @@
     objc_NumQuals
   };
   IdentifierInfo *ObjCTypeQuals[objc_NumQuals];
-  
+
   bool isTokIdentifier_in() const;
 
   TypeTy *ParseObjCTypeName(ObjCDeclSpec &DS);
@@ -707,9 +707,9 @@
                                 DeclPtrTy classDecl,
             tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword);
   void ParseObjCPropertyAttribute(ObjCDeclSpec &DS);
-  
+
   DeclPtrTy ParseObjCMethodDefinition();
-  
+
   //===--------------------------------------------------------------------===//
   // C99 6.5: Expressions.
 
@@ -734,7 +734,7 @@
   OwningExprResult ParsePostfixExpressionSuffix(OwningExprResult LHS);
   OwningExprResult ParseSizeofAlignofExpression();
   OwningExprResult ParseBuiltinPrimaryExpression();
-  
+
   OwningExprResult ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
                                                      bool &isCastExpr,
                                                      TypeTy *&CastTy,
@@ -759,26 +759,26 @@
                                         bool parseAsExprList,
                                         TypeTy *&CastTy,
                                         SourceLocation &RParenLoc);
-  
+
   OwningExprResult ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
                                                     TypeTy *&CastTy,
                                                     SourceLocation LParenLoc,
                                                     SourceLocation &RParenLoc);
-  
+
   OwningExprResult ParseCompoundLiteralExpression(TypeTy *Ty,
                                                   SourceLocation LParenLoc,
                                                   SourceLocation RParenLoc);
-  
+
   OwningExprResult ParseStringLiteralExpression();
 
   //===--------------------------------------------------------------------===//
   // C++ Expressions
   OwningExprResult ParseCXXIdExpression(bool isAddressOfOperand = false);
 
-  bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, 
+  bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
                                       TypeTy *ObjectType,
                                       bool EnteringContext);
-  
+
   //===--------------------------------------------------------------------===//
   // C++ 5.2p1: C++ Casts
   OwningExprResult ParseCXXCasts();
@@ -832,7 +832,7 @@
 
   //===--------------------------------------------------------------------===//
   // C99 6.7.8: Initialization.
-  
+
   /// ParseInitializer
   ///       initializer: [C99 6.7.8]
   ///         assignment-expression
@@ -852,15 +852,15 @@
 
   //===--------------------------------------------------------------------===//
   // Objective-C Expressions
-  
+
   bool isTokObjCMessageIdentifierReceiver() const {
     if (!Tok.is(tok::identifier))
       return false;
-    
+
     IdentifierInfo *II = Tok.getIdentifierInfo();
     if (Actions.getTypeName(*II, Tok.getLocation(), CurScope))
       return true;
-    
+
     return II == Ident_super;
   }
 
@@ -935,7 +935,7 @@
     DSC_normal, // normal context
     DSC_class   // class context, enables 'friend'
   };
-  
+
   DeclGroupPtrTy ParseDeclaration(unsigned Context, SourceLocation &DeclEnd);
   DeclGroupPtrTy ParseSimpleDeclaration(unsigned Context,
                                         SourceLocation &DeclEnd,
@@ -949,17 +949,17 @@
   bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
                         const ParsedTemplateInfo &TemplateInfo,
                         AccessSpecifier AS);
-  void ParseDeclarationSpecifiers(DeclSpec &DS, 
+  void ParseDeclarationSpecifiers(DeclSpec &DS,
                 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
                                   AccessSpecifier AS = AS_none,
                                   DeclSpecContext DSC = DSC_normal);
-  bool ParseOptionalTypeSpecifier(DeclSpec &DS, bool &isInvalid, 
+  bool ParseOptionalTypeSpecifier(DeclSpec &DS, bool &isInvalid,
                                   const char *&PrevSpec,
                                   unsigned &DiagID,
                const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
 
   void ParseSpecifierQualifierList(DeclSpec &DS);
-  
+
   void ParseObjCTypeQualifierList(ObjCDeclSpec &DS);
 
   void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
@@ -969,7 +969,7 @@
                             DeclPtrTy TagDecl);
   void ParseStructDeclaration(DeclSpec &DS,
                               llvm::SmallVectorImpl<FieldDeclarator> &Fields);
-                              
+
   bool isDeclarationSpecifier();
   bool isTypeSpecifierQualifier();
   bool isTypeQualifier() const;
@@ -1131,7 +1131,7 @@
       }
     }
   };
-  
+
   /// ParseDeclarator - Parse and verify a newly-initialized declarator.
   void ParseDeclarator(Declarator &D);
   /// A function that parses a variant of direct-declarator.
@@ -1147,10 +1147,10 @@
   void ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc,
                                              Declarator &D);
   void ParseBracketDeclarator(Declarator &D);
-  
+
   //===--------------------------------------------------------------------===//
   // C++ 7: Declarations [dcl.dcl]
-  
+
   DeclPtrTy ParseNamespace(unsigned Context, SourceLocation &DeclEnd);
   DeclPtrTy ParseLinkage(unsigned Context);
   DeclPtrTy ParseUsingDirectiveOrDeclaration(unsigned Context,
@@ -1164,14 +1164,14 @@
   DeclPtrTy ParseNamespaceAlias(SourceLocation NamespaceLoc,
                                 SourceLocation AliasLoc, IdentifierInfo *Alias,
                                 SourceLocation &DeclEnd);
-  
+
   //===--------------------------------------------------------------------===//
   // C++ 9: classes [class] and C structs/unions.
-  TypeResult ParseClassName(SourceLocation &EndLocation, 
+  TypeResult ParseClassName(SourceLocation &EndLocation,
                             const CXXScopeSpec *SS = 0,
                             bool DestrExpected = false);
   void ParseClassSpecifier(tok::TokenKind TagTokKind, SourceLocation TagLoc,
-                           DeclSpec &DS, 
+                           DeclSpec &DS,
                 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
                            AccessSpecifier AS = AS_none);
   void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
@@ -1212,9 +1212,9 @@
                                        const ParsedTemplateInfo &TemplateInfo,
                                        SourceLocation &DeclEnd,
                                        AccessSpecifier AS=AS_none);
-  bool ParseTemplateParameters(unsigned Depth, 
+  bool ParseTemplateParameters(unsigned Depth,
                                TemplateParameterList &TemplateParams,
-                               SourceLocation &LAngleLoc, 
+                               SourceLocation &LAngleLoc,
                                SourceLocation &RAngleLoc);
   bool ParseTemplateParameterList(unsigned Depth,
                                   TemplateParameterList &TemplateParams);
@@ -1228,7 +1228,7 @@
   typedef llvm::SmallVector<SourceLocation, 16> TemplateArgLocationList;
 
   bool ParseTemplateIdAfterTemplateName(TemplateTy Template,
-                                        SourceLocation TemplateNameLoc, 
+                                        SourceLocation TemplateNameLoc,
                                         const CXXScopeSpec *SS,
                                         bool ConsumeLastToken,
                                         SourceLocation &LAngleLoc,
@@ -1247,7 +1247,7 @@
                                  TemplateArgLocationList &TemplateArgLocations);
   void *ParseTemplateArgument(bool &ArgIsType);
   DeclPtrTy ParseExplicitInstantiation(SourceLocation ExternLoc,
-                                       SourceLocation TemplateLoc, 
+                                       SourceLocation TemplateLoc,
                                        SourceLocation &DeclEnd);
 
   //===--------------------------------------------------------------------===//

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Scope.h (original)
+++ cfe/trunk/include/clang/Parse/Scope.h Wed Sep  9 10:08:12 2009
@@ -31,15 +31,15 @@
     /// FnScope - This indicates that the scope corresponds to a function, which
     /// means that labels are set here.
     FnScope       = 0x01,
-    
+
     /// BreakScope - This is a while,do,switch,for, etc that can have break
     /// stmts embedded into it.
     BreakScope    = 0x02,
-    
+
     /// ContinueScope - This is a while,do,for, which can have continue
     /// stmt embedded into it.
     ContinueScope = 0x04,
-    
+
     /// DeclScope - This is a scope that can contain a declaration.  Some scopes
     /// just contain loop constructs but don't contain decls.
     DeclScope = 0x08,
@@ -49,7 +49,7 @@
 
     /// ClassScope - The scope of a struct/union/class definition.
     ClassScope = 0x20,
-    
+
     /// BlockScope - This is a scope that corresponds to a block object.
     /// Blocks serve as top-level scopes for some objects like labels, they
     /// also prevent things like break and continue.  BlockScopes have the
@@ -65,7 +65,7 @@
     /// FunctionPrototypeScope - This is a scope that corresponds to the
     /// parameters within a function prototype.
     FunctionPrototypeScope = 0x100,
-    
+
     /// AtCatchScope - This is a scope that corresponds to the Objective-C
     /// @catch statement.
     AtCatchScope = 0x200
@@ -74,15 +74,15 @@
   /// The parent scope for this scope.  This is null for the translation-unit
   /// scope.
   Scope *AnyParent;
-  
+
   /// Depth - This is the depth of this scope.  The translation-unit scope has
   /// depth 0.
   unsigned Depth : 16;
-  
+
   /// Flags - This contains a set of ScopeFlags, which indicates how the scope
   /// interrelates with other control flow statements.
   unsigned Flags : 10;
-  
+
   /// WithinElse - Whether this scope is part of the "else" branch in
   /// its parent ControlScope.
   bool WithinElse : 1;
@@ -90,7 +90,7 @@
   /// FnParent - If this scope has a parent scope that is a function body, this
   /// pointer is non-null and points to it.  This is used for label processing.
   Scope *FnParent;
-  
+
   /// BreakParent/ContinueParent - This is a direct link to the immediately
   /// preceeding BreakParent/ContinueParent if this scope is not one, or null if
   /// there is no containing break/continue scope.
@@ -119,7 +119,7 @@
   /// implement these semantics.
   typedef llvm::SmallPtrSet<Action::DeclPtrTy, 32> DeclSetTy;
   DeclSetTy DeclsInScope;
-  
+
   /// Entity - The entity with which this scope is associated. For
   /// example, the entity of a class scope is the class itself, the
   /// entity of a function scope is a function, etc. This field is
@@ -151,9 +151,9 @@
   ///
   const Scope *getFnParent() const { return FnParent; }
   Scope *getFnParent() { return FnParent; }
-  
+
   /// getContinueParent - Return the closest scope that a continue statement
-  /// would be affected by.  If the closest scope is a closure scope, we know 
+  /// would be affected by.  If the closest scope is a closure scope, we know
   /// that there is no loop *inside* the closure.
   Scope *getContinueParent() {
     if (ContinueParent && !ContinueParent->isBlockScope())
@@ -164,9 +164,9 @@
   const Scope *getContinueParent() const {
     return const_cast<Scope*>(this)->getContinueParent();
   }
-  
+
   /// getBreakParent - Return the closest scope that a break statement
-  /// would be affected by.  If the closest scope is a block scope, we know 
+  /// would be affected by.  If the closest scope is a block scope, we know
   /// that there is no loop *inside* the block.
   Scope *getBreakParent() {
     if (BreakParent && !BreakParent->isBlockScope())
@@ -176,16 +176,16 @@
   const Scope *getBreakParent() const {
     return const_cast<Scope*>(this)->getBreakParent();
   }
- 
+
   Scope *getControlParent() { return ControlParent; }
   const Scope *getControlParent() const { return ControlParent; }
-  
+
   Scope *getBlockParent() { return BlockParent; }
-  const Scope *getBlockParent() const { return BlockParent; }  
+  const Scope *getBlockParent() const { return BlockParent; }
 
   Scope *getTemplateParamParent() { return TemplateParamParent; }
-  const Scope *getTemplateParamParent() const { return TemplateParamParent; }  
- 
+  const Scope *getTemplateParamParent() const { return TemplateParamParent; }
+
   typedef DeclSetTy::iterator decl_iterator;
   decl_iterator decl_begin() const { return DeclsInScope.begin(); }
   decl_iterator decl_end()   const { return DeclsInScope.end(); }
@@ -222,7 +222,7 @@
     }
     return false;
   }
-  
+
   /// isTemplateParamScope - Return true if this scope is a C++
   /// template parameter scope.
   bool isTemplateParamScope() const {
@@ -275,7 +275,7 @@
     AnyParent = Parent;
     Depth = AnyParent ? AnyParent->Depth+1 : 0;
     Flags = ScopeFlags;
-    
+
     if (AnyParent) {
       FnParent       = AnyParent->FnParent;
       BreakParent    = AnyParent->BreakParent;
@@ -291,7 +291,7 @@
       TemplateParamParent = 0;
       WithinElse = false;
     }
-    
+
     // If this scope is a function or contains breaks/continues, remember it.
     if (Flags & FnScope)            FnParent = this;
     if (Flags & BreakScope)         BreakParent = this;
@@ -304,7 +304,7 @@
     Entity = 0;
   }
 };
-    
+
 }  // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Rewrite/DeltaTree.h (original)
+++ cfe/trunk/include/clang/Rewrite/DeltaTree.h Wed Sep  9 10:08:12 2009
@@ -15,7 +15,7 @@
 #define CLANG_REWRITE_DELTATREE_H
 
 namespace clang {
- 
+
   /// DeltaTree - a multiway search tree (BTree) structure with some fancy
   /// features.  B-Trees are are generally more memory and cache efficient than
   /// binary trees, because they store multiple keys/values in each node.  This
@@ -32,16 +32,16 @@
     // Note: Currently we only support copying when the RHS is empty.
     DeltaTree(const DeltaTree &RHS);
     ~DeltaTree();
-    
+
     /// getDeltaAt - Return the accumulated delta at the specified file offset.
     /// This includes all insertions or delections that occurred *before* the
     /// specified file index.
-    int getDeltaAt(unsigned FileIndex) const;        
+    int getDeltaAt(unsigned FileIndex) const;
 
     /// AddDelta - When a change is made that shifts around the text buffer,
     /// this method is used to record that info.  It inserts a delta of 'Delta'
     /// into the current DeltaTree at offset FileIndex.
-    void AddDelta(unsigned FileIndex, int Delta);    
+    void AddDelta(unsigned FileIndex, int Delta);
   };
 }  // end namespace clang
 

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

==============================================================================
--- cfe/trunk/include/clang/Rewrite/HTMLRewrite.h (original)
+++ cfe/trunk/include/clang/Rewrite/HTMLRewrite.h Wed Sep  9 10:08:12 2009
@@ -19,36 +19,36 @@
 #include <string>
 
 namespace clang {
-  
+
 class Rewriter;
 class RewriteBuffer;
 class Preprocessor;
 class PreprocessorFactory;
-  
+
 namespace html {
-  
+
   /// HighlightRange - Highlight a range in the source code with the specified
   /// start/end tags.  B/E must be in the same file.  This ensures that
   /// start/end tags are placed at the start/end of each line if the range is
   /// multiline.
   void HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
                       const char *StartTag, const char *EndTag);
-  
+
   /// HighlightRange - Highlight a range in the source code with the specified
-  /// start/end tags.  The Start/end of the range must be in the same file.  
+  /// start/end tags.  The Start/end of the range must be in the same file.
   /// This ensures that start/end tags are placed at the start/end of each line
   /// if the range is multiline.
   inline void HighlightRange(Rewriter &R, SourceRange Range,
                              const char *StartTag, const char *EndTag) {
     HighlightRange(R, Range.getBegin(), Range.getEnd(), StartTag, EndTag);
   }
-  
+
   /// HighlightRange - This is the same as the above method, but takes
   /// decomposed file locations.
   void HighlightRange(RewriteBuffer &RB, unsigned B, unsigned E,
                       const char *BufferStart,
                       const char *StartTag, const char *EndTag);
-  
+
   /// EscapeText - HTMLize a specified file so that special characters are
   /// are translated so that they are not interpreted as HTML tags.
   void EscapeText(Rewriter& R, FileID FID,
@@ -61,9 +61,9 @@
   std::string EscapeText(const std::string& s,
                          bool EscapeSpaces = false, bool ReplaceTabs = false);
 
-  void AddLineNumbers(Rewriter& R, FileID FID);  
-  
-  void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID, 
+  void AddLineNumbers(Rewriter& R, FileID FID);
+
+  void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
                                          const char *title = NULL);
 
   /// SyntaxHighlight - Relex the specified FileID and annotate the HTML with

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

==============================================================================
--- cfe/trunk/include/clang/Rewrite/RewriteRope.h (original)
+++ cfe/trunk/include/clang/Rewrite/RewriteRope.h Wed Sep  9 10:08:12 2009
@@ -22,7 +22,7 @@
   //===--------------------------------------------------------------------===//
   // RopeRefCountString Class
   //===--------------------------------------------------------------------===//
-  
+
   /// RopeRefCountString - This struct is allocated with 'new char[]' from the
   /// heap, and represents a reference counted chunk of string data.  When its
   /// ref count drops to zero, it is delete[]'d.  This is primarily managed
@@ -30,21 +30,21 @@
   struct RopeRefCountString {
     unsigned RefCount;
     char Data[1];  //  Variable sized.
-    
+
     void addRef() {
       if (this) ++RefCount;
     }
-    
+
     void dropRef() {
       if (this && --RefCount == 0)
         delete [] (char*)this;
     }
   };
-  
+
   //===--------------------------------------------------------------------===//
   // RopePiece Class
   //===--------------------------------------------------------------------===//
-  
+
   /// RopePiece - This class represents a view into a RopeRefCountString object.
   /// This allows references to string data to be efficiently chopped up and
   /// moved around without having to push around the string data itself.
@@ -57,9 +57,9 @@
     RopeRefCountString *StrData;
     unsigned StartOffs;
     unsigned EndOffs;
-    
+
     RopePiece() : StrData(0), StartOffs(0), EndOffs(0) {}
-    
+
     RopePiece(RopeRefCountString *Str, unsigned Start, unsigned End)
       : StrData(Str), StartOffs(Start), EndOffs(End) {
       StrData->addRef();
@@ -68,11 +68,11 @@
       : StrData(RP.StrData), StartOffs(RP.StartOffs), EndOffs(RP.EndOffs) {
       StrData->addRef();
     }
-    
+
     ~RopePiece() {
       StrData->dropRef();
     }
-    
+
     void operator=(const RopePiece &RHS) {
       if (StrData != RHS.StrData) {
         StrData->dropRef();
@@ -82,21 +82,21 @@
       StartOffs = RHS.StartOffs;
       EndOffs = RHS.EndOffs;
     }
-    
+
     const char &operator[](unsigned Offset) const {
       return StrData->Data[Offset+StartOffs];
     }
     char &operator[](unsigned Offset) {
       return StrData->Data[Offset+StartOffs];
     }
-    
+
     unsigned size() const { return EndOffs-StartOffs; }
   };
-  
+
   //===--------------------------------------------------------------------===//
   // RopePieceBTreeIterator Class
   //===--------------------------------------------------------------------===//
-  
+
   /// RopePieceBTreeIterator - This class provides read-only forward iteration
   /// over bytes that are in a RopePieceBTree.  This first iterates over bytes
   /// in a RopePiece, then iterates over RopePiece's in a RopePieceBTreeLeaf,
@@ -115,18 +115,18 @@
     RopePieceBTreeIterator(const void /*RopePieceBTreeNode*/ *N);
     // end iterator
     RopePieceBTreeIterator() : CurNode(0), CurPiece(0), CurChar(0) {}
-    
+
     char operator*() const {
       return (*CurPiece)[CurChar];
     }
-    
+
     bool operator==(const RopePieceBTreeIterator &RHS) const {
       return CurPiece == RHS.CurPiece && CurChar == RHS.CurChar;
     }
     bool operator!=(const RopePieceBTreeIterator &RHS) const {
       return !operator==(RHS);
     }
-    
+
     RopePieceBTreeIterator& operator++() {   // Preincrement
       if (CurChar+1 < CurPiece->size())
         ++CurChar;
@@ -140,11 +140,11 @@
   private:
     void MoveToNextPiece();
   };
-  
+
   //===--------------------------------------------------------------------===//
   // RopePieceBTree Class
   //===--------------------------------------------------------------------===//
-  
+
   class RopePieceBTree {
     void /*RopePieceBTreeNode*/ *Root;
     void operator=(const RopePieceBTree &); // DO NOT IMPLEMENT
@@ -152,15 +152,15 @@
     RopePieceBTree();
     RopePieceBTree(const RopePieceBTree &RHS);
     ~RopePieceBTree();
-    
+
     typedef RopePieceBTreeIterator iterator;
     iterator begin() const { return iterator(Root); }
     iterator end() const { return iterator(); }
     unsigned size() const;
     unsigned empty() const { return size() == 0; }
-    
+
     void clear();
-    
+
     void insert(unsigned Offset, const RopePiece &R);
 
     void erase(unsigned Offset, unsigned NumBytes);
@@ -169,13 +169,13 @@
   //===--------------------------------------------------------------------===//
   // RewriteRope Class
   //===--------------------------------------------------------------------===//
-  
+
 /// RewriteRope - A powerful string class.  This class supports extremely
 /// efficient insertions and deletions into the middle of it, even for
 /// ridiculously long strings.
 class RewriteRope {
   RopePieceBTree Chunks;
-  
+
   /// We allocate space for string data out of a buffer of size AllocChunkSize.
   /// This keeps track of how much space is left.
   RopeRefCountString *AllocBuffer;
@@ -184,7 +184,7 @@
 
 public:
   RewriteRope() :  AllocBuffer(0), AllocOffs(AllocChunkSize) {}
-  RewriteRope(const RewriteRope &RHS) 
+  RewriteRope(const RewriteRope &RHS)
     : Chunks(RHS.Chunks), AllocBuffer(0), AllocOffs(AllocChunkSize) {
   }
 
@@ -192,23 +192,23 @@
     // If we had an allocation buffer, drop our reference to it.
     AllocBuffer->dropRef();
   }
-  
+
   typedef RopePieceBTree::iterator iterator;
   typedef RopePieceBTree::iterator const_iterator;
   iterator begin() const { return Chunks.begin(); }
   iterator end() const  { return Chunks.end(); }
   unsigned size() const { return Chunks.size(); }
-  
+
   void clear() {
     Chunks.clear();
   }
-  
+
   void assign(const char *Start, const char *End) {
     clear();
     if (Start != End)
       Chunks.insert(0, MakeRopeString(Start, End));
   }
-  
+
   void insert(unsigned Offset, const char *Start, const char *End) {
     assert(Offset <= size() && "Invalid position to insert!");
     if (Start == End) return;
@@ -224,7 +224,7 @@
 private:
   RopePiece MakeRopeString(const char *Start, const char *End);
 };
-  
+
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Rewrite/Rewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/Rewriter.h Wed Sep  9 10:08:12 2009
@@ -29,7 +29,7 @@
   class LangOptions;
   class Rewriter;
   class Stmt;
-  
+
 /// RewriteBuffer - As code is rewritten, SourceBuffer's from the original
 /// input with modifications get a new RewriteBuffer associated with them.  The
 /// RewriteBuffer captures the modified text itself as well as information used
@@ -41,7 +41,7 @@
   /// Deltas - Keep track of all the deltas in the source code due to insertions
   /// and deletions.
   DeltaTree Deltas;
-  
+
   /// Buffer - This is the actual buffer itself.  Note that using a vector or
   /// string is a horribly inefficient way to do this, we should use a rope
   /// instead.
@@ -52,17 +52,17 @@
   iterator begin() const { return Buffer.begin(); }
   iterator end() const { return Buffer.end(); }
   unsigned size() const { return Buffer.size(); }
-  
+
   /// RemoveText - Remove the specified text.
   void RemoveText(unsigned OrigOffset, unsigned Size);
-  
+
   /// InsertText - Insert some text at the specified point, where the offset in
   /// the buffer is specified relative to the original SourceBuffer.  The
   /// text is inserted after the specified location.
   ///
   void InsertText(unsigned OrigOffset, const llvm::StringRef &Str,
                   bool InsertAfter = true);
-  
+
 
   /// InsertTextBefore - Insert some text before the specified point, where the
   /// offset in the buffer is specified relative to the original
@@ -71,28 +71,28 @@
   void InsertTextBefore(unsigned OrigOffset, const llvm::StringRef &Str) {
     InsertText(OrigOffset, Str, false);
   }
-  
+
   /// InsertTextAfter - Insert some text at the specified point, where the
   /// offset in the buffer is specified relative to the original SourceBuffer.
   /// The text is inserted after the specified location.
   void InsertTextAfter(unsigned OrigOffset, const llvm::StringRef &Str) {
     InsertText(OrigOffset, Str);
   }
-  
+
   /// ReplaceText - This method replaces a range of characters in the input
   /// buffer with a new string.  This is effectively a combined "remove/insert"
   /// operation.
   void ReplaceText(unsigned OrigOffset, unsigned OrigLength,
                    const llvm::StringRef &NewStr);
-  
+
 private:  // Methods only usable by Rewriter.
-  
+
   /// Initialize - Start this rewrite buffer out with a copy of the unmodified
   /// input buffer.
   void Initialize(const char *BufStart, const char *BufEnd) {
     Buffer.assign(BufStart, BufEnd);
   }
-  
+
   /// getMappedOffset - Given an offset into the original SourceBuffer that this
   /// RewriteBuffer is based on, map it into the offset space of the
   /// RewriteBuffer.  If AfterInserts is true and if the OrigOffset indicates a
@@ -102,7 +102,7 @@
                            bool AfterInserts = false) const{
     return Deltas.getDeltaAt(2*OrigOffset+AfterInserts)+OrigOffset;
   }
-  
+
   /// AddInsertDelta - When an insertion is made at a position, this
   /// method is used to record that information.
   void AddInsertDelta(unsigned OrigOffset, int Change) {
@@ -115,7 +115,7 @@
     return Deltas.AddDelta(2*OrigOffset+1, Change);
   }
 };
-  
+
 
 /// Rewriter - This is the main interface to the rewrite buffers.  Its primary
 /// job is to dispatch high-level requests to the low-level RewriteBuffers that
@@ -128,14 +128,14 @@
   explicit Rewriter(SourceManager &SM, const LangOptions &LO)
     : SourceMgr(&SM), LangOpts(&LO) {}
   explicit Rewriter() : SourceMgr(0), LangOpts(0) {}
-  
+
   void setSourceMgr(SourceManager &SM, const LangOptions &LO) {
     SourceMgr = &SM;
     LangOpts = &LO;
   }
   SourceManager &getSourceMgr() { return *SourceMgr; }
   const LangOptions &getLangOpts() { return *LangOpts; }
-  
+
   /// isRewritable - Return true if this location is a raw file location, which
   /// is rewritable.  Locations from macros, etc are not rewritable.
   static bool isRewritable(SourceLocation Loc) {
@@ -145,7 +145,7 @@
   /// getRangeSize - Return the size in bytes of the specified range if they
   /// are in the same file.  If not, this returns -1.
   int getRangeSize(SourceRange Range) const;
-  
+
   /// 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.
@@ -153,22 +153,22 @@
   /// Note that this method is not particularly efficient.
   ///
   std::string getRewritenText(SourceRange Range) const;
-  
+
   /// InsertText - Insert the specified string at the specified location in the
   /// original buffer.  This method returns true (and does nothing) if the input
   /// location was not rewritable, false otherwise.
   bool InsertText(SourceLocation Loc, const llvm::StringRef &Str,
                   bool InsertAfter = true);
-  
+
   /// InsertTextAfter - Insert the specified string at the specified location in
-  ///  the original buffer.  This method returns true (and does nothing) if 
+  ///  the original buffer.  This method returns true (and does nothing) if
   ///  the input location was not rewritable, false otherwise.  Text is
   ///  inserted after any other text that has been previously inserted
   ///  at the some point (the default behavior for InsertText).
   bool InsertTextAfter(SourceLocation Loc, const llvm::StringRef &Str) {
     return InsertText(Loc, Str);
-  }    
-  
+  }
+
   /// InsertText - Insert the specified string at the specified location in the
   /// original buffer.  This method returns true (and does nothing) if the input
   /// location was not rewritable, false otherwise.  Text is
@@ -177,21 +177,21 @@
   bool InsertTextBefore(SourceLocation Loc, const llvm::StringRef &Str) {
     return InsertText(Loc, Str, false);
   }
-  
+
   /// RemoveText - Remove the specified text region.
   bool RemoveText(SourceLocation Start, unsigned Length);
-  
+
   /// ReplaceText - This method replaces a range of characters in the input
   /// buffer with a new string.  This is effectively a combined "remove/insert"
   /// operation.
   bool ReplaceText(SourceLocation Start, unsigned OrigLength,
                    const llvm::StringRef &NewStr);
-  
+
   /// ReplaceStmt - This replaces a Stmt/Expr with another, using the pretty
   /// printer to generate the replacement code.  This returns true if the input
   /// could not be rewritten, or false if successful.
   bool ReplaceStmt(Stmt *From, Stmt *To);
-  
+
   /// getRewriteBufferFor - Return the rewrite buffer for the specified FileID.
   /// If no modification has been made to it, return null.
   const RewriteBuffer *getRewriteBufferFor(FileID FID) const {
@@ -209,7 +209,7 @@
 private:
   unsigned getLocationOffsetAndFileID(SourceLocation Loc, FileID &FID) const;
 };
-  
+
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Rewrite/TokenRewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/TokenRewriter.h Wed Sep  9 10:08:12 2009
@@ -24,7 +24,7 @@
   class Token;
   class LangOptions;
   class ScratchBuffer;
-  
+
   class TokenRewriter {
     /// TokenList - This is the list of raw tokens that make up this file.  Each
     /// of these tokens has a unique SourceLocation, which is a FileID.
@@ -32,17 +32,17 @@
 
     /// TokenRefTy - This is the type used to refer to a token in the TokenList.
     typedef std::list<Token>::iterator TokenRefTy;
-    
+
     /// TokenAtLoc - This map indicates which token exists at a specific
     /// SourceLocation.  Since each token has a unique SourceLocation, this is a
     /// one to one map.  The token can return its own location directly, to map
     /// backwards.
     std::map<SourceLocation, TokenRefTy> TokenAtLoc;
-    
+
     /// ScratchBuf - This is the buffer that we create scratch tokens from.
     ///
     llvm::OwningPtr<ScratchBuffer> ScratchBuf;
-    
+
     TokenRewriter(const TokenRewriter&);  // DO NOT IMPLEMENT
     void operator=(const TokenRewriter&); // DO NOT IMPLEMENT.
   public:
@@ -50,30 +50,30 @@
     /// specified FileID.
     TokenRewriter(FileID FID, SourceManager &SM, const LangOptions &LO);
     ~TokenRewriter();
-    
+
     typedef std::list<Token>::const_iterator token_iterator;
     token_iterator token_begin() const { return TokenList.begin(); }
     token_iterator token_end() const { return TokenList.end(); }
-    
-    
+
+
     token_iterator AddTokenBefore(token_iterator I, const char *Val);
     token_iterator AddTokenAfter(token_iterator I, const char *Val) {
       assert(I != token_end() && "Cannot insert after token_end()!");
       return AddTokenBefore(++I, Val);
     }
-    
+
   private:
     /// RemapIterator - Convert from token_iterator (a const iterator) to
     /// TokenRefTy (a non-const iterator).
     TokenRefTy RemapIterator(token_iterator I);
-    
+
     /// AddToken - Add the specified token into the Rewriter before the other
     /// position.
     TokenRefTy AddToken(const Token &T, TokenRefTy Where);
   };
-  
-  
-  
+
+
+
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Sema/ExternalSemaSource.h (original)
+++ cfe/trunk/include/clang/Sema/ExternalSemaSource.h Wed Sep  9 10:08:12 2009
@@ -39,13 +39,13 @@
   ///
   /// \returns a pair of Objective-C methods lists containing the
   /// instance and factory methods, respectively, with this selector.
-  virtual std::pair<ObjCMethodList, ObjCMethodList> 
-  ReadMethodPool(Selector Sel) { 
+  virtual std::pair<ObjCMethodList, ObjCMethodList>
+  ReadMethodPool(Selector Sel) {
     return std::pair<ObjCMethodList, ObjCMethodList>();
   }
-  
+
   // isa/cast/dyn_cast support
-  static bool classof(const ExternalASTSource *Source) { 
+  static bool classof(const ExternalASTSource *Source) {
     return Source->SemaSource;
   }
   static bool classof(const ExternalSemaSource *) { return true; }

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

==============================================================================
--- cfe/trunk/include/clang/Sema/ParseAST.h (original)
+++ cfe/trunk/include/clang/Sema/ParseAST.h Wed Sep  9 10:08:12 2009
@@ -28,7 +28,7 @@
   /// \param CompleteTranslationUnit When true, the parsed file is
   /// considered to be a complete translation unit, and any
   /// end-of-translation-unit wrapup will be performed.
-  void ParseAST(Preprocessor &pp, ASTConsumer *C, 
+  void ParseAST(Preprocessor &pp, ASTConsumer *C,
                 ASTContext &Ctx, bool PrintStats = false,
                 bool CompleteTranslationUnit = true);
 

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

==============================================================================
--- cfe/trunk/include/clang/Sema/SemaConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/SemaConsumer.h Wed Sep  9 10:08:12 2009
@@ -35,8 +35,8 @@
     virtual void InitializeSema(Sema &S) {}
 
     // isa/cast/dyn_cast support
-    static bool classof(const ASTConsumer *Consumer) { 
-      return Consumer->SemaConsumer; 
+    static bool classof(const ASTConsumer *Consumer) {
+      return Consumer->SemaConsumer;
     }
     static bool classof(const SemaConsumer *) { return true; }
   };

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

==============================================================================
--- cfe/trunk/include/clang/Sema/SemaDiagnostic.h (original)
+++ cfe/trunk/include/clang/Sema/SemaDiagnostic.h Wed Sep  9 10:08:12 2009
@@ -13,7 +13,7 @@
 #include "clang/Basic/Diagnostic.h"
 
 namespace clang {
-  namespace diag { 
+  namespace diag {
     enum {
 #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE) ENUM,
 #define SEMASTART

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

==============================================================================
--- cfe/trunk/lib/AST/APValue.cpp (original)
+++ cfe/trunk/lib/AST/APValue.cpp Wed Sep  9 10:08:12 2009
@@ -91,7 +91,7 @@
     return;
   case Vector:
     OS << "Vector: " << getVectorElt(0);
-    for (unsigned i = 1; i != getVectorLength(); ++i) 
+    for (unsigned i = 1; i != getVectorLength(); ++i)
       OS << ", " << getVectorElt(i);
     return;
   case ComplexInt:

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

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Sep  9 10:08:12 2009
@@ -37,16 +37,16 @@
                        TargetInfo &t,
                        IdentifierTable &idents, SelectorTable &sels,
                        Builtin::Context &builtins,
-                       bool FreeMem, unsigned size_reserve) : 
-  GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0), 
+                       bool FreeMem, unsigned size_reserve) :
+  GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0),
   ObjCFastEnumerationStateTypeDecl(0), FILEDecl(0), jmp_bufDecl(0),
-  sigjmp_bufDecl(0), SourceMgr(SM), LangOpts(LOpts), 
-  LoadedExternalComments(false), FreeMemory(FreeMem), Target(t), 
+  sigjmp_bufDecl(0), SourceMgr(SM), LangOpts(LOpts),
+  LoadedExternalComments(false), FreeMemory(FreeMem), Target(t),
   Idents(idents), Selectors(sels),
-  BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts) {  
+  BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts) {
   ObjCIdRedefinitionType = QualType();
   ObjCClassRedefinitionType = QualType();
-  if (size_reserve > 0) Types.reserve(size_reserve);    
+  if (size_reserve > 0) Types.reserve(size_reserve);
   TUDecl = TranslationUnitDecl::Create(*this);
   InitBuiltinTypes();
 }
@@ -79,8 +79,8 @@
   // Destroy nested-name-specifiers.
   for (llvm::FoldingSet<NestedNameSpecifier>::iterator
          NNS = NestedNameSpecifiers.begin(),
-         NNSEnd = NestedNameSpecifiers.end(); 
-       NNS != NNSEnd; 
+         NNSEnd = NestedNameSpecifiers.end();
+       NNS != NNSEnd;
        /* Increment in loop */)
     (*NNS++).Destroy(*this);
 
@@ -90,7 +90,7 @@
   TUDecl->Destroy(*this);
 }
 
-void 
+void
 ASTContext::setExternalSource(llvm::OwningPtr<ExternalASTSource> &Source) {
   ExternalSource.reset(Source.take());
 }
@@ -100,7 +100,7 @@
   fprintf(stderr, "  %d types total.\n", (int)Types.size());
 
   unsigned counts[] = {
-#define TYPE(Name, Parent) 0, 
+#define TYPE(Name, Parent) 0,
 #define ABSTRACT_TYPE(Name, Parent)
 #include "clang/AST/TypeNodes.def"
     0 // Extra
@@ -120,7 +120,7 @@
   ++Idx;
 #define ABSTRACT_TYPE(Name, Parent)
 #include "clang/AST/TypeNodes.def"
-  
+
   fprintf(stderr, "Total bytes = %d\n", int(TotalBytes));
 
   if (ExternalSource.get()) {
@@ -136,10 +136,10 @@
 
 void ASTContext::InitBuiltinTypes() {
   assert(VoidTy.isNull() && "Context reinitialized?");
-  
+
   // C99 6.2.5p19.
   InitBuiltinType(VoidTy,              BuiltinType::Void);
-  
+
   // C99 6.2.5p2.
   InitBuiltinType(BoolTy,              BuiltinType::Bool);
   // C99 6.2.5p3.
@@ -153,14 +153,14 @@
   InitBuiltinType(IntTy,               BuiltinType::Int);
   InitBuiltinType(LongTy,              BuiltinType::Long);
   InitBuiltinType(LongLongTy,          BuiltinType::LongLong);
-  
+
   // C99 6.2.5p6.
   InitBuiltinType(UnsignedCharTy,      BuiltinType::UChar);
   InitBuiltinType(UnsignedShortTy,     BuiltinType::UShort);
   InitBuiltinType(UnsignedIntTy,       BuiltinType::UInt);
   InitBuiltinType(UnsignedLongTy,      BuiltinType::ULong);
   InitBuiltinType(UnsignedLongLongTy,  BuiltinType::ULongLong);
-  
+
   // C99 6.2.5p10.
   InitBuiltinType(FloatTy,             BuiltinType::Float);
   InitBuiltinType(DoubleTy,            BuiltinType::Double);
@@ -195,27 +195,27 @@
   // expressions.
   InitBuiltinType(DependentTy,         BuiltinType::Dependent);
 
-  // Placeholder type for C++0x auto declarations whose real type has 
+  // Placeholder type for C++0x auto declarations whose real type has
   // not yet been deduced.
   InitBuiltinType(UndeducedAutoTy, BuiltinType::UndeducedAuto);
-  
+
   // C99 6.2.5p11.
   FloatComplexTy      = getComplexType(FloatTy);
   DoubleComplexTy     = getComplexType(DoubleTy);
   LongDoubleComplexTy = getComplexType(LongDoubleTy);
 
   BuiltinVaListType = QualType();
-  
+
   // "Builtin" typedefs set by Sema::ActOnTranslationUnitScope().
   ObjCIdTypedefType = QualType();
   ObjCClassTypedefType = QualType();
-  
+
   // Builtin types for 'id' and 'Class'.
   InitBuiltinType(ObjCBuiltinIdTy, BuiltinType::ObjCId);
   InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);
 
   ObjCConstantStringType = QualType();
-  
+
   // void * type
   VoidPtrTy = getPointerType(VoidTy);
 
@@ -229,11 +229,11 @@
     = InstantiatedFromStaticDataMember.find(Var);
   if (Pos == InstantiatedFromStaticDataMember.end())
     return 0;
-  
+
   return Pos->second;
 }
 
-void 
+void
 ASTContext::setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl) {
   assert(Inst->isStaticDataMember() && "Not a static data member");
   assert(Tmpl->isStaticDataMember() && "Not a static data member");
@@ -244,11 +244,11 @@
 
 UnresolvedUsingDecl *
 ASTContext::getInstantiatedFromUnresolvedUsingDecl(UsingDecl *UUD) {
-  llvm::DenseMap<UsingDecl *, UnresolvedUsingDecl *>::iterator Pos 
+  llvm::DenseMap<UsingDecl *, UnresolvedUsingDecl *>::iterator Pos
     = InstantiatedFromUnresolvedUsingDecl.find(UUD);
   if (Pos == InstantiatedFromUnresolvedUsingDecl.end())
     return 0;
-  
+
   return Pos->second;
 }
 
@@ -265,7 +265,7 @@
     = InstantiatedFromUnnamedFieldDecl.find(Field);
   if (Pos == InstantiatedFromUnnamedFieldDecl.end())
     return 0;
-  
+
   return Pos->second;
 }
 
@@ -275,18 +275,18 @@
   assert(!Tmpl->getDeclName() && "Template field decl is not unnamed");
   assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
          "Already noted what unnamed field was instantiated from");
-  
+
   InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
 }
 
 namespace {
-  class BeforeInTranslationUnit 
+  class BeforeInTranslationUnit
     : std::binary_function<SourceRange, SourceRange, bool> {
     SourceManager *SourceMgr;
-    
+
   public:
     explicit BeforeInTranslationUnit(SourceManager *SM) : SourceMgr(SM) { }
-      
+
     bool operator()(SourceRange X, SourceRange Y) {
       return SourceMgr->isBeforeInTranslationUnit(X.getBegin(), Y.getBegin());
     }
@@ -302,14 +302,14 @@
 /// \param Member whether we want to check whether this is a member comment
 /// (which requires a < after the Doxygen-comment delimiter). Otherwise,
 /// we only return true when we find a non-member comment.
-static bool 
-isDoxygenComment(SourceManager &SourceMgr, SourceRange Comment, 
+static bool
+isDoxygenComment(SourceManager &SourceMgr, SourceRange Comment,
                  bool Member = false) {
-  const char *BufferStart 
+  const char *BufferStart
     = SourceMgr.getBufferData(SourceMgr.getFileID(Comment.getBegin())).first;
   const char *Start = BufferStart + SourceMgr.getFileOffset(Comment.getBegin());
   const char* End = BufferStart + SourceMgr.getFileOffset(Comment.getEnd());
-  
+
   if (End - Start < 4)
     return false;
 
@@ -323,32 +323,32 @@
 }
 
 /// \brief Retrieve the comment associated with the given declaration, if
-/// it has one. 
+/// it has one.
 const char *ASTContext::getCommentForDecl(const Decl *D) {
   if (!D)
     return 0;
-  
+
   // Check whether we have cached a comment string for this declaration
   // already.
-  llvm::DenseMap<const Decl *, std::string>::iterator Pos 
+  llvm::DenseMap<const Decl *, std::string>::iterator Pos
     = DeclComments.find(D);
   if (Pos != DeclComments.end())
     return Pos->second.c_str();
 
-  // If we have an external AST source and have not yet loaded comments from 
+  // If we have an external AST source and have not yet loaded comments from
   // that source, do so now.
   if (ExternalSource && !LoadedExternalComments) {
     std::vector<SourceRange> LoadedComments;
     ExternalSource->ReadComments(LoadedComments);
-    
+
     if (!LoadedComments.empty())
       Comments.insert(Comments.begin(), LoadedComments.begin(),
                       LoadedComments.end());
-    
+
     LoadedExternalComments = true;
   }
-  
-  // If there are no comments anywhere, we won't find anything.  
+
+  // If there are no comments anywhere, we won't find anything.
   if (Comments.empty())
     return 0;
 
@@ -360,17 +360,17 @@
 
   // Find the comment that occurs just before this declaration.
   std::vector<SourceRange>::iterator LastComment
-    = std::lower_bound(Comments.begin(), Comments.end(), 
+    = std::lower_bound(Comments.begin(), Comments.end(),
                        SourceRange(DeclStartLoc),
                        BeforeInTranslationUnit(&SourceMgr));
-  
+
   // Decompose the location for the start of the declaration and find the
   // beginning of the file buffer.
-  std::pair<FileID, unsigned> DeclStartDecomp 
+  std::pair<FileID, unsigned> DeclStartDecomp
     = SourceMgr.getDecomposedLoc(DeclStartLoc);
-  const char *FileBufferStart 
+  const char *FileBufferStart
     = SourceMgr.getBufferData(DeclStartDecomp.first).first;
-  
+
   // First check whether we have a comment for a member.
   if (LastComment != Comments.end() &&
       !isa<TagDecl>(D) && !isa<NamespaceDecl>(D) &&
@@ -379,19 +379,19 @@
       = SourceMgr.getDecomposedLoc(LastComment->getEnd());
     if (DeclStartDecomp.first == LastCommentEndDecomp.first &&
         SourceMgr.getLineNumber(DeclStartDecomp.first, DeclStartDecomp.second)
-          == SourceMgr.getLineNumber(LastCommentEndDecomp.first, 
+          == SourceMgr.getLineNumber(LastCommentEndDecomp.first,
                                      LastCommentEndDecomp.second)) {
       // The Doxygen member comment comes after the declaration starts and
       // is on the same line and in the same file as the declaration. This
       // is the comment we want.
       std::string &Result = DeclComments[D];
-      Result.append(FileBufferStart + 
-                      SourceMgr.getFileOffset(LastComment->getBegin()), 
+      Result.append(FileBufferStart +
+                      SourceMgr.getFileOffset(LastComment->getBegin()),
                     FileBufferStart + LastCommentEndDecomp.second + 1);
       return Result.c_str();
     }
   }
-  
+
   if (LastComment == Comments.begin())
     return 0;
   --LastComment;
@@ -399,33 +399,33 @@
   // Decompose the end of the comment.
   std::pair<FileID, unsigned> LastCommentEndDecomp
     = SourceMgr.getDecomposedLoc(LastComment->getEnd());
-  
+
   // If the comment and the declaration aren't in the same file, then they
   // aren't related.
   if (DeclStartDecomp.first != LastCommentEndDecomp.first)
     return 0;
-  
+
   // Check that we actually have a Doxygen comment.
   if (!isDoxygenComment(SourceMgr, *LastComment))
     return 0;
-      
+
   // Compute the starting line for the declaration and for the end of the
   // comment (this is expensive).
-  unsigned DeclStartLine 
+  unsigned DeclStartLine
     = SourceMgr.getLineNumber(DeclStartDecomp.first, DeclStartDecomp.second);
   unsigned CommentEndLine
-    = SourceMgr.getLineNumber(LastCommentEndDecomp.first, 
+    = SourceMgr.getLineNumber(LastCommentEndDecomp.first,
                               LastCommentEndDecomp.second);
-  
+
   // If the comment does not end on the line prior to the declaration, then
   // the comment is not associated with the declaration at all.
   if (CommentEndLine + 1 != DeclStartLine)
     return 0;
-  
+
   // We have a comment, but there may be more comments on the previous lines.
   // Keep looking so long as the comments are still Doxygen comments and are
   // still adjacent.
-  unsigned ExpectedLine 
+  unsigned ExpectedLine
     = SourceMgr.getSpellingLineNumber(LastComment->getBegin()) - 1;
   std::vector<SourceRange>::iterator FirstComment = LastComment;
   while (FirstComment != Comments.begin()) {
@@ -433,31 +433,31 @@
     --FirstComment;
     std::pair<FileID, unsigned> Decomp
       = SourceMgr.getDecomposedLoc(FirstComment->getEnd());
-    
+
     // If this previous comment is in a different file, we're done.
     if (Decomp.first != DeclStartDecomp.first) {
       ++FirstComment;
       break;
     }
-    
+
     // If this comment is not a Doxygen comment, we're done.
     if (!isDoxygenComment(SourceMgr, *FirstComment)) {
       ++FirstComment;
       break;
     }
-    
+
     // If the line number is not what we expected, we're done.
     unsigned Line = SourceMgr.getLineNumber(Decomp.first, Decomp.second);
     if (Line != ExpectedLine) {
       ++FirstComment;
       break;
     }
-    
+
     // Set the next expected line number.
-    ExpectedLine 
+    ExpectedLine
       = SourceMgr.getSpellingLineNumber(FirstComment->getBegin()) - 1;
   }
-  
+
   // The iterator range [FirstComment, LastComment] contains all of the
   // BCPL comments that, together, are associated with this declaration.
   // Form a single comment block string for this declaration that concatenates
@@ -472,10 +472,10 @@
                   FileBufferStart + DecompEnd.second + 1);
     ++FirstComment;
   }
-  
+
   // Append the last comment line.
-  Result.append(FileBufferStart + 
-                  SourceMgr.getFileOffset(LastComment->getBegin()), 
+  Result.append(FileBufferStart +
+                  SourceMgr.getFileOffset(LastComment->getBegin()),
                 FileBufferStart + LastCommentEndDecomp.second + 1);
   return Result.c_str();
 }
@@ -555,7 +555,7 @@
   case Type::ConstantArrayWithoutExpr:
   case Type::ConstantArray: {
     const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
-    
+
     std::pair<uint64_t, unsigned> EltInfo = getTypeInfo(CAT->getElementType());
     Width = EltInfo.first*CAT->getSize().getZExtValue();
     Align = EltInfo.second;
@@ -563,7 +563,7 @@
   }
   case Type::ExtVector:
   case Type::Vector: {
-    std::pair<uint64_t, unsigned> EltInfo = 
+    std::pair<uint64_t, unsigned> EltInfo =
       getTypeInfo(cast<VectorType>(T)->getElementType());
     Width = EltInfo.first*cast<VectorType>(T)->getNumElements();
     Align = Width;
@@ -689,7 +689,7 @@
     // If we ever want to support other ABIs this needs to be abstracted.
 
     QualType Pointee = cast<MemberPointerType>(T)->getPointeeType();
-    std::pair<uint64_t, unsigned> PtrDiffInfo = 
+    std::pair<uint64_t, unsigned> PtrDiffInfo =
       getTypeInfo(getPointerDiffType());
     Width = PtrDiffInfo.first;
     if (Pointee->isFunctionType())
@@ -700,7 +700,7 @@
   case Type::Complex: {
     // Complex types have the same alignment as their elements, but twice the
     // size.
-    std::pair<uint64_t, unsigned> EltInfo = 
+    std::pair<uint64_t, unsigned> EltInfo =
       getTypeInfo(cast<ComplexType>(T)->getElementType());
     Width = EltInfo.first*2;
     Align = EltInfo.second;
@@ -722,7 +722,7 @@
       Align = 1;
       break;
     }
-    
+
     if (const EnumType *ET = dyn_cast<EnumType>(TT))
       return getTypeInfo(ET->getDecl()->getIntegerType());
 
@@ -760,16 +760,16 @@
 
   case Type::QualifiedName:
     return getTypeInfo(cast<QualifiedNameType>(T)->getNamedType().getTypePtr());
-    
+
   case Type::TemplateSpecialization:
-    assert(getCanonicalType(T) != T && 
+    assert(getCanonicalType(T) != T &&
            "Cannot request the size of a dependent type");
     // FIXME: this is likely to be wrong once we support template
     // aliases, since a template alias could refer to a typedef that
     // has an __aligned__ attribute on it.
     return getTypeInfo(getCanonicalType(T));
   }
-  
+
   assert(Align && (Align & (Align-1)) == 0 && "Alignment must be power of 2");
   return std::make_pair(Width, Align);
 }
@@ -829,7 +829,7 @@
        E = PD->prop_end(); I != E; ++I)
     if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
       Ivars.push_back(Ivar);
-  
+
   // Also look into nested protocols.
   for (ObjCProtocolDecl::protocol_iterator P = PD->protocol_begin(),
        E = PD->protocol_end(); P != E; ++P)
@@ -869,8 +869,7 @@
   return count;
 }
 
-unsigned ASTContext::CountSynthesizedIvars(const ObjCInterfaceDecl *OI)
-{
+unsigned ASTContext::CountSynthesizedIvars(const ObjCInterfaceDecl *OI) {
   unsigned count = 0;
   for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
        E = OI->prop_end(); I != E; ++I) {
@@ -944,7 +943,7 @@
   assert(!D->isForwardDecl() && "Invalid interface decl!");
 
   // Look up this layout, if already laid out, return what we have.
-  ObjCContainerDecl *Key = 
+  ObjCContainerDecl *Key =
     Impl ? (ObjCContainerDecl*) Impl : (ObjCContainerDecl*) D;
   if (const ASTRecordLayout *Entry = ObjCLayouts[Key])
     return *Entry;
@@ -962,10 +961,10 @@
       return getObjCLayout(D, 0);
   }
 
-  const ASTRecordLayout *NewEntry = 
+  const ASTRecordLayout *NewEntry =
     ASTRecordLayoutBuilder::ComputeLayout(*this, D, Impl);
   ObjCLayouts[Key] = NewEntry;
-  
+
   return *NewEntry;
 }
 
@@ -992,10 +991,10 @@
   const ASTRecordLayout *Entry = ASTRecordLayouts[D];
   if (Entry) return *Entry;
 
-  const ASTRecordLayout *NewEntry = 
+  const ASTRecordLayout *NewEntry =
     ASTRecordLayoutBuilder::ComputeLayout(*this, D);
   ASTRecordLayouts[D] = NewEntry;
-  
+
   return *NewEntry;
 }
 
@@ -1013,7 +1012,7 @@
   unsigned CVRQuals = T.getCVRQualifiers();
   QualType::GCAttrTypes GCAttr = QualType::GCNone;
   Type *TypeNode = T.getTypePtr();
-  
+
   if (ExtQualType *EQT = dyn_cast<ExtQualType>(TypeNode)) {
     // If this type already has an address space specified, it cannot get
     // another one.
@@ -1022,7 +1021,7 @@
     GCAttr = EQT->getObjCGCAttr();
     TypeNode = EQT->getBaseType();
   }
-  
+
   // Check if we've already instantiated this type.
   llvm::FoldingSetNodeID ID;
   ExtQualType::Profile(ID, TypeNode, AddressSpace, GCAttr);
@@ -1035,7 +1034,7 @@
   QualType Canonical;
   if (!TypeNode->isCanonical()) {
     Canonical = getAddrSpaceQualType(CanT, AddressSpace);
-    
+
     // Update InsertPos, the previous call could have invalidated it.
     ExtQualType *NewIP = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1052,7 +1051,7 @@
   QualType CanT = getCanonicalType(T);
   if (CanT.getObjCGCAttr() == GCAttr)
     return T;
-  
+
   if (T->isPointerType()) {
     QualType Pointee = T->getAs<PointerType>()->getPointeeType();
     if (Pointee->isAnyPointerType()) {
@@ -1065,7 +1064,7 @@
   unsigned CVRQuals = T.getCVRQualifiers();
   Type *TypeNode = T.getTypePtr();
   unsigned AddressSpace = 0;
-  
+
   if (ExtQualType *EQT = dyn_cast<ExtQualType>(TypeNode)) {
     // If this type already has an ObjCGC specified, it cannot get
     // another one.
@@ -1074,14 +1073,14 @@
     AddressSpace = EQT->getAddressSpace();
     TypeNode = EQT->getBaseType();
   }
-  
+
   // Check if we've already instantiated an gc qual'd type of this type.
   llvm::FoldingSetNodeID ID;
   ExtQualType::Profile(ID, TypeNode, AddressSpace, GCAttr);
   void *InsertPos = 0;
   if (ExtQualType *EXTQy = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(EXTQy, CVRQuals);
-  
+
   // If the base type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
   // FIXME: Isn't this also not canonical if the base type is a array
@@ -1089,7 +1088,7 @@
   QualType Canonical;
   if (!T->isCanonical()) {
     Canonical = getObjCGCQualType(CanT, GCAttr);
-    
+
     // Update InsertPos, the previous call could have invalidated it.
     ExtQualType *NewIP = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1117,10 +1116,10 @@
     ResultType = getBlockPointerType(ResultType);
     ResultType.setCVRQualifiers(T.getCVRQualifiers());
     return qs.apply(ResultType, *this);
-  }    
+  }
   if (!T->isFunctionType())
     assert(0 && "can't noreturn qualify non-pointer to function or block type");
-  
+
   if (const FunctionNoProtoType *F = T->getAsFunctionNoProtoType()) {
     return getFunctionNoProtoType(F->getResultType(), true);
   }
@@ -1138,17 +1137,17 @@
   // structure.
   llvm::FoldingSetNodeID ID;
   ComplexType::Profile(ID, T);
-  
+
   void *InsertPos = 0;
   if (ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(CT, 0);
-  
+
   // If the pointee type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
   QualType Canonical;
   if (!T->isCanonical()) {
     Canonical = getComplexType(getCanonicalType(T));
-    
+
     // Get the new insert position for the node we care about.
     ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1175,17 +1174,17 @@
   // structure.
   llvm::FoldingSetNodeID ID;
   PointerType::Profile(ID, T);
-  
+
   void *InsertPos = 0;
   if (PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(PT, 0);
-  
+
   // If the pointee type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
   QualType Canonical;
   if (!T->isCanonical()) {
     Canonical = getPointerType(getCanonicalType(T));
-   
+
     // Get the new insert position for the node we care about.
     PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1196,7 +1195,7 @@
   return QualType(New, 0);
 }
 
-/// getBlockPointerType - Return the uniqued reference to the type for 
+/// getBlockPointerType - Return the uniqued reference to the type for
 /// a pointer to the specified block.
 QualType ASTContext::getBlockPointerType(QualType T) {
   assert(T->isFunctionType() && "block of function types only");
@@ -1204,18 +1203,18 @@
   // structure.
   llvm::FoldingSetNodeID ID;
   BlockPointerType::Profile(ID, T);
-  
+
   void *InsertPos = 0;
   if (BlockPointerType *PT =
         BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(PT, 0);
-  
-  // If the block pointee type isn't canonical, this won't be a canonical 
+
+  // If the block pointee type isn't canonical, this won't be a canonical
   // type either so fill in the canonical type field.
   QualType Canonical;
   if (!T->isCanonical()) {
     Canonical = getBlockPointerType(getCanonicalType(T));
-    
+
     // Get the new insert position for the node we care about.
     BlockPointerType *NewIP =
       BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -1291,8 +1290,7 @@
 
 /// getMemberPointerType - Return the uniqued reference to the type for a
 /// member pointer to the specified type, in the specified class.
-QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls)
-{
+QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls) {
   // Unique pointers, to guarantee there is only one pointer of a particular
   // structure.
   llvm::FoldingSetNodeID ID;
@@ -1320,9 +1318,9 @@
   return QualType(New, 0);
 }
 
-/// getConstantArrayType - Return the unique reference to the type for an 
+/// getConstantArrayType - Return the unique reference to the type for an
 /// array of the specified element type.
-QualType ASTContext::getConstantArrayType(QualType EltTy, 
+QualType ASTContext::getConstantArrayType(QualType EltTy,
                                           const llvm::APInt &ArySizeIn,
                                           ArrayType::ArraySizeModifier ASM,
                                           unsigned EltTypeQuals) {
@@ -1333,27 +1331,27 @@
   // the target.
   llvm::APInt ArySize(ArySizeIn);
   ArySize.zextOrTrunc(Target.getPointerWidth(EltTy.getAddressSpace()));
-  
+
   llvm::FoldingSetNodeID ID;
   ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, EltTypeQuals);
-      
+
   void *InsertPos = 0;
-  if (ConstantArrayType *ATP = 
+  if (ConstantArrayType *ATP =
       ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(ATP, 0);
-  
+
   // If the element type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
   QualType Canonical;
   if (!EltTy->isCanonical()) {
-    Canonical = getConstantArrayType(getCanonicalType(EltTy), ArySize, 
+    Canonical = getConstantArrayType(getCanonicalType(EltTy), ArySize,
                                      ASM, EltTypeQuals);
     // Get the new insert position for the node we care about.
-    ConstantArrayType *NewIP = 
+    ConstantArrayType *NewIP =
       ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
   }
-  
+
   ConstantArrayType *New =
     new(*this,8)ConstantArrayType(EltTy, Canonical, ArySize, ASM, EltTypeQuals);
   ConstantArrayTypes.InsertNode(New, InsertPos);
@@ -1437,11 +1435,11 @@
                                                 ArrayType::ArraySizeModifier ASM,
                                                 unsigned EltTypeQuals,
                                                 SourceRange Brackets) {
-  assert((NumElts->isTypeDependent() || NumElts->isValueDependent()) && 
+  assert((NumElts->isTypeDependent() || NumElts->isValueDependent()) &&
          "Size must be type- or value-dependent!");
 
   llvm::FoldingSetNodeID ID;
-  DependentSizedArrayType::Profile(ID, *this, getCanonicalType(EltTy), ASM, 
+  DependentSizedArrayType::Profile(ID, *this, getCanonicalType(EltTy), ASM,
                                    EltTypeQuals, NumElts);
 
   void *InsertPos = 0;
@@ -1451,7 +1449,7 @@
   if (Canon) {
     // We already have a canonical version of this array type; use it as
     // the canonical type for a newly-built type.
-    New = new (*this,8) DependentSizedArrayType(*this, EltTy, 
+    New = new (*this,8) DependentSizedArrayType(*this, EltTy,
                                                 QualType(Canon, 0),
                                                 NumElts, ASM, EltTypeQuals,
                                                 Brackets);
@@ -1468,10 +1466,10 @@
                                                   SourceRange());
       New = new (*this,8) DependentSizedArrayType(*this, EltTy, Canon,
                                                   NumElts, ASM, EltTypeQuals,
-                                                  Brackets);      
+                                                  Brackets);
     }
   }
-  
+
   Types.push_back(New);
   return QualType(New, 0);
 }
@@ -1483,7 +1481,7 @@
   IncompleteArrayType::Profile(ID, EltTy, ASM, EltTypeQuals);
 
   void *InsertPos = 0;
-  if (IncompleteArrayType *ATP = 
+  if (IncompleteArrayType *ATP =
        IncompleteArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(ATP, 0);
 
@@ -1514,13 +1512,13 @@
 /// the specified element type and size. VectorType must be a built-in type.
 QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts) {
   BuiltinType *baseType;
-  
+
   baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
   assert(baseType != 0 && "getVectorType(): Expecting a built-in type");
-         
+
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
-  VectorType::Profile(ID, vecType, NumElts, Type::Vector);      
+  VectorType::Profile(ID, vecType, NumElts, Type::Vector);
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(VTP, 0);
@@ -1530,7 +1528,7 @@
   QualType Canonical;
   if (!vecType->isCanonical()) {
     Canonical = getVectorType(getCanonicalType(vecType), NumElts);
-    
+
     // Get the new insert position for the node we care about.
     VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1545,13 +1543,13 @@
 /// the specified element type and size. VectorType must be a built-in type.
 QualType ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) {
   BuiltinType *baseType;
-  
+
   baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
   assert(baseType != 0 && "getExtVectorType(): Expecting a built-in type");
-         
+
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
-  VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);      
+  VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(VTP, 0);
@@ -1561,7 +1559,7 @@
   QualType Canonical;
   if (!vecType->isCanonical()) {
     Canonical = getExtVectorType(getCanonicalType(vecType), NumElts);
-    
+
     // Get the new insert position for the node we care about.
     VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1572,13 +1570,13 @@
   return QualType(New, 0);
 }
 
-QualType ASTContext::getDependentSizedExtVectorType(QualType vecType, 
+QualType ASTContext::getDependentSizedExtVectorType(QualType vecType,
                                                     Expr *SizeExpr,
                                                     SourceLocation AttrLoc) {
   llvm::FoldingSetNodeID ID;
-  DependentSizedExtVectorType::Profile(ID, *this, getCanonicalType(vecType), 
+  DependentSizedExtVectorType::Profile(ID, *this, getCanonicalType(vecType),
                                        SizeExpr);
-  
+
   void *InsertPos = 0;
   DependentSizedExtVectorType *Canon
     = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -1592,8 +1590,8 @@
   } else {
     QualType CanonVecTy = getCanonicalType(vecType);
     if (CanonVecTy == vecType) {
-      New = new (*this,8) DependentSizedExtVectorType(*this, vecType, 
-                                                      QualType(), SizeExpr, 
+      New = new (*this,8) DependentSizedExtVectorType(*this, vecType,
+                                                      QualType(), SizeExpr,
                                                       AttrLoc);
       DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
     } else {
@@ -1603,7 +1601,7 @@
                                                       SizeExpr, AttrLoc);
     }
   }
-  
+
   Types.push_back(New);
   return QualType(New, 0);
 }
@@ -1615,22 +1613,22 @@
   // structure.
   llvm::FoldingSetNodeID ID;
   FunctionNoProtoType::Profile(ID, ResultTy, NoReturn);
-  
+
   void *InsertPos = 0;
-  if (FunctionNoProtoType *FT = 
+  if (FunctionNoProtoType *FT =
         FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(FT, 0);
-  
+
   QualType Canonical;
   if (!ResultTy->isCanonical()) {
     Canonical = getFunctionNoProtoType(getCanonicalType(ResultTy), NoReturn);
-    
+
     // Get the new insert position for the node we care about.
     FunctionNoProtoType *NewIP =
       FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
   }
-  
+
   FunctionNoProtoType *New
     = new (*this,8) FunctionNoProtoType(ResultTy, Canonical, NoReturn);
   Types.push_back(New);
@@ -1653,7 +1651,7 @@
                              NumExs, ExArray, NoReturn);
 
   void *InsertPos = 0;
-  if (FunctionProtoType *FTP = 
+  if (FunctionProtoType *FTP =
         FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(FTP, 0);
 
@@ -1688,7 +1686,7 @@
   // FunctionProtoType objects are allocated with extra bytes after them
   // for two variable size arrays (for parameter and exception types) at the
   // end of them.
-  FunctionProtoType *FTP = 
+  FunctionProtoType *FTP =
     (FunctionProtoType*)Allocate(sizeof(FunctionProtoType) +
                                  NumArgs*sizeof(QualType) +
                                  NumExs*sizeof(QualType), 8);
@@ -1705,7 +1703,7 @@
 QualType ASTContext::getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl) {
   assert(Decl && "Passed null for Decl param");
   if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
-  
+
   if (TypedefDecl *Typedef = dyn_cast<TypedefDecl>(Decl))
     return getTypedefType(Typedef);
   else if (isa<TemplateTypeParmDecl>(Decl)) {
@@ -1735,7 +1733,7 @@
 /// specified typename decl.
 QualType ASTContext::getTypedefType(TypedefDecl *Decl) {
   if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
-  
+
   QualType Canonical = getCanonicalType(Decl->getUnderlyingType());
   Decl->TypeForDecl = new(*this,8) TypedefType(Type::Typedef, Decl, Canonical);
   Types.push_back(Decl->TypeForDecl);
@@ -1743,20 +1741,20 @@
 }
 
 /// \brief Retrieve the template type parameter type for a template
-/// parameter or parameter pack with the given depth, index, and (optionally) 
+/// parameter or parameter pack with the given depth, index, and (optionally)
 /// name.
-QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index, 
+QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index,
                                              bool ParameterPack,
                                              IdentifierInfo *Name) {
   llvm::FoldingSetNodeID ID;
   TemplateTypeParmType::Profile(ID, Depth, Index, ParameterPack, Name);
   void *InsertPos = 0;
-  TemplateTypeParmType *TypeParm 
+  TemplateTypeParmType *TypeParm
     = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
 
   if (TypeParm)
     return QualType(TypeParm, 0);
-  
+
   if (Name) {
     QualType Canon = getTemplateTypeParmType(Depth, Index, ParameterPack);
     TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index, ParameterPack,
@@ -1770,7 +1768,7 @@
   return QualType(TypeParm, 0);
 }
 
-QualType 
+QualType
 ASTContext::getTemplateSpecializationType(TemplateName Template,
                                           const TemplateArgument *Args,
                                           unsigned NumArgs,
@@ -1788,65 +1786,65 @@
     // Determine whether this canonical template specialization type already
     // exists.
     llvm::FoldingSetNodeID ID;
-    TemplateSpecializationType::Profile(ID, CanonTemplate, 
+    TemplateSpecializationType::Profile(ID, CanonTemplate,
                                         CanonArgs.data(), NumArgs, *this);
 
     void *InsertPos = 0;
     TemplateSpecializationType *Spec
       = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
-    
+
     if (!Spec) {
       // Allocate a new canonical template specialization type.
-      void *Mem = Allocate((sizeof(TemplateSpecializationType) + 
+      void *Mem = Allocate((sizeof(TemplateSpecializationType) +
                             sizeof(TemplateArgument) * NumArgs),
                            8);
-      Spec = new (Mem) TemplateSpecializationType(*this, CanonTemplate, 
+      Spec = new (Mem) TemplateSpecializationType(*this, CanonTemplate,
                                                   CanonArgs.data(), NumArgs,
                                                   Canon);
       Types.push_back(Spec);
-      TemplateSpecializationTypes.InsertNode(Spec, InsertPos);      
+      TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
     }
-    
+
     if (Canon.isNull())
       Canon = QualType(Spec, 0);
-    assert(Canon->isDependentType() && 
+    assert(Canon->isDependentType() &&
            "Non-dependent template-id type must have a canonical type");
   }
 
   // Allocate the (non-canonical) template specialization type, but don't
   // try to unique it: these types typically have location information that
   // we don't unique and don't want to lose.
-  void *Mem = Allocate((sizeof(TemplateSpecializationType) + 
+  void *Mem = Allocate((sizeof(TemplateSpecializationType) +
                         sizeof(TemplateArgument) * NumArgs),
                        8);
-  TemplateSpecializationType *Spec 
-    = new (Mem) TemplateSpecializationType(*this, Template, Args, NumArgs, 
+  TemplateSpecializationType *Spec
+    = new (Mem) TemplateSpecializationType(*this, Template, Args, NumArgs,
                                            Canon);
-  
+
   Types.push_back(Spec);
-  return QualType(Spec, 0);  
+  return QualType(Spec, 0);
 }
 
-QualType 
+QualType
 ASTContext::getQualifiedNameType(NestedNameSpecifier *NNS,
                                  QualType NamedType) {
   llvm::FoldingSetNodeID ID;
   QualifiedNameType::Profile(ID, NNS, NamedType);
 
   void *InsertPos = 0;
-  QualifiedNameType *T 
+  QualifiedNameType *T
     = QualifiedNameTypes.FindNodeOrInsertPos(ID, InsertPos);
   if (T)
     return QualType(T, 0);
 
-  T = new (*this) QualifiedNameType(NNS, NamedType, 
+  T = new (*this) QualifiedNameType(NNS, NamedType,
                                     getCanonicalType(NamedType));
   Types.push_back(T);
   QualifiedNameTypes.InsertNode(T, InsertPos);
   return QualType(T, 0);
 }
 
-QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS, 
+QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
                                      const IdentifierInfo *Name,
                                      QualType Canon) {
   assert(NNS->isDependent() && "nested-name-specifier must be dependent");
@@ -1861,7 +1859,7 @@
   TypenameType::Profile(ID, NNS, Name);
 
   void *InsertPos = 0;
-  TypenameType *T 
+  TypenameType *T
     = TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
   if (T)
     return QualType(T, 0);
@@ -1869,11 +1867,11 @@
   T = new (*this) TypenameType(NNS, Name, Canon);
   Types.push_back(T);
   TypenameTypes.InsertNode(T, InsertPos);
-  return QualType(T, 0);  
+  return QualType(T, 0);
 }
 
-QualType 
-ASTContext::getTypenameType(NestedNameSpecifier *NNS, 
+QualType
+ASTContext::getTypenameType(NestedNameSpecifier *NNS,
                             const TemplateSpecializationType *TemplateId,
                             QualType Canon) {
   assert(NNS->isDependent() && "nested-name-specifier must be dependent");
@@ -1894,7 +1892,7 @@
   TypenameType::Profile(ID, NNS, TemplateId);
 
   void *InsertPos = 0;
-  TypenameType *T 
+  TypenameType *T
     = TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
   if (T)
     return QualType(T, 0);
@@ -1902,7 +1900,7 @@
   T = new (*this) TypenameType(NNS, TemplateId, Canon);
   Types.push_back(T);
   TypenameTypes.InsertNode(T, InsertPos);
-  return QualType(T, 0);    
+  return QualType(T, 0);
 }
 
 QualType
@@ -1910,7 +1908,7 @@
                               ElaboratedType::TagKind Tag) {
   llvm::FoldingSetNodeID ID;
   ElaboratedType::Profile(ID, UnderlyingType, Tag);
-  
+
   void *InsertPos = 0;
   ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
   if (T)
@@ -1934,7 +1932,7 @@
 static void SortAndUniqueProtocols(ObjCProtocolDecl **&Protocols,
                                    unsigned &NumProtocols) {
   ObjCProtocolDecl **ProtocolsEnd = Protocols+NumProtocols;
-  
+
   // Sort protocols, keyed by name.
   std::sort(Protocols, Protocols+NumProtocols, CmpProtocolNames);
 
@@ -1946,7 +1944,7 @@
 /// getObjCObjectPointerType - Return a ObjCObjectPointerType type for
 /// the given interface decl and the conforming protocol list.
 QualType ASTContext::getObjCObjectPointerType(QualType InterfaceT,
-                                              ObjCProtocolDecl **Protocols, 
+                                              ObjCProtocolDecl **Protocols,
                                               unsigned NumProtocols) {
   // Sort the protocol list alphabetically to canonicalize it.
   if (NumProtocols)
@@ -1963,7 +1961,7 @@
   // No Match;
   ObjCObjectPointerType *QType =
     new (*this,8) ObjCObjectPointerType(InterfaceT, Protocols, NumProtocols);
-  
+
   Types.push_back(QType);
   ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
   return QualType(QType, 0);
@@ -1973,21 +1971,21 @@
 /// specified ObjC interface decl. The list of protocols is optional.
 QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
                        ObjCProtocolDecl **Protocols, unsigned NumProtocols) {
-  if (NumProtocols) 
+  if (NumProtocols)
     // Sort the protocol list alphabetically to canonicalize it.
     SortAndUniqueProtocols(Protocols, NumProtocols);
-  
+
   llvm::FoldingSetNodeID ID;
   ObjCInterfaceType::Profile(ID, Decl, Protocols, NumProtocols);
-  
+
   void *InsertPos = 0;
   if (ObjCInterfaceType *QT =
       ObjCInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(QT, 0);
-  
+
   // No Match;
   ObjCInterfaceType *QType =
-    new (*this,8) ObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(Decl), 
+    new (*this,8) ObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(Decl),
                                     Protocols, NumProtocols);
   Types.push_back(QType);
   ObjCInterfaceTypes.InsertNode(QType, InsertPos);
@@ -1997,21 +1995,21 @@
 /// getTypeOfExprType - Unlike many "get<Type>" functions, we can't unique
 /// TypeOfExprType AST's (since expression's are never shared). For example,
 /// multiple declarations that refer to "typeof(x)" all contain different
-/// DeclRefExpr's. This doesn't effect the type checker, since it operates 
+/// DeclRefExpr's. This doesn't effect the type checker, since it operates
 /// on canonical type's (which are always unique).
 QualType ASTContext::getTypeOfExprType(Expr *tofExpr) {
   TypeOfExprType *toe;
   if (tofExpr->isTypeDependent()) {
     llvm::FoldingSetNodeID ID;
     DependentTypeOfExprType::Profile(ID, *this, tofExpr);
-    
+
     void *InsertPos = 0;
     DependentTypeOfExprType *Canon
       = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
     if (Canon) {
       // We already have a "canonical" version of an identical, dependent
       // typeof(expr) type. Use that as our canonical type.
-      toe = new (*this, 8) TypeOfExprType(tofExpr, 
+      toe = new (*this, 8) TypeOfExprType(tofExpr,
                                           QualType((TypeOfExprType*)Canon, 0));
     }
     else {
@@ -2031,7 +2029,7 @@
 /// getTypeOfType -  Unlike many "get<Type>" functions, we don't unique
 /// TypeOfType AST's. The only motivation to unique these nodes would be
 /// memory savings. Since typeof(t) is fairly uncommon, space shouldn't be
-/// an issue. This doesn't effect the type checker, since it operates 
+/// an issue. This doesn't effect the type checker, since it operates
 /// on canonical type's (which are always unique).
 QualType ASTContext::getTypeOfType(QualType tofType) {
   QualType Canonical = getCanonicalType(tofType);
@@ -2045,7 +2043,7 @@
 static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) {
   if (e->isTypeDependent())
     return Context.DependentTy;
-  
+
   // If e is an id expression or a class member access, decltype(e) is defined
   // as the type of the entity named by e.
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(e)) {
@@ -2061,28 +2059,28 @@
   // return type of that function.
   if (const CallExpr *CE = dyn_cast<CallExpr>(e->IgnoreParens()))
     return CE->getCallReturnType();
-  
+
   QualType T = e->getType();
-  
-  // Otherwise, where T is the type of e, if e is an lvalue, decltype(e) is 
+
+  // Otherwise, where T is the type of e, if e is an lvalue, decltype(e) is
   // defined as T&, otherwise decltype(e) is defined as T.
   if (e->isLvalue(Context) == Expr::LV_Valid)
     T = Context.getLValueReferenceType(T);
-  
+
   return T;
 }
 
 /// getDecltypeType -  Unlike many "get<Type>" functions, we don't unique
 /// DecltypeType AST's. The only motivation to unique these nodes would be
 /// memory savings. Since decltype(t) is fairly uncommon, space shouldn't be
-/// an issue. This doesn't effect the type checker, since it operates 
+/// an issue. This doesn't effect the type checker, since it operates
 /// on canonical type's (which are always unique).
 QualType ASTContext::getDecltypeType(Expr *e) {
   DecltypeType *dt;
   if (e->isTypeDependent()) {
     llvm::FoldingSetNodeID ID;
     DependentDecltypeType::Profile(ID, *this, e);
-    
+
     void *InsertPos = 0;
     DependentDecltypeType *Canon
       = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -2100,7 +2098,7 @@
     }
   } else {
     QualType T = getDecltypeForExpr(e, *this);
-    dt = new (*this, 8) DecltypeType(e, T, getCanonicalType(T));    
+    dt = new (*this, 8) DecltypeType(e, T, getCanonicalType(T));
   }
   Types.push_back(dt);
   return QualType(dt, 0);
@@ -2115,9 +2113,9 @@
   return getTypeDeclType(const_cast<TagDecl*>(Decl));
 }
 
-/// getSizeType - Return the unique type for "size_t" (C99 7.17), the result 
-/// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and 
-/// needs to agree with the definition in <stddef.h>. 
+/// getSizeType - Return the unique type for "size_t" (C99 7.17), the result
+/// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and
+/// needs to agree with the definition in <stddef.h>.
 QualType ASTContext::getSizeType() const {
   return getFromTargetType(Target.getSizeType());
 }
@@ -2154,10 +2152,10 @@
 /// for exact equality with a simple pointer comparison.
 CanQualType ASTContext::getCanonicalType(QualType T) {
   QualType CanType = T.getTypePtr()->getCanonicalTypeInternal();
-  
+
   // If the result has type qualifiers, make sure to canonicalize them as well.
   unsigned TypeQuals = T.getCVRQualifiers() | CanType.getCVRQualifiers();
-  if (TypeQuals == 0) 
+  if (TypeQuals == 0)
     return CanQualType::CreateUnsafe(CanType);
 
   // If the type qualifiers are on an array type, get the canonical type of the
@@ -2165,12 +2163,12 @@
   ArrayType *AT = dyn_cast<ArrayType>(CanType);
   if (!AT)
     return CanQualType::CreateUnsafe(CanType.getQualifiedType(TypeQuals));
-  
+
   // Get the canonical version of the element with the extra qualifiers on it.
   // This can recursively sink qualifiers through multiple levels of arrays.
   QualType NewEltTy=AT->getElementType().getWithAdditionalQualifiers(TypeQuals);
   NewEltTy = getCanonicalType(NewEltTy);
-  
+
   if (ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
     return CanQualType::CreateUnsafe(
              getConstantArrayType(NewEltTy, CAT->getSize(),
@@ -2180,7 +2178,7 @@
     return CanQualType::CreateUnsafe(
              getIncompleteArrayType(NewEltTy, IAT->getSizeModifier(),
                                     IAT->getIndexTypeQualifier()));
-  
+
   if (DependentSizedArrayType *DSAT = dyn_cast<DependentSizedArrayType>(AT))
     return CanQualType::CreateUnsafe(
              getDependentSizedArrayType(NewEltTy,
@@ -2205,7 +2203,7 @@
   if (TemplateDecl *Template = Name.getAsTemplateDecl())
     return TemplateName(cast<TemplateDecl>(Template->getCanonicalDecl()));
 
-  // If this template name refers to a set of overloaded function templates, 
+  // If this template name refers to a set of overloaded function templates,
   /// the canonical template name merely stores the set of function templates.
   if (OverloadedFunctionDecl *Ovl = Name.getAsOverloadedFunctionDecl()) {
     OverloadedFunctionDecl *CanonOvl = 0;
@@ -2215,55 +2213,55 @@
       Decl *Canon = F->get()->getCanonicalDecl();
       if (CanonOvl || Canon != F->get()) {
         if (!CanonOvl)
-          CanonOvl = OverloadedFunctionDecl::Create(*this, 
-                                                    Ovl->getDeclContext(), 
+          CanonOvl = OverloadedFunctionDecl::Create(*this,
+                                                    Ovl->getDeclContext(),
                                                     Ovl->getDeclName());
-        
+
         CanonOvl->addOverload(
                     AnyFunctionDecl::getFromNamedDecl(cast<NamedDecl>(Canon)));
       }
     }
-    
+
     return TemplateName(CanonOvl? CanonOvl : Ovl);
   }
-  
+
   DependentTemplateName *DTN = Name.getAsDependentTemplateName();
   assert(DTN && "Non-dependent template names must refer to template decls.");
   return DTN->CanonicalTemplateName;
 }
 
-TemplateArgument 
+TemplateArgument
 ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) {
   switch (Arg.getKind()) {
     case TemplateArgument::Null:
       return Arg;
-      
+
     case TemplateArgument::Expression:
       // FIXME: Build canonical expression?
       return Arg;
-      
+
     case TemplateArgument::Declaration:
       return TemplateArgument(SourceLocation(),
                               Arg.getAsDecl()->getCanonicalDecl());
-      
+
     case TemplateArgument::Integral:
       return TemplateArgument(SourceLocation(),
                               *Arg.getAsIntegral(),
                               getCanonicalType(Arg.getIntegralType()));
-      
+
     case TemplateArgument::Type:
       return TemplateArgument(SourceLocation(),
                               getCanonicalType(Arg.getAsType()));
-      
+
     case TemplateArgument::Pack: {
       // FIXME: Allocate in ASTContext
       TemplateArgument *CanonArgs = new TemplateArgument[Arg.pack_size()];
       unsigned Idx = 0;
-      for (TemplateArgument::pack_iterator A = Arg.pack_begin(), 
+      for (TemplateArgument::pack_iterator A = Arg.pack_begin(),
                                         AEnd = Arg.pack_end();
            A != AEnd; (void)++A, ++Idx)
         CanonArgs[Idx] = getCanonicalTemplateArgument(*A);
-      
+
       TemplateArgument Result;
       Result.setArgumentPack(CanonArgs, Arg.pack_size(), false);
       return Result;
@@ -2277,13 +2275,13 @@
 
 NestedNameSpecifier *
 ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) {
-  if (!NNS) 
+  if (!NNS)
     return 0;
 
   switch (NNS->getKind()) {
   case NestedNameSpecifier::Identifier:
     // Canonicalize the prefix but keep the identifier the same.
-    return NestedNameSpecifier::Create(*this, 
+    return NestedNameSpecifier::Create(*this,
                          getCanonicalNestedNameSpecifier(NNS->getPrefix()),
                                        NNS->getAsIdentifier());
 
@@ -2295,8 +2293,8 @@
   case NestedNameSpecifier::TypeSpec:
   case NestedNameSpecifier::TypeSpecWithTemplate: {
     QualType T = getCanonicalType(QualType(NNS->getAsType(), 0));
-    return NestedNameSpecifier::Create(*this, 0, 
-                 NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate, 
+    return NestedNameSpecifier::Create(*this, 0,
+                 NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate,
                                        T.getTypePtr());
   }
 
@@ -2317,27 +2315,27 @@
     if (const ArrayType *AT = dyn_cast<ArrayType>(T))
       return AT;
   }
-  
+
   // Handle the common negative case fast, ignoring CVR qualifiers.
   QualType CType = T->getCanonicalTypeInternal();
-    
+
   // Make sure to look through type qualifiers (like ExtQuals) for the negative
   // test.
   if (!isa<ArrayType>(CType) &&
       !isa<ArrayType>(CType.getUnqualifiedType()))
     return 0;
-  
+
   // Apply any CVR qualifiers from the array type to the element type.  This
   // implements C99 6.7.3p8: "If the specification of an array type includes
   // any type qualifiers, the element type is so qualified, not the array type."
-  
+
   // If we get here, we either have type qualifiers on the type, or we have
   // sugar such as a typedef in the way.  If we have type qualifiers on the type
   // we must propagate them down into the element type.
   unsigned CVRQuals = T.getCVRQualifiers();
   unsigned AddrSpace = 0;
   Type *Ty = T.getTypePtr();
-  
+
   // Rip through ExtQualType's and typedefs to get to a concrete type.
   while (1) {
     if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(Ty)) {
@@ -2351,12 +2349,12 @@
       Ty = T.getTypePtr();
     }
   }
-  
+
   // If we have a simple case, just return now.
   const ArrayType *ATy = dyn_cast<ArrayType>(Ty);
   if (ATy == 0 || (AddrSpace == 0 && CVRQuals == 0))
     return ATy;
-  
+
   // Otherwise, we have an array and we have qualifiers on it.  Push the
   // qualifiers into the array element type and return a new array type.
   // Get the canonical version of the element with the extra qualifiers on it.
@@ -2365,7 +2363,7 @@
   if (AddrSpace)
     NewEltTy = getAddrSpaceQualType(NewEltTy, AddrSpace);
   NewEltTy = NewEltTy.getWithAdditionalQualifiers(CVRQuals);
-  
+
   if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(ATy))
     return cast<ArrayType>(getConstantArrayType(NewEltTy, CAT->getSize(),
                                                 CAT->getSizeModifier(),
@@ -2375,16 +2373,16 @@
                                                   IAT->getSizeModifier(),
                                                   IAT->getIndexTypeQualifier()));
 
-  if (const DependentSizedArrayType *DSAT 
+  if (const DependentSizedArrayType *DSAT
         = dyn_cast<DependentSizedArrayType>(ATy))
     return cast<ArrayType>(
-                     getDependentSizedArrayType(NewEltTy, 
+                     getDependentSizedArrayType(NewEltTy,
                                                 DSAT->getSizeExpr() ?
                                               DSAT->getSizeExpr()->Retain() : 0,
                                                 DSAT->getSizeModifier(),
                                                 DSAT->getIndexTypeQualifier(),
                                                 DSAT->getBracketsRange()));
-  
+
   const VariableArrayType *VAT = cast<VariableArrayType>(ATy);
   return cast<ArrayType>(getVariableArrayType(NewEltTy,
                                               VAT->getSizeExpr() ?
@@ -2408,7 +2406,7 @@
   // (C99 6.7.3p8).
   const ArrayType *PrettyArrayType = getAsArrayType(Ty);
   assert(PrettyArrayType && "Not an array type!");
-  
+
   QualType PtrTy = getPointerType(PrettyArrayType->getElementType());
 
   // int x[restrict 4] ->  int *restrict
@@ -2429,15 +2427,15 @@
 
 QualType ASTContext::getBaseElementType(const VariableArrayType *VAT) {
   QualType ElemTy = VAT->getElementType();
-  
+
   if (const VariableArrayType *VAT = getAsVariableArrayType(ElemTy))
     return getBaseElementType(VAT);
-  
+
   return ElemTy;
 }
 
 /// getConstantArrayElementCount - Returns number of constant array elements.
-uint64_t 
+uint64_t
 ASTContext::getConstantArrayElementCount(const ConstantArrayType *CA)  const {
   uint64_t ElementCount = 1;
   do {
@@ -2462,8 +2460,8 @@
   }
 }
 
-/// getFloatingTypeOfSizeWithinDomain - Returns a real floating 
-/// point or a complex type (based on typeDomain/typeSize). 
+/// getFloatingTypeOfSizeWithinDomain - Returns a real floating
+/// point or a complex type (based on typeDomain/typeSize).
 /// 'typeDomain' is a real floating point or complex type.
 /// 'typeSize' is a real floating point or complex type.
 QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,
@@ -2490,11 +2488,11 @@
 /// getFloatingTypeOrder - Compare the rank of the two specified floating
 /// point types, ignoring the domain of the type (i.e. 'double' ==
 /// '_Complex double').  If LHS > RHS, return 1.  If LHS == RHS, return 0. If
-/// LHS < RHS, return -1. 
+/// LHS < RHS, return -1.
 int ASTContext::getFloatingTypeOrder(QualType LHS, QualType RHS) {
   FloatingRank LHSR = getFloatingRank(LHS);
   FloatingRank RHSR = getFloatingRank(RHS);
-  
+
   if (LHSR == RHSR)
     return 0;
   if (LHSR > RHSR)
@@ -2597,77 +2595,77 @@
   return (PromotableSize != IntSize) ? IntTy : UnsignedIntTy;
 }
 
-/// getIntegerTypeOrder - Returns the highest ranked integer type: 
+/// getIntegerTypeOrder - Returns the highest ranked integer type:
 /// C99 6.3.1.8p1.  If LHS > RHS, return 1.  If LHS == RHS, return 0. If
-/// LHS < RHS, return -1. 
+/// LHS < RHS, return -1.
 int ASTContext::getIntegerTypeOrder(QualType LHS, QualType RHS) {
   Type *LHSC = getCanonicalType(LHS).getTypePtr();
   Type *RHSC = getCanonicalType(RHS).getTypePtr();
   if (LHSC == RHSC) return 0;
-  
+
   bool LHSUnsigned = LHSC->isUnsignedIntegerType();
   bool RHSUnsigned = RHSC->isUnsignedIntegerType();
-  
+
   unsigned LHSRank = getIntegerRank(LHSC);
   unsigned RHSRank = getIntegerRank(RHSC);
-  
+
   if (LHSUnsigned == RHSUnsigned) {  // Both signed or both unsigned.
     if (LHSRank == RHSRank) return 0;
     return LHSRank > RHSRank ? 1 : -1;
   }
-  
+
   // Otherwise, the LHS is signed and the RHS is unsigned or visa versa.
   if (LHSUnsigned) {
     // If the unsigned [LHS] type is larger, return it.
     if (LHSRank >= RHSRank)
       return 1;
-    
+
     // If the signed type can represent all values of the unsigned type, it
     // wins.  Because we are dealing with 2's complement and types that are
-    // powers of two larger than each other, this is always safe. 
+    // powers of two larger than each other, this is always safe.
     return -1;
   }
 
   // If the unsigned [RHS] type is larger, return it.
   if (RHSRank >= LHSRank)
     return -1;
-  
+
   // If the signed type can represent all values of the unsigned type, it
   // wins.  Because we are dealing with 2's complement and types that are
-  // powers of two larger than each other, this is always safe. 
+  // powers of two larger than each other, this is always safe.
   return 1;
 }
 
-// getCFConstantStringType - Return the type used for constant CFStrings. 
+// getCFConstantStringType - Return the type used for constant CFStrings.
 QualType ASTContext::getCFConstantStringType() {
   if (!CFConstantStringTypeDecl) {
-    CFConstantStringTypeDecl = 
-      RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(), 
+    CFConstantStringTypeDecl =
+      RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
                          &Idents.get("NSConstantString"));
     QualType FieldTypes[4];
-  
+
     // const int *isa;
-    FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));  
+    FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));
     // int flags;
     FieldTypes[1] = IntTy;
     // const char *str;
-    FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));  
+    FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));
     // long length;
-    FieldTypes[3] = LongTy;  
-  
+    FieldTypes[3] = LongTy;
+
     // Create fields
     for (unsigned i = 0; i < 4; ++i) {
-      FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl, 
+      FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl,
                                            SourceLocation(), 0,
                                            FieldTypes[i], /*DInfo=*/0,
-                                           /*BitWidth=*/0, 
+                                           /*BitWidth=*/0,
                                            /*Mutable=*/false);
       CFConstantStringTypeDecl->addDecl(Field);
     }
 
     CFConstantStringTypeDecl->completeDefinition(*this);
   }
-  
+
   return getTagDeclType(CFConstantStringTypeDecl);
 }
 
@@ -2677,13 +2675,12 @@
   CFConstantStringTypeDecl = Rec->getDecl();
 }
 
-QualType ASTContext::getObjCFastEnumerationStateType()
-{
+QualType ASTContext::getObjCFastEnumerationStateType() {
   if (!ObjCFastEnumerationStateTypeDecl) {
     ObjCFastEnumerationStateTypeDecl =
       RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
                          &Idents.get("__objcFastEnumerationState"));
-    
+
     QualType FieldTypes[] = {
       UnsignedLongTy,
       getPointerType(ObjCIdTypedefType),
@@ -2691,20 +2688,20 @@
       getConstantArrayType(UnsignedLongTy,
                            llvm::APInt(32, 5), ArrayType::Normal, 0)
     };
-    
+
     for (size_t i = 0; i < 4; ++i) {
-      FieldDecl *Field = FieldDecl::Create(*this, 
-                                           ObjCFastEnumerationStateTypeDecl, 
-                                           SourceLocation(), 0, 
+      FieldDecl *Field = FieldDecl::Create(*this,
+                                           ObjCFastEnumerationStateTypeDecl,
+                                           SourceLocation(), 0,
                                            FieldTypes[i], /*DInfo=*/0,
-                                           /*BitWidth=*/0, 
+                                           /*BitWidth=*/0,
                                            /*Mutable=*/false);
       ObjCFastEnumerationStateTypeDecl->addDecl(Field);
     }
-    
+
     ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
   }
-  
+
   return getTagDeclType(ObjCFastEnumerationStateTypeDecl);
 }
 
@@ -2720,7 +2717,7 @@
   if (const TypedefType *TT = dyn_cast<TypedefType>(T))
     if (IdentifierInfo *II = TT->getDecl()->getIdentifier())
       return II->isStr("BOOL");
-        
+
   return false;
 }
 
@@ -2728,7 +2725,7 @@
 /// purpose.
 int ASTContext::getObjCEncodingTypeSize(QualType type) {
   uint64_t sz = getTypeSize(type);
-  
+
   // Make all integer and enum types at least as large as an int
   if (sz > 0 && type->isIntegralType())
     sz = std::max(sz, getTypeSize(IntTy));
@@ -2740,7 +2737,7 @@
 
 /// getObjCEncodingForMethodDecl - Return the encoded type for this method
 /// declaration.
-void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, 
+void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
                                               std::string& S) {
   // FIXME: This is not very efficient.
   // Encode type qualifer, 'in', 'inout', etc. for the return type.
@@ -2765,13 +2762,13 @@
   S += llvm::utostr(ParmOffset);
   S += "@0:";
   S += llvm::utostr(PtrSize);
-  
+
   // Argument types.
   ParmOffset = 2 * PtrSize;
   for (ObjCMethodDecl::param_iterator PI = Decl->param_begin(),
        E = Decl->param_end(); PI != E; ++PI) {
     ParmVarDecl *PVDecl = *PI;
-    QualType PType = PVDecl->getOriginalType(); 
+    QualType PType = PVDecl->getOriginalType();
     if (const ArrayType *AT =
           dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) {
       // Use array's original type only if it has known number of
@@ -2793,11 +2790,11 @@
 /// property declaration. If non-NULL, Container must be either an
 /// ObjCCategoryImplDecl or ObjCImplementationDecl; it should only be
 /// NULL when getting encodings for protocol properties.
-/// Property attributes are stored as a comma-delimited C string. The simple 
-/// attributes readonly and bycopy are encoded as single characters. The 
-/// parametrized attributes, getter=name, setter=name, and ivar=name, are 
-/// encoded as single characters, followed by an identifier. Property types 
-/// are also encoded as a parametrized attribute. The characters used to encode 
+/// Property attributes are stored as a comma-delimited C string. The simple
+/// attributes readonly and bycopy are encoded as single characters. The
+/// parametrized attributes, getter=name, setter=name, and ivar=name, are
+/// encoded as single characters, followed by an identifier. Property types
+/// are also encoded as a parametrized attribute. The characters used to encode
 /// these attributes are defined by the following enumeration:
 /// @code
 /// enum PropertyAttributes {
@@ -2814,7 +2811,7 @@
 /// kPropertyNonAtomic = 'N'         // property non-atomic
 /// };
 /// @endcode
-void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, 
+void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
                                                 const Decl *Container,
                                                 std::string& S) {
   // Collect information from the property implementation decl(s).
@@ -2823,7 +2820,7 @@
 
   // FIXME: Duplicated code due to poor abstraction.
   if (Container) {
-    if (const ObjCCategoryImplDecl *CID = 
+    if (const ObjCCategoryImplDecl *CID =
         dyn_cast<ObjCCategoryImplDecl>(Container)) {
       for (ObjCCategoryImplDecl::propimpl_iterator
              i = CID->propimpl_begin(), e = CID->propimpl_end();
@@ -2850,7 +2847,7 @@
             SynthesizePID = PID;
           }
         }
-      }      
+      }
     }
   }
 
@@ -2860,7 +2857,7 @@
   // Encode result type.
   // GCC has some special rules regarding encoding of properties which
   // closely resembles encoding of ivars.
-  getObjCEncodingForTypeImpl(PD->getType(), S, true, true, 0, 
+  getObjCEncodingForTypeImpl(PD->getType(), S, true, true, 0,
                              true /* outermost type */,
                              true /* encoding for property */);
 
@@ -2870,7 +2867,7 @@
     switch (PD->getSetterKind()) {
     case ObjCPropertyDecl::Assign: break;
     case ObjCPropertyDecl::Copy:   S += ",C"; break;
-    case ObjCPropertyDecl::Retain: S += ",&"; break;      
+    case ObjCPropertyDecl::Retain: S += ",&"; break;
     }
   }
 
@@ -2881,7 +2878,7 @@
 
   if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic)
     S += ",N";
-  
+
   if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) {
     S += ",G";
     S += PD->getGetterName().getAsString();
@@ -2902,8 +2899,8 @@
 }
 
 /// getLegacyIntegralTypeEncoding -
-/// Another legacy compatibility encoding: 32-bit longs are encoded as 
-/// 'l' or 'L' , but not always.  For typedefs, we need to use 
+/// Another legacy compatibility encoding: 32-bit longs are encoded as
+/// 'l' or 'L' , but not always.  For typedefs, we need to use
 /// 'i' or 'I' instead if encoding a struct field, or a pointer!
 ///
 void ASTContext::getLegacyIntegralTypeEncoding (QualType &PointeeTy) const {
@@ -2912,7 +2909,7 @@
       if (BT->getKind() == BuiltinType::ULong &&
           ((const_cast<ASTContext *>(this))->getIntWidth(PointeeTy) == 32))
         PointeeTy = UnsignedIntTy;
-      else 
+      else
         if (BT->getKind() == BuiltinType::Long &&
             ((const_cast<ASTContext *>(this))->getIntWidth(PointeeTy) == 32))
           PointeeTy = IntTy;
@@ -2926,11 +2923,11 @@
   // directly pointed to, and expanding embedded structures. Note that
   // these rules are sufficient to prevent recursive encoding of the
   // same type.
-  getObjCEncodingForTypeImpl(T, S, true, true, Field, 
+  getObjCEncodingForTypeImpl(T, S, true, true, Field,
                              true /* outermost type */);
 }
 
-static void EncodeBitField(const ASTContext *Context, std::string& S, 
+static void EncodeBitField(const ASTContext *Context, std::string& S,
                            const FieldDecl *FD) {
   const Expr *E = FD->getBitWidth();
   assert(E && "bitfield width not there - getObjCEncodingForTypeImpl");
@@ -2951,16 +2948,16 @@
       return EncodeBitField(this, S, FD);
     char encoding;
     switch (BT->getKind()) {
-    default: assert(0 && "Unhandled builtin type kind");          
+    default: assert(0 && "Unhandled builtin type kind");
     case BuiltinType::Void:       encoding = 'v'; break;
     case BuiltinType::Bool:       encoding = 'B'; break;
     case BuiltinType::Char_U:
     case BuiltinType::UChar:      encoding = 'C'; break;
     case BuiltinType::UShort:     encoding = 'S'; break;
     case BuiltinType::UInt:       encoding = 'I'; break;
-    case BuiltinType::ULong:      
-        encoding = 
-          (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'L' : 'Q'; 
+    case BuiltinType::ULong:
+        encoding =
+          (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'L' : 'Q';
         break;
     case BuiltinType::UInt128:    encoding = 'T'; break;
     case BuiltinType::ULongLong:  encoding = 'Q'; break;
@@ -2968,9 +2965,9 @@
     case BuiltinType::SChar:      encoding = 'c'; break;
     case BuiltinType::Short:      encoding = 's'; break;
     case BuiltinType::Int:        encoding = 'i'; break;
-    case BuiltinType::Long:       
-      encoding = 
-        (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'l' : 'q'; 
+    case BuiltinType::Long:
+      encoding =
+        (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'l' : 'q';
       break;
     case BuiltinType::LongLong:   encoding = 'q'; break;
     case BuiltinType::Int128:     encoding = 't'; break;
@@ -2978,25 +2975,25 @@
     case BuiltinType::Double:     encoding = 'd'; break;
     case BuiltinType::LongDouble: encoding = 'd'; break;
     }
-  
+
     S += encoding;
     return;
   }
-  
+
   if (const ComplexType *CT = T->getAsComplexType()) {
     S += 'j';
-    getObjCEncodingForTypeImpl(CT->getElementType(), S, false, false, 0, false, 
+    getObjCEncodingForTypeImpl(CT->getElementType(), S, false, false, 0, false,
                                false);
     return;
   }
-  
+
   if (const PointerType *PT = T->getAs<PointerType>()) {
     QualType PointeeTy = PT->getPointeeType();
     bool isReadOnly = false;
     // For historical/compatibility reasons, the read-only qualifier of the
     // pointee gets emitted _before_ the '^'.  The read-only qualifier of
     // the pointer itself gets ignored, _unless_ we are looking at a typedef!
-    // Also, do not emit the 'r' for anything but the outermost type! 
+    // Also, do not emit the 'r' for anything but the outermost type!
     if (isa<TypedefType>(T.getTypePtr())) {
       if (OutermostType && T.isConstQualified()) {
         isReadOnly = true;
@@ -3026,7 +3023,7 @@
       S += ':';
       return;
     }
-    
+
     if (PointeeTy->isCharType()) {
       // char pointer types should be encoded as '*' unless it is a
       // type that has been typedef'd to 'BOOL'.
@@ -3050,11 +3047,11 @@
     S += '^';
     getLegacyIntegralTypeEncoding(PointeeTy);
 
-    getObjCEncodingForTypeImpl(PointeeTy, S, false, ExpandPointedToStructures, 
+    getObjCEncodingForTypeImpl(PointeeTy, S, false, ExpandPointedToStructures,
                                NULL);
     return;
   }
-  
+
   if (const ArrayType *AT =
       // Ignore type qualifiers etc.
         dyn_cast<ArrayType>(T->getCanonicalTypeInternal())) {
@@ -3062,11 +3059,11 @@
       // Incomplete arrays are encoded as a pointer to the array element.
       S += '^';
 
-      getObjCEncodingForTypeImpl(AT->getElementType(), S, 
+      getObjCEncodingForTypeImpl(AT->getElementType(), S,
                                  false, ExpandStructures, FD);
     } else {
       S += '[';
-    
+
       if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
         S += llvm::utostr(CAT->getSize().getZExtValue());
       else {
@@ -3074,19 +3071,19 @@
         assert(isa<VariableArrayType>(AT) && "Unknown array type!");
         S += '0';
       }
-    
-      getObjCEncodingForTypeImpl(AT->getElementType(), S, 
+
+      getObjCEncodingForTypeImpl(AT->getElementType(), S,
                                  false, ExpandStructures, FD);
       S += ']';
     }
     return;
   }
-  
+
   if (T->getAsFunctionType()) {
     S += '?';
     return;
   }
-  
+
   if (const RecordType *RTy = T->getAs<RecordType>()) {
     RecordDecl *RDecl = RTy->getDecl();
     S += RDecl->isUnion() ? '(' : '{';
@@ -3106,15 +3103,15 @@
           S += Field->getNameAsString();
           S += '"';
         }
-        
+
         // Special case bit-fields.
         if (Field->isBitField()) {
-          getObjCEncodingForTypeImpl(Field->getType(), S, false, true, 
+          getObjCEncodingForTypeImpl(Field->getType(), S, false, true,
                                      (*Field));
         } else {
           QualType qt = Field->getType();
           getLegacyIntegralTypeEncoding(qt);
-          getObjCEncodingForTypeImpl(qt, S, false, true, 
+          getObjCEncodingForTypeImpl(qt, S, false, true,
                                      FD);
         }
       }
@@ -3122,7 +3119,7 @@
     S += RDecl->isUnion() ? ')' : '}';
     return;
   }
-  
+
   if (T->isEnumeralType()) {
     if (FD && FD->isBitField())
       EncodeBitField(this, S, FD);
@@ -3130,12 +3127,12 @@
       S += 'i';
     return;
   }
-  
+
   if (T->isBlockPointerType()) {
     S += "@?"; // Unlike a pointer-to-function, which is "^?".
     return;
   }
-  
+
   if (T->isObjCInterfaceType()) {
     // @encode(class_name)
     ObjCInterfaceDecl *OI = T->getAsObjCInterfaceType()->getDecl();
@@ -3147,29 +3144,29 @@
     CollectObjCIvars(OI, RecFields);
     for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
       if (RecFields[i]->isBitField())
-        getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true, 
+        getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
                                    RecFields[i]);
       else
-        getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true, 
+        getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
                                    FD);
     }
     S += '}';
     return;
   }
-  
+
   if (const ObjCObjectPointerType *OPT = T->getAsObjCObjectPointerType()) {
     if (OPT->isObjCIdType()) {
       S += '@';
       return;
     }
-    
+
     if (OPT->isObjCClassType()) {
       S += '#';
       return;
     }
-    
+
     if (OPT->isObjCQualifiedIdType()) {
-      getObjCEncodingForTypeImpl(getObjCIdType(), S, 
+      getObjCEncodingForTypeImpl(getObjCIdType(), S,
                                  ExpandPointedToStructures,
                                  ExpandStructures, FD);
       if (FD || EncodingProperty) {
@@ -3186,16 +3183,16 @@
       }
       return;
     }
-    
+
     QualType PointeeTy = OPT->getPointeeType();
     if (!EncodingProperty &&
         isa<TypedefType>(PointeeTy.getTypePtr())) {
       // Another historical/compatibility reason.
-      // We encode the underlying type which comes out as 
+      // We encode the underlying type which comes out as
       // {...};
       S += '^';
-      getObjCEncodingForTypeImpl(PointeeTy, S, 
-                                 false, ExpandPointedToStructures, 
+      getObjCEncodingForTypeImpl(PointeeTy, S,
+                                 false, ExpandPointedToStructures,
                                  NULL);
       return;
     }
@@ -3209,16 +3206,16 @@
         S += '<';
         S += (*I)->getNameAsString();
         S += '>';
-      } 
+      }
       S += '"';
     }
     return;
   }
-  
+
   assert(0 && "@encode for type not implemented!");
 }
 
-void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, 
+void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
                                                  std::string& S) const {
   if (QT & Decl::OBJC_TQ_In)
     S += 'n';
@@ -3236,7 +3233,7 @@
 
 void ASTContext::setBuiltinVaListType(QualType T) {
   assert(BuiltinVaListType.isNull() && "__builtin_va_list type already set!");
-    
+
   BuiltinVaListType = T;
 }
 
@@ -3271,15 +3268,15 @@
 }
 
 void ASTContext::setObjCConstantStringInterface(ObjCInterfaceDecl *Decl) {
-  assert(ObjCConstantStringType.isNull() && 
+  assert(ObjCConstantStringType.isNull() &&
          "'NSConstantString' type already set!");
-  
+
   ObjCConstantStringType = getObjCInterfaceType(Decl);
 }
 
 /// \brief Retrieve the template name that represents a qualified
 /// template name such as \c std::vector.
-TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS, 
+TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
                                                   bool TemplateKeyword,
                                                   TemplateDecl *Template) {
   llvm::FoldingSetNodeID ID;
@@ -3298,12 +3295,12 @@
 
 /// \brief Retrieve the template name that represents a qualified
 /// template name such as \c std::vector.
-TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS, 
+TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
                                                   bool TemplateKeyword,
                                             OverloadedFunctionDecl *Template) {
   llvm::FoldingSetNodeID ID;
   QualifiedTemplateName::Profile(ID, NNS, TemplateKeyword, Template);
-  
+
   void *InsertPos = 0;
   QualifiedTemplateName *QTN =
   QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
@@ -3311,15 +3308,15 @@
     QTN = new (*this,4) QualifiedTemplateName(NNS, TemplateKeyword, Template);
     QualifiedTemplateNames.InsertNode(QTN, InsertPos);
   }
-  
+
   return TemplateName(QTN);
 }
 
 /// \brief Retrieve the template name that represents a dependent
 /// template name such as \c MetaFun::template apply.
-TemplateName ASTContext::getDependentTemplateName(NestedNameSpecifier *NNS, 
+TemplateName ASTContext::getDependentTemplateName(NestedNameSpecifier *NNS,
                                                   const IdentifierInfo *Name) {
-  assert((!NNS || NNS->isDependent()) && 
+  assert((!NNS || NNS->isDependent()) &&
          "Nested name specifier must be dependent");
 
   llvm::FoldingSetNodeID ID;
@@ -3349,7 +3346,7 @@
 /// is actually a value of type @c TargetInfo::IntType.
 QualType ASTContext::getFromTargetType(unsigned Type) const {
   switch (Type) {
-  case TargetInfo::NoInt: return QualType(); 
+  case TargetInfo::NoInt: return QualType();
   case TargetInfo::SignedShort: return ShortTy;
   case TargetInfo::UnsignedShort: return UnsignedShortTy;
   case TargetInfo::SignedInt: return IntTy;
@@ -3379,7 +3376,7 @@
       if (TD->getAttr<ObjCNSObjectAttr>())
         return true;
   }
-  return false;  
+  return false;
 }
 
 /// getObjCGCAttr - Returns one of GCNone, Weak or Strong objc's
@@ -3391,7 +3388,7 @@
       getLangOptions().getGCMode() != LangOptions::NonGC) {
     GCAttrs = Ty.getObjCGCAttr();
     // Default behavious under objective-c's gc is for objective-c pointers
-    // (or pointers to them) be treated as though they were declared 
+    // (or pointers to them) be treated as though they were declared
     // as __strong.
     if (GCAttrs == QualType::GCNone) {
       if (Ty->isObjCObjectPointerType())
@@ -3411,7 +3408,7 @@
 //                        Type Compatibility Testing
 //===----------------------------------------------------------------------===//
 
-/// areCompatVectorTypes - Return true if the two specified vector types are 
+/// areCompatVectorTypes - Return true if the two specified vector types are
 /// compatible.
 static bool areCompatVectorTypes(const VectorType *LHS,
                                  const VectorType *RHS) {
@@ -3451,20 +3448,20 @@
 bool ASTContext::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs,
                                                    bool compare) {
   // Allow id<P..> and an 'id' or void* type in all cases.
-  if (lhs->isVoidPointerType() || 
+  if (lhs->isVoidPointerType() ||
       lhs->isObjCIdType() || lhs->isObjCClassType())
     return true;
-  else if (rhs->isVoidPointerType() || 
+  else if (rhs->isVoidPointerType() ||
            rhs->isObjCIdType() || rhs->isObjCClassType())
     return true;
 
   if (const ObjCObjectPointerType *lhsQID = lhs->getAsObjCQualifiedIdType()) {
     const ObjCObjectPointerType *rhsOPT = rhs->getAsObjCObjectPointerType();
-    
+
     if (!rhsOPT) return false;
-    
+
     if (rhsOPT->qual_empty()) {
-      // If the RHS is a unqualified interface pointer "NSString*", 
+      // If the RHS is a unqualified interface pointer "NSString*",
       // make sure we check the class hierarchy.
       if (ObjCInterfaceDecl *rhsID = rhsOPT->getInterfaceDecl()) {
         for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
@@ -3479,7 +3476,7 @@
       // If there are no qualifiers and no interface, we have an 'id'.
       return true;
     }
-    // Both the right and left sides have qualifiers.    
+    // Both the right and left sides have qualifiers.
     for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
          E = lhsQID->qual_end(); I != E; ++I) {
       ObjCProtocolDecl *lhsProto = *I;
@@ -3497,7 +3494,7 @@
           break;
         }
       }
-      // If the RHS is a qualified interface pointer "NSString<P>*", 
+      // If the RHS is a qualified interface pointer "NSString<P>*",
       // make sure we check the class hierarchy.
       if (ObjCInterfaceDecl *rhsID = rhsOPT->getInterfaceDecl()) {
         for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
@@ -3514,14 +3511,14 @@
       if (!match)
         return false;
     }
-    
+
     return true;
   }
-  
+
   const ObjCObjectPointerType *rhsQID = rhs->getAsObjCQualifiedIdType();
   assert(rhsQID && "One of the LHS/RHS should be id<x>");
 
-  if (const ObjCObjectPointerType *lhsOPT = 
+  if (const ObjCObjectPointerType *lhsOPT =
         lhs->getAsObjCInterfacePointerType()) {
     if (lhsOPT->qual_empty()) {
       bool match = false;
@@ -3541,7 +3538,7 @@
       }
       return true;
     }
-    // Both the right and left sides have qualifiers.    
+    // Both the right and left sides have qualifiers.
     for (ObjCObjectPointerType::qual_iterator I = lhsOPT->qual_begin(),
          E = lhsOPT->qual_end(); I != E; ++I) {
       ObjCProtocolDecl *lhsProto = *I;
@@ -3578,15 +3575,15 @@
     return true;
 
   if (LHSOPT->isObjCQualifiedIdType() || RHSOPT->isObjCQualifiedIdType())
-    return ObjCQualifiedIdTypesAreCompatible(QualType(LHSOPT,0), 
-                                             QualType(RHSOPT,0), 
+    return ObjCQualifiedIdTypesAreCompatible(QualType(LHSOPT,0),
+                                             QualType(RHSOPT,0),
                                              false);
 
   const ObjCInterfaceType* LHS = LHSOPT->getInterfaceType();
   const ObjCInterfaceType* RHS = RHSOPT->getInterfaceType();
   if (LHS && RHS) // We have 2 user-defined types.
     return canAssignObjCInterfaces(LHS, RHS);
-    
+
   return false;
 }
 
@@ -3596,17 +3593,17 @@
   // the LHS.
   if (!LHS->getDecl()->isSuperClassOf(RHS->getDecl()))
     return false;
-  
+
   // RHS must have a superset of the protocols in the LHS.  If the LHS is not
   // protocol qualified at all, then we are good.
   if (LHS->getNumProtocols() == 0)
     return true;
-  
+
   // Okay, we know the LHS has protocol qualifiers.  If the RHS doesn't, then it
   // isn't a superset.
   if (RHS->getNumProtocols() == 0)
     return true;  // FIXME: should return false!
-  
+
   for (ObjCInterfaceType::qual_iterator LHSPI = LHS->qual_begin(),
                                         LHSPE = LHS->qual_end();
        LHSPI != LHSPE; LHSPI++) {
@@ -3634,7 +3631,7 @@
   // get the "pointed to" types
   const ObjCObjectPointerType *LHSOPT = LHS->getAsObjCObjectPointerType();
   const ObjCObjectPointerType *RHSOPT = RHS->getAsObjCObjectPointerType();
-  
+
   if (!LHSOPT || !RHSOPT)
     return false;
 
@@ -3642,9 +3639,9 @@
          canAssignObjCInterfaces(RHSOPT, LHSOPT);
 }
 
-/// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible, 
+/// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible,
 /// both shall have the identically qualified version of a compatible type.
-/// C99 6.2.7p1: Two types have compatible types if their types are the 
+/// C99 6.2.7p1: Two types have compatible types if their types are the
 /// same. See 6.7.[2,3,5] for additional rules.
 bool ASTContext::typesAreCompatible(QualType LHS, QualType RHS) {
   return !mergeTypes(LHS, RHS).isNull();
@@ -3671,7 +3668,7 @@
     allLTypes = false;
   if (NoReturn != rbase->getNoReturnAttr())
     allRTypes = false;
-    
+
   if (lproto && rproto) { // two C99 style function prototypes
     assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
            "C++ shouldn't be here");
@@ -3783,15 +3780,15 @@
     QualType::GCAttrTypes GCAttr = RHSCan.getObjCGCAttr();
     if (GCAttr != QualType::GCNone) {
       QualType::GCAttrTypes GCLHSAttr = LHSCan.getObjCGCAttr();
-      // __weak attribute must appear on both declarations. 
-      // __strong attribue is redundant if other decl is an objective-c 
+      // __weak attribute must appear on both declarations.
+      // __strong attribue is redundant if other decl is an objective-c
       // object pointer (or decorated with __strong attribute); otherwise
       // issue error.
       if ((GCAttr == QualType::Weak && GCLHSAttr != GCAttr) ||
           (GCAttr == QualType::Strong && GCLHSAttr != GCAttr &&
            !LHSCan->isObjCObjectPointerType()))
         return QualType();
-          
+
       RHS = QualType(cast<ExtQualType>(RHS.getDesugaredType())->getBaseType(),
                      RHS.getCVRQualifiers());
       QualType Result = mergeTypes(LHS, RHS);
@@ -3809,14 +3806,14 @@
     if (GCAttr != QualType::GCNone) {
       QualType::GCAttrTypes GCRHSAttr = RHSCan.getObjCGCAttr();
       // __weak attribute must appear on both declarations. __strong
-      // __strong attribue is redundant if other decl is an objective-c 
+      // __strong attribue is redundant if other decl is an objective-c
       // object pointer (or decorated with __strong attribute); otherwise
       // issue error.
       if ((GCAttr == QualType::Weak && GCRHSAttr != GCAttr) ||
           (GCAttr == QualType::Strong && GCRHSAttr != GCAttr &&
            !RHSCan->isObjCObjectPointerType()))
         return QualType();
-      
+
       LHS = QualType(cast<ExtQualType>(LHS.getDesugaredType())->getBaseType(),
                      LHS.getCVRQualifiers());
       QualType Result = mergeTypes(LHS, RHS);
@@ -3835,15 +3832,15 @@
     LHSClass = Type::ConstantArray;
   if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
     RHSClass = Type::ConstantArray;
-  
+
   // Canonicalize ExtVector -> Vector.
   if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
   if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
-  
+
   // If the canonical type classes don't match.
   if (LHSClass != RHSClass) {
     // C99 6.7.2.2p4: Each enumerated type shall be compatible with char,
-    // a signed integer type, or an unsigned integer type. 
+    // a signed integer type, or an unsigned integer type.
     if (const EnumType* ETy = LHS->getAsEnumType()) {
       if (ETy->getDecl()->getIntegerType() == RHSCan.getUnqualifiedType())
         return RHS;
@@ -3976,7 +3973,7 @@
     return QualType();
   }
   case Type::ObjCObjectPointer: {
-    if (canAssignObjCInterfaces(LHS->getAsObjCObjectPointerType(), 
+    if (canAssignObjCInterfaces(LHS->getAsObjCObjectPointerType(),
                                 RHS->getAsObjCObjectPointerType()))
       return LHS;
 
@@ -4072,18 +4069,18 @@
 
 /// DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the
 /// pointer over the consumed characters.  This returns the resultant type.
-static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context, 
+static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
                                   ASTContext::GetBuiltinTypeError &Error,
                                   bool AllowTypeModifiers = true) {
   // Modifiers.
   int HowLong = 0;
   bool Signed = false, Unsigned = false;
-  
+
   // Read the modifiers first.
   bool Done = false;
   while (!Done) {
     switch (*Str++) {
-    default: Done = true; --Str; break; 
+    default: Done = true; --Str; break;
     case 'S':
       assert(!Unsigned && "Can't use both 'S' and 'U' modifiers!");
       assert(!Signed && "Can't use 'S' modifier multiple times!");
@@ -4102,7 +4099,7 @@
   }
 
   QualType Type;
-  
+
   // Read the base type.
   switch (*Str++) {
   default: assert(0 && "Unknown builtin type letter!");
@@ -4186,9 +4183,9 @@
     char *End;
     unsigned NumElements = strtoul(Str, &End, 10);
     assert(End != Str && "Missing vector size");
-    
+
     Str = End;
-    
+
     QualType ElementType = DecodeTypeFromStr(Str, Context, Error, false);
     Type = Context.getVectorType(ElementType, NumElements);
     break;
@@ -4212,10 +4209,10 @@
     }
     break;
   }
-  
+
   if (!AllowTypeModifiers)
     return Type;
-  
+
   Done = false;
   while (!Done) {
     switch (*Str++) {
@@ -4232,7 +4229,7 @@
         break;
     }
   }
-  
+
   return Type;
 }
 
@@ -4240,9 +4237,9 @@
 QualType ASTContext::GetBuiltinType(unsigned id,
                                     GetBuiltinTypeError &Error) {
   const char *TypeStr = BuiltinInfo.GetTypeString(id);
-  
+
   llvm::SmallVector<QualType, 8> ArgTypes;
-  
+
   Error = GE_None;
   QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error);
   if (Error != GE_None)
@@ -4255,7 +4252,7 @@
     // Do array -> pointer decay.  The builtin should use the decayed type.
     if (Ty->isArrayType())
       Ty = getArrayDecayedType(Ty);
-   
+
     ArgTypes.push_back(Ty);
   }
 
@@ -4288,42 +4285,42 @@
   // If both types are identical, no conversion is needed.
   if (lhs == rhs)
     return lhs;
-  
+
   // If either side is a non-arithmetic type (e.g. a pointer), we are done.
   // The caller can deal with this (e.g. pointer + int).
   if (!lhs->isArithmeticType() || !rhs->isArithmeticType())
     return lhs;
-    
-  // At this point, we have two different arithmetic types. 
-  
+
+  // At this point, we have two different arithmetic types.
+
   // Handle complex types first (C99 6.3.1.8p1).
   if (lhs->isComplexType() || rhs->isComplexType()) {
     // if we have an integer operand, the result is the complex type.
-    if (rhs->isIntegerType() || rhs->isComplexIntegerType()) { 
+    if (rhs->isIntegerType() || rhs->isComplexIntegerType()) {
       // convert the rhs to the lhs complex type.
       return lhs;
     }
-    if (lhs->isIntegerType() || lhs->isComplexIntegerType()) { 
+    if (lhs->isIntegerType() || lhs->isComplexIntegerType()) {
       // convert the lhs to the rhs complex type.
       return rhs;
     }
     // This handles complex/complex, complex/float, or float/complex.
-    // When both operands are complex, the shorter operand is converted to the 
-    // type of the longer, and that is the type of the result. This corresponds 
-    // to what is done when combining two real floating-point operands. 
-    // The fun begins when size promotion occur across type domains. 
+    // When both operands are complex, the shorter operand is converted to the
+    // type of the longer, and that is the type of the result. This corresponds
+    // to what is done when combining two real floating-point operands.
+    // The fun begins when size promotion occur across type domains.
     // From H&S 6.3.4: When one operand is complex and the other is a real
-    // floating-point type, the less precise type is converted, within it's 
+    // floating-point type, the less precise type is converted, within it's
     // real or complex domain, to the precision of the other type. For example,
-    // when combining a "long double" with a "double _Complex", the 
+    // when combining a "long double" with a "double _Complex", the
     // "double _Complex" is promoted to "long double _Complex".
     int result = getFloatingTypeOrder(lhs, rhs);
-    
-    if (result > 0) { // The left side is bigger, convert rhs. 
+
+    if (result > 0) { // The left side is bigger, convert rhs.
       rhs = getFloatingTypeOfSizeWithinDomain(lhs, rhs);
-    } else if (result < 0) { // The right side is bigger, convert lhs. 
+    } else if (result < 0) { // The right side is bigger, convert lhs.
       lhs = getFloatingTypeOfSizeWithinDomain(rhs, lhs);
-    } 
+    }
     // At this point, lhs and rhs have the same rank/size. Now, make sure the
     // domains match. This is a requirement for our implementation, C99
     // does not require this promotion.
@@ -4351,7 +4348,7 @@
       // convert lhs to the rhs floating point type.
       return rhs;
     }
-    if (lhs->isComplexIntegerType()) { 
+    if (lhs->isComplexIntegerType()) {
       // convert lhs to the complex floating point type.
       return getComplexType(rhs);
     }
@@ -4369,7 +4366,7 @@
     const ComplexType *rhsComplexInt = rhs->getAsComplexIntegerType();
 
     if (lhsComplexInt && rhsComplexInt) {
-      if (getIntegerTypeOrder(lhsComplexInt->getElementType(), 
+      if (getIntegerTypeOrder(lhsComplexInt->getElementType(),
                               rhsComplexInt->getElementType()) >= 0)
         return lhs; // convert the rhs
       return rhs;

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

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Sep  9 10:08:12 2009
@@ -45,7 +45,7 @@
 //===----------------------------------------------------------------------===//
 // Decl Allocation/Deallocation Method Implementations
 //===----------------------------------------------------------------------===//
- 
+
 
 TranslationUnitDecl *TranslationUnitDecl::Create(ASTContext &C) {
   return new (C) TranslationUnitDecl(C);
@@ -59,7 +59,7 @@
 void NamespaceDecl::Destroy(ASTContext& C) {
   // NamespaceDecl uses "NextDeclarator" to chain namespace declarations
   // together. They are all top-level Decls.
-  
+
   this->~NamespaceDecl();
   C.Deallocate((void *)this);
 }
@@ -75,9 +75,9 @@
   case VarDecl::None:          break;
   case VarDecl::Auto:          return "auto"; break;
   case VarDecl::Extern:        return "extern"; break;
-  case VarDecl::PrivateExtern: return "__private_extern__"; break; 
+  case VarDecl::PrivateExtern: return "__private_extern__"; break;
   case VarDecl::Register:      return "register"; break;
-  case VarDecl::Static:        return "static"; break; 
+  case VarDecl::Static:        return "static"; break;
   }
 
   assert(0 && "Invalid storage class");
@@ -92,13 +92,13 @@
 }
 
 QualType ParmVarDecl::getOriginalType() const {
-  if (const OriginalParmVarDecl *PVD = 
+  if (const OriginalParmVarDecl *PVD =
       dyn_cast<OriginalParmVarDecl>(this))
     return PVD->OriginalType;
   return getType();
 }
 
-void VarDecl::setInit(ASTContext &C, Expr *I) { 
+void VarDecl::setInit(ASTContext &C, Expr *I) {
     if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) {
       Eval->~EvaluatedStmt();
       C.Deallocate(Eval);
@@ -109,11 +109,11 @@
 
 bool VarDecl::isExternC(ASTContext &Context) const {
   if (!Context.getLangOptions().CPlusPlus)
-    return (getDeclContext()->isTranslationUnit() && 
+    return (getDeclContext()->isTranslationUnit() &&
             getStorageClass() != Static) ||
       (getDeclContext()->isFunctionOrMethod() && hasExternalStorage());
 
-  for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit(); 
+  for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
        DC = DC->getParent()) {
     if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC))  {
       if (Linkage->getLanguage() == LinkageSpecDecl::lang_c)
@@ -138,12 +138,12 @@
 }
 
 FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
-                                   SourceLocation L, 
+                                   SourceLocation L,
                                    DeclarationName N, QualType T,
                                    DeclaratorInfo *DInfo,
-                                   StorageClass S, bool isInline, 
+                                   StorageClass S, bool isInline,
                                    bool hasWrittenPrototype) {
-  FunctionDecl *New 
+  FunctionDecl *New
     = new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline);
   New->HasWrittenPrototype = hasWrittenPrototype;
   return New;
@@ -162,7 +162,7 @@
 bool FieldDecl::isAnonymousStructOrUnion() const {
   if (!isImplicit() || getDeclName())
     return false;
-  
+
   if (const RecordType *Record = getType()->getAs<RecordType>())
     return Record->getDecl()->isAnonymousStructOrUnion();
 
@@ -233,7 +233,7 @@
       // scope class/struct/union. How do we handle this case?
       break;
 
-    if (const ClassTemplateSpecializationDecl *Spec 
+    if (const ClassTemplateSpecializationDecl *Spec
           = dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) {
       const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
       std::string TemplateArgsStr
@@ -271,7 +271,7 @@
     return cast<UsingDirectiveDecl>(this)->getNominatedNamespace() ==
            cast<UsingDirectiveDecl>(OldD)->getNominatedNamespace();
   }
-           
+
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
     // For function declarations, we keep track of redeclarations.
     return FD->getPreviousDeclaration() == OldD;
@@ -283,11 +283,11 @@
           = dyn_cast<FunctionTemplateDecl>(OldD))
       return FunctionTemplate->getTemplatedDecl()
                ->declarationReplaces(OldFunctionTemplate->getTemplatedDecl());
-  
+
   // For method declarations, we keep track of redeclarations.
   if (isa<ObjCMethodDecl>(this))
     return false;
-    
+
   // For non-function declarations, if the declarations are of the
   // same kind then this must be a redeclaration, or semantic analysis
   // would not have given us the new declaration.
@@ -444,11 +444,11 @@
   if (!Context.getLangOptions().CPlusPlus)
     return getStorageClass() != Static && !getAttr<OverloadableAttr>();
 
-  for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit(); 
+  for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
        DC = DC->getParent()) {
     if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC))  {
       if (Linkage->getLanguage() == LinkageSpecDecl::lang_c)
-        return getStorageClass() != Static && 
+        return getStorageClass() != Static &&
                !getAttr<OverloadableAttr>();
 
       break;
@@ -465,7 +465,7 @@
   if (getStorageClass() == Static)
     return false;
 
-  for (const DeclContext *DC = getDeclContext(); 
+  for (const DeclContext *DC = getDeclContext();
        DC->isNamespace();
        DC = DC->getParent()) {
     if (const NamespaceDecl *Namespace = cast<NamespaceDecl>(DC)) {
@@ -485,7 +485,7 @@
 /// declared at translation scope or within an extern "C" block and
 /// its name matches with the name of a builtin. The returned value
 /// will be 0 for functions that do not correspond to a builtin, a
-/// value of type \c Builtin::ID if in the target-independent range 
+/// value of type \c Builtin::ID if in the target-independent range
 /// \c [1,Builtin::First), or a target-specific builtin value.
 unsigned FunctionDecl::getBuiltinID(ASTContext &Context) const {
   if (!getIdentifier() || !getIdentifier()->getBuiltinID())
@@ -512,7 +512,7 @@
   // If the function is in an extern "C" linkage specification and is
   // not marked "overloadable", it's the real function.
   if (isa<LinkageSpecDecl>(getDeclContext()) &&
-      cast<LinkageSpecDecl>(getDeclContext())->getLanguage() 
+      cast<LinkageSpecDecl>(getDeclContext())->getLanguage()
         == LinkageSpecDecl::lang_c &&
       !getAttr<OverloadableAttr>())
     return BuiltinID;
@@ -530,14 +530,14 @@
   if (isa<FunctionNoProtoType>(FT))
     return 0;
   return cast<FunctionProtoType>(FT)->getNumArgs();
-  
+
 }
 
 void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
                              unsigned NumParams) {
   assert(ParamInfo == 0 && "Already has param info!");
   assert(NumParams == getNumParams() && "Parameter count mismatch!");
-  
+
   // Zero params -> null pointer.
   if (NumParams) {
     void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
@@ -586,12 +586,12 @@
   return false;
 }
 
-void 
+void
 FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) {
   redeclarable_base::setPreviousDeclaration(PrevDecl);
 
   if (FunctionTemplateDecl *FunTmpl = getDescribedFunctionTemplate()) {
-    FunctionTemplateDecl *PrevFunTmpl 
+    FunctionTemplateDecl *PrevFunTmpl
       = PrevDecl? PrevDecl->getDescribedFunctionTemplate() : 0;
     assert((!PrevDecl || PrevFunTmpl) && "Function/function template mismatch");
     FunTmpl->setPreviousDeclaration(PrevFunTmpl);
@@ -612,7 +612,7 @@
 }
 
 FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const {
-  if (FunctionTemplateSpecializationInfo *Info 
+  if (FunctionTemplateSpecializationInfo *Info
         = TemplateOrSpecialization
             .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
     return Info->Template.getPointer();
@@ -622,7 +622,7 @@
 
 const TemplateArgumentList *
 FunctionDecl::getTemplateSpecializationArgs() const {
-  if (FunctionTemplateSpecializationInfo *Info 
+  if (FunctionTemplateSpecializationInfo *Info
       = TemplateOrSpecialization
       .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
     return Info->TemplateArguments;
@@ -630,53 +630,53 @@
   return 0;
 }
 
-void 
+void
 FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context,
                                                 FunctionTemplateDecl *Template,
                                      const TemplateArgumentList *TemplateArgs,
                                                 void *InsertPos) {
-  FunctionTemplateSpecializationInfo *Info 
+  FunctionTemplateSpecializationInfo *Info
     = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
   if (!Info)
     Info = new (Context) FunctionTemplateSpecializationInfo;
-  
+
   Info->Function = this;
   Info->Template.setPointer(Template);
   Info->Template.setInt(TSK_ImplicitInstantiation - 1);
   Info->TemplateArguments = TemplateArgs;
   TemplateOrSpecialization = Info;
-  
+
   // Insert this function template specialization into the set of known
   // function template specialiations.
   Template->getSpecializations().InsertNode(Info, InsertPos);
 }
 
 TemplateSpecializationKind FunctionDecl::getTemplateSpecializationKind() const {
-  // For a function template specialization, query the specialization 
+  // For a function template specialization, query the specialization
   // information object.
-  FunctionTemplateSpecializationInfo *Info 
+  FunctionTemplateSpecializationInfo *Info
     = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
   if (Info)
     return Info->getTemplateSpecializationKind();
-  
+
   if (!getInstantiatedFromMemberFunction())
     return TSK_Undeclared;
-  
+
   // Find the class template specialization corresponding to this instantiation
   // of a member function.
   const DeclContext *Parent = getDeclContext();
   while (Parent && !isa<ClassTemplateSpecializationDecl>(Parent))
     Parent = Parent->getParent();
-  
+
   if (!Parent)
     return TSK_Undeclared;
 
   return cast<ClassTemplateSpecializationDecl>(Parent)->getSpecializationKind();
 }
 
-void 
+void
 FunctionDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
-  FunctionTemplateSpecializationInfo *Info 
+  FunctionTemplateSpecializationInfo *Info
     = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
   assert(Info && "Not a function template specialization");
   Info->setTemplateSpecializationKind(TSK);
@@ -714,12 +714,12 @@
 TagDecl* TagDecl::getDefinition(ASTContext& C) const {
   if (isDefinition())
     return const_cast<TagDecl *>(this);
-  
-  for (redecl_iterator R = redecls_begin(), REnd = redecls_end(); 
+
+  for (redecl_iterator R = redecls_begin(), REnd = redecls_end();
        R != REnd; ++R)
     if (R->isDefinition())
       return *R;
-  
+
   return 0;
 }
 
@@ -750,7 +750,7 @@
 RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC,
                                SourceLocation L, IdentifierInfo *Id,
                                SourceLocation TKL, RecordDecl* PrevDecl) {
-  
+
   RecordDecl* R = new (C) RecordDecl(Record, TK, DC, L, Id, PrevDecl, TKL);
   C.getTypeDeclType(R, PrevDecl);
   return R;
@@ -764,7 +764,7 @@
 }
 
 bool RecordDecl::isInjectedClassName() const {
-  return isImplicit() && getDeclName() && getDeclContext()->isRecord() && 
+  return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
     cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName();
 }
 
@@ -788,15 +788,15 @@
 
   for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
     (*I)->Destroy(C);
-  
-  C.Deallocate(ParamInfo);    
+
+  C.Deallocate(ParamInfo);
   Decl::Destroy(C);
 }
 
 void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
                           unsigned NParms) {
   assert(ParamInfo == 0 && "Already has param info!");
-  
+
   // Zero params -> null pointer.
   if (NParms) {
     NumParams = NParms;

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

==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Wed Sep  9 10:08:12 2009
@@ -62,12 +62,12 @@
 
 void Decl::PrintStats() {
   fprintf(stderr, "*** Decl Stats:\n");
-  
+
   int totalDecls = 0;
 #define DECL(Derived, Base) totalDecls += n##Derived##s;
 #include "clang/AST/DeclNodes.def"
   fprintf(stderr, "  %d decls total.\n", totalDecls);
- 
+
   int totalBytes = 0;
 #define DECL(Derived, Base)                                             \
   if (n##Derived##s > 0) {                                              \
@@ -77,7 +77,7 @@
             (int)(n##Derived##s * sizeof(Derived##Decl)));              \
   }
 #include "clang/AST/DeclNodes.def"
-  
+
   fprintf(stderr, "Total bytes = %d\n", totalBytes);
 }
 
@@ -92,26 +92,26 @@
 bool Decl::isTemplateParameterPack() const {
   if (const TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(this))
     return TTP->isParameterPack();
-  
+
   return false;
 }
 
 bool Decl::isFunctionOrFunctionTemplate() const {
   if (const UsingDecl *UD = dyn_cast<UsingDecl>(this))
     return UD->getTargetDecl()->isFunctionOrFunctionTemplate();
-    
+
   return isa<FunctionDecl>(this) || isa<FunctionTemplateDecl>(this);
 }
 
 //===----------------------------------------------------------------------===//
 // PrettyStackTraceDecl Implementation
 //===----------------------------------------------------------------------===//
-  
+
 void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const {
   SourceLocation TheLoc = Loc;
   if (TheLoc.isInvalid() && TheDecl)
     TheLoc = TheDecl->getLocation();
-  
+
   if (TheLoc.isValid()) {
     TheLoc.print(OS, SM);
     OS << ": ";
@@ -123,7 +123,7 @@
     OS << " '" << DN->getQualifiedNameAsString() << '\'';
   OS << '\n';
 }
-  
+
 //===----------------------------------------------------------------------===//
 // Decl Implementation
 //===----------------------------------------------------------------------===//
@@ -132,14 +132,14 @@
 Decl::~Decl() {
   if (isOutOfSemaDC())
     delete getMultipleDC();
-  
+
   assert(!HasAttrs && "attributes should have been freed by Destroy");
 }
 
 void Decl::setDeclContext(DeclContext *DC) {
   if (isOutOfSemaDC())
     delete getMultipleDC();
-  
+
   DeclCtx = DC;
 }
 
@@ -163,22 +163,22 @@
 
   DeclContext *DC = getDeclContext();
   assert(DC && "This decl is not contained in a translation unit!");
- 
+
   while (!DC->isTranslationUnit()) {
     DC = DC->getParent();
     assert(DC && "This decl is not contained in a translation unit!");
   }
-  
+
   return cast<TranslationUnitDecl>(DC);
 }
 
 ASTContext &Decl::getASTContext() const {
-  return getTranslationUnitDecl()->getASTContext();  
+  return getTranslationUnitDecl()->getASTContext();
 }
 
 unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
   switch (DeclKind) {
-    default: 
+    default:
       if (DeclKind >= FunctionFirst && DeclKind <= FunctionLast)
         return IDNS_Ordinary;
       assert(0 && "Unknown decl kind!");
@@ -202,7 +202,7 @@
 
     case ObjCProtocol:
       return IDNS_ObjCProtocol;
-      
+
     case ObjCImplementation:
       return IDNS_ObjCImplementation;
 
@@ -213,13 +213,13 @@
     case ObjCAtDefsField:
     case ObjCIvar:
       return IDNS_Member;
-      
+
     case Record:
     case CXXRecord:
     case Enum:
     case TemplateTypeParm:
       return IDNS_Tag;
-      
+
     case Namespace:
     case Template:
     case FunctionTemplate:
@@ -227,7 +227,7 @@
     case TemplateTemplateParm:
     case NamespaceAlias:
       return IDNS_Tag | IDNS_Ordinary;
-    
+
     // Never have names.
     case Friend:
     case LinkageSpec:
@@ -252,41 +252,41 @@
 
   NewAttr->setNext(ExistingAttr);
   ExistingAttr = NewAttr;
-  
+
   HasAttrs = true;
 }
 
 void Decl::invalidateAttrs() {
   if (!HasAttrs) return;
-  
+
   HasAttrs = false;
   getASTContext().eraseDeclAttrs(this);
 }
 
 const Attr *Decl::getAttrsImpl() const {
-  assert(HasAttrs && "getAttrs() should verify this!"); 
+  assert(HasAttrs && "getAttrs() should verify this!");
   return getASTContext().getDeclAttrs(this);
 }
 
 void Decl::swapAttrs(Decl *RHS) {
   bool HasLHSAttr = this->HasAttrs;
   bool HasRHSAttr = RHS->HasAttrs;
-  
+
   // Usually, neither decl has attrs, nothing to do.
   if (!HasLHSAttr && !HasRHSAttr) return;
-  
+
   // If 'this' has no attrs, swap the other way.
   if (!HasLHSAttr)
     return RHS->swapAttrs(this);
-  
+
   ASTContext &Context = getASTContext();
-  
+
   // Handle the case when both decls have attrs.
   if (HasRHSAttr) {
     std::swap(Context.getDeclAttrs(this), Context.getDeclAttrs(RHS));
     return;
   }
-  
+
   // Otherwise, LHS has an attr and RHS doesn't.
   Context.getDeclAttrs(RHS) = Context.getDeclAttrs(this);
   Context.eraseDeclAttrs(this);
@@ -302,7 +302,7 @@
     invalidateAttrs();
     HasAttrs = false;
   }
-  
+
 #if 0
   // FIXME: Once ownership is fully understood, we can enable this code
   if (DeclContext *DC = dyn_cast<DeclContext>(this))
@@ -311,15 +311,15 @@
   // Observe the unrolled recursion.  By setting N->NextDeclInContext = 0x0
   // within the loop, only the Destroy method for the first Decl
   // will deallocate all of the Decls in a chain.
-  
+
   Decl* N = getNextDeclInContext();
-  
+
   while (N) {
     Decl* Tmp = N->getNextDeclInContext();
     N->NextDeclInContext = 0;
     N->Destroy(C);
     N = Tmp;
-  }  
+  }
 
   this->~Decl();
   C.Deallocate((void *)this);
@@ -384,8 +384,8 @@
   if (isa<TranslationUnitDecl>(this) ||
       !isa<CXXRecordDecl>(getDeclContext()))
     return;
-  
-  assert(Access != AS_none && 
+
+  assert(Access != AS_none &&
          "Access specifier is AS_none inside a record decl");
 }
 
@@ -434,7 +434,7 @@
   if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(this))
     if (Function->getDescribedFunctionTemplate())
       return true;
-  
+
   return getParent() && getParent()->isDependentContext();
 }
 
@@ -454,18 +454,18 @@
 bool DeclContext::Encloses(DeclContext *DC) {
   if (getPrimaryContext() != this)
     return getPrimaryContext()->Encloses(DC);
-  
+
   for (; DC; DC = DC->getParent())
     if (DC->getPrimaryContext() == this)
       return true;
-  return false;  
+  return false;
 }
 
 DeclContext *DeclContext::getPrimaryContext() {
   switch (DeclKind) {
   case Decl::TranslationUnit:
   case Decl::LinkageSpec:
-  case Decl::Block:    
+  case Decl::Block:
     // There is only one DeclContext for these entities.
     return this;
 
@@ -491,7 +491,7 @@
       // If this is a tag type that has a definition or is currently
       // being defined, that definition is our primary context.
       if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAs<TagType>())
-        if (TagT->isBeingDefined() || 
+        if (TagT->isBeingDefined() ||
             (TagT->getDecl() && TagT->getDecl()->isDefinition()))
           return TagT->getDecl();
       return this;
@@ -516,13 +516,13 @@
 
 /// \brief Load the declarations within this lexical storage from an
 /// external source.
-void 
+void
 DeclContext::LoadLexicalDeclsFromExternalStorage() const {
   ExternalASTSource *Source = getParentASTContext().getExternalSource();
   assert(hasExternalLexicalStorage() && Source && "No external storage?");
 
   llvm::SmallVector<uint32_t, 64> Decls;
-  if (Source->ReadDeclsLexicallyInContext(const_cast<DeclContext *>(this), 
+  if (Source->ReadDeclsLexicallyInContext(const_cast<DeclContext *>(this),
                                           Decls))
     return;
 
@@ -554,7 +554,7 @@
     LastDecl = PrevDecl;
 }
 
-void 
+void
 DeclContext::LoadVisibleDeclsFromExternalStorage() const {
   DeclContext *This = const_cast<DeclContext *>(this);
   ExternalASTSource *Source = getParentASTContext().getExternalSource();
@@ -583,14 +583,14 @@
 
   // FIXME: Check whether we need to load some declarations from
   // external storage.
-  return decl_iterator(FirstDecl); 
+  return decl_iterator(FirstDecl);
 }
 
 DeclContext::decl_iterator DeclContext::decls_end() const {
   if (hasExternalLexicalStorage())
     LoadLexicalDeclsFromExternalStorage();
 
-  return decl_iterator(); 
+  return decl_iterator();
 }
 
 bool DeclContext::decls_empty() const {
@@ -603,7 +603,7 @@
 void DeclContext::addHiddenDecl(Decl *D) {
   assert(D->getLexicalDeclContext() == this &&
          "Decl inserted into wrong lexical context");
-  assert(!D->getNextDeclInContext() && D != LastDecl && 
+  assert(!D->getNextDeclInContext() && D != LastDecl &&
          "Decl already inserted into a DeclContext");
 
   if (FirstDecl) {
@@ -626,8 +626,8 @@
 /// transparent contexts nested within it).
 void DeclContext::buildLookup(DeclContext *DCtx) {
   for (; DCtx; DCtx = DCtx->getNextContext()) {
-    for (decl_iterator D = DCtx->decls_begin(), 
-                    DEnd = DCtx->decls_end(); 
+    for (decl_iterator D = DCtx->decls_begin(),
+                    DEnd = DCtx->decls_end();
          D != DEnd; ++D) {
       // Insert this declaration into the lookup structure, but only
       // if it's semantically in its decl context.  During non-lazy
@@ -645,7 +645,7 @@
   }
 }
 
-DeclContext::lookup_result 
+DeclContext::lookup_result
 DeclContext::lookup(DeclarationName Name) {
   DeclContext *PrimaryContext = getPrimaryContext();
   if (PrimaryContext != this)
@@ -671,7 +671,7 @@
   return Pos->second.getLookupResult(getParentASTContext());
 }
 
-DeclContext::lookup_const_result 
+DeclContext::lookup_const_result
 DeclContext::lookup(DeclarationName Name) const {
   return const_cast<DeclContext*>(this)->lookup(Name);
 }
@@ -744,14 +744,14 @@
   // one, just replace it and return.
   if (DeclNameEntries.HandleRedeclaration(getParentASTContext(), D))
     return;
-  
+
   // Put this declaration into the appropriate slot.
   DeclNameEntries.AddSubsequentDecl(D);
 }
 
 /// Returns iterator range [First, Last) of UsingDirectiveDecls stored within
 /// this context.
-DeclContext::udir_iterator_range 
+DeclContext::udir_iterator_range
 DeclContext::getUsingDirectives() const {
   lookup_const_result Result = lookup(UsingDirectiveDecl::getName());
   return udir_iterator_range(reinterpret_cast<udir_iterator>(Result.first),

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

==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Sep  9 10:08:12 2009
@@ -26,7 +26,7 @@
 CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
                              SourceLocation L, IdentifierInfo *Id,
                              CXXRecordDecl *PrevDecl,
-                             SourceLocation TKL) 
+                             SourceLocation TKL)
   : RecordDecl(K, TK, DC, L, Id, PrevDecl, TKL),
     UserDeclaredConstructor(false), UserDeclaredCopyConstructor(false),
     UserDeclaredCopyAssignment(false), UserDeclaredDestructor(false),
@@ -42,12 +42,12 @@
                                      SourceLocation TKL,
                                      CXXRecordDecl* PrevDecl,
                                      bool DelayTypeCreation) {
-  CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id, 
+  CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id,
                                            PrevDecl, TKL);
-  
+
   // FIXME: DelayTypeCreation seems like such a hack
   if (!DelayTypeCreation)
-    C.getTypeDeclType(R, PrevDecl);  
+    C.getTypeDeclType(R, PrevDecl);
   return R;
 }
 
@@ -60,22 +60,22 @@
   this->RecordDecl::Destroy(C);
 }
 
-void 
+void
 CXXRecordDecl::setBases(ASTContext &C,
-                        CXXBaseSpecifier const * const *Bases, 
+                        CXXBaseSpecifier const * const *Bases,
                         unsigned NumBases) {
-  // C++ [dcl.init.aggr]p1: 
+  // C++ [dcl.init.aggr]p1:
   //   An aggregate is an array or a class (clause 9) with [...]
   //   no base classes [...].
   Aggregate = false;
 
   if (this->Bases)
     C.Deallocate(this->Bases);
-  
+
   int vbaseCount = 0;
   llvm::SmallVector<const CXXBaseSpecifier*, 8> UniqueVbases;
   bool hasDirectVirtualBase = false;
-  
+
   this->Bases = new(C) CXXBaseSpecifier [NumBases];
   this->NumBases = NumBases;
   for (unsigned i = 0; i < NumBases; ++i) {
@@ -83,7 +83,7 @@
     // Keep track of inherited vbases for this base class.
     const CXXBaseSpecifier *Base = Bases[i];
     QualType BaseType = Base->getType();
-    // Skip template types. 
+    // Skip template types.
     // FIXME. This means that this list must be rebuilt during template
     // instantiation.
     if (BaseType->isDependentType())
@@ -92,10 +92,10 @@
       = cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
     if (Base->isVirtual())
       hasDirectVirtualBase = true;
-    for (CXXRecordDecl::base_class_iterator VBase = 
+    for (CXXRecordDecl::base_class_iterator VBase =
           BaseClassDecl->vbases_begin(),
          E = BaseClassDecl->vbases_end(); VBase != E; ++VBase) {
-      // Add this vbase to the array of vbases for current class if it is 
+      // Add this vbase to the array of vbases for current class if it is
       // not already in the list.
       // FIXME. Note that we do a linear search as number of such classes are
       // very few.
@@ -134,7 +134,7 @@
       QualType QT = UniqueVbases[i]->getType();
       CXXRecordDecl *VBaseClassDecl
         = cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl());
-      this->VBases[i] = 
+      this->VBases[i] =
         CXXBaseSpecifier(VBaseClassDecl->getSourceRange(), true,
                          VBaseClassDecl->getTagKind() == RecordDecl::TK_class,
                          UniqueVbases[i]->getAccessSpecifier(), QT);
@@ -146,11 +146,11 @@
   return getCopyConstructor(Context, QualType::Const) != 0;
 }
 
-CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context, 
+CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
                                                       unsigned TypeQuals) const{
   QualType ClassType
     = Context.getTypeDeclType(const_cast<CXXRecordDecl*>(this));
-  DeclarationName ConstructorName 
+  DeclarationName ConstructorName
     = Context.DeclarationNames.getCXXConstructorName(
                                           Context.getCanonicalType(ClassType));
   unsigned FoundTQs;
@@ -162,12 +162,12 @@
     if (isa<FunctionTemplateDecl>(*Con))
       continue;
 
-    if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, 
+    if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
                                                           FoundTQs)) {
       if (((TypeQuals & QualType::Const) == (FoundTQs & QualType::Const)) ||
           (!(TypeQuals & QualType::Const) && (FoundTQs & QualType::Const)))
         return cast<CXXConstructorDecl>(*Con);
-      
+
     }
   }
   return 0;
@@ -217,13 +217,13 @@
 }
 
 void
-CXXRecordDecl::addedConstructor(ASTContext &Context, 
+CXXRecordDecl::addedConstructor(ASTContext &Context,
                                 CXXConstructorDecl *ConDecl) {
   assert(!ConDecl->isImplicit() && "addedConstructor - not for implicit decl");
   // Note that we have a user-declared constructor.
   UserDeclaredConstructor = true;
 
-  // C++ [dcl.init.aggr]p1: 
+  // C++ [dcl.init.aggr]p1:
   //   An aggregate is an array or a class (clause 9) with no
   //   user-declared constructors (12.1) [...].
   Aggregate = false;
@@ -237,7 +237,7 @@
   //   constructor.
   // FIXME: C++0x: don't do this for "= default" default constructors.
   HasTrivialConstructor = false;
-    
+
   // Note when we have a user-declared copy constructor, which will
   // suppress the implicit declaration of a copy constructor.
   if (ConDecl->isCopyConstructor(Context)) {
@@ -282,14 +282,14 @@
   PlainOldData = false;
 }
 
-void CXXRecordDecl::addConversionFunction(ASTContext &Context, 
+void CXXRecordDecl::addConversionFunction(ASTContext &Context,
                                           CXXConversionDecl *ConvDecl) {
   assert(!ConvDecl->getDescribedFunctionTemplate() &&
          "Conversion function templates should cast to FunctionTemplateDecl.");
   Conversions.addOverload(ConvDecl);
 }
 
-void CXXRecordDecl::addConversionFunction(ASTContext &Context, 
+void CXXRecordDecl::addConversionFunction(ASTContext &Context,
                                           FunctionTemplateDecl *ConvDecl) {
   assert(isa<CXXConversionDecl>(ConvDecl->getTemplatedDecl()) &&
          "Function template is not a conversion function template");
@@ -302,7 +302,7 @@
   DeclarationName ConstructorName
     = Context.DeclarationNames.getCXXConstructorName(
                       Context.getCanonicalType(ClassType.getUnqualifiedType()));
-  
+
   DeclContext::lookup_const_iterator Con, ConEnd;
   for (llvm::tie(Con, ConEnd) = lookup(ConstructorName);
        Con != ConEnd; ++Con) {
@@ -320,18 +320,18 @@
 const CXXDestructorDecl *
 CXXRecordDecl::getDestructor(ASTContext &Context) {
   QualType ClassType = Context.getTypeDeclType(this);
-  
-  DeclarationName Name 
+
+  DeclarationName Name
     = Context.DeclarationNames.getCXXDestructorName(
                                           Context.getCanonicalType(ClassType));
 
   DeclContext::lookup_iterator I, E;
-  llvm::tie(I, E) = lookup(Name); 
+  llvm::tie(I, E) = lookup(Name);
   assert(I != E && "Did not find a destructor!");
-  
+
   const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(*I);
   assert(++I == E && "Found more than one destructor!");
-  
+
   return Dtor;
 }
 
@@ -345,8 +345,8 @@
 }
 
 
-typedef llvm::DenseMap<const CXXMethodDecl*, 
-                       std::vector<const CXXMethodDecl *> *> 
+typedef llvm::DenseMap<const CXXMethodDecl*,
+                       std::vector<const CXXMethodDecl *> *>
                        OverriddenMethodsMapTy;
 
 // FIXME: We hate static data.  This doesn't survive PCH saving/loading, and
@@ -355,21 +355,21 @@
 
 void CXXMethodDecl::addOverriddenMethod(const CXXMethodDecl *MD) {
   // FIXME: The CXXMethodDecl dtor needs to remove and free the entry.
-  
+
   if (!OverriddenMethods)
     OverriddenMethods = new OverriddenMethodsMapTy();
-  
+
   std::vector<const CXXMethodDecl *> *&Methods = (*OverriddenMethods)[this];
   if (!Methods)
     Methods = new std::vector<const CXXMethodDecl *>;
-  
+
   Methods->push_back(MD);
 }
 
 CXXMethodDecl::method_iterator CXXMethodDecl::begin_overridden_methods() const {
   if (!OverriddenMethods)
     return 0;
-  
+
   OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
   if (it == OverriddenMethods->end() || it->second->empty())
     return 0;
@@ -380,7 +380,7 @@
 CXXMethodDecl::method_iterator CXXMethodDecl::end_overridden_methods() const {
   if (!OverriddenMethods)
     return 0;
-  
+
   OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
   if (it == OverriddenMethods->end() || it->second->empty())
     return 0;
@@ -409,12 +409,12 @@
 CXXBaseOrMemberInitializer::
 CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
                            CXXConstructorDecl *C,
-                           SourceLocation L, SourceLocation R) 
+                           SourceLocation L, SourceLocation R)
   : Args(0), NumArgs(0), CtorOrAnonUnion(), IdLoc(L), RParenLoc(R) {
   BaseOrMember = reinterpret_cast<uintptr_t>(BaseType.getTypePtr());
   assert((BaseOrMember & 0x01) == 0 && "Invalid base class type pointer");
   BaseOrMember |= 0x01;
-  
+
   if (NumArgs > 0) {
     this->NumArgs = NumArgs;
     // FIXME. Allocation via Context
@@ -431,7 +431,7 @@
                            SourceLocation L, SourceLocation R)
   : Args(0), NumArgs(0), CtorOrAnonUnion(), IdLoc(L), RParenLoc(R) {
   BaseOrMember = reinterpret_cast<uintptr_t>(Member);
-  assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");  
+  assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
 
   if (NumArgs > 0) {
     this->NumArgs = NumArgs;
@@ -466,8 +466,8 @@
          (getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
 }
 
-bool 
-CXXConstructorDecl::isCopyConstructor(ASTContext &Context, 
+bool
+CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
                                       unsigned &TypeQuals) const {
   // C++ [class.copy]p2:
   //   A non-template constructor for class X is a copy constructor
@@ -508,7 +508,7 @@
   if (isExplicit() && !AllowExplicit)
     return false;
 
-  return (getNumParams() == 0 && 
+  return (getNumParams() == 0 &&
           getType()->getAsFunctionProtoType()->isVariadic()) ||
          (getNumParams() == 1) ||
          (getNumParams() > 1 && getParamDecl(1)->hasDefaultArg());
@@ -517,11 +517,11 @@
 CXXDestructorDecl *
 CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
                           SourceLocation L, DeclarationName N,
-                          QualType T, bool isInline, 
+                          QualType T, bool isInline,
                           bool isImplicitlyDeclared) {
   assert(N.getNameKind() == DeclarationName::CXXDestructorName &&
          "Name must refer to a destructor");
-  return new (C) CXXDestructorDecl(RD, L, N, T, isInline, 
+  return new (C) CXXDestructorDecl(RD, L, N, T, isInline,
                                    isImplicitlyDeclared);
 }
 
@@ -556,7 +556,7 @@
 OverloadIterator::OverloadIterator(NamedDecl *ND) : D(0) {
   if (!ND)
     return;
-  
+
   if (isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND))
     D = ND;
   else if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(ND)) {
@@ -575,10 +575,10 @@
 OverloadIterator::reference OverloadIterator::operator*() const {
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
     return FD;
-  
+
   if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D))
     return FTD;
-  
+
   assert(isa<OverloadedFunctionDecl>(D));
   return *Iter;
 }
@@ -588,20 +588,20 @@
     D = 0;
     return *this;
   }
-  
+
   if (++Iter == cast<OverloadedFunctionDecl>(D)->function_end())
     D = 0;
-  
+
   return *this;
 }
 
 bool OverloadIterator::Equals(const OverloadIterator &Other) const {
   if (!D || !Other.D)
     return D == Other.D;
-  
+
   if (D != Other.D)
     return false;
-  
+
   return !isa<OverloadedFunctionDecl>(D) || Iter == Other.Iter;
 }
 
@@ -621,10 +621,10 @@
 #endif
 
   return new (C) FriendDecl(DC, L, Friend, FriendL);
-}                                               
+}
 
 LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
-                                         DeclContext *DC, 
+                                         DeclContext *DC,
                                          SourceLocation L,
                                          LanguageIDs Lang, bool Braces) {
   return new (C) LinkageSpecDecl(DC, L, Lang, Braces);
@@ -638,19 +638,19 @@
                                                SourceLocation IdentLoc,
                                                NamespaceDecl *Used,
                                                DeclContext *CommonAncestor) {
-  return new (C) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierRange, 
+  return new (C) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierRange,
                                     Qualifier, IdentLoc, Used, CommonAncestor);
 }
 
-NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC, 
-                                               SourceLocation L, 
-                                               SourceLocation AliasLoc, 
-                                               IdentifierInfo *Alias, 
+NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC,
+                                               SourceLocation L,
+                                               SourceLocation AliasLoc,
+                                               IdentifierInfo *Alias,
                                                SourceRange QualifierRange,
                                                NestedNameSpecifier *Qualifier,
-                                               SourceLocation IdentLoc, 
+                                               SourceLocation IdentLoc,
                                                NamedDecl *Namespace) {
-  return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, QualifierRange, 
+  return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, QualifierRange,
                                     Qualifier, IdentLoc, Namespace);
 }
 

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

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Sep  9 10:08:12 2009
@@ -30,8 +30,8 @@
 void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) {
   assert(List == 0 && "Elements already set!");
   if (Elts == 0) return;  // Setting to an empty list is a noop.
-  
-  
+
+
   List = new (Ctx) void*[Elts];
   NumElts = Elts;
   memcpy(List, InList, sizeof(void*)*Elts);
@@ -83,15 +83,15 @@
   for (prop_iterator I = prop_begin(), E = prop_end(); I != E; ++I)
     if ((*I)->getIdentifier() == PropertyId)
       return *I;
-  
+
   const ObjCProtocolDecl *PID = dyn_cast<ObjCProtocolDecl>(this);
   if (PID) {
-    for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(), 
+    for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(),
          E = PID->protocol_end(); I != E; ++I)
       if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId))
         return P;
   }
-  
+
   if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this)) {
     // Look through categories.
     for (ObjCCategoryDecl *Category = OID->getCategoryList();
@@ -151,11 +151,11 @@
                                                 bool isInstance) const {
   const ObjCInterfaceDecl* ClassDecl = this;
   ObjCMethodDecl *MethodDecl = 0;
-  
+
   while (ClassDecl != NULL) {
     if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance)))
       return MethodDecl;
-      
+
     // Didn't find one yet - look through protocols.
     const ObjCList<ObjCProtocolDecl> &Protocols =
       ClassDecl->getReferencedProtocols();
@@ -163,13 +163,13 @@
          E = Protocols.end(); I != E; ++I)
       if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
         return MethodDecl;
-    
+
     // Didn't find one yet - now look through categories.
     ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList();
     while (CatDecl) {
       if ((MethodDecl = CatDecl->getMethod(Sel, isInstance)))
         return MethodDecl;
-        
+
       // Didn't find one yet - look through protocols.
       const ObjCList<ObjCProtocolDecl> &Protocols =
         CatDecl->getReferencedProtocols();
@@ -191,7 +191,7 @@
 //===----------------------------------------------------------------------===//
 
 ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
-                                       SourceLocation beginLoc, 
+                                       SourceLocation beginLoc,
                                        SourceLocation endLoc,
                                        Selector SelInfo, QualType T,
                                        DeclContext *contextDecl,
@@ -201,14 +201,14 @@
                                        ImplementationControl impControl) {
   return new (C) ObjCMethodDecl(beginLoc, endLoc,
                                   SelInfo, T, contextDecl,
-                                  isInstance, 
+                                  isInstance,
                                   isVariadic, isSynthesized, impControl);
 }
 
 void ObjCMethodDecl::Destroy(ASTContext &C) {
   if (Body) Body->Destroy(C);
   if (SelfDecl) SelfDecl->Destroy(C);
-  
+
   for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
     if (*I) (*I)->Destroy(C);
 
@@ -267,7 +267,7 @@
   return this;
 }
 
-void ObjCMethodDecl::createImplicitParams(ASTContext &Context, 
+void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
                                           const ObjCInterfaceDecl *OID) {
   QualType selfTy;
   if (isInstanceMethod()) {
@@ -282,11 +282,11 @@
   } else // we have a factory method.
     selfTy = Context.getObjCClassType();
 
-  setSelfDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(), 
+  setSelfDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
                                         &Context.Idents.get("self"), selfTy));
 
-  setCmdDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(), 
-                                       &Context.Idents.get("_cmd"), 
+  setCmdDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
+                                       &Context.Idents.get("_cmd"),
                                        Context.getObjCSelType()));
 }
 
@@ -310,7 +310,7 @@
 ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
                                              DeclContext *DC,
                                              SourceLocation atLoc,
-                                             IdentifierInfo *Id, 
+                                             IdentifierInfo *Id,
                                              SourceLocation ClassLoc,
                                              bool ForwardDecl, bool isInternal){
   return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, ForwardDecl,
@@ -326,13 +326,13 @@
     ClassLoc(CLoc) {
 }
 
-void ObjCInterfaceDecl::Destroy(ASTContext &C) {  
+void ObjCInterfaceDecl::Destroy(ASTContext &C) {
   for (ivar_iterator I = ivar_begin(), E = ivar_end(); I != E; ++I)
     if (*I) (*I)->Destroy(C);
-  
+
   IVars.Destroy(C);
   // FIXME: CategoryList?
-  
+
   // FIXME: Because there is no clear ownership
   //  role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
   //  reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
@@ -391,7 +391,7 @@
   // 1st, look up the class.
   const ObjCList<ObjCProtocolDecl> &Protocols =
   IDecl->getReferencedProtocols();
-  
+
   for (ObjCList<ObjCProtocolDecl>::iterator PI = Protocols.begin(),
        E = Protocols.end(); PI != E; ++PI) {
     if (getASTContext().ProtocolCompatibleWithProtocol(lProto, *PI))
@@ -402,11 +402,11 @@
     // object. This IMO, should be a bug.
     // FIXME: Treat this as an extension, and flag this as an error when GCC
     // extensions are not enabled.
-    if (RHSIsQualifiedID && 
+    if (RHSIsQualifiedID &&
         getASTContext().ProtocolCompatibleWithProtocol(*PI, lProto))
       return true;
   }
-  
+
   // 2nd, look up the category.
   if (lookupCategory)
     for (ObjCCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl;
@@ -416,13 +416,13 @@
         if (getASTContext().ProtocolCompatibleWithProtocol(lProto, *PI))
           return true;
     }
-  
+
   // 3rd, look up the super class(s)
   if (IDecl->getSuperClass())
     return
   IDecl->getSuperClass()->ClassImplementsProtocol(lProto, lookupCategory,
                                                   RHSIsQualifiedID);
-  
+
   return false;
 }
 
@@ -451,7 +451,7 @@
 
 void ObjCAtDefsFieldDecl::Destroy(ASTContext& C) {
   this->~ObjCAtDefsFieldDecl();
-  C.Deallocate((void *)this); 
+  C.Deallocate((void *)this);
 }
 
 //===----------------------------------------------------------------------===//
@@ -459,7 +459,7 @@
 //===----------------------------------------------------------------------===//
 
 ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
-                                           SourceLocation L, 
+                                           SourceLocation L,
                                            IdentifierInfo *Id) {
   return new (C) ObjCProtocolDecl(DC, L, Id);
 }
@@ -478,7 +478,7 @@
   for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I)
     if ((PDecl = (*I)->lookupProtocolNamed(Name)))
       return PDecl;
-      
+
   return NULL;
 }
 
@@ -487,10 +487,10 @@
 ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel,
                                                bool isInstance) const {
   ObjCMethodDecl *MethodDecl = NULL;
-  
+
   if ((MethodDecl = getMethod(Sel, isInstance)))
     return MethodDecl;
-  
+
   for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I)
     if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
       return MethodDecl;
@@ -501,7 +501,7 @@
 // ObjCClassDecl
 //===----------------------------------------------------------------------===//
 
-ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L, 
+ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L,
                              ObjCInterfaceDecl *const *Elts, unsigned nElts,
                              ASTContext &C)
   : Decl(ObjCClass, DC, L) {
@@ -517,7 +517,7 @@
 }
 
 void ObjCClassDecl::Destroy(ASTContext &C) {
-  
+
   // FIXME: There is no clear ownership policy now for referenced
   //  ObjCInterfaceDecls.  Some of them can be forward declarations that
   //  are never later defined (in which case the ObjCClassDecl owns them)
@@ -525,7 +525,7 @@
   //  we should have separate objects for forward declarations and definitions,
   //  obviating this problem.  Because of this situation, referenced
   //  ObjCInterfaceDecls are destroyed in ~TranslationUnit.
-  
+
   ForwardDecls.Destroy(C);
   Decl::Destroy(C);
 }
@@ -538,14 +538,14 @@
 ObjCForwardProtocolDecl(DeclContext *DC, SourceLocation L,
                         ObjCProtocolDecl *const *Elts, unsigned nElts,
                         ASTContext &C)
-: Decl(ObjCForwardProtocol, DC, L) { 
+: Decl(ObjCForwardProtocol, DC, L) {
   ReferencedProtocols.set(Elts, nElts, C);
 }
 
 
 ObjCForwardProtocolDecl *
 ObjCForwardProtocolDecl::Create(ASTContext &C, DeclContext *DC,
-                                SourceLocation L, 
+                                SourceLocation L,
                                 ObjCProtocolDecl *const *Elts,
                                 unsigned NumElts) {
   return new (C) ObjCForwardProtocolDecl(DC, L, Elts, NumElts, C);
@@ -649,7 +649,7 @@
 //===----------------------------------------------------------------------===//
 
 ObjCImplementationDecl *
-ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC, 
+ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
                                SourceLocation L,
                                ObjCInterfaceDecl *ClassInterface,
                                ObjCInterfaceDecl *SuperDecl) {
@@ -663,7 +663,7 @@
 ObjCCompatibleAliasDecl *
 ObjCCompatibleAliasDecl::Create(ASTContext &C, DeclContext *DC,
                                 SourceLocation L,
-                                IdentifierInfo *Id, 
+                                IdentifierInfo *Id,
                                 ObjCInterfaceDecl* AliasedClass) {
   return new (C) ObjCCompatibleAliasDecl(DC, L, Id, AliasedClass);
 }

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

==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Sep  9 10:08:12 2009
@@ -34,9 +34,9 @@
     void ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls);
 
     void Print(AccessSpecifier AS);
-    
+
   public:
-    DeclPrinter(llvm::raw_ostream &Out, ASTContext &Context, 
+    DeclPrinter(llvm::raw_ostream &Out, ASTContext &Context,
                 const PrintingPolicy &Policy,
                 unsigned Indentation = 0)
       : Out(Out), Context(Context), Policy(Policy), Indentation(Indentation) { }
@@ -186,7 +186,7 @@
 
   bool PrintAccess = isa<CXXRecordDecl>(DC);
   AccessSpecifier CurAS = AS_none;
-  
+
   llvm::SmallVector<Decl*, 2> Decls;
   for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
        D != DEnd; ++D) {
@@ -209,7 +209,7 @@
         CurAS = AS;
       }
     }
-    
+
     // The next bits of code handles stuff like "struct {int x;} a,b"; we're
     // forced to merge the declarations because there's no other way to
     // refer to the struct in question.  This limited merging is safe without
@@ -240,16 +240,16 @@
     }
     this->Indent();
     Visit(*D);
-    
-    // FIXME: Need to be able to tell the DeclPrinter when 
+
+    // FIXME: Need to be able to tell the DeclPrinter when
     const char *Terminator = 0;
-    if (isa<FunctionDecl>(*D) && 
+    if (isa<FunctionDecl>(*D) &&
         cast<FunctionDecl>(*D)->isThisDeclarationADefinition())
       Terminator = 0;
     else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody())
       Terminator = 0;
     else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
-             isa<ObjCImplementationDecl>(*D) || 
+             isa<ObjCImplementationDecl>(*D) ||
              isa<ObjCInterfaceDecl>(*D) ||
              isa<ObjCProtocolDecl>(*D) ||
              isa<ObjCCategoryImplDecl>(*D) ||
@@ -299,7 +299,7 @@
     Out << " ";
     Out << D->getNameAsString();
   }
-  
+
   if (D->isDefinition()) {
     Out << " {\n";
     VisitDeclContext(D);
@@ -315,7 +315,7 @@
   }
 }
 
-void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { 
+void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
   if (!Policy.SuppressSpecifiers) {
     switch (D->getStorageClass()) {
     case FunctionDecl::None: break;
@@ -346,7 +346,7 @@
         if (i) POut << ", ";
         ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
       }
-    
+
       if (FT->isVariadic()) {
         if (D->getNumParams()) POut << ", ";
         POut << "...";
@@ -367,29 +367,29 @@
         Proto += " : ";
         Out << Proto;
         Proto.clear();
-        for (CXXConstructorDecl::init_const_iterator B = CDecl->init_begin(), 
+        for (CXXConstructorDecl::init_const_iterator B = CDecl->init_begin(),
              E = CDecl->init_end();
              B != E; ++B) {
           CXXBaseOrMemberInitializer * BMInitializer = (*B);
           if (B != CDecl->init_begin())
             Out << ", ";
-          bool hasArguments = (BMInitializer->arg_begin() != 
+          bool hasArguments = (BMInitializer->arg_begin() !=
                                BMInitializer->arg_end());
           if (BMInitializer->isMemberInitializer()) {
             FieldDecl *FD = BMInitializer->getMember();
             Out <<  FD->getNameAsString();
           }
           else // FIXME. skip dependent types for now.
-            if (const RecordType *RT = 
+            if (const RecordType *RT =
                 BMInitializer->getBaseClass()->getAs<RecordType>()) {
-              const CXXRecordDecl *BaseDecl = 
+              const CXXRecordDecl *BaseDecl =
                 cast<CXXRecordDecl>(RT->getDecl());
               Out << BaseDecl->getNameAsString();
           }
           if (hasArguments) {
             Out << "(";
-            for (CXXBaseOrMemberInitializer::const_arg_iterator BE = 
-                 BMInitializer->const_arg_begin(), 
+            for (CXXBaseOrMemberInitializer::const_arg_iterator BE =
+                 BMInitializer->const_arg_begin(),
                  EE =  BMInitializer->const_arg_end(); BE != EE; ++BE) {
               if (BE != BMInitializer->const_arg_begin())
                 Out<< ", ";
@@ -407,7 +407,7 @@
         // List order of base/member destruction for visualization purposes.
         assert (D->isThisDeclarationADefinition() && "Destructor with dtor-list");
         Proto += "/* : ";
-        for (CXXDestructorDecl::destr_const_iterator *B = DDecl->destr_begin(), 
+        for (CXXDestructorDecl::destr_const_iterator *B = DDecl->destr_begin(),
              *E = DDecl->destr_end();
              B != E; ++B) {
           uintptr_t BaseOrMember = (*B);
@@ -420,10 +420,10 @@
             Proto += FD->getNameAsString();
           }
           else // FIXME. skip dependent types for now.
-            if (const RecordType *RT = 
+            if (const RecordType *RT =
                   DDecl->getAnyBaseClassToDestroy(BaseOrMember)
                     ->getAs<RecordType>()) {
-              const CXXRecordDecl *BaseDecl = 
+              const CXXRecordDecl *BaseDecl =
                 cast<CXXRecordDecl>(RT->getDecl());
               Proto += "~";
               Proto += BaseDecl->getNameAsString();
@@ -522,7 +522,7 @@
 // C++ declarations
 //----------------------------------------------------------------------------
 void DeclPrinter::VisitOverloadedFunctionDecl(OverloadedFunctionDecl *D) {
-  assert(false && 
+  assert(false &&
          "OverloadedFunctionDecls aren't really decls and are never printed");
 }
 
@@ -552,14 +552,13 @@
     Out << " ";
     Out << D->getNameAsString();
   }
-  
+
   if (D->isDefinition()) {
     // Print the base classes
     if (D->getNumBases()) {
       Out << " : ";
-      for(CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
-                                          BaseEnd = D->bases_end();
-          Base != BaseEnd; ++Base) {
+      for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
+             BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) {
         if (Base != D->bases_begin())
           Out << ", ";
 
@@ -578,7 +577,7 @@
     Out << " {\n";
     VisitDeclContext(D);
     Indent() << "}";
-  }  
+  }
 }
 
 void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
@@ -602,17 +601,17 @@
 
 void DeclPrinter::VisitTemplateDecl(TemplateDecl *D) {
   Out << "template <";
-  
+
   TemplateParameterList *Params = D->getTemplateParameters();
   for (unsigned i = 0, e = Params->size(); i != e; ++i) {
     if (i != 0)
       Out << ", ";
-    
+
     const Decl *Param = Params->getParam(i);
-    if (const TemplateTypeParmDecl *TTP = 
+    if (const TemplateTypeParmDecl *TTP =
           dyn_cast<TemplateTypeParmDecl>(Param)) {
-      
-      QualType ParamType = 
+
+      QualType ParamType =
         Context.getTypeDeclType(const_cast<TemplateTypeParmDecl*>(TTP));
 
       if (TTP->wasDeclaredWithTypename())
@@ -622,14 +621,14 @@
 
       if (TTP->isParameterPack())
         Out << "... ";
-      
+
       Out << ParamType.getAsString(Policy);
 
       if (TTP->hasDefaultArgument()) {
         Out << " = ";
         Out << TTP->getDefaultArgument().getAsString(Policy);
       };
-    } else if (const NonTypeTemplateParmDecl *NTTP = 
+    } else if (const NonTypeTemplateParmDecl *NTTP =
                  dyn_cast<NonTypeTemplateParmDecl>(Param)) {
       Out << NTTP->getType().getAsString(Policy);
 
@@ -637,15 +636,15 @@
         Out << ' ';
         Out << Name->getName();
       }
-      
+
       if (NTTP->hasDefaultArgument()) {
         Out << " = ";
-        NTTP->getDefaultArgument()->printPretty(Out, Context, 0, Policy, 
+        NTTP->getDefaultArgument()->printPretty(Out, Context, 0, Policy,
                                                 Indentation);
       }
     }
   }
-  
+
   Out << "> ";
 
   Visit(D->getTemplatedDecl());
@@ -667,29 +666,29 @@
 void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
   if (OMD->isInstanceMethod())
     Out << "- ";
-  else 
+  else
     Out << "+ ";
   if (!OMD->getResultType().isNull())
     Out << '(' << OMD->getResultType().getAsString(Policy) << ")";
-  
+
   std::string name = OMD->getSelector().getAsString();
   std::string::size_type pos, lastPos = 0;
   for (ObjCMethodDecl::param_iterator PI = OMD->param_begin(),
        E = OMD->param_end(); PI != E; ++PI) {
-    // FIXME: selector is missing here!    
+    // FIXME: selector is missing here!
     pos = name.find_first_of(":", lastPos);
     Out << " " << name.substr(lastPos, pos - lastPos);
     Out << ":(" << (*PI)->getType().getAsString(Policy) << ")"
-        << (*PI)->getNameAsString(); 
+        << (*PI)->getNameAsString();
     lastPos = pos + 1;
   }
-    
+
   if (OMD->param_begin() == OMD->param_end())
     Out << " " << name;
-    
+
   if (OMD->isVariadic())
       Out << ", ...";
-  
+
   if (OMD->getBody()) {
     Out << ' ';
     OMD->getBody()->printPretty(Out, Context, 0, Policy);
@@ -718,7 +717,7 @@
     Out << "@interface " << I << " : " << SID->getNameAsString();
   else
     Out << "@interface " << I;
-  
+
   // Protocols?
   const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols();
   if (!Protocols.empty()) {
@@ -726,22 +725,22 @@
          E = Protocols.end(); I != E; ++I)
       Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getNameAsString();
   }
-  
+
   if (!Protocols.empty())
     Out << "> ";
-  
+
   if (OID->ivar_size() > 0) {
     Out << "{\n";
     Indentation += Policy.Indentation;
     for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
          E = OID->ivar_end(); I != E; ++I) {
       Indent() << (*I)->getType().getAsString(Policy)
-          << ' '  << (*I)->getNameAsString() << ";\n";      
+          << ' '  << (*I)->getNameAsString() << ";\n";
     }
     Indentation -= Policy.Indentation;
     Out << "}\n";
   }
-  
+
   VisitDeclContext(OID, false);
   Out << "@end";
   // FIXME: implement the rest...
@@ -749,7 +748,7 @@
 
 void DeclPrinter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
   Out << "@protocol ";
-  for (ObjCForwardProtocolDecl::protocol_iterator I = D->protocol_begin(), 
+  for (ObjCForwardProtocolDecl::protocol_iterator I = D->protocol_begin(),
          E = D->protocol_end();
        I != E; ++I) {
     if (I != D->protocol_begin()) Out << ", ";
@@ -766,7 +765,7 @@
 void DeclPrinter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
   Out << "@implementation "
       << PID->getClassInterface()->getNameAsString()
-      << '(' << PID->getNameAsString() << ")\n";  
+      << '(' << PID->getNameAsString() << ")\n";
 
   VisitDeclContext(PID, false);
   Out << "@end";
@@ -774,18 +773,18 @@
 }
 
 void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
-  Out << "@interface " 
+  Out << "@interface "
       << PID->getClassInterface()->getNameAsString()
       << '(' << PID->getNameAsString() << ")\n";
   VisitDeclContext(PID, false);
   Out << "@end";
-  
+
   // FIXME: implement the rest...
 }
 
 void DeclPrinter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
-  Out << "@compatibility_alias " << AID->getNameAsString() 
-      << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";  
+  Out << "@compatibility_alias " << AID->getNameAsString()
+      << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
 }
 
 /// PrintObjCPropertyDecl - print a property declaration.
@@ -795,17 +794,17 @@
     Out << "@required\n";
   else if (PDecl->getPropertyImplementation() == ObjCPropertyDecl::Optional)
     Out << "@optional\n";
-  
+
   Out << "@property";
   if (PDecl->getPropertyAttributes() != ObjCPropertyDecl::OBJC_PR_noattr) {
     bool first = true;
     Out << " (";
-    if (PDecl->getPropertyAttributes() & 
+    if (PDecl->getPropertyAttributes() &
         ObjCPropertyDecl::OBJC_PR_readonly) {
       Out << (first ? ' ' : ',') << "readonly";
       first = false;
   }
-      
+
   if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) {
     Out << (first ? ' ' : ',') << "getter = "
         << PDecl->getGetterName().getAsString();
@@ -816,29 +815,29 @@
         << PDecl->getSetterName().getAsString();
     first = false;
   }
-      
+
   if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_assign) {
     Out << (first ? ' ' : ',') << "assign";
     first = false;
   }
-      
+
   if (PDecl->getPropertyAttributes() &
       ObjCPropertyDecl::OBJC_PR_readwrite) {
     Out << (first ? ' ' : ',') << "readwrite";
     first = false;
   }
-      
+
   if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_retain) {
     Out << (first ? ' ' : ',') << "retain";
     first = false;
   }
-      
+
   if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_copy) {
     Out << (first ? ' ' : ',') << "copy";
     first = false;
   }
-      
-  if (PDecl->getPropertyAttributes() & 
+
+  if (PDecl->getPropertyAttributes() &
       ObjCPropertyDecl::OBJC_PR_nonatomic) {
     Out << (first ? ' ' : ',') << "nonatomic";
     first = false;

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

==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Wed Sep  9 10:08:12 2009
@@ -40,26 +40,26 @@
   unsigned Size = sizeof(TemplateParameterList) + sizeof(Decl *) * NumParams;
   unsigned Align = llvm::AlignOf<TemplateParameterList>::Alignment;
   void *Mem = C.Allocate(Size, Align);
-  return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params, 
+  return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
                                          NumParams, RAngleLoc);
 }
 
 unsigned TemplateParameterList::getMinRequiredArguments() const {
   unsigned NumRequiredArgs = size();
-  iterator Param = const_cast<TemplateParameterList *>(this)->end(), 
+  iterator Param = const_cast<TemplateParameterList *>(this)->end(),
       ParamBegin = const_cast<TemplateParameterList *>(this)->begin();
   while (Param != ParamBegin) {
     --Param;
-    
+
     if (!(*Param)->isTemplateParameterPack() &&
-        !(isa<TemplateTypeParmDecl>(*Param) && 
+        !(isa<TemplateTypeParmDecl>(*Param) &&
           cast<TemplateTypeParmDecl>(*Param)->hasDefaultArgument()) &&
         !(isa<NonTypeTemplateParmDecl>(*Param) &&
           cast<NonTypeTemplateParmDecl>(*Param)->hasDefaultArgument()) &&
         !(isa<TemplateTemplateParmDecl>(*Param) &&
           cast<TemplateTemplateParmDecl>(*Param)->hasDefaultArgument()))
       break;
-        
+
     --NumRequiredArgs;
   }
 
@@ -94,7 +94,7 @@
          Spec != SpecEnd; ++Spec)
       C.Deallocate(&*Spec);
   }
-  
+
   Decl::Destroy(C);
 }
 
@@ -110,7 +110,7 @@
   FunctionTemplateDecl *First = this;
   while (First->getPreviousDeclaration())
     First = First->getPreviousDeclaration();
-  
+
   if (First->CommonOrPrev.isNull()) {
     // FIXME: Allocate with the ASTContext
     First->CommonOrPrev = new Common;
@@ -142,7 +142,7 @@
   else
     CommonPtr = new (C) Common;
 
-  return new (C) ClassTemplateDecl(DC, L, Name, Params, Decl, PrevDecl, 
+  return new (C) ClassTemplateDecl(DC, L, Name, Params, Decl, PrevDecl,
                                    CommonPtr);
 }
 
@@ -172,7 +172,7 @@
     if (Context.hasSameType(Context.getTypeDeclType(&*P), T))
       return &*P;
   }
-  
+
   return 0;
 }
 
@@ -188,21 +188,21 @@
   TemplateParameterList *Params = getTemplateParameters();
   llvm::SmallVector<TemplateArgument, 16> TemplateArgs;
   TemplateArgs.reserve(Params->size());
-  for (TemplateParameterList::iterator Param = Params->begin(), 
-                                    ParamEnd = Params->end(); 
+  for (TemplateParameterList::iterator Param = Params->begin(),
+                                    ParamEnd = Params->end();
        Param != ParamEnd; ++Param) {
     if (isa<TemplateTypeParmDecl>(*Param)) {
       QualType ParamType = Context.getTypeDeclType(cast<TypeDecl>(*Param));
-      TemplateArgs.push_back(TemplateArgument((*Param)->getLocation(), 
+      TemplateArgs.push_back(TemplateArgument((*Param)->getLocation(),
                                               ParamType));
-    } else if (NonTypeTemplateParmDecl *NTTP = 
+    } else if (NonTypeTemplateParmDecl *NTTP =
                  dyn_cast<NonTypeTemplateParmDecl>(*Param)) {
       Expr *E = new (Context) DeclRefExpr(NTTP, NTTP->getType(),
                                           NTTP->getLocation(),
                                           NTTP->getType()->isDependentType(),
                                           /*Value-dependent=*/true);
       TemplateArgs.push_back(TemplateArgument(E));
-    } else { 
+    } else {
       TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*Param);
       TemplateArgs.push_back(TemplateArgument(TTP->getLocation(), TTP));
     }
@@ -242,7 +242,7 @@
 
 SourceLocation NonTypeTemplateParmDecl::getDefaultArgumentLoc() const {
   return DefaultArgument? DefaultArgument->getSourceRange().getBegin()
-                        : SourceLocation(); 
+                        : SourceLocation();
 }
 
 //===----------------------------------------------------------------------===//
@@ -259,7 +259,7 @@
 
 SourceLocation TemplateTemplateParmDecl::getDefaultArgumentLoc() const {
   return DefaultArgument? DefaultArgument->getSourceRange().getBegin()
-                        : SourceLocation(); 
+                        : SourceLocation();
 }
 
 //===----------------------------------------------------------------------===//
@@ -272,10 +272,10 @@
 }
 
 /// \brief Construct a template argument pack.
-void TemplateArgument::setArgumentPack(TemplateArgument *args, unsigned NumArgs, 
+void TemplateArgument::setArgumentPack(TemplateArgument *args, unsigned NumArgs,
                                        bool CopyArgs) {
   assert(isNull() && "Must call setArgumentPack on a null argument");
-  
+
   Kind = Pack;
   Args.NumArgs = NumArgs;
   Args.CopyArgs = CopyArgs;
@@ -283,7 +283,7 @@
     Args.Args = args;
     return;
   }
-  
+
   // FIXME: Allocate in ASTContext
   Args.Args = new TemplateArgument[NumArgs];
   for (unsigned I = 0; I != Args.NumArgs; ++I)
@@ -301,21 +301,21 @@
       assert(Arg.getAsType()->isCanonical() && "Type must be canonical!");
       break;
   }
-  
+
   assert(NumFlatArgs < MaxFlatArgs && "Argument list builder is full!");
-  assert(!StructuredArgs && 
+  assert(!StructuredArgs &&
          "Can't append arguments when an argument pack has been added!");
-  
+
   if (!FlatArgs)
     FlatArgs = new TemplateArgument[MaxFlatArgs];
-  
+
   FlatArgs[NumFlatArgs++] = Arg;
 }
 
 void TemplateArgumentListBuilder::BeginPack() {
   assert(!AddingToPack && "Already adding to pack!");
   assert(!StructuredArgs && "Argument list already contains a pack!");
-  
+
   AddingToPack = true;
   PackBeginIndex = NumFlatArgs;
 }
@@ -323,24 +323,24 @@
 void TemplateArgumentListBuilder::EndPack() {
   assert(AddingToPack && "Not adding to pack!");
   assert(!StructuredArgs && "Argument list already contains a pack!");
-  
+
   AddingToPack = false;
 
   StructuredArgs = new TemplateArgument[MaxStructuredArgs];
-  
+
   // First copy the flat entries over to the list  (if any)
   for (unsigned I = 0; I != PackBeginIndex; ++I) {
     NumStructuredArgs++;
     StructuredArgs[I] = FlatArgs[I];
   }
-  
+
   // Next, set the pack.
   TemplateArgument *PackArgs = 0;
   unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
   if (NumPackArgs)
     PackArgs = &FlatArgs[PackBeginIndex];
-  
-  StructuredArgs[NumStructuredArgs++].setArgumentPack(PackArgs, NumPackArgs, 
+
+  StructuredArgs[NumStructuredArgs++].setArgumentPack(PackArgs, NumPackArgs,
                                                       /*CopyArgs=*/false);
 }
 
@@ -359,14 +359,14 @@
 TemplateArgumentList::TemplateArgumentList(ASTContext &Context,
                                            TemplateArgumentListBuilder &Builder,
                                            bool TakeArgs)
-  : FlatArguments(Builder.getFlatArguments(), TakeArgs), 
-    NumFlatArguments(Builder.flatSize()), 
+  : FlatArguments(Builder.getFlatArguments(), TakeArgs),
+    NumFlatArguments(Builder.flatSize()),
     StructuredArguments(Builder.getStructuredArguments(), TakeArgs),
     NumStructuredArguments(Builder.structuredSize()) {
-  
+
   if (!TakeArgs)
     return;
-    
+
   if (Builder.getStructuredArguments() == Builder.getFlatArguments())
     StructuredArguments.setInt(0);
   Builder.ReleaseArgs();
@@ -385,8 +385,8 @@
                                 ClassTemplateDecl *SpecializedTemplate,
                                 TemplateArgumentListBuilder &Builder,
                                 ClassTemplateSpecializationDecl *PrevDecl)
-  : CXXRecordDecl(DK, 
-                  SpecializedTemplate->getTemplatedDecl()->getTagKind(), 
+  : CXXRecordDecl(DK,
+                  SpecializedTemplate->getTemplatedDecl()->getTagKind(),
                   DC, L,
                   // FIXME: Should we use DeclarationName for the name of
                   // class template specializations?
@@ -396,17 +396,17 @@
     TemplateArgs(Context, Builder, /*TakeArgs=*/true),
     SpecializationKind(TSK_Undeclared) {
 }
-                  
+
 ClassTemplateSpecializationDecl *
-ClassTemplateSpecializationDecl::Create(ASTContext &Context, 
+ClassTemplateSpecializationDecl::Create(ASTContext &Context,
                                         DeclContext *DC, SourceLocation L,
                                         ClassTemplateDecl *SpecializedTemplate,
                                         TemplateArgumentListBuilder &Builder,
                                    ClassTemplateSpecializationDecl *PrevDecl) {
   ClassTemplateSpecializationDecl *Result
-    = new (Context)ClassTemplateSpecializationDecl(Context, 
+    = new (Context)ClassTemplateSpecializationDecl(Context,
                                                    ClassTemplateSpecialization,
-                                                   DC, L, 
+                                                   DC, L,
                                                    SpecializedTemplate,
                                                    Builder,
                                                    PrevDecl);
@@ -415,16 +415,16 @@
 }
 
 void ClassTemplateSpecializationDecl::Destroy(ASTContext &C) {
-  if (SpecializedPartialSpecialization *PartialSpec 
+  if (SpecializedPartialSpecialization *PartialSpec
         = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
     C.Deallocate(PartialSpec);
-  
+
   CXXRecordDecl::Destroy(C);
 }
 
 ClassTemplateDecl *
-ClassTemplateSpecializationDecl::getSpecializedTemplate() const { 
-  if (SpecializedPartialSpecialization *PartialSpec 
+ClassTemplateSpecializationDecl::getSpecializedTemplate() const {
+  if (SpecializedPartialSpecialization *PartialSpec
       = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
     return PartialSpec->PartialSpecialization->getSpecializedTemplate();
   return SpecializedTemplate.get<ClassTemplateDecl*>();
@@ -441,7 +441,7 @@
        TemplateArgumentListBuilder &Builder,
        ClassTemplatePartialSpecializationDecl *PrevDecl) {
   ClassTemplatePartialSpecializationDecl *Result
-    = new (Context)ClassTemplatePartialSpecializationDecl(Context, 
+    = new (Context)ClassTemplatePartialSpecializationDecl(Context,
                                                           DC, L, Params,
                                                           SpecializedTemplate,
                                                           Builder, PrevDecl);

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

==============================================================================
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Wed Sep  9 10:08:12 2009
@@ -23,7 +23,7 @@
 /// CXXSpecialName - Records the type associated with one of the
 /// "special" kinds of declaration names in C++, e.g., constructors,
 /// destructors, and conversion functions.
-class CXXSpecialName 
+class CXXSpecialName
   : public DeclarationNameExtra, public llvm::FoldingSetNode {
 public:
   /// Type - The type associated with this declaration name.
@@ -40,7 +40,7 @@
 };
 
 /// CXXOperatorIdName - Contains extra information for the name of an
-/// overloaded operator in C++, such as "operator+. 
+/// overloaded operator in C++, such as "operator+.
 class CXXOperatorIdName : public DeclarationNameExtra {
 public:
   /// FETokenInfo - Extra information associated with this operator
@@ -93,13 +93,13 @@
 
   case StoredDeclarationNameExtra:
     switch (getExtra()->ExtraKindOrNumArgs) {
-    case DeclarationNameExtra::CXXConstructor: 
+    case DeclarationNameExtra::CXXConstructor:
       return CXXConstructorName;
 
-    case DeclarationNameExtra::CXXDestructor: 
+    case DeclarationNameExtra::CXXDestructor:
       return CXXDestructorName;
 
-    case DeclarationNameExtra::CXXConversionFunction: 
+    case DeclarationNameExtra::CXXConversionFunction:
       return CXXConversionFunctionName;
 
     case DeclarationNameExtra::CXXUsingDirective:
@@ -107,7 +107,7 @@
 
     default:
       // Check if we have one of the CXXOperator* enumeration values.
-      if (getExtra()->ExtraKindOrNumArgs < 
+      if (getExtra()->ExtraKindOrNumArgs <
             DeclarationNameExtra::CXXUsingDirective)
         return CXXOperatorName;
 
@@ -159,7 +159,7 @@
     };
     const char *OpName = OperatorNames[getCXXOverloadedOperator()];
     assert(OpName && "not an overloaded operator");
-      
+
     std::string Result = "operator";
     if (OpName[0] >= 'a' && OpName[0] <= 'z')
       Result += ' ';
@@ -193,7 +193,7 @@
 
 OverloadedOperatorKind DeclarationName::getCXXOverloadedOperator() const {
   if (CXXOperatorIdName *CXXOp = getAsCXXOperatorIdName()) {
-    unsigned value 
+    unsigned value
       = CXXOp->ExtraKindOrNumArgs - DeclarationNameExtra::CXXConversionFunction;
     return static_cast<OverloadedOperatorKind>(value);
   } else {
@@ -276,7 +276,7 @@
   // Initialize the overloaded operator names.
   CXXOperatorNames = new CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
   for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
-    CXXOperatorNames[Op].ExtraKindOrNumArgs 
+    CXXOperatorNames[Op].ExtraKindOrNumArgs
       = Op + DeclarationNameExtra::CXXConversionFunction;
     CXXOperatorNames[Op].FETokenInfo = 0;
   }
@@ -296,18 +296,18 @@
   delete [] CXXOperatorNames;
 }
 
-DeclarationName 
-DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind, 
+DeclarationName
+DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
                                         CanQualType Ty) {
   assert(Kind >= DeclarationName::CXXConstructorName &&
          Kind <= DeclarationName::CXXConversionFunctionName &&
          "Kind must be a C++ special name kind");
-  llvm::FoldingSet<CXXSpecialName> *SpecialNames 
+  llvm::FoldingSet<CXXSpecialName> *SpecialNames
     = static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
 
   DeclarationNameExtra::ExtraKind EKind;
   switch (Kind) {
-  case DeclarationName::CXXConstructorName: 
+  case DeclarationName::CXXConstructorName:
     EKind = DeclarationNameExtra::CXXConstructor;
     assert(Ty.getCVRQualifiers() == 0 &&"Constructor type must be unqualified");
     break;
@@ -340,12 +340,12 @@
   return DeclarationName(SpecialName);
 }
 
-DeclarationName 
+DeclarationName
 DeclarationNameTable::getCXXOperatorName(OverloadedOperatorKind Op) {
   return DeclarationName(&CXXOperatorNames[(unsigned)Op]);
 }
 
-unsigned 
+unsigned
 llvm::DenseMapInfo<clang::DeclarationName>::
 getHashValue(clang::DeclarationName N) {
   return DenseMapInfo<void*>::getHashValue(N.getAsOpaquePtr());

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

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Sep  9 10:08:12 2009
@@ -120,7 +120,7 @@
 StringLiteral *StringLiteral::Create(ASTContext &C, const char *StrData,
                                      unsigned ByteLength, bool Wide,
                                      QualType Ty,
-                                     const SourceLocation *Loc, 
+                                     const SourceLocation *Loc,
                                      unsigned NumStrs) {
   // Allocate enough space for the StringLiteral plus an array of locations for
   // any concatenated string tokens.
@@ -128,7 +128,7 @@
                          sizeof(SourceLocation)*(NumStrs-1),
                          llvm::alignof<StringLiteral>());
   StringLiteral *SL = new (Mem) StringLiteral(Ty);
-  
+
   // OPTIMIZE: could allocate this appended to the StringLiteral.
   char *AStrData = new (C, 1) char[ByteLength];
   memcpy(AStrData, StrData, ByteLength);
@@ -191,7 +191,7 @@
   }
 }
 
-UnaryOperator::Opcode 
+UnaryOperator::Opcode
 UnaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix) {
   switch (OO) {
   default: assert(false && "No unary operator for overloaded function");
@@ -227,11 +227,11 @@
 
 CallExpr::CallExpr(ASTContext& C, StmtClass SC, Expr *fn, Expr **args,
                    unsigned numargs, QualType t, SourceLocation rparenloc)
-  : Expr(SC, t, 
+  : Expr(SC, t,
          fn->isTypeDependent() || hasAnyTypeDependentArguments(args, numargs),
          fn->isValueDependent() || hasAnyValueDependentArguments(args,numargs)),
     NumArgs(numargs) {
-      
+
   SubExprs = new (C) Stmt*[numargs+1];
   SubExprs[FN] = fn;
   for (unsigned i = 0; i != numargs; ++i)
@@ -255,8 +255,8 @@
   RParenLoc = rparenloc;
 }
 
-CallExpr::CallExpr(ASTContext &C, StmtClass SC, EmptyShell Empty) 
-  : Expr(SC, Empty), SubExprs(0), NumArgs(0) { 
+CallExpr::CallExpr(ASTContext &C, StmtClass SC, EmptyShell Empty)
+  : Expr(SC, Empty), SubExprs(0), NumArgs(0) {
   SubExprs = new (C) Stmt*[1];
 }
 
@@ -281,7 +281,7 @@
 void CallExpr::setNumArgs(ASTContext& C, unsigned NumArgs) {
   // No change, just return.
   if (NumArgs == getNumArgs()) return;
-  
+
   // If shrinking # arguments, just delete the extras and forgot them.
   if (NumArgs < getNumArgs()) {
     for (unsigned i = NumArgs, e = getNumArgs(); i != e; ++i)
@@ -298,7 +298,7 @@
   // Null out new args.
   for (unsigned i = getNumArgs()+ARGS_START; i != NumArgs+ARGS_START; ++i)
     NewSubExprs[i] = 0;
-  
+
   if (SubExprs) C.Deallocate(SubExprs);
   SubExprs = NewSubExprs;
   this->NumArgs = NumArgs;
@@ -308,20 +308,20 @@
 /// not, return 0.
 unsigned CallExpr::isBuiltinCall(ASTContext &Context) const {
   // All simple function calls (e.g. func()) are implicitly cast to pointer to
-  // function. As a result, we try and obtain the DeclRefExpr from the 
+  // function. As a result, we try and obtain the DeclRefExpr from the
   // ImplicitCastExpr.
   const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(getCallee());
   if (!ICE) // FIXME: deal with more complex calls (e.g. (func)(), (*func)()).
     return 0;
-  
+
   const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr());
   if (!DRE)
     return 0;
-  
+
   const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
   if (!FDecl)
     return 0;
-  
+
   if (!FDecl->getIdentifier())
     return 0;
 
@@ -334,18 +334,18 @@
     CalleeType = FnTypePtr->getPointeeType();
   else if (const BlockPointerType *BPT = CalleeType->getAs<BlockPointerType>())
     CalleeType = BPT->getPointeeType();
-  
+
   const FunctionType *FnType = CalleeType->getAsFunctionType();
   return FnType->getResultType();
 }
 
-MemberExpr::MemberExpr(Expr *base, bool isarrow, NestedNameSpecifier *qual, 
-                       SourceRange qualrange, NamedDecl *memberdecl, 
+MemberExpr::MemberExpr(Expr *base, bool isarrow, NestedNameSpecifier *qual,
+                       SourceRange qualrange, NamedDecl *memberdecl,
                        SourceLocation l, bool has_explicit,
                        SourceLocation langle,
                        const TemplateArgument *targs, unsigned numtargs,
                        SourceLocation rangle, QualType ty)
-  : Expr(MemberExprClass, ty, 
+  : Expr(MemberExprClass, ty,
          base->isTypeDependent() || (qual && qual->isDependent()),
          base->isValueDependent() || (qual && qual->isDependent())),
     Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow),
@@ -356,26 +356,26 @@
     NQ->NNS = qual;
     NQ->Range = qualrange;
   }
-      
+
   // Initialize the explicit template argument list, if any.
   if (HasExplicitTemplateArgumentList) {
-    ExplicitTemplateArgumentList *ETemplateArgs 
+    ExplicitTemplateArgumentList *ETemplateArgs
       = getExplicitTemplateArgumentList();
     ETemplateArgs->LAngleLoc = langle;
     ETemplateArgs->RAngleLoc = rangle;
     ETemplateArgs->NumTemplateArgs = numtargs;
-    
+
     TemplateArgument *TemplateArgs = ETemplateArgs->getTemplateArgs();
     for (unsigned I = 0; I < numtargs; ++I)
-      new (TemplateArgs + I) TemplateArgument(targs[I]);      
+      new (TemplateArgs + I) TemplateArgument(targs[I]);
   }
 }
 
-MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow, 
-                               NestedNameSpecifier *qual, 
+MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow,
+                               NestedNameSpecifier *qual,
                                SourceRange qualrange,
-                               NamedDecl *memberdecl, 
-                               SourceLocation l, 
+                               NamedDecl *memberdecl,
+                               SourceLocation l,
                                bool has_explicit,
                                SourceLocation langle,
                                const TemplateArgument *targs,
@@ -385,11 +385,11 @@
   std::size_t Size = sizeof(MemberExpr);
   if (qual != 0)
     Size += sizeof(NameQualifier);
-  
+
   if (has_explicit)
-    Size += sizeof(ExplicitTemplateArgumentList) + 
+    Size += sizeof(ExplicitTemplateArgumentList) +
     sizeof(TemplateArgument) * numtargs;
-  
+
   void *Mem = C.Allocate(Size, llvm::alignof<MemberExpr>());
   return new (Mem) MemberExpr(base, isarrow, qual, qualrange, memberdecl, l,
                               has_explicit, langle, targs, numtargs, rangle,
@@ -423,7 +423,7 @@
   case CastExpr::CK_ConstructorConversion:
     return "ConstructorConversion";
   }
-  
+
   assert(0 && "Unhandled cast kind!");
   return 0;
 }
@@ -469,7 +469,7 @@
   return "";
 }
 
-BinaryOperator::Opcode 
+BinaryOperator::Opcode
 BinaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO) {
   switch (OO) {
   default: assert(false && "Not an overloadable binary operator");
@@ -531,13 +531,13 @@
   return OverOps[Opc];
 }
 
-InitListExpr::InitListExpr(SourceLocation lbraceloc, 
+InitListExpr::InitListExpr(SourceLocation lbraceloc,
                            Expr **initExprs, unsigned numInits,
                            SourceLocation rbraceloc)
   : Expr(InitListExprClass, QualType(),
          hasAnyTypeDependentArguments(initExprs, numInits),
          hasAnyValueDependentArguments(initExprs, numInits)),
-    LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), SyntacticForm(0), 
+    LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), SyntacticForm(0),
     UnionFieldInit(0), HadArrayRangeDesignator(false) {
 
   InitExprs.insert(InitExprs.end(), initExprs, initExprs+numInits);
@@ -561,7 +561,7 @@
     InitExprs.back() = expr;
     return 0;
   }
-  
+
   Expr *Result = cast_or_null<Expr>(InitExprs[Init]);
   InitExprs[Init] = expr;
   return Result;
@@ -574,14 +574,14 @@
                     getPointeeType()->getAsFunctionType();
 }
 
-SourceLocation BlockExpr::getCaretLocation() const { 
-  return TheBlock->getCaretLocation(); 
+SourceLocation BlockExpr::getCaretLocation() const {
+  return TheBlock->getCaretLocation();
 }
-const Stmt *BlockExpr::getBody() const { 
+const Stmt *BlockExpr::getBody() const {
   return TheBlock->getBody();
 }
-Stmt *BlockExpr::getBody() { 
-  return TheBlock->getBody(); 
+Stmt *BlockExpr::getBody() {
+  return TheBlock->getBody();
 }
 
 
@@ -599,7 +599,7 @@
   // instantiating to void.
   if (isTypeDependent())
     return false;
-  
+
   switch (getStmtClass()) {
   default:
     Loc = getExprLoc();
@@ -610,7 +610,7 @@
       isUnusedResultAWarning(Loc, R1, R2);
   case UnaryOperatorClass: {
     const UnaryOperator *UO = cast<UnaryOperator>(this);
-    
+
     switch (UO->getOpcode()) {
     default: break;
     case UnaryOperator::PostInc:
@@ -642,7 +642,7 @@
     if (BO->getOpcode() == BinaryOperator::Comma)
       return BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2) ||
              BO->getLHS()->isUnusedResultAWarning(Loc, R1, R2);
-      
+
     if (BO->isAssignmentOp())
       return false;
     Loc = BO->getOperatorLoc();
@@ -657,7 +657,7 @@
     // The condition must be evaluated, but if either the LHS or RHS is a
     // warning, warn about them.
     const ConditionalOperator *Exp = cast<ConditionalOperator>(this);
-    if (Exp->getLHS() && 
+    if (Exp->getLHS() &&
         Exp->getLHS()->isUnusedResultAWarning(Loc, R1, R2))
       return true;
     return Exp->getRHS()->isUnusedResultAWarning(Loc, R1, R2);
@@ -672,7 +672,7 @@
     R1 = SourceRange(Loc, Loc);
     R2 = cast<MemberExpr>(this)->getBase()->getSourceRange();
     return true;
-      
+
   case ArraySubscriptExprClass:
     // If the base pointer or element is to a volatile pointer/field, accessing
     // it is a side effect.
@@ -697,7 +697,7 @@
             FD->getAttr<PureAttr>() || FD->getAttr<ConstAttr>()) {
           Loc = CE->getCallee()->getLocStart();
           R1 = CE->getCallee()->getSourceRange();
-          
+
           if (unsigned NumArgs = CE->getNumArgs())
             R2 = SourceRange(CE->getArg(0)->getLocStart(),
                              CE->getArg(NumArgs-1)->getLocEnd());
@@ -708,10 +708,10 @@
   }
   case ObjCMessageExprClass:
     return false;
-      
+
   case ObjCImplicitSetterGetterRefExprClass: {   // Dot syntax for message send.
 #if 0
-    const ObjCImplicitSetterGetterRefExpr *Ref = 
+    const ObjCImplicitSetterGetterRefExpr *Ref =
       cast<ObjCImplicitSetterGetterRefExpr>(this);
     // FIXME: We really want the location of the '.' here.
     Loc = Ref->getLocation();
@@ -734,7 +734,7 @@
     if (!CS->body_empty())
       if (const Expr *E = dyn_cast<Expr>(CS->body_back()))
         return E->isUnusedResultAWarning(Loc, R1, R2);
-    
+
     Loc = cast<StmtExpr>(this)->getLParenLoc();
     R1 = getSourceRange();
     return true;
@@ -756,7 +756,7 @@
     Loc = cast<CXXFunctionalCastExpr>(this)->getTypeBeginLoc();
     R1 = cast<CXXFunctionalCastExpr>(this)->getSubExpr()->getSourceRange();
     return true;
-      
+
   case ImplicitCastExprClass:
     // Check the operand, since implicit casts are inserted by Sema
     return cast<ImplicitCastExpr>(this)
@@ -785,7 +785,7 @@
 static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
   // C++ [temp.param]p6:
   //   A non-type non-reference template-parameter is not an lvalue.
-  if (const NonTypeTemplateParmDecl *NTTParm 
+  if (const NonTypeTemplateParmDecl *NTTParm
         = dyn_cast<NonTypeTemplateParmDecl>(Decl))
     return NTTParm->getType()->isReferenceType();
 
@@ -838,7 +838,7 @@
     if (cast<ArraySubscriptExpr>(this)->getBase()->getType()->isVectorType())
       return cast<ArraySubscriptExpr>(this)->getBase()->isLvalue(Ctx);
     return LV_Valid;
-  case DeclRefExprClass: 
+  case DeclRefExprClass:
   case QualifiedDeclRefExprClass: { // C99 6.5.1p2
     const NamedDecl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
     if (DeclCanBeLvalue(RefdDecl, Ctx))
@@ -885,7 +885,7 @@
 
         // Not an lvalue.
       return LV_InvalidExpression;
-    } 
+    }
 
     // C99 6.5.2.3p4
     return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
@@ -905,7 +905,7 @@
       return LV_Valid;
     break;
   case ImplicitCastExprClass:
-    return cast<ImplicitCastExpr>(this)->isLvalueCast()? LV_Valid 
+    return cast<ImplicitCastExpr>(this)->isLvalueCast()? LV_Valid
                                                        : LV_InvalidExpression;
   case ParenExprClass: // C99 6.5.1p5
     return cast<ParenExpr>(this)->getSubExpr()->isLvalue(Ctx);
@@ -927,7 +927,7 @@
       return LV_InvalidExpression;
 
     if (Ctx.getLangOptions().CPlusPlus)
-      // C++ [expr.ass]p1: 
+      // C++ [expr.ass]p1:
       //   The result of an assignment operation [...] is an lvalue.
       return LV_Valid;
 
@@ -936,7 +936,7 @@
     //   An assignment expression [...] is not an lvalue.
     return LV_InvalidExpression;
   }
-  case CallExprClass: 
+  case CallExprClass:
   case CXXOperatorCallExprClass:
   case CXXMemberCallExprClass: {
     // C++0x [expr.call]p10
@@ -1023,15 +1023,15 @@
 
 /// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
 /// does not have an incomplete type, does not have a const-qualified type, and
-/// if it is a structure or union, does not have any member (including, 
+/// if it is a structure or union, does not have any member (including,
 /// recursively, any member or element of all contained aggregates or unions)
 /// with a const-qualified type.
-Expr::isModifiableLvalueResult 
+Expr::isModifiableLvalueResult
 Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
   isLvalueResult lvalResult = isLvalue(Ctx);
-    
+
   switch (lvalResult) {
-  case LV_Valid: 
+  case LV_Valid:
     // C++ 3.10p11: Functions cannot be modified, but pointers to
     // functions can be modifiable.
     if (Ctx.getLangOptions().CPlusPlus && TR->isFunctionType())
@@ -1068,27 +1068,27 @@
   }
 
   QualType CT = Ctx.getCanonicalType(getType());
-  
+
   if (CT.isConstQualified())
     return MLV_ConstQualified;
   if (CT->isArrayType())
     return MLV_ArrayType;
   if (CT->isIncompleteType())
     return MLV_IncompleteType;
-    
+
   if (const RecordType *r = CT->getAs<RecordType>()) {
-    if (r->hasConstFields()) 
+    if (r->hasConstFields())
       return MLV_ConstQualified;
   }
-  
+
   // Assigning to an 'implicit' property?
   else if (isa<ObjCImplicitSetterGetterRefExpr>(this)) {
-    const ObjCImplicitSetterGetterRefExpr* Expr = 
+    const ObjCImplicitSetterGetterRefExpr* Expr =
       cast<ObjCImplicitSetterGetterRefExpr>(this);
     if (Expr->getSetterMethod() == 0)
       return MLV_NoSetterProperty;
   }
-  return MLV_Valid;    
+  return MLV_Valid;
 }
 
 /// isOBJCGCCandidate - Check if an expression is objc gc'able.
@@ -1131,7 +1131,7 @@
   Expr* E = this;
   while (ParenExpr* P = dyn_cast<ParenExpr>(E))
     E = P->getSubExpr();
-  
+
   return E;
 }
 
@@ -1159,17 +1159,17 @@
       E = P->getSubExpr();
       continue;
     }
-    
+
     if (CastExpr *P = dyn_cast<CastExpr>(E)) {
       // We ignore integer <-> casts that are of the same width, ptr<->ptr and
       // ptr<->int casts of the same width.  We also ignore all identify casts.
       Expr *SE = P->getSubExpr();
-      
+
       if (Ctx.hasSameUnqualifiedType(E->getType(), SE->getType())) {
         E = SE;
         continue;
       }
-      
+
       if ((E->getType()->isPointerType() || E->getType()->isIntegralType()) &&
           (SE->getType()->isPointerType() || SE->getType()->isIntegralType()) &&
           Ctx.getTypeSize(E->getType()) == Ctx.getTypeSize(SE->getType())) {
@@ -1177,7 +1177,7 @@
         continue;
       }
     }
-    
+
     return E;
   }
 }
@@ -1233,7 +1233,7 @@
     const InitListExpr *Exp = cast<InitListExpr>(this);
     unsigned numInits = Exp->getNumInits();
     for (unsigned i = 0; i < numInits; i++) {
-      if (!Exp->getInit(i)->isConstantInitializer(Ctx)) 
+      if (!Exp->getInit(i)->isConstantInitializer(Ctx))
         return false;
     }
     return true;
@@ -1274,9 +1274,9 @@
 // CheckICE - This function does the fundamental ICE checking: the returned
 // ICEDiag contains a Val of 0, 1, or 2, and a possibly null SourceLocation.
 // Note that to reduce code duplication, this helper does no evaluation
-// itself; the caller checks whether the expression is evaluatable, and 
+// itself; the caller checks whether the expression is evaluatable, and
 // in the rare cases where CheckICE actually cares about the evaluated
-// value, it calls into Evalute.  
+// value, it calls into Evalute.
 //
 // Meanings of Val:
 // 0: This expression is an ICE if it can be evaluated by Evaluate.
@@ -1323,7 +1323,7 @@
   case Expr::TypesCompatibleExprClass:
   case Expr::UnaryTypeTraitExprClass:
     return NoDiag();
-  case Expr::CallExprClass: 
+  case Expr::CallExprClass:
   case Expr::CXXOperatorCallExprClass: {
     const CallExpr *CE = cast<CallExpr>(E);
     if (CE->isBuiltinCall(Ctx))
@@ -1474,7 +1474,7 @@
   }
   case Expr::ConditionalOperatorClass: {
     const ConditionalOperator *Exp = cast<ConditionalOperator>(E);
-    // If the condition (ignoring parens) is a __builtin_constant_p call, 
+    // If the condition (ignoring parens) is a __builtin_constant_p call,
     // then only the true side is actually considered in an integer constant
     // expression, and it is fully evaluated.  This is an important GNU
     // extension.  See GCC PR38377 for discussion.
@@ -1535,15 +1535,14 @@
 /// isNullPointerConstant - C99 6.3.2.3p3 -  Return true if this is either an
 /// integer constant expression with the value zero, or if this is one that is
 /// cast to void*.
-bool Expr::isNullPointerConstant(ASTContext &Ctx) const
-{
+bool Expr::isNullPointerConstant(ASTContext &Ctx) const {
   // Strip off a cast to void*, if it exists. Except in C++.
   if (const ExplicitCastExpr *CE = dyn_cast<ExplicitCastExpr>(this)) {
     if (!Ctx.getLangOptions().CPlusPlus) {
       // Check that it is a cast to void*.
       if (const PointerType *PT = CE->getType()->getAs<PointerType>()) {
         QualType Pointee = PT->getPointeeType();
-        if (Pointee.getCVRQualifiers() == 0 && 
+        if (Pointee.getCVRQualifiers() == 0 &&
             Pointee->isVoidType() &&                              // to void*
             CE->getSubExpr()->getType()->isIntegerType())         // from int.
           return CE->getSubExpr()->isNullPointerConstant(Ctx);
@@ -1556,7 +1555,7 @@
     // Accept ((void*)0) as a null pointer constant, as many other
     // implementations do.
     return PE->getSubExpr()->isNullPointerConstant(Ctx);
-  } else if (const CXXDefaultArgExpr *DefaultArg 
+  } else if (const CXXDefaultArgExpr *DefaultArg
                = dyn_cast<CXXDefaultArgExpr>(this)) {
     // See through default argument expressions
     return DefaultArg->getExpr()->isNullPointerConstant(Ctx);
@@ -1572,7 +1571,7 @@
   // This expression must be an integer type.
   if (!getType()->isIntegerType())
     return false;
-  
+
   // If we have an integer constant expression, we need to *evaluate* it and
   // test for the value 0.
   llvm::APSInt Result;
@@ -1612,20 +1611,20 @@
   unsigned length = Accessor->getLength();
 
   // Halving swizzles do not contain duplicate elements.
-  if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") || 
+  if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") ||
       !strcmp(compStr, "even") || !strcmp(compStr, "odd"))
     return false;
-  
+
   // Advance past s-char prefix on hex swizzles.
   if (*compStr == 's' || *compStr == 'S') {
     compStr++;
     length--;
   }
-  
+
   for (unsigned i = 0; i != length-1; i++) {
     const char *s = compStr+i;
     for (const char c = *s++; *s; s++)
-      if (c == *s) 
+      if (c == *s)
         return true;
   }
   return false;
@@ -1637,15 +1636,15 @@
   const char *compStr = Accessor->getName();
   if (*compStr == 's' || *compStr == 'S')
     compStr++;
- 
+
   bool isHi =   !strcmp(compStr, "hi");
   bool isLo =   !strcmp(compStr, "lo");
   bool isEven = !strcmp(compStr, "even");
   bool isOdd  = !strcmp(compStr, "odd");
-    
+
   for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
     uint64_t Index;
-    
+
     if (isHi)
       Index = e + i;
     else if (isLo)
@@ -1666,7 +1665,7 @@
                 QualType retType, ObjCMethodDecl *mproto,
                 SourceLocation LBrac, SourceLocation RBrac,
                 Expr **ArgExprs, unsigned nargs)
-  : Expr(ObjCMessageExprClass, retType), SelName(selInfo), 
+  : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
     MethodProto(mproto) {
   NumArgs = nargs;
   SubExprs = new Stmt*[NumArgs+1];
@@ -1679,13 +1678,13 @@
   RBracloc = RBrac;
 }
 
-// constructor for class messages. 
+// constructor for class messages.
 // FIXME: clsName should be typed to ObjCInterfaceType
 ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
                 QualType retType, ObjCMethodDecl *mproto,
                 SourceLocation LBrac, SourceLocation RBrac,
                 Expr **ArgExprs, unsigned nargs)
-  : Expr(ObjCMessageExprClass, retType), SelName(selInfo), 
+  : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
     MethodProto(mproto) {
   NumArgs = nargs;
   SubExprs = new Stmt*[NumArgs+1];
@@ -1698,12 +1697,12 @@
   RBracloc = RBrac;
 }
 
-// constructor for class messages. 
+// constructor for class messages.
 ObjCMessageExpr::ObjCMessageExpr(ObjCInterfaceDecl *cls, Selector selInfo,
                                  QualType retType, ObjCMethodDecl *mproto,
                                  SourceLocation LBrac, SourceLocation RBrac,
                                  Expr **ArgExprs, unsigned nargs)
-: Expr(ObjCMessageExprClass, retType), SelName(selInfo), 
+: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
 MethodProto(mproto) {
   NumArgs = nargs;
   SubExprs = new Stmt*[NumArgs+1];
@@ -1753,7 +1752,7 @@
   SubExprs = new (C) Stmt* [NumExprs];
   this->NumExprs = NumExprs;
   memcpy(SubExprs, Exprs, sizeof(Expr *) * NumExprs);
-}  
+}
 
 void ShuffleVectorExpr::DoDestroy(ASTContext& C) {
   DestroyChildren(C);
@@ -1788,17 +1787,17 @@
     return getField()->getIdentifier();
 }
 
-DesignatedInitExpr::DesignatedInitExpr(QualType Ty, unsigned NumDesignators, 
+DesignatedInitExpr::DesignatedInitExpr(QualType Ty, unsigned NumDesignators,
                                        const Designator *Designators,
-                                       SourceLocation EqualOrColonLoc, 
+                                       SourceLocation EqualOrColonLoc,
                                        bool GNUSyntax,
-                                       Expr **IndexExprs, 
+                                       Expr **IndexExprs,
                                        unsigned NumIndexExprs,
                                        Expr *Init)
-  : Expr(DesignatedInitExprClass, Ty, 
+  : Expr(DesignatedInitExprClass, Ty,
          Init->isTypeDependent(), Init->isValueDependent()),
-    EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax), 
-    NumDesignators(NumDesignators), NumSubExprs(NumIndexExprs + 1) { 
+    EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax),
+    NumDesignators(NumDesignators), NumSubExprs(NumIndexExprs + 1) {
   this->Designators = new Designator[NumDesignators];
 
   // Record the initializer itself.
@@ -1814,7 +1813,7 @@
     if (this->Designators[I].isArrayDesignator()) {
       // Compute type- and value-dependence.
       Expr *Index = IndexExprs[IndexIdx];
-      ValueDependent = ValueDependent || 
+      ValueDependent = ValueDependent ||
         Index->isTypeDependent() || Index->isValueDependent();
 
       // Copy the index expressions into permanent storage.
@@ -1823,7 +1822,7 @@
       // Compute type- and value-dependence.
       Expr *Start = IndexExprs[IndexIdx];
       Expr *End = IndexExprs[IndexIdx + 1];
-      ValueDependent = ValueDependent || 
+      ValueDependent = ValueDependent ||
         Start->isTypeDependent() || Start->isValueDependent() ||
         End->isTypeDependent() || End->isValueDependent();
 
@@ -1837,7 +1836,7 @@
 }
 
 DesignatedInitExpr *
-DesignatedInitExpr::Create(ASTContext &C, Designator *Designators, 
+DesignatedInitExpr::Create(ASTContext &C, Designator *Designators,
                            unsigned NumDesignators,
                            Expr **IndexExprs, unsigned NumIndexExprs,
                            SourceLocation ColonOrEqualLoc,
@@ -1849,14 +1848,14 @@
                                       IndexExprs, NumIndexExprs, Init);
 }
 
-DesignatedInitExpr *DesignatedInitExpr::CreateEmpty(ASTContext &C, 
+DesignatedInitExpr *DesignatedInitExpr::CreateEmpty(ASTContext &C,
                                                     unsigned NumIndexExprs) {
   void *Mem = C.Allocate(sizeof(DesignatedInitExpr) +
                          sizeof(Stmt *) * (NumIndexExprs + 1), 8);
   return new (Mem) DesignatedInitExpr(NumIndexExprs + 1);
 }
 
-void DesignatedInitExpr::setDesignators(const Designator *Desigs, 
+void DesignatedInitExpr::setDesignators(const Designator *Desigs,
                                         unsigned NumDesigs) {
   if (Designators)
     delete [] Designators;
@@ -1891,7 +1890,7 @@
 }
 
 Expr *DesignatedInitExpr::getArrayRangeStart(const Designator& D) {
-  assert(D.Kind == Designator::ArrayRangeDesignator && 
+  assert(D.Kind == Designator::ArrayRangeDesignator &&
          "Requires array range designator");
   char* Ptr = static_cast<char*>(static_cast<void *>(this));
   Ptr += sizeof(DesignatedInitExpr);
@@ -1900,7 +1899,7 @@
 }
 
 Expr *DesignatedInitExpr::getArrayRangeEnd(const Designator& D) {
-  assert(D.Kind == Designator::ArrayRangeDesignator && 
+  assert(D.Kind == Designator::ArrayRangeDesignator &&
          "Requires array range designator");
   char* Ptr = static_cast<char*>(static_cast<void *>(this));
   Ptr += sizeof(DesignatedInitExpr);
@@ -1910,8 +1909,8 @@
 
 /// \brief Replaces the designator at index @p Idx with the series
 /// of designators in [First, Last).
-void DesignatedInitExpr::ExpandDesignator(unsigned Idx, 
-                                          const Designator *First, 
+void DesignatedInitExpr::ExpandDesignator(unsigned Idx,
+                                          const Designator *First,
                                           const Designator *Last) {
   unsigned NumNewDesignators = Last - First;
   if (NumNewDesignators == 0) {
@@ -1925,7 +1924,7 @@
     return;
   }
 
-  Designator *NewDesignators 
+  Designator *NewDesignators
     = new Designator[NumDesignators - 1 + NumNewDesignators];
   std::copy(Designators, Designators + Idx, NewDesignators);
   std::copy(First, Last, NewDesignators + Idx);
@@ -1941,14 +1940,14 @@
   Expr::DoDestroy(C);
 }
 
-ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc, 
+ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc,
                              Expr **exprs, unsigned nexprs,
                              SourceLocation rparenloc)
 : Expr(ParenListExprClass, QualType(),
        hasAnyTypeDependentArguments(exprs, nexprs),
-       hasAnyValueDependentArguments(exprs, nexprs)), 
+       hasAnyValueDependentArguments(exprs, nexprs)),
   NumExprs(nexprs), LParenLoc(lparenloc), RParenLoc(rparenloc) {
-  
+
   Exprs = new (C) Stmt*[nexprs];
   for (unsigned i = 0; i != nexprs; ++i)
     Exprs[i] = exprs[i];
@@ -1991,11 +1990,11 @@
 Stmt::child_iterator ObjCPropertyRefExpr::child_end() { return &Base+1; }
 
 // ObjCImplicitSetterGetterRefExpr
-Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() { 
-  return &Base; 
+Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() {
+  return &Base;
 }
-Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() { 
-  return &Base+1; 
+Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() {
+  return &Base+1;
 }
 
 // ObjCSuperExpr
@@ -2039,7 +2038,7 @@
 Stmt::child_iterator UnaryOperator::child_end() { return &Val+1; }
 
 // SizeOfAlignOfExpr
-Stmt::child_iterator SizeOfAlignOfExpr::child_begin() { 
+Stmt::child_iterator SizeOfAlignOfExpr::child_begin() {
   // If this is of a type and the type is a VLA type (and not a typedef), the
   // size expression of the VLA needs to be treated as an executable expression.
   // Why isn't this weirdness documented better in StmtIterator?
@@ -2161,12 +2160,12 @@
 }
 
 // ImplicitValueInitExpr
-Stmt::child_iterator ImplicitValueInitExpr::child_begin() { 
-  return child_iterator(); 
+Stmt::child_iterator ImplicitValueInitExpr::child_begin() {
+  return child_iterator();
 }
 
-Stmt::child_iterator ImplicitValueInitExpr::child_end() { 
-  return child_iterator(); 
+Stmt::child_iterator ImplicitValueInitExpr::child_end() {
+  return child_iterator();
 }
 
 // ParenListExpr
@@ -2178,7 +2177,7 @@
 }
 
 // ObjCStringLiteral
-Stmt::child_iterator ObjCStringLiteral::child_begin() { 
+Stmt::child_iterator ObjCStringLiteral::child_begin() {
   return &String;
 }
 Stmt::child_iterator ObjCStringLiteral::child_end() {
@@ -2190,7 +2189,7 @@
 Stmt::child_iterator ObjCEncodeExpr::child_end() { return child_iterator(); }
 
 // ObjCSelectorExpr
-Stmt::child_iterator ObjCSelectorExpr::child_begin() { 
+Stmt::child_iterator ObjCSelectorExpr::child_begin() {
   return child_iterator();
 }
 Stmt::child_iterator ObjCSelectorExpr::child_end() {
@@ -2206,7 +2205,7 @@
 }
 
 // ObjCMessageExpr
-Stmt::child_iterator ObjCMessageExpr::child_begin() {  
+Stmt::child_iterator ObjCMessageExpr::child_begin() {
   return getReceiver() ? &SubExprs[0] : &SubExprs[0] + ARGS_START;
 }
 Stmt::child_iterator ObjCMessageExpr::child_end() {

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

==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Wed Sep  9 10:08:12 2009
@@ -30,7 +30,7 @@
 }
 
 // CXXBoolLiteralExpr
-Stmt::child_iterator CXXBoolLiteralExpr::child_begin() { 
+Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
   return child_iterator();
 }
 Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
@@ -38,7 +38,7 @@
 }
 
 // CXXNullPtrLiteralExpr
-Stmt::child_iterator CXXNullPtrLiteralExpr::child_begin() { 
+Stmt::child_iterator CXXNullPtrLiteralExpr::child_begin() {
   return child_iterator();
 }
 Stmt::child_iterator CXXNullPtrLiteralExpr::child_end() {
@@ -65,7 +65,7 @@
 }
 
 // CXXZeroInitValueExpr
-Stmt::child_iterator CXXZeroInitValueExpr::child_begin() { 
+Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
   return child_iterator();
 }
 Stmt::child_iterator CXXZeroInitValueExpr::child_end() {
@@ -93,8 +93,7 @@
     Initializer(initializer), Array(arraySize), NumPlacementArgs(numPlaceArgs),
     NumConstructorArgs(numConsArgs), OperatorNew(operatorNew),
     OperatorDelete(operatorDelete), Constructor(constructor),
-    StartLoc(startLoc), EndLoc(endLoc)
-{
+    StartLoc(startLoc), EndLoc(endLoc) {
   unsigned TotalSize = Array + NumPlacementArgs + NumConstructorArgs;
   SubExprs = new Stmt*[TotalSize];
   unsigned i = 0;
@@ -123,8 +122,8 @@
 }
 
 // UnresolvedFunctionNameExpr
-Stmt::child_iterator UnresolvedFunctionNameExpr::child_begin() { 
-  return child_iterator(); 
+Stmt::child_iterator UnresolvedFunctionNameExpr::child_begin() {
+  return child_iterator();
 }
 Stmt::child_iterator UnresolvedFunctionNameExpr::child_end() {
   return child_iterator();
@@ -147,16 +146,16 @@
 }
 
 TemplateIdRefExpr::TemplateIdRefExpr(QualType T,
-                                     NestedNameSpecifier *Qualifier, 
+                                     NestedNameSpecifier *Qualifier,
                                      SourceRange QualifierRange,
-                                     TemplateName Template, 
+                                     TemplateName Template,
                                      SourceLocation TemplateNameLoc,
-                                     SourceLocation LAngleLoc, 
+                                     SourceLocation LAngleLoc,
                                      const TemplateArgument *TemplateArgs,
                                      unsigned NumTemplateArgs,
                                      SourceLocation RAngleLoc)
   : Expr(TemplateIdRefExprClass, T,
-         (Template.isDependent() || 
+         (Template.isDependent() ||
           TemplateSpecializationType::anyDependentTemplateArguments(
                                               TemplateArgs, NumTemplateArgs)),
          (Template.isDependent() ||
@@ -164,10 +163,8 @@
                                               TemplateArgs, NumTemplateArgs))),
     Qualifier(Qualifier), QualifierRange(QualifierRange), Template(Template),
     TemplateNameLoc(TemplateNameLoc), LAngleLoc(LAngleLoc),
-    RAngleLoc(RAngleLoc), NumTemplateArgs(NumTemplateArgs)
-    
-{ 
-  TemplateArgument *StoredTemplateArgs 
+    RAngleLoc(RAngleLoc), NumTemplateArgs(NumTemplateArgs) {
+  TemplateArgument *StoredTemplateArgs
     = reinterpret_cast<TemplateArgument *> (this+1);
   for (unsigned I = 0; I != NumTemplateArgs; ++I)
     new (StoredTemplateArgs + I) TemplateArgument(TemplateArgs[I]);
@@ -175,10 +172,10 @@
 
 TemplateIdRefExpr *
 TemplateIdRefExpr::Create(ASTContext &Context, QualType T,
-                          NestedNameSpecifier *Qualifier, 
+                          NestedNameSpecifier *Qualifier,
                           SourceRange QualifierRange,
                           TemplateName Template, SourceLocation TemplateNameLoc,
-                          SourceLocation LAngleLoc, 
+                          SourceLocation LAngleLoc,
                           const TemplateArgument *TemplateArgs,
                           unsigned NumTemplateArgs, SourceLocation RAngleLoc) {
   void *Mem = Context.Allocate(sizeof(TemplateIdRefExpr) +
@@ -298,7 +295,7 @@
   if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
     if (getNumArgs() == 1)
       // Prefix operator
-      return SourceRange(getOperatorLoc(), 
+      return SourceRange(getOperatorLoc(),
                          getArg(0)->getSourceRange().getEnd());
     else
       // Postfix operator
@@ -343,7 +340,7 @@
   }
 }
 
-CXXTemporary *CXXTemporary::Create(ASTContext &C, 
+CXXTemporary *CXXTemporary::Create(ASTContext &C,
                                    const CXXDestructorDecl *Destructor) {
   return new (C) CXXTemporary(Destructor);
 }
@@ -353,10 +350,10 @@
   Ctx.Deallocate(this);
 }
 
-CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C, 
+CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C,
                                                    CXXTemporary *Temp,
                                                    Expr* SubExpr) {
-  assert(SubExpr->getType()->isRecordType() && 
+  assert(SubExpr->getType()->isRecordType() &&
          "Expression bound to a temporary must have record type!");
 
   return new (C) CXXBindTemporaryExpr(Temp, SubExpr);
@@ -371,46 +368,46 @@
 CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
                                                CXXConstructorDecl *Cons,
                                                QualType writtenTy,
-                                               SourceLocation tyBeginLoc, 
+                                               SourceLocation tyBeginLoc,
                                                Expr **Args,
-                                               unsigned NumArgs, 
+                                               unsigned NumArgs,
                                                SourceLocation rParenLoc)
-  : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons, 
-                     false, Args, NumArgs), 
+  : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons,
+                     false, Args, NumArgs),
   TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
 }
 
-CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T, 
+CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T,
                                            CXXConstructorDecl *D, bool Elidable,
                                            Expr **Args, unsigned NumArgs) {
-  return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable, 
+  return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable,
                                   Args, NumArgs);
 }
 
-CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, 
+CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
                                    CXXConstructorDecl *D, bool elidable,
-                                   Expr **args, unsigned numargs) 
+                                   Expr **args, unsigned numargs)
 : Expr(SC, T,
        T->isDependentType(),
        (T->isDependentType() ||
         CallExpr::hasAnyValueDependentArguments(args, numargs))),
   Constructor(D), Elidable(elidable), Args(0), NumArgs(numargs) {
     // leave room for default arguments;
-    const FunctionProtoType *FTy = 
+    const FunctionProtoType *FTy =
       cast<FunctionDecl>(D)->getType()->getAsFunctionProtoType();
-    
+
     unsigned NumArgsInProto = FTy->getNumArgs();
     unsigned NumArgsToAllocate = FTy->isVariadic() ? NumArgs : NumArgsInProto;
     if (NumArgsToAllocate) {
       Args = new (C) Stmt*[NumArgsToAllocate];
-      
+
       for (unsigned i = 0; i != NumArgs; ++i)
         Args[i] = args[i];
-      
+
       // Set default arguments to 0.
       for (unsigned i = NumArgs; i != NumArgsToAllocate; ++i)
         Args[i] = 0;
-        
+
       NumArgs = NumArgsToAllocate;
     }
 }
@@ -423,13 +420,13 @@
   C.Deallocate(this);
 }
 
-CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr, 
-                                               CXXTemporary **temps, 
+CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr,
+                                               CXXTemporary **temps,
                                                unsigned numtemps,
                                                bool shoulddestroytemps)
 : Expr(CXXExprWithTemporariesClass, subexpr->getType(),
-       subexpr->isTypeDependent(), subexpr->isValueDependent()), 
-  SubExpr(subexpr), Temps(0), NumTemps(numtemps), 
+       subexpr->isTypeDependent(), subexpr->isValueDependent()),
+  SubExpr(subexpr), Temps(0), NumTemps(numtemps),
   ShouldDestroyTemps(shoulddestroytemps) {
   if (NumTemps > 0) {
     Temps = new CXXTemporary*[NumTemps];
@@ -438,12 +435,12 @@
   }
 }
 
-CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C, 
+CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C,
                                                        Expr *SubExpr,
-                                                       CXXTemporary **Temps, 
+                                                       CXXTemporary **Temps,
                                                        unsigned NumTemps,
                                                        bool ShouldDestroyTemps){
-  return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps, 
+  return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps,
                                         ShouldDestroyTemps);
 }
 
@@ -462,7 +459,7 @@
   return &SubExpr;
 }
 
-Stmt::child_iterator CXXBindTemporaryExpr::child_end() { 
+Stmt::child_iterator CXXBindTemporaryExpr::child_end() {
   return &SubExpr + 1;
 }
 
@@ -479,7 +476,7 @@
   return &SubExpr;
 }
 
-Stmt::child_iterator CXXExprWithTemporaries::child_end() { 
+Stmt::child_iterator CXXExprWithTemporaries::child_end() {
   return &SubExpr + 1;
 }
 
@@ -502,7 +499,7 @@
 }
 
 CXXUnresolvedConstructExpr *
-CXXUnresolvedConstructExpr::Create(ASTContext &C, 
+CXXUnresolvedConstructExpr::Create(ASTContext &C,
                                    SourceLocation TyBegin,
                                    QualType T,
                                    SourceLocation LParenLoc,
@@ -523,8 +520,8 @@
   return child_iterator(reinterpret_cast<Stmt **>(this + 1) + NumArgs);
 }
 
-CXXUnresolvedMemberExpr::CXXUnresolvedMemberExpr(ASTContext &C, 
-                                                 Expr *Base, bool IsArrow, 
+CXXUnresolvedMemberExpr::CXXUnresolvedMemberExpr(ASTContext &C,
+                                                 Expr *Base, bool IsArrow,
                                                  SourceLocation OperatorLoc,
                                                  NestedNameSpecifier *Qualifier,
                                                  SourceRange QualifierRange,
@@ -537,29 +534,28 @@
                                                  unsigned NumTemplateArgs,
                                                  SourceLocation RAngleLoc)
   : Expr(CXXUnresolvedMemberExprClass, C.DependentTy, true, true),
-    Base(Base), IsArrow(IsArrow), 
+    Base(Base), IsArrow(IsArrow),
     HasExplicitTemplateArgumentList(HasExplicitTemplateArgs),
     OperatorLoc(OperatorLoc),
     Qualifier(Qualifier), QualifierRange(QualifierRange),
     FirstQualifierFoundInScope(FirstQualifierFoundInScope),
-    Member(Member), MemberLoc(MemberLoc)
-{
+    Member(Member), MemberLoc(MemberLoc) {
   if (HasExplicitTemplateArgumentList) {
-    ExplicitTemplateArgumentList *ETemplateArgs 
+    ExplicitTemplateArgumentList *ETemplateArgs
       = getExplicitTemplateArgumentList();
     ETemplateArgs->LAngleLoc = LAngleLoc;
     ETemplateArgs->RAngleLoc = RAngleLoc;
     ETemplateArgs->NumTemplateArgs = NumTemplateArgs;
-    
+
     TemplateArgument *SavedTemplateArgs = ETemplateArgs->getTemplateArgs();
     for (unsigned I = 0; I < NumTemplateArgs; ++I)
-      new (SavedTemplateArgs + I) TemplateArgument(TemplateArgs[I]);            
+      new (SavedTemplateArgs + I) TemplateArgument(TemplateArgs[I]);
   }
 }
 
 CXXUnresolvedMemberExpr *
-CXXUnresolvedMemberExpr::Create(ASTContext &C, 
-                                Expr *Base, bool IsArrow, 
+CXXUnresolvedMemberExpr::Create(ASTContext &C,
+                                Expr *Base, bool IsArrow,
                                 SourceLocation OperatorLoc,
                                 NestedNameSpecifier *Qualifier,
                                 SourceRange QualifierRange,
@@ -570,16 +566,15 @@
                                 SourceLocation LAngleLoc,
                                 const TemplateArgument *TemplateArgs,
                                 unsigned NumTemplateArgs,
-                                SourceLocation RAngleLoc)
-{
+                                SourceLocation RAngleLoc) {
   if (!HasExplicitTemplateArgs)
     return new (C) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,
                                            Qualifier, QualifierRange,
                                            FirstQualifierFoundInScope,
                                            Member, MemberLoc);
-  
+
   void *Mem = C.Allocate(sizeof(CXXUnresolvedMemberExpr) +
-                         sizeof(ExplicitTemplateArgumentList) + 
+                         sizeof(ExplicitTemplateArgumentList) +
                          sizeof(TemplateArgument) * NumTemplateArgs,
                          llvm::alignof<CXXUnresolvedMemberExpr>());
   return new (Mem) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,

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

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Sep  9 10:08:12 2009
@@ -42,11 +42,11 @@
 /// certain things in certain situations.
 struct EvalInfo {
   ASTContext &Ctx;
-  
+
   /// EvalResult - Contains information about the evaluation.
   Expr::EvalResult &EvalResult;
 
-  EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx), 
+  EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx),
            EvalResult(evalresult) {}
 };
 
@@ -104,12 +104,12 @@
   return false;
 }
 
-static APSInt HandleFloatToIntCast(QualType DestType, QualType SrcType, 
+static APSInt HandleFloatToIntCast(QualType DestType, QualType SrcType,
                                    APFloat &Value, ASTContext &Ctx) {
   unsigned DestWidth = Ctx.getIntWidth(DestType);
   // Determine whether we are converting to unsigned or signed.
   bool DestSigned = DestType->isSignedIntegerType();
-  
+
   // FIXME: Warning for overflow.
   uint64_t Space[4];
   bool ignored;
@@ -118,16 +118,16 @@
   return APSInt(llvm::APInt(DestWidth, 4, Space), !DestSigned);
 }
 
-static APFloat HandleFloatToFloatCast(QualType DestType, QualType SrcType, 
+static APFloat HandleFloatToFloatCast(QualType DestType, QualType SrcType,
                                       APFloat &Value, ASTContext &Ctx) {
   bool ignored;
   APFloat Result = Value;
-  Result.convert(Ctx.getFloatTypeSemantics(DestType), 
+  Result.convert(Ctx.getFloatTypeSemantics(DestType),
                  APFloat::rmNearestTiesToEven, &ignored);
   return Result;
 }
 
-static APSInt HandleIntToIntCast(QualType DestType, QualType SrcType, 
+static APSInt HandleIntToIntCast(QualType DestType, QualType SrcType,
                                  APSInt &Value, ASTContext &Ctx) {
   unsigned DestWidth = Ctx.getIntWidth(DestType);
   APSInt Result = Value;
@@ -138,7 +138,7 @@
   return Result;
 }
 
-static APFloat HandleIntToFloatCast(QualType DestType, QualType SrcType, 
+static APFloat HandleIntToFloatCast(QualType DestType, QualType SrcType,
                                     APSInt &Value, ASTContext &Ctx) {
 
   APFloat Result(Ctx.getFloatTypeSemantics(DestType), 1);
@@ -155,7 +155,7 @@
   : public StmtVisitor<LValueExprEvaluator, APValue> {
   EvalInfo &Info;
 public:
-    
+
   LValueExprEvaluator(EvalInfo &info) : Info(info) {}
 
   APValue VisitStmt(Stmt *S) {
@@ -185,8 +185,7 @@
   return Result.isLValue();
 }
 
-APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E)
-{
+APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E) {
   if (isa<FunctionDecl>(E->getDecl())) {
     return APValue(E, 0);
   } else if (VarDecl* VD = dyn_cast<VarDecl>(E->getDecl())) {
@@ -202,11 +201,10 @@
   return APValue();
 }
 
-APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E)
-{ 
+APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E) {
   if (E->hasBlockDeclRefExprs())
     return APValue();
-    
+
   return APValue(E, 0);
 }
 
@@ -255,13 +253,12 @@
   return result;
 }
 
-APValue LValueExprEvaluator::VisitArraySubscriptExpr(ArraySubscriptExpr *E)
-{
+APValue LValueExprEvaluator::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
   APValue Result;
-  
+
   if (!EvaluatePointer(E->getBase(), Result, Info))
     return APValue();
-  
+
   APSInt Index;
   if (!EvaluateInteger(E->getIdx(), Index, Info))
     return APValue();
@@ -269,13 +266,12 @@
   uint64_t ElementSize = Info.Ctx.getTypeSize(E->getType()) / 8;
 
   uint64_t Offset = Index.getSExtValue() * ElementSize;
-  Result.setLValue(Result.getLValueBase(), 
+  Result.setLValue(Result.getLValueBase(),
                    Result.getLValueOffset() + Offset);
   return Result;
 }
 
-APValue LValueExprEvaluator::VisitUnaryDeref(UnaryOperator *E)
-{
+APValue LValueExprEvaluator::VisitUnaryDeref(UnaryOperator *E) {
   APValue Result;
   if (!EvaluatePointer(E->getSubExpr(), Result, Info))
     return APValue();
@@ -291,7 +287,7 @@
   : public StmtVisitor<PointerExprEvaluator, APValue> {
   EvalInfo &Info;
 public:
-    
+
   PointerExprEvaluator(EvalInfo &info) : Info(info) {}
 
   APValue VisitStmt(Stmt *S) {
@@ -337,23 +333,23 @@
   if (E->getOpcode() != BinaryOperator::Add &&
       E->getOpcode() != BinaryOperator::Sub)
     return APValue();
-  
+
   const Expr *PExp = E->getLHS();
   const Expr *IExp = E->getRHS();
   if (IExp->getType()->isPointerType())
     std::swap(PExp, IExp);
-  
+
   APValue ResultLValue;
   if (!EvaluatePointer(PExp, ResultLValue, Info))
     return APValue();
-  
+
   llvm::APSInt AdditionalOffset(32);
   if (!EvaluateInteger(IExp, AdditionalOffset, Info))
     return APValue();
 
   QualType PointeeType = PExp->getType()->getAs<PointerType>()->getPointeeType();
   uint64_t SizeOfPointee;
-  
+
   // Explicitly handle GNU void* and function pointer arithmetic extensions.
   if (PointeeType->isVoidType() || PointeeType->isFunctionType())
     SizeOfPointee = 1;
@@ -376,7 +372,7 @@
     return result;
   return APValue();
 }
-  
+
 
 APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
   const Expr* SubExpr = E->getSubExpr();
@@ -389,7 +385,7 @@
       return Result;
     return APValue();
   }
-  
+
   if (SubExpr->getType()->isIntegralType()) {
     APValue Result;
     if (!EvaluateIntegerOrLValue(SubExpr, Result, Info))
@@ -399,7 +395,7 @@
       Result.getInt().extOrTrunc((unsigned)Info.Ctx.getTypeSize(E->getType()));
       return APValue(0, Result.getInt().getZExtValue());
     }
-    
+
     // Cast is of an lvalue, no need to change value.
     return Result;
   }
@@ -414,10 +410,10 @@
   }
 
   return APValue();
-}  
+}
 
 APValue PointerExprEvaluator::VisitCallExpr(CallExpr *E) {
-  if (E->isBuiltinCall(Info.Ctx) == 
+  if (E->isBuiltinCall(Info.Ctx) ==
         Builtin::BI__builtin___CFStringMakeConstantString)
     return APValue(E, 0);
   return APValue();
@@ -446,13 +442,13 @@
     EvalInfo &Info;
     APValue GetZeroVector(QualType VecType);
   public:
-    
+
     VectorExprEvaluator(EvalInfo &info) : Info(info) {}
-    
+
     APValue VisitStmt(Stmt *S) {
       return APValue();
     }
-    
+
     APValue VisitParenExpr(ParenExpr *E)
         { return Visit(E->getSubExpr()); }
     APValue VisitUnaryExtension(const UnaryOperator *E)
@@ -490,7 +486,7 @@
   QualType EltTy = VTy->getElementType();
   unsigned NElts = VTy->getNumElements();
   unsigned EltWidth = Info.Ctx.getTypeSize(EltTy);
-  
+
   const Expr* SE = E->getSubExpr();
   QualType SETy = SE->getType();
   APValue Result = APValue();
@@ -540,12 +536,12 @@
   // element.
   APSInt Init;
   Init = Result.isInt() ? Result.getInt() : Result.getFloat().bitcastToAPInt();
-  
+
   llvm::SmallVector<APValue, 4> Elts;
   for (unsigned i = 0; i != NElts; ++i) {
     APSInt Tmp = Init;
     Tmp.extOrTrunc(EltWidth);
-    
+
     if (EltTy->isIntegerType())
       Elts.push_back(APValue(Tmp));
     else if (EltTy->isRealFloatingType())
@@ -558,17 +554,17 @@
   return APValue(&Elts[0], Elts.size());
 }
 
-APValue 
+APValue
 VectorExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
   return this->Visit(const_cast<Expr*>(E->getInitializer()));
 }
 
-APValue 
+APValue
 VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
   const VectorType *VT = E->getType()->getAsVectorType();
   unsigned NumInits = E->getNumInits();
   unsigned NumElements = VT->getNumElements();
-  
+
   QualType EltTy = VT->getElementType();
   llvm::SmallVector<APValue, 4> Elements;
 
@@ -596,7 +592,7 @@
   return APValue(&Elements[0], Elements.size());
 }
 
-APValue 
+APValue
 VectorExprEvaluator::GetZeroVector(QualType T) {
   const VectorType *VT = T->getAsVectorType();
   QualType EltTy = VT->getElementType();
@@ -677,20 +673,20 @@
     }
     return false;
   }
-    
+
   //===--------------------------------------------------------------------===//
   //                            Visitor Methods
   //===--------------------------------------------------------------------===//
-  
+
   bool VisitStmt(Stmt *) {
     assert(0 && "This should be called on integers, stmts are not integers");
     return false;
   }
-    
+
   bool VisitExpr(Expr *E) {
     return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E);
   }
-  
+
   bool VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
 
   bool VisitIntegerLiteral(const IntegerLiteral *E) {
@@ -705,7 +701,7 @@
     // be able to strip CRV qualifiers from the type.
     QualType T0 = Info.Ctx.getCanonicalType(E->getArgType1());
     QualType T1 = Info.Ctx.getCanonicalType(E->getArgType2());
-    return Success(Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(), 
+    return Success(Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(),
                                                T1.getUnqualifiedType()),
                    E);
   }
@@ -721,11 +717,11 @@
   bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
     return Success(E->getValue(), E);
   }
-  
+
   bool VisitGNUNullExpr(const GNUNullExpr *E) {
     return Success(0, E);
   }
-    
+
   bool VisitCXXZeroInitValueExpr(const CXXZeroInitValueExpr *E) {
     return Success(0, E);
   }
@@ -755,7 +751,7 @@
 static bool EvaluateIntegerOrLValue(const Expr* E, APValue &Result, EvalInfo &Info) {
   if (!E->getType()->isIntegralType())
     return false;
-  
+
   return IntExprEvaluator(Info, Result).Visit(const_cast<Expr*>(E));
 }
 
@@ -818,12 +814,12 @@
     array_type_class, string_type_class,
     lang_type_class
   };
-  
-  // If no argument was supplied, default to "no_type_class". This isn't 
+
+  // If no argument was supplied, default to "no_type_class". This isn't
   // ideal, however it is what gcc does.
   if (E->getNumArgs() == 0)
     return no_type_class;
-  
+
   QualType ArgTy = E->getArg(0)->getType();
   if (ArgTy->isVoidType())
     return void_type_class;
@@ -864,7 +860,7 @@
     return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E);
   case Builtin::BI__builtin_classify_type:
     return Success(EvaluateBuiltinClassifyType(E), E);
-    
+
   case Builtin::BI__builtin_constant_p:
     // __builtin_constant_p always has one operand: it returns true if that
     // operand can be folded, false otherwise.
@@ -889,7 +885,7 @@
     // These need to be handled specially because the operands aren't
     // necessarily integral
     bool lhsResult, rhsResult;
-    
+
     if (HandleConversionToBool(E->getLHS(), lhsResult, Info)) {
       // We were able to evaluate the LHS, see if we can get away with not
       // evaluating the RHS: 0 && X -> 0, 1 || X -> 1
@@ -906,7 +902,7 @@
       if (HandleConversionToBool(E->getRHS(), rhsResult, Info)) {
         // We can't evaluate the LHS; however, sometimes the result
         // is determined by the RHS: X && 0 -> 0, X || 1 -> 1.
-        if (rhsResult == (E->getOpcode() == BinaryOperator::LOr) || 
+        if (rhsResult == (E->getOpcode() == BinaryOperator::LOr) ||
             !rhsResult == (E->getOpcode() == BinaryOperator::LAnd)) {
           // Since we weren't able to evaluate the left hand side, it
           // must have had side effects.
@@ -934,9 +930,9 @@
       return false;
 
     if (LHS.isComplexFloat()) {
-      APFloat::cmpResult CR_r = 
+      APFloat::cmpResult CR_r =
         LHS.getComplexFloatReal().compare(RHS.getComplexFloatReal());
-      APFloat::cmpResult CR_i = 
+      APFloat::cmpResult CR_i =
         LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
 
       if (E->getOpcode() == BinaryOperator::EQ)
@@ -945,9 +941,9 @@
       else {
         assert(E->getOpcode() == BinaryOperator::NE &&
                "Invalid complex comparison.");
-        return Success(((CR_r == APFloat::cmpGreaterThan || 
+        return Success(((CR_r == APFloat::cmpGreaterThan ||
                          CR_r == APFloat::cmpLessThan) &&
-                        (CR_i == APFloat::cmpGreaterThan || 
+                        (CR_i == APFloat::cmpGreaterThan ||
                          CR_i == APFloat::cmpLessThan)), E);
       }
     } else {
@@ -962,17 +958,17 @@
       }
     }
   }
-  
+
   if (LHSTy->isRealFloatingType() &&
       RHSTy->isRealFloatingType()) {
     APFloat RHS(0.0), LHS(0.0);
-    
+
     if (!EvaluateFloat(E->getRHS(), RHS, Info))
       return false;
-    
+
     if (!EvaluateFloat(E->getLHS(), LHS, Info))
       return false;
-    
+
     APFloat::cmpResult CR = LHS.compare(RHS);
 
     switch (E->getOpcode()) {
@@ -985,16 +981,16 @@
     case BinaryOperator::LE:
       return Success(CR == APFloat::cmpLessThan || CR == APFloat::cmpEqual, E);
     case BinaryOperator::GE:
-      return Success(CR == APFloat::cmpGreaterThan || CR == APFloat::cmpEqual, 
+      return Success(CR == APFloat::cmpGreaterThan || CR == APFloat::cmpEqual,
                      E);
     case BinaryOperator::EQ:
       return Success(CR == APFloat::cmpEqual, E);
     case BinaryOperator::NE:
-      return Success(CR == APFloat::cmpGreaterThan 
+      return Success(CR == APFloat::cmpGreaterThan
                      || CR == APFloat::cmpLessThan, E);
     }
   }
-  
+
   if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
     if (E->getOpcode() == BinaryOperator::Sub || E->isEqualityOp()) {
       APValue LHSValue;
@@ -1106,16 +1102,16 @@
     return Success(Result.getInt() % RHS, E);
   case BinaryOperator::Shl: {
     // FIXME: Warn about out of range shift amounts!
-    unsigned SA = 
+    unsigned SA =
       (unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
     return Success(Result.getInt() << SA, E);
   }
   case BinaryOperator::Shr: {
-    unsigned SA = 
+    unsigned SA =
       (unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
     return Success(Result.getInt() >> SA, E);
   }
-      
+
   case BinaryOperator::LT: return Success(Result.getInt() < RHS, E);
   case BinaryOperator::GT: return Success(Result.getInt() > RHS, E);
   case BinaryOperator::LE: return Success(Result.getInt() <= RHS, E);
@@ -1145,7 +1141,7 @@
   E = E->IgnoreParens();
 
   // alignof decl is always accepted, even if it doesn't make sense: we default
-  // to 1 in those cases. 
+  // to 1 in those cases.
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
     return Info.Ctx.getDeclAlignInBytes(DRE->getDecl());
 
@@ -1225,7 +1221,7 @@
     // If so, we could clear the diagnostic ID.
     return true;
   case UnaryOperator::Plus:
-    // The result is always just the subexpr. 
+    // The result is always just the subexpr.
     return true;
   case UnaryOperator::Minus:
     if (!Result.isInt()) return false;
@@ -1235,7 +1231,7 @@
     return Success(~Result.getInt(), E);
   }
 }
-  
+
 /// HandleCast - This is used to evaluate implicit or explicit casts where the
 /// result type is integer.
 bool IntExprEvaluator::VisitCastExpr(CastExpr *E) {
@@ -1263,7 +1259,7 @@
     return Success(HandleIntToIntCast(DestType, SrcType,
                                       Result.getInt(), Info.Ctx), E);
   }
-  
+
   // FIXME: Clean this up!
   if (SrcType->isPointerType()) {
     APValue LV;
@@ -1317,7 +1313,7 @@
   APFloat F(0.0);
   if (!EvaluateFloat(SubExpr, F, Info))
     return Error(E->getExprLoc(), diag::note_invalid_subexpr_in_ice, E);
-  
+
   return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E);
 }
 
@@ -1400,13 +1396,13 @@
     Result = llvm::APFloat::getInf(Sem);
     return true;
   }
-      
+
   case Builtin::BI__builtin_nan:
   case Builtin::BI__builtin_nanf:
   case Builtin::BI__builtin_nanl:
     // If this is __builtin_nan() turn this into a nan, otherwise we
     // can't constant fold it.
-    if (const StringLiteral *S = 
+    if (const StringLiteral *S =
         dyn_cast<StringLiteral>(E->getArg(0)->IgnoreParenCasts())) {
       if (!S->isWide()) {
         const llvm::fltSemantics &Sem =
@@ -1431,13 +1427,13 @@
   case Builtin::BI__builtin_fabsl:
     if (!EvaluateFloat(E->getArg(0), Result, Info))
       return false;
-    
+
     if (Result.isNegative())
       Result.changeSign();
     return true;
 
-  case Builtin::BI__builtin_copysign: 
-  case Builtin::BI__builtin_copysignf: 
+  case Builtin::BI__builtin_copysign:
+  case Builtin::BI__builtin_copysignf:
   case Builtin::BI__builtin_copysignl: {
     APFloat RHS(0.);
     if (!EvaluateFloat(E->getArg(0), Result, Info) ||
@@ -1458,7 +1454,7 @@
 
   switch (E->getOpcode()) {
   default: return false;
-  case UnaryOperator::Plus: 
+  case UnaryOperator::Plus:
     return true;
   case UnaryOperator::Minus:
     Result.changeSign();
@@ -1499,12 +1495,12 @@
 
 bool FloatExprEvaluator::VisitCastExpr(CastExpr *E) {
   Expr* SubExpr = E->getSubExpr();
-  
+
   if (SubExpr->getType()->isIntegralType()) {
     APSInt IntResult;
     if (!EvaluateInteger(SubExpr, IntResult, Info))
       return false;
-    Result = HandleIntToFloatCast(E->getType(), SubExpr->getType(), 
+    Result = HandleIntToFloatCast(E->getType(), SubExpr->getType(),
                                   IntResult, Info.Ctx);
     return true;
   }
@@ -1533,10 +1529,10 @@
 class VISIBILITY_HIDDEN ComplexExprEvaluator
   : public StmtVisitor<ComplexExprEvaluator, APValue> {
   EvalInfo &Info;
-  
+
 public:
   ComplexExprEvaluator(EvalInfo &info) : Info(info) {}
-  
+
   //===--------------------------------------------------------------------===//
   //                            Visitor Methods
   //===--------------------------------------------------------------------===//
@@ -1544,7 +1540,7 @@
   APValue VisitStmt(Stmt *S) {
     return APValue();
   }
-    
+
   APValue VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
 
   APValue VisitImaginaryLiteral(ImaginaryLiteral *E) {
@@ -1555,17 +1551,17 @@
 
       if (!EvaluateFloat(SubExpr, Result, Info))
         return APValue();
-    
-      return APValue(APFloat(Result.getSemantics(), APFloat::fcZero, false), 
+
+      return APValue(APFloat(Result.getSemantics(), APFloat::fcZero, false),
                      Result);
     } else {
-      assert(SubExpr->getType()->isIntegerType() && 
+      assert(SubExpr->getType()->isIntegerType() &&
              "Unexpected imaginary literal.");
 
       llvm::APSInt Result;
       if (!EvaluateInteger(SubExpr, Result, Info))
         return APValue();
-      
+
       llvm::APSInt Zero(Result.getBitWidth(), !Result.isSigned());
       Zero = 0;
       return APValue(Zero, Result);
@@ -1585,7 +1581,7 @@
 
       if (EltType->isRealFloatingType()) {
         Result = HandleFloatToFloatCast(EltType, SubType, Result, Info.Ctx);
-        return APValue(Result, 
+        return APValue(Result,
                        APFloat(Result.getSemantics(), APFloat::fcZero, false));
       } else {
         llvm::APSInt IResult;
@@ -1603,7 +1599,7 @@
       if (EltType->isRealFloatingType()) {
         APFloat FResult =
             HandleIntToFloatCast(EltType, SubType, Result, Info.Ctx);
-        return APValue(FResult, 
+        return APValue(FResult,
                        APFloat(FResult.getSemantics(), APFloat::fcZero, false));
       } else {
         Result = HandleIntToIntCast(EltType, SubType, Result, Info.Ctx);
@@ -1621,36 +1617,36 @@
 
       if (Src.isComplexFloat()) {
         if (EltType->isRealFloatingType()) {
-          return APValue(HandleFloatToFloatCast(EltType, SrcType, 
+          return APValue(HandleFloatToFloatCast(EltType, SrcType,
                                                 Src.getComplexFloatReal(),
                                                 Info.Ctx),
-                         HandleFloatToFloatCast(EltType, SrcType, 
+                         HandleFloatToFloatCast(EltType, SrcType,
                                                 Src.getComplexFloatImag(),
                                                 Info.Ctx));
         } else {
           return APValue(HandleFloatToIntCast(EltType, SrcType,
                                               Src.getComplexFloatReal(),
                                               Info.Ctx),
-                         HandleFloatToIntCast(EltType, SrcType, 
+                         HandleFloatToIntCast(EltType, SrcType,
                                               Src.getComplexFloatImag(),
-                                              Info.Ctx)); 
+                                              Info.Ctx));
         }
       } else {
         assert(Src.isComplexInt() && "Invalid evaluate result.");
         if (EltType->isRealFloatingType()) {
-          return APValue(HandleIntToFloatCast(EltType, SrcType, 
+          return APValue(HandleIntToFloatCast(EltType, SrcType,
                                               Src.getComplexIntReal(),
                                               Info.Ctx),
-                         HandleIntToFloatCast(EltType, SrcType, 
+                         HandleIntToFloatCast(EltType, SrcType,
                                               Src.getComplexIntImag(),
                                               Info.Ctx));
         } else {
           return APValue(HandleIntToIntCast(EltType, SrcType,
                                             Src.getComplexIntReal(),
                                             Info.Ctx),
-                         HandleIntToIntCast(EltType, SrcType, 
+                         HandleIntToIntCast(EltType, SrcType,
                                             Src.getComplexIntImag(),
-                                            Info.Ctx)); 
+                                            Info.Ctx));
         }
       }
     }
@@ -1658,7 +1654,7 @@
     // FIXME: Handle more casts.
     return APValue();
   }
-  
+
   APValue VisitBinaryOperator(const BinaryOperator *E);
   APValue VisitChooseExpr(const ChooseExpr *E)
     { return Visit(E->getChosenSubExpr(Info.Ctx)); }
@@ -1669,23 +1665,21 @@
 };
 } // end anonymous namespace
 
-static bool EvaluateComplex(const Expr *E, APValue &Result, EvalInfo &Info)
-{
+static bool EvaluateComplex(const Expr *E, APValue &Result, EvalInfo &Info) {
   Result = ComplexExprEvaluator(Info).Visit(const_cast<Expr*>(E));
   assert((!Result.isComplexFloat() ||
-          (&Result.getComplexFloatReal().getSemantics() == 
-           &Result.getComplexFloatImag().getSemantics())) && 
+          (&Result.getComplexFloatReal().getSemantics() ==
+           &Result.getComplexFloatImag().getSemantics())) &&
          "Invalid complex evaluation.");
   return Result.isComplexFloat() || Result.isComplexInt();
 }
 
-APValue ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E)
-{
+APValue ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
   APValue Result, RHS;
-  
+
   if (!EvaluateComplex(E->getLHS(), Result, Info))
     return APValue();
-  
+
   if (!EvaluateComplex(E->getRHS(), RHS, Info))
     return APValue();
 
@@ -1722,7 +1716,7 @@
       APFloat &LHS_i = LHS.getComplexFloatImag();
       APFloat &RHS_r = RHS.getComplexFloatReal();
       APFloat &RHS_i = RHS.getComplexFloatImag();
-      
+
       APFloat Tmp = LHS_r;
       Tmp.multiply(RHS_r, APFloat::rmNearestTiesToEven);
       Result.getComplexFloatReal() = Tmp;
@@ -1738,10 +1732,10 @@
       Result.getComplexFloatImag().add(Tmp, APFloat::rmNearestTiesToEven);
     } else {
       APValue LHS = Result;
-      Result.getComplexIntReal() = 
+      Result.getComplexIntReal() =
         (LHS.getComplexIntReal() * RHS.getComplexIntReal() -
          LHS.getComplexIntImag() * RHS.getComplexIntImag());
-      Result.getComplexIntImag() = 
+      Result.getComplexIntImag() =
         (LHS.getComplexIntReal() * RHS.getComplexIntImag() +
          LHS.getComplexIntImag() * RHS.getComplexIntReal());
     }
@@ -1775,7 +1769,7 @@
     llvm::APFloat f(0.0);
     if (!EvaluateFloat(this, f, Info))
       return false;
-    
+
     Result.Val = APValue(f);
   } else if (getType()->isAnyComplexType()) {
     if (!EvaluateComplex(this, Result.Val, Info))

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

==============================================================================
--- cfe/trunk/lib/AST/InheritViz.cpp (original)
+++ cfe/trunk/lib/AST/InheritViz.cpp Wed Sep  9 10:08:12 2009
@@ -89,7 +89,7 @@
   Out << " \"];\n";
 
   // Display the base classes.
-  const CXXRecordDecl *Decl 
+  const CXXRecordDecl *Decl
     = static_cast<const CXXRecordDecl *>(Type->getAs<RecordType>()->getDecl());
   for (CXXRecordDecl::base_class_const_iterator Base = Decl->bases_begin();
        Base != Decl->bases_end(); ++Base) {
@@ -120,8 +120,8 @@
 /// WriteNodeReference - Write out a reference to the given node,
 /// using a unique identifier for each direct base and for the
 /// (only) virtual base.
-llvm::raw_ostream& 
-InheritanceHierarchyWriter::WriteNodeReference(QualType Type, 
+llvm::raw_ostream&
+InheritanceHierarchyWriter::WriteNodeReference(QualType Type,
                                                bool FromVirtual) {
   QualType CanonType = Context.getCanonicalType(Type);
 

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

==============================================================================
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Wed Sep  9 10:08:12 2009
@@ -22,13 +22,13 @@
 using namespace clang;
 
 NestedNameSpecifier *
-NestedNameSpecifier::FindOrInsert(ASTContext &Context, 
+NestedNameSpecifier::FindOrInsert(ASTContext &Context,
                                   const NestedNameSpecifier &Mockup) {
   llvm::FoldingSetNodeID ID;
   Mockup.Profile(ID);
 
   void *InsertPos = 0;
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = Context.NestedNameSpecifiers.FindNodeOrInsertPos(ID, InsertPos);
   if (!NNS) {
     NNS = new (Context, 4) NestedNameSpecifier(Mockup);
@@ -39,7 +39,7 @@
 }
 
 NestedNameSpecifier *
-NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix, 
+NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
                             IdentifierInfo *II) {
   assert(II && "Identifier cannot be NULL");
   assert((!Prefix || Prefix->isDependent()) && "Prefix must be dependent");
@@ -52,10 +52,10 @@
 }
 
 NestedNameSpecifier *
-NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix, 
+NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
                             NamespaceDecl *NS) {
   assert(NS && "Namespace cannot be NULL");
-  assert((!Prefix || 
+  assert((!Prefix ||
           (Prefix->getAsType() == 0 && Prefix->getAsIdentifier() == 0)) &&
          "Broken nested name specifier");
   NestedNameSpecifier Mockup;
@@ -115,8 +115,8 @@
 
 /// \brief Print this nested name specifier to the given output
 /// stream.
-void 
-NestedNameSpecifier::print(llvm::raw_ostream &OS, 
+void
+NestedNameSpecifier::print(llvm::raw_ostream &OS,
                            const PrintingPolicy &Policy) const {
   if (getPrefix())
     getPrefix()->print(OS, Policy);
@@ -144,26 +144,26 @@
     PrintingPolicy InnerPolicy(Policy);
     InnerPolicy.SuppressTagKind = true;
     InnerPolicy.SuppressScope = true;
-    
+
     // Nested-name-specifiers are intended to contain minimally-qualified
     // types. An actual QualifiedNameType will not occur, since we'll store
     // just the type that is referred to in the nested-name-specifier (e.g.,
     // a TypedefType, TagType, etc.). However, when we are dealing with
-    // dependent template-id types (e.g., Outer<T>::template Inner<U>), 
+    // dependent template-id types (e.g., Outer<T>::template Inner<U>),
     // the type requires its own nested-name-specifier for uniqueness, so we
     // suppress that nested-name-specifier during printing.
-    assert(!isa<QualifiedNameType>(T) && 
+    assert(!isa<QualifiedNameType>(T) &&
            "Qualified name type in nested-name-specifier");
     if (const TemplateSpecializationType *SpecType
           = dyn_cast<TemplateSpecializationType>(T)) {
-      // Print the template name without its corresponding 
+      // Print the template name without its corresponding
       // nested-name-specifier.
       SpecType->getTemplateName().print(OS, InnerPolicy, true);
-      
+
       // Print the template argument list.
       TypeStr = TemplateSpecializationType::PrintTemplateArgumentList(
-                                                          SpecType->getArgs(), 
-                                                       SpecType->getNumArgs(), 
+                                                          SpecType->getArgs(),
+                                                       SpecType->getNumArgs(),
                                                                  InnerPolicy);
     } else {
       // Print the type normally

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

==============================================================================
--- cfe/trunk/lib/AST/ParentMap.cpp (original)
+++ cfe/trunk/lib/AST/ParentMap.cpp Wed Sep  9 10:08:12 2009
@@ -32,7 +32,7 @@
   if (S) {
     MapTy *M = new MapTy();
     BuildParentMap(*M, S);
-    Impl = M;    
+    Impl = M;
   }
 }
 
@@ -54,16 +54,16 @@
 bool ParentMap::isConsumedExpr(Expr* E) const {
   Stmt *P = getParent(E);
   Stmt *DirectChild = E;
-  
+
   // Ignore parents that are parentheses or casts.
   while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P))) {
     DirectChild = P;
     P = getParent(P);
   }
-  
+
   if (!P)
     return false;
-  
+
   switch (P->getStmtClass()) {
     default:
       return isa<Expr>(P);
@@ -78,7 +78,7 @@
     case Stmt::ForStmtClass:
       return DirectChild == cast<ForStmt>(P)->getCond();
     case Stmt::WhileStmtClass:
-      return DirectChild == cast<WhileStmt>(P)->getCond();      
+      return DirectChild == cast<WhileStmt>(P)->getCond();
     case Stmt::DoStmtClass:
       return DirectChild == cast<DoStmt>(P)->getCond();
     case Stmt::IfStmtClass:

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

==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Sep  9 10:08:12 2009
@@ -21,8 +21,8 @@
 
 using namespace clang;
 
-ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx) 
-  : Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0), 
+ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx)
+  : Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0),
   NextOffset(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8) {}
 
 /// LayoutVtable - Lay out the vtable and set PrimaryBase.
@@ -43,12 +43,12 @@
   }
 }
 
-void 
+void
 ASTRecordLayoutBuilder::LayoutNonVirtualBases(const CXXRecordDecl *RD) {
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
        e = RD->bases_end(); i != e; ++i) {
     if (!i->isVirtual()) {
-      const CXXRecordDecl *Base = 
+      const CXXRecordDecl *Base =
         cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
       // Skip the PrimaryBase here, as it is laid down first.
       if (Base != PrimaryBase || PrimaryBaseWasVirtual)
@@ -83,7 +83,7 @@
 
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
        e = RD->bases_end(); i != e; ++i) {
-    const CXXRecordDecl *Base = 
+    const CXXRecordDecl *Base =
       cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
     // Only bases with virtual bases participate in computing the
     // indirect primary virtual base classes.
@@ -97,7 +97,7 @@
                     llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary) {
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
          e = RD->bases_end(); i != e; ++i) {
-    const CXXRecordDecl *Base = 
+    const CXXRecordDecl *Base =
       cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
     if (!i->isVirtual()) {
       SelectPrimaryVBase(Base, FirstPrimary, IndirectPrimary);
@@ -125,7 +125,7 @@
   const CXXRecordDecl *FirstPrimary = 0;
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
        e = RD->bases_end(); i != e; ++i) {
-    const CXXRecordDecl *Base = 
+    const CXXRecordDecl *Base =
       cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
     SelectPrimaryForBase(Base, IndirectPrimary);
   }
@@ -135,7 +135,7 @@
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
        e = RD->bases_end(); i != e; ++i) {
     if (!i->isVirtual()) {
-      const CXXRecordDecl *Base = 
+      const CXXRecordDecl *Base =
         cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
       if (Base->isDynamicClass()) {
         setPrimaryBase(Base, false);
@@ -174,7 +174,7 @@
                     llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary) {
   for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
          e = RD->bases_end(); i != e; ++i) {
-    const CXXRecordDecl *Base = 
+    const CXXRecordDecl *Base =
       cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
 #if 0
     const ASTRecordLayout &L = Ctx.getASTRecordLayout(Base);
@@ -224,12 +224,12 @@
 void ASTRecordLayoutBuilder::LayoutBaseNonVirtually(const CXXRecordDecl *RD,
   bool IsVirtualBase) {
   const ASTRecordLayout &BaseInfo = Ctx.getASTRecordLayout(RD);
-    assert(BaseInfo.getDataSize() > 0 && 
+    assert(BaseInfo.getDataSize() > 0 &&
            "FIXME: Handle empty classes.");
-  
+
   unsigned BaseAlign = BaseInfo.getNonVirtualAlign();
   uint64_t BaseSize = BaseInfo.getNonVirtualSize();
-  
+
   // Round up the current record size to the base's alignment boundary.
   Size = (Size + (BaseAlign-1)) & ~(BaseAlign-1);
 
@@ -260,10 +260,10 @@
 
   // Reserve space for this base.
   Size += BaseSize;
-  
+
   // Remember the next available offset.
   NextOffset = Size;
-  
+
   // Remember max struct/class alignment.
   UpdateAlignment(BaseAlign);
 }
@@ -276,7 +276,7 @@
   // The #pragma pack attribute specifies the maximum field alignment.
   if (const PragmaPackAttr *PPA = D->getAttr<PragmaPackAttr>())
     MaxFieldAlignment = PPA->getAlignment();
-  
+
   if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
     UpdateAlignment(AA->getAlignment());
 
@@ -296,7 +296,7 @@
   }
 
   LayoutFields(D);
-  
+
   NonVirtualSize = Size;
   NonVirtualAlignment = Alignment;
 
@@ -316,28 +316,28 @@
     const ASTRecordLayout &SL = Ctx.getASTObjCInterfaceLayout(SD);
 
     UpdateAlignment(SL.getAlignment());
-    
+
     // We start laying out ivars not at the end of the superclass
     // structure, but at the next byte following the last field.
     Size = llvm::RoundUpToAlignment(SL.getDataSize(), 8);
     NextOffset = Size;
   }
-  
+
   Packed = D->hasAttr<PackedAttr>();
-  
+
   // The #pragma pack attribute specifies the maximum field alignment.
   if (const PragmaPackAttr *PPA = D->getAttr<PragmaPackAttr>())
     MaxFieldAlignment = PPA->getAlignment();
-  
+
   if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
     UpdateAlignment(AA->getAlignment());
-  
+
   // Layout each ivar sequentially.
   llvm::SmallVector<ObjCIvarDecl*, 16> Ivars;
   Ctx.ShallowCollectObjCIvars(D, Ivars, Impl);
   for (unsigned i = 0, e = Ivars.size(); i != e; ++i)
     LayoutField(Ivars[i]);
-  
+
   // Finally, round the size of the total struct up to the alignment of the
   // struct itself.
   FinishLayout();
@@ -346,7 +346,7 @@
 void ASTRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
   // Layout each field, for now, just sequentially, respecting alignment.  In
   // the future, this will need to be tweakable by targets.
-  for (RecordDecl::field_iterator Field = D->field_begin(), 
+  for (RecordDecl::field_iterator Field = D->field_begin(),
        FieldEnd = D->field_end(); Field != FieldEnd; ++Field)
     LayoutField(*Field);
 }
@@ -356,19 +356,19 @@
   uint64_t FieldOffset = IsUnion ? 0 : Size;
   uint64_t FieldSize;
   unsigned FieldAlign;
-  
-  FieldPacked |= D->hasAttr<PackedAttr>();  
-  
+
+  FieldPacked |= D->hasAttr<PackedAttr>();
+
   if (const Expr *BitWidthExpr = D->getBitWidth()) {
     // TODO: Need to check this algorithm on other targets!
     //       (tested on Linux-X86)
     FieldSize = BitWidthExpr->EvaluateAsInt(Ctx).getZExtValue();
-    
+
     std::pair<uint64_t, unsigned> FieldInfo = Ctx.getTypeInfo(D->getType());
     uint64_t TypeSize = FieldInfo.first;
 
     FieldAlign = FieldInfo.second;
-    
+
     if (FieldPacked)
       FieldAlign = 1;
     if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
@@ -381,7 +381,7 @@
     // alignment.
     if (FieldSize == 0 || (FieldOffset & (FieldAlign-1)) + FieldSize > TypeSize)
       FieldOffset = (FieldOffset + (FieldAlign-1)) & ~(FieldAlign-1);
-    
+
     // Padding members don't affect overall alignment
     if (!D->getIdentifier())
       FieldAlign = 1;
@@ -403,7 +403,7 @@
       FieldSize = FieldInfo.first;
       FieldAlign = FieldInfo.second;
     }
-    
+
     if (FieldPacked)
       FieldAlign = 8;
     if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
@@ -411,23 +411,23 @@
     // The maximum field alignment overrides the aligned attribute.
     if (MaxFieldAlignment)
       FieldAlign = std::min(FieldAlign, MaxFieldAlignment);
-    
+
     // Round up the current record size to the field's alignment boundary.
     FieldOffset = (FieldOffset + (FieldAlign-1)) & ~(FieldAlign-1);
   }
-  
+
   // Place this field at the current location.
   FieldOffsets.push_back(FieldOffset);
-  
+
   // Reserve space for this field.
   if (IsUnion)
     Size = std::max(Size, FieldSize);
   else
     Size = FieldOffset + FieldSize;
-  
+
   // Remember the next available offset.
   NextOffset = Size;
-  
+
   // Remember max struct/class alignment.
   UpdateAlignment(FieldAlign);
 }
@@ -444,14 +444,14 @@
 void ASTRecordLayoutBuilder::UpdateAlignment(unsigned NewAlignment) {
   if (NewAlignment <= Alignment)
     return;
-  
+
   assert(llvm::isPowerOf2_32(NewAlignment && "Alignment not a power of 2"));
-  
+
   Alignment = NewAlignment;
 }
-         
+
 const ASTRecordLayout *
-ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx, 
+ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
                                       const RecordDecl *D) {
   ASTRecordLayoutBuilder Builder(Ctx);
 
@@ -459,27 +459,27 @@
 
   if (!isa<CXXRecordDecl>(D))
     return new ASTRecordLayout(Builder.Size, Builder.Alignment, Builder.Size,
-                               Builder.FieldOffsets.data(), 
+                               Builder.FieldOffsets.data(),
                                Builder.FieldOffsets.size());
-  
+
   // FIXME: This is not always correct. See the part about bitfields at
   // http://www.codesourcery.com/public/cxx-abi/abi.html#POD for more info.
   // FIXME: IsPODForThePurposeOfLayout should be stored in the record layout.
   bool IsPODForThePurposeOfLayout = cast<CXXRecordDecl>(D)->isPOD();
-  
-  assert(Builder.Bases.size() == Builder.BaseOffsets.size() && 
+
+  assert(Builder.Bases.size() == Builder.BaseOffsets.size() &&
          "Base offsets vector must be same size as bases vector!");
-  assert(Builder.VBases.size() == Builder.VBaseOffsets.size() && 
+  assert(Builder.VBases.size() == Builder.VBaseOffsets.size() &&
          "Base offsets vector must be same size as bases vector!");
 
   // FIXME: This should be done in FinalizeLayout.
-  uint64_t DataSize = 
+  uint64_t DataSize =
     IsPODForThePurposeOfLayout ? Builder.Size : Builder.NextOffset;
-  uint64_t NonVirtualSize = 
+  uint64_t NonVirtualSize =
     IsPODForThePurposeOfLayout ? DataSize : Builder.NonVirtualSize;
-  
+
   return new ASTRecordLayout(Builder.Size, Builder.Alignment, DataSize,
-                             Builder.FieldOffsets.data(), 
+                             Builder.FieldOffsets.data(),
                              Builder.FieldOffsets.size(),
                              NonVirtualSize,
                              Builder.NonVirtualAlignment,
@@ -498,11 +498,11 @@
                                       const ObjCInterfaceDecl *D,
                                       const ObjCImplementationDecl *Impl) {
   ASTRecordLayoutBuilder Builder(Ctx);
-  
+
   Builder.Layout(D, Impl);
-  
+
   return new ASTRecordLayout(Builder.Size, Builder.Alignment,
                              Builder.NextOffset,
-                             Builder.FieldOffsets.data(), 
+                             Builder.FieldOffsets.data(),
                              Builder.FieldOffsets.size());
 }

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

==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Wed Sep  9 10:08:12 2009
@@ -22,19 +22,19 @@
   class ObjCImplementationDecl;
   class ObjCInterfaceDecl;
   class RecordDecl;
-  
+
 class ASTRecordLayoutBuilder {
   ASTContext &Ctx;
 
   uint64_t Size;
   unsigned Alignment;
   llvm::SmallVector<uint64_t, 16> FieldOffsets;
-  
+
   bool Packed;
   unsigned MaxFieldAlignment;
   uint64_t NextOffset;
   bool IsUnion;
-  
+
   uint64_t NonVirtualSize;
   unsigned NonVirtualAlignment;
   const CXXRecordDecl *PrimaryBase;
@@ -45,9 +45,9 @@
 
   llvm::SmallVector<const CXXRecordDecl *, 4> VBases;
   llvm::SmallVector<uint64_t, 4> VBaseOffsets;
-  
+
   ASTRecordLayoutBuilder(ASTContext &Ctx);
-  
+
   void Layout(const RecordDecl *D);
   void Layout(const CXXRecordDecl *D);
   void Layout(const ObjCInterfaceDecl *D,
@@ -77,23 +77,23 @@
                           int64_t Offset,
                                  llvm::SmallSet<const CXXRecordDecl*, 32> &mark,
                      llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary);
-  
+
   /// FinishLayout - Finalize record layout. Adjust record size based on the
   /// alignment.
   void FinishLayout();
-  
+
   void UpdateAlignment(unsigned NewAlignment);
 
   ASTRecordLayoutBuilder(const ASTRecordLayoutBuilder&);   // DO NOT IMPLEMENT
   void operator=(const ASTRecordLayoutBuilder&); // DO NOT IMPLEMENT
 public:
-  static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx, 
+  static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
                                               const RecordDecl *RD);
   static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
                                               const ObjCInterfaceDecl *D,
                                             const ObjCImplementationDecl *Impl);
 };
-  
+
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Wed Sep  9 10:08:12 2009
@@ -95,7 +95,7 @@
 
 void SwitchStmt::DoDestroy(ASTContext &Ctx) {
   // Destroy the SwitchCase statements in this switch. In the normal
-  // case, this loop will merely decrement the reference counts from 
+  // case, this loop will merely decrement the reference counts from
   // the Retain() calls in addSwitchCase();
   SwitchCase *SC = FirstCase;
   while (SC) {
@@ -103,7 +103,7 @@
     SC->Destroy(Ctx);
     SC = Next;
   }
-  
+
   Stmt::DoDestroy(Ctx);
 }
 
@@ -187,7 +187,7 @@
 
 
 void AsmStmt::setOutputsAndInputs(unsigned NumOutputs,
-                                  unsigned NumInputs, 
+                                  unsigned NumInputs,
                                   const std::string *Names,
                                   StringLiteral **Constraints,
                                   Stmt **Exprs) {
@@ -196,7 +196,7 @@
   this->Names.clear();
   this->Names.insert(this->Names.end(), Names, Names + NumOutputs + NumInputs);
   this->Constraints.clear();
-  this->Constraints.insert(this->Constraints.end(), 
+  this->Constraints.insert(this->Constraints.end(),
                            Constraints, Constraints + NumOutputs + NumInputs);
   this->Exprs.clear();
   this->Exprs.insert(this->Exprs.end(), Exprs, Exprs + NumOutputs + NumInputs);
@@ -207,13 +207,13 @@
 /// This returns -1 if the operand name is invalid.
 int AsmStmt::getNamedOperand(const std::string &SymbolicName) const {
   unsigned NumPlusOperands = 0;
-  
+
   // Check if this is an output operand.
   for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) {
     if (getOutputName(i) == SymbolicName)
       return i;
   }
-  
+
   for (unsigned i = 0, e = getNumInputs(); i != e; ++i)
     if (getInputName(i) == SymbolicName)
       return getNumOutputs() + NumPlusOperands + i;
@@ -235,7 +235,7 @@
   const char *StrStart = getAsmString()->getStrData();
   const char *StrEnd = StrStart + getAsmString()->getByteLength();
   const char *CurPtr = StrStart;
-  
+
   // "Simple" inline asms have no constraints or operands, just convert the asm
   // string to escape $'s.
   if (isSimple()) {
@@ -257,7 +257,7 @@
   // CurStringPiece - The current string that we are building up as we scan the
   // asm string.
   std::string CurStringPiece;
-  
+
   while (1) {
     // Done with the string?
     if (CurPtr == StrEnd) {
@@ -265,7 +265,7 @@
         Pieces.push_back(AsmStringPiece(CurStringPiece));
       return 0;
     }
-    
+
     char CurChar = *CurPtr++;
     if (CurChar == '$') {
       CurStringPiece += "$$";
@@ -274,48 +274,48 @@
       CurStringPiece += CurChar;
       continue;
     }
-    
+
     // Escaped "%" character in asm string.
     if (CurPtr == StrEnd) {
       // % at end of string is invalid (no escape).
       DiagOffs = CurPtr-StrStart-1;
       return diag::err_asm_invalid_escape;
     }
-    
+
     char EscapedChar = *CurPtr++;
     if (EscapedChar == '%') {  // %% -> %
       // Escaped percentage sign.
       CurStringPiece += '%';
       continue;
     }
-    
+
     if (EscapedChar == '=') {  // %= -> Generate an unique ID.
       CurStringPiece += "${:uid}";
       continue;
     }
-    
+
     // Otherwise, we have an operand.  If we have accumulated a string so far,
     // add it to the Pieces list.
     if (!CurStringPiece.empty()) {
       Pieces.push_back(AsmStringPiece(CurStringPiece));
       CurStringPiece.clear();
     }
-    
+
     // Handle %x4 and %x[foo] by capturing x as the modifier character.
     char Modifier = '\0';
     if (isalpha(EscapedChar)) {
       Modifier = EscapedChar;
       EscapedChar = *CurPtr++;
     }
-    
+
     if (isdigit(EscapedChar)) {
       // %n - Assembler operand n
       unsigned N = 0;
-      
+
       --CurPtr;
       while (CurPtr != StrEnd && isdigit(*CurPtr))
         N = N*10 + ((*CurPtr++)-'0');
-      
+
       unsigned NumOperands =
         getNumOutputs() + getNumPlusOperands() + getNumInputs();
       if (N >= NumOperands) {
@@ -326,20 +326,20 @@
       Pieces.push_back(AsmStringPiece(N, Modifier));
       continue;
     }
-    
+
     // Handle %[foo], a symbolic operand reference.
     if (EscapedChar == '[') {
       DiagOffs = CurPtr-StrStart-1;
-      
+
       // Find the ']'.
       const char *NameEnd = (const char*)memchr(CurPtr, ']', StrEnd-CurPtr);
       if (NameEnd == 0)
         return diag::err_asm_unterminated_symbolic_operand_name;
       if (NameEnd == CurPtr)
         return diag::err_asm_empty_symbolic_operand_name;
-      
+
       std::string SymbolicName(CurPtr, NameEnd);
-      
+
       int N = getNamedOperand(SymbolicName);
       if (N == -1) {
         // Verify that an operand with that name exists.
@@ -347,11 +347,11 @@
         return diag::err_asm_unknown_symbolic_operand_name;
       }
       Pieces.push_back(AsmStringPiece(N, Modifier));
-      
+
       CurPtr = NameEnd+1;
       continue;
     }
-    
+
     DiagOffs = CurPtr-StrStart-1;
     return diag::err_asm_invalid_escape;
   }
@@ -509,7 +509,7 @@
 }
 
 // AsmStmt
-Stmt::child_iterator AsmStmt::child_begin() { 
+Stmt::child_iterator AsmStmt::child_begin() {
   return Exprs.empty() ? 0 : &Exprs[0];
 }
 Stmt::child_iterator AsmStmt::child_end() {

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

==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Wed Sep  9 10:08:12 2009
@@ -30,12 +30,12 @@
     SourceManager *SM;
     FILE *F;
     unsigned IndentLevel;
-    
+
     /// MaxDepth - When doing a normal dump (not dumpAll) we only want to dump
     /// the first few levels of an AST.  This keeps track of how many ast levels
     /// are left.
     unsigned MaxDepth;
-    
+
     /// LastLocFilename/LastLocLine - Keep track of the last location we print
     /// out so that we can print out deltas from then on out.
     const char *LastLocFilename;
@@ -47,18 +47,18 @@
       LastLocFilename = "";
       LastLocLine = ~0U;
     }
-    
+
     void DumpSubTree(Stmt *S) {
       // Prune the recursion if not using dump all.
       if (MaxDepth == 0) return;
-      
+
       ++IndentLevel;
       if (S) {
         if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
           VisitDeclStmt(DS);
-        else {        
+        else {
           Visit(S);
-          
+
           // Print out children.
           Stmt::child_iterator CI = S->child_begin(), CE = S->child_end();
           if (CI != CE) {
@@ -75,14 +75,14 @@
       }
       --IndentLevel;
     }
-    
+
     void DumpDeclarator(Decl *D);
-    
+
     void Indent() const {
       for (int i = 0, e = IndentLevel; i < e; ++i)
         fprintf(F, "  ");
     }
-    
+
     void DumpType(QualType T) {
       fprintf(F, "'%s'", T.getAsString().c_str());
 
@@ -90,7 +90,7 @@
         // If the type is directly a typedef, strip off typedefness to give at
         // least one level of concreteness.
         if (TypedefType *TDT = dyn_cast<TypedefType>(T)) {
-          QualType Simplified = 
+          QualType Simplified =
             TDT->LookThroughTypedefs().getQualifiedType(T.getCVRQualifiers());
           fprintf(F, ":'%s'", Simplified.getAsString().c_str());
         }
@@ -108,13 +108,13 @@
     }
     void DumpSourceRange(const Stmt *Node);
     void DumpLocation(SourceLocation Loc);
-    
+
     // Stmts.
     void VisitStmt(Stmt *Node);
     void VisitDeclStmt(DeclStmt *Node);
     void VisitLabelStmt(LabelStmt *Node);
     void VisitGotoStmt(GotoStmt *Node);
-    
+
     // Exprs
     void VisitExpr(Expr *Node);
     void VisitCastExpr(CastExpr *Node);
@@ -142,7 +142,7 @@
     void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node);
     void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node);
     void DumpCXXTemporary(CXXTemporary *Temporary);
-    
+
     // ObjC
     void VisitObjCEncodeExpr(ObjCEncodeExpr *Node);
     void VisitObjCMessageExpr(ObjCMessageExpr* Node);
@@ -162,7 +162,7 @@
 
 void StmtDumper::DumpLocation(SourceLocation Loc) {
   SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
-  
+
   if (SpellingLoc.isInvalid()) {
     fprintf(stderr, "<invalid sloc>");
     return;
@@ -188,11 +188,11 @@
 void StmtDumper::DumpSourceRange(const Stmt *Node) {
   // Can't translate locations if a SourceManager isn't available.
   if (SM == 0) return;
-  
+
   // TODO: If the parent expression is available, we can print a delta vs its
   // location.
   SourceRange R = Node->getSourceRange();
-  
+
   fprintf(stderr, " <");
   DumpLocation(R.getBegin());
   if (R.getBegin() != R.getEnd()) {
@@ -200,7 +200,7 @@
     DumpLocation(R.getEnd());
   }
   fprintf(stderr, ">");
-    
+
   // <t2.c:123:421[blah], t2.c:412:321>
 
 }
@@ -226,15 +226,15 @@
     // Emit storage class for vardecls.
     if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
       if (V->getStorageClass() != VarDecl::None)
-        fprintf(F, "%s ", 
+        fprintf(F, "%s ",
                 VarDecl::getStorageClassSpecifierString(V->getStorageClass()));
     }
-    
+
     std::string Name = VD->getNameAsString();
-    VD->getType().getAsStringInternal(Name, 
+    VD->getType().getAsStringInternal(Name,
                           PrintingPolicy(VD->getASTContext().getLangOptions()));
     fprintf(F, "%s", Name.c_str());
-    
+
     // If this is a vardecl with an initializer, emit it.
     if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
       if (V->getInit()) {
@@ -321,15 +321,15 @@
   case Decl::ObjCInterface: fprintf(F,"ObjCInterface"); break;
   case Decl::ObjCClass: fprintf(F,"ObjCClass"); break;
   }
-  
-  fprintf(F, "='%s' %p", Node->getDecl()->getNameAsString().c_str(), 
+
+  fprintf(F, "='%s' %p", Node->getDecl()->getNameAsString().c_str(),
           (void*)Node->getDecl());
 }
 
 void StmtDumper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
   DumpExpr(Node);
 
-  fprintf(F, " %sDecl='%s' %p", Node->getDecl()->getDeclKindName(), 
+  fprintf(F, " %sDecl='%s' %p", Node->getDecl()->getDeclKindName(),
           Node->getDecl()->getNameAsString().c_str(), (void*)Node->getDecl());
   if (Node->isFreeIvar())
     fprintf(F, " isFreeIvar");
@@ -370,7 +370,7 @@
     switch (char C = Str->getStrData()[i]) {
     default:
       if (isprint(C))
-        fputc(C, F); 
+        fputc(C, F);
       else
         fprintf(F, "\\%03o", C);
       break;
@@ -401,7 +401,7 @@
 void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
   DumpExpr(Node);
   fprintf(F, " %s%s %p", Node->isArrow() ? "->" : ".",
-          Node->getMemberDecl()->getNameAsString().c_str(), 
+          Node->getMemberDecl()->getNameAsString().c_str(),
           (void*)Node->getMemberDecl());
 }
 void StmtDumper::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
@@ -459,7 +459,7 @@
 
 void StmtDumper::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
   DumpExpr(Node);
-  fprintf(F, " functional cast to %s", 
+  fprintf(F, " functional cast to %s",
           Node->getTypeAsWritten().getAsString().c_str());
 }
 
@@ -503,21 +503,21 @@
 
 void StmtDumper::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
   DumpExpr(Node);
- 
+
   fprintf(F, " ");
   DumpType(Node->getEncodedType());
 }
 
 void StmtDumper::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
   DumpExpr(Node);
-  
+
   fprintf(F, " ");
   fprintf(F, "%s", Node->getSelector().getAsString().c_str());
 }
 
 void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
   DumpExpr(Node);
-  
+
   fprintf(F, " ");
   fprintf(F, "%s", Node->getProtocol()->getNameAsString().c_str());
 }
@@ -525,17 +525,17 @@
 void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
   DumpExpr(Node);
 
-  fprintf(F, " Kind=PropertyRef Property=\"%s\"", 
+  fprintf(F, " Kind=PropertyRef Property=\"%s\"",
           Node->getProperty()->getNameAsString().c_str());
 }
 
 void StmtDumper::VisitObjCImplicitSetterGetterRefExpr(
                                         ObjCImplicitSetterGetterRefExpr *Node) {
   DumpExpr(Node);
-  
+
   ObjCMethodDecl *Getter = Node->getGetterMethod();
   ObjCMethodDecl *Setter = Node->getSetterMethod();
-  fprintf(F, " Kind=MethodRef Getter=\"%s\" Setter=\"%s\"", 
+  fprintf(F, " Kind=MethodRef Getter=\"%s\" Setter=\"%s\"",
           Getter->getSelector().getAsString().c_str(),
           Setter ? Setter->getSelector().getAsString().c_str() : "(null)");
 }

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

==============================================================================
--- cfe/trunk/lib/AST/StmtIterator.cpp (original)
+++ cfe/trunk/lib/AST/StmtIterator.cpp Wed Sep  9 10:08:12 2009
@@ -23,10 +23,10 @@
     if (VariableArrayType* vat = dyn_cast<VariableArrayType>(vt))
       if (vat->getSizeExpr())
         return vat;
-    
+
     t = vt->getElementType().getTypePtr();
   }
-  
+
   return NULL;
 }
 
@@ -39,20 +39,20 @@
 
   if (p)
     return;
-  
+
   if (inDecl()) {
-    if (VarDecl* VD = dyn_cast<VarDecl>(decl)) 
+    if (VarDecl* VD = dyn_cast<VarDecl>(decl))
       if (VD->Init)
         return;
-    
+
     NextDecl();
   }
   else if (inDeclGroup()) {
-    if (VarDecl* VD = dyn_cast<VarDecl>(*DGI)) 
+    if (VarDecl* VD = dyn_cast<VarDecl>(*DGI))
       if (VD->Init)
         return;
-    
-    NextDecl();  
+
+    NextDecl();
   }
   else {
     assert (inSizeOfTypeVA());
@@ -63,10 +63,10 @@
 
 void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
   assert (getVAPtr() == NULL);
-  
+
   if (inDecl()) {
     assert (decl);
-    
+
     // FIXME: SIMPLIFY AWAY.
     if (ImmediateAdvance)
       decl = 0;
@@ -75,10 +75,10 @@
   }
   else {
     assert (inDeclGroup());
-    
+
     if (ImmediateAdvance)
       ++DGI;
-    
+
     for ( ; DGI != DGE; ++DGI)
       if (HandleDecl(*DGI))
         return;
@@ -88,18 +88,18 @@
 }
 
 bool StmtIteratorBase::HandleDecl(Decl* D) {
-    
-  if (VarDecl* VD = dyn_cast<VarDecl>(D)) {        
+
+  if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
     if (VariableArrayType* VAPtr = FindVA(VD->getType().getTypePtr())) {
       setVAPtr(VAPtr);
       return true;
     }
-        
+
     if (VD->getInit())
       return true;
   }
   else if (TypedefDecl* TD = dyn_cast<TypedefDecl>(D)) {
-    if (VariableArrayType* VAPtr = 
+    if (VariableArrayType* VAPtr =
         FindVA(TD->getUnderlyingType().getTypePtr())) {
       setVAPtr(VAPtr);
       return true;
@@ -110,7 +110,7 @@
       return true;
   }
 
-  return false;  
+  return false;
 }
 
 StmtIteratorBase::StmtIteratorBase(Decl* d)
@@ -130,19 +130,19 @@
 }
 
 Stmt*& StmtIteratorBase::GetDeclExpr() const {
-  
+
   if (VariableArrayType* VAPtr = getVAPtr()) {
     assert (VAPtr->SizeExpr);
     return VAPtr->SizeExpr;
   }
 
   assert (inDecl() || inDeclGroup());
-  
+
   if (inDeclGroup()) {
     VarDecl* VD = cast<VarDecl>(*DGI);
     return *VD->getInitAddress();
   }
-  
+
   assert (inDecl());
 
   if (VarDecl* VD = dyn_cast<VarDecl>(decl)) {

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

==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Wed Sep  9 10:08:12 2009
@@ -33,12 +33,12 @@
     PrintingPolicy Policy;
 
   public:
-    StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper, 
+    StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper,
                 const PrintingPolicy &Policy,
                 unsigned Indentation = 0)
       : OS(os), Context(C), IndentLevel(Indentation), Helper(helper),
         Policy(Policy) {}
-    
+
     void PrintStmt(Stmt *S) {
       PrintStmt(S, Policy.Indentation);
     }
@@ -63,29 +63,29 @@
     void PrintRawDeclStmt(DeclStmt *S);
     void PrintRawIfStmt(IfStmt *If);
     void PrintRawCXXCatchStmt(CXXCatchStmt *Catch);
-    
+
     void PrintExpr(Expr *E) {
       if (E)
         Visit(E);
       else
         OS << "<null expr>";
     }
-    
+
     llvm::raw_ostream &Indent(int Delta = 0) {
       for (int i = 0, e = IndentLevel+Delta; i < e; ++i)
         OS << "  ";
       return OS;
     }
-    
+
     bool PrintOffsetOfDesignator(Expr *E);
     void VisitUnaryOffsetOf(UnaryOperator *Node);
-    
-    void Visit(Stmt* S) {    
+
+    void Visit(Stmt* S) {
       if (Helper && Helper->handledStmt(S,OS))
           return;
       else StmtVisitor<StmtPrinter>::Visit(S);
     }
-    
+
     void VisitStmt(Stmt *Node);
 #define STMT(CLASS, PARENT) \
     void Visit##CLASS(CLASS *Node);
@@ -108,7 +108,7 @@
   for (CompoundStmt::body_iterator I = Node->body_begin(), E = Node->body_end();
        I != E; ++I)
     PrintStmt(*I);
-  
+
   Indent() << "}";
 }
 
@@ -119,7 +119,7 @@
 void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
   DeclStmt::decl_iterator Begin = S->decl_begin(), End = S->decl_end();
   llvm::SmallVector<Decl*, 2> Decls;
-  for ( ; Begin != End; ++Begin) 
+  for ( ; Begin != End; ++Begin)
     Decls.push_back(*Begin);
 
   Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
@@ -149,7 +149,7 @@
     PrintExpr(Node->getRHS());
   }
   OS << ":\n";
-  
+
   PrintStmt(Node->getSubStmt(), 0);
 }
 
@@ -167,7 +167,7 @@
   OS << "if (";
   PrintExpr(If->getCond());
   OS << ')';
-  
+
   if (CompoundStmt *CS = dyn_cast<CompoundStmt>(If->getThen())) {
     OS << ' ';
     PrintRawCompoundStmt(CS);
@@ -177,10 +177,10 @@
     PrintStmt(If->getThen());
     if (If->getElse()) Indent();
   }
-  
+
   if (Stmt *Else = If->getElse()) {
     OS << "else";
-    
+
     if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Else)) {
       OS << ' ';
       PrintRawCompoundStmt(CS);
@@ -204,7 +204,7 @@
   Indent() << "switch (";
   PrintExpr(Node->getCond());
   OS << ")";
-  
+
   // Pretty print compoundstmt bodies (very common).
   if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
     OS << " ";
@@ -237,7 +237,7 @@
     PrintStmt(Node->getBody());
     Indent();
   }
-  
+
   OS << "while (";
   PrintExpr(Node->getCond());
   OS << ");\n";
@@ -262,7 +262,7 @@
     PrintExpr(Node->getInc());
   }
   OS << ") ";
-  
+
   if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
     PrintRawCompoundStmt(CS);
     OS << "\n";
@@ -281,7 +281,7 @@
   OS << " in ";
   PrintExpr(Node->getCollection());
   OS << ") ";
-  
+
   if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
     PrintRawCompoundStmt(CS);
     OS << "\n";
@@ -322,63 +322,63 @@
 
 void StmtPrinter::VisitAsmStmt(AsmStmt *Node) {
   Indent() << "asm ";
-  
+
   if (Node->isVolatile())
     OS << "volatile ";
-  
+
   OS << "(";
   VisitStringLiteral(Node->getAsmString());
-  
+
   // Outputs
   if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
       Node->getNumClobbers() != 0)
     OS << " : ";
-  
+
   for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
     if (i != 0)
       OS << ", ";
-    
+
     if (!Node->getOutputName(i).empty()) {
       OS << '[';
       OS << Node->getOutputName(i);
       OS << "] ";
     }
-    
+
     VisitStringLiteral(Node->getOutputConstraintLiteral(i));
     OS << " ";
     Visit(Node->getOutputExpr(i));
   }
-  
+
   // Inputs
   if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0)
     OS << " : ";
-  
+
   for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
     if (i != 0)
       OS << ", ";
-    
+
     if (!Node->getInputName(i).empty()) {
       OS << '[';
       OS << Node->getInputName(i);
       OS << "] ";
     }
-    
+
     VisitStringLiteral(Node->getInputConstraintLiteral(i));
     OS << " ";
     Visit(Node->getInputExpr(i));
   }
-  
+
   // Clobbers
   if (Node->getNumClobbers() != 0)
     OS << " : ";
-    
+
   for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
     if (i != 0)
       OS << ", ";
-      
+
     VisitStringLiteral(Node->getClobber(i));
   }
-  
+
   OS << ");\n";
 }
 
@@ -388,11 +388,11 @@
     PrintRawCompoundStmt(TS);
     OS << "\n";
   }
-  
-  for (ObjCAtCatchStmt *catchStmt = 
+
+  for (ObjCAtCatchStmt *catchStmt =
          static_cast<ObjCAtCatchStmt *>(Node->getCatchStmts());
-       catchStmt; 
-       catchStmt = 
+       catchStmt;
+       catchStmt =
          static_cast<ObjCAtCatchStmt *>(catchStmt->getNextCatchStmt())) {
     Indent() << "@catch(";
     if (catchStmt->getCatchParamDecl()) {
@@ -400,19 +400,18 @@
         PrintRawDecl(DS);
     }
     OS << ")";
-    if (CompoundStmt *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) 
-      {
-        PrintRawCompoundStmt(CS);
-        OS << "\n";
-      } 
-  }
-  
-  if (ObjCAtFinallyStmt *FS =static_cast<ObjCAtFinallyStmt *>(
-          Node->getFinallyStmt())) {
+    if (CompoundStmt *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
+      PrintRawCompoundStmt(CS);
+      OS << "\n";
+    }
+  }
+
+  if (ObjCAtFinallyStmt *FS = static_cast<ObjCAtFinallyStmt *>(
+        Node->getFinallyStmt())) {
     Indent() << "@finally";
     PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
     OS << "\n";
-  }  
+  }
 }
 
 void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
@@ -458,7 +457,7 @@
 void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
   Indent() << "try ";
   PrintRawCompoundStmt(Node->getTryBlock());
-  for(unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
+  for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
     OS << " ";
     PrintRawCXXCatchStmt(Node->getHandler(i));
   }
@@ -477,14 +476,14 @@
   OS << Node->getDecl()->getNameAsString();
 }
 
-void StmtPrinter::VisitQualifiedDeclRefExpr(QualifiedDeclRefExpr *Node) {  
+void StmtPrinter::VisitQualifiedDeclRefExpr(QualifiedDeclRefExpr *Node) {
   NamedDecl *D = Node->getDecl();
 
   Node->getQualifier()->print(OS, Policy);
   OS << D->getNameAsString();
 }
 
-void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {  
+void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {
   Node->getQualifier()->print(OS, Policy);
   OS << Node->getDeclName().getAsString();
 }
@@ -523,7 +522,7 @@
   }
   if (Node->getGetterMethod())
     OS << Node->getGetterMethod()->getNameAsString();
-    
+
 }
 
 void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
@@ -594,7 +593,7 @@
 void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
   bool isSigned = Node->getType()->isSignedIntegerType();
   OS << Node->getValue().toString(10, isSigned);
-  
+
   // Emit suffixes.  Integer literals are always a builtin integer type.
   switch (Node->getType()->getAsBuiltinType()->getKind()) {
   default: assert(0 && "Unexpected type for integer literal!");
@@ -623,7 +622,7 @@
   // FIXME: this doesn't print wstrings right.
   for (unsigned i = 0, e = Str->getByteLength(); i != e; ++i) {
     unsigned char Char = Str->getStrData()[i];
-    
+
     switch (Char) {
     default:
       if (isprint(Char))
@@ -653,7 +652,7 @@
 void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
   if (!Node->isPostfix()) {
     OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
-    
+
     // Print a space if this is an "identifier operator" like __real, or if
     // it might be concatenated incorrectly like '+'.
     switch (Node->getOpcode()) {
@@ -671,7 +670,7 @@
     }
   }
   PrintExpr(Node->getSubExpr());
-  
+
   if (Node->isPostfix())
     OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
 }
@@ -741,7 +740,7 @@
     Qualifier->print(OS, Policy);
 
   OS << Node->getMemberDecl()->getNameAsString();
-  
+
   if (Node->hasExplicitTemplateArgumentList())
     OS << TemplateSpecializationType::PrintTemplateArgumentList(
                                                     Node->getTemplateArgs(),
@@ -788,7 +787,7 @@
 }
 void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
   PrintExpr(Node->getCond());
-  
+
   if (Node->getLHS()) {
     OS << " ? ";
     PrintExpr(Node->getLHS());
@@ -797,7 +796,7 @@
   else { // Handle GCC extension where LHS can be NULL.
     OS << " ?: ";
   }
-  
+
   PrintExpr(Node->getRHS());
 }
 
@@ -884,7 +883,7 @@
       } else {
         PrintExpr(Node->getArrayRangeStart(*D));
         OS << " ... ";
-        PrintExpr(Node->getArrayRangeEnd(*D));        
+        PrintExpr(Node->getArrayRangeEnd(*D));
       }
       OS << "]";
     }
@@ -1036,7 +1035,7 @@
   OS << Node->getType().getAsString();
   OS << "(";
   for (CXXTemporaryObjectExpr::arg_iterator Arg = Node->arg_begin(),
-                                         ArgEnd = Node->arg_end(); 
+                                         ArgEnd = Node->arg_end();
        Arg != ArgEnd; ++Arg) {
     if (Arg != Node->arg_begin())
       OS << ", ";
@@ -1113,7 +1112,7 @@
     OS << '.';
   if (E->getQualifier())
     E->getQualifier()->print(OS, Policy);
-  
+
   std::string TypeS;
   E->getDestroyedType().getAsStringInternal(TypeS, Policy);
   OS << TypeS;
@@ -1132,13 +1131,13 @@
   PrintExpr(E->getSubExpr());
 }
 
-void 
+void
 StmtPrinter::VisitCXXUnresolvedConstructExpr(
                                            CXXUnresolvedConstructExpr *Node) {
   OS << Node->getTypeAsWritten().getAsString();
   OS << "(";
   for (CXXUnresolvedConstructExpr::arg_iterator Arg = Node->arg_begin(),
-                                             ArgEnd = Node->arg_end(); 
+                                             ArgEnd = Node->arg_end();
        Arg != ArgEnd; ++Arg) {
     if (Arg != Node->arg_begin())
       OS << ", ";
@@ -1155,9 +1154,9 @@
   else if (Node->hasExplicitTemplateArgumentList())
     // FIXME: Track use of "template" keyword explicitly?
     OS << "template ";
-  
+
   OS << Node->getMember().getAsString();
-  
+
   if (Node->hasExplicitTemplateArgumentList()) {
     OS << TemplateSpecializationType::PrintTemplateArgumentList(
                                                     Node->getTemplateArgs(),
@@ -1192,7 +1191,7 @@
      << E->getQueriedType().getAsString() << ")";
 }
 
-// Obj-C 
+// Obj-C
 
 void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
   OS << "@";
@@ -1230,7 +1229,7 @@
            OS << ":";
       }
       else OS << ", "; // Handle variadic methods.
-      
+
       PrintExpr(Mess->getArg(i));
     }
   }
@@ -1244,9 +1243,9 @@
 void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
   BlockDecl *BD = Node->getBlockDecl();
   OS << "^";
-  
+
   const FunctionType *AFT = Node->getFunctionType();
-  
+
   if (isa<FunctionNoProtoType>(AFT)) {
     OS << "()";
   } else if (!BD->param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
@@ -1259,7 +1258,7 @@
       (*AI)->getType().getAsStringInternal(ParamStr, Policy);
       OS << ParamStr;
     }
-    
+
     const FunctionProtoType *FT = cast<FunctionProtoType>(AFT);
     if (FT->isVariadic()) {
       if (!BD->param_empty()) OS << ", ";
@@ -1294,7 +1293,7 @@
     dump(Context.getSourceManager());
     return;
   }
-  
+
   StmtPrinter P(OS, Context, Helper, Policy, Indentation);
   P.Visit(const_cast<Stmt*>(this));
 }

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

==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Wed Sep  9 10:08:12 2009
@@ -28,36 +28,36 @@
     llvm::FoldingSetNodeID &ID;
     ASTContext &Context;
     bool Canonical;
-    
+
   public:
     StmtProfiler(llvm::FoldingSetNodeID &ID, ASTContext &Context,
-                 bool Canonical) 
+                 bool Canonical)
       : ID(ID), Context(Context), Canonical(Canonical) { }
-    
+
     void VisitStmt(Stmt *S);
-    
+
 #define STMT(Node, Base) void Visit##Node(Node *S);
 #include "clang/AST/StmtNodes.def"
-    
+
     /// \brief Visit a declaration that is referenced within an expression
     /// or statement.
     void VisitDecl(Decl *D);
-    
-    /// \brief Visit a type that is referenced within an expression or 
+
+    /// \brief Visit a type that is referenced within an expression or
     /// statement.
     void VisitType(QualType T);
-    
+
     /// \brief Visit a name that occurs within an expression or statement.
     void VisitName(DeclarationName Name);
-    
+
     /// \brief Visit a nested-name-specifier that occurs within an expression
     /// or statement.
     void VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
-    
+
     /// \brief Visit a template name that occurs within an expression or
     /// statement.
     void VisitTemplateName(TemplateName Name);
-    
+
     /// \brief Visit template arguments that occur within an expression or
     /// statement.
     void VisitTemplateArguments(const TemplateArgument *Args, unsigned NumArgs);
@@ -348,7 +348,7 @@
     VisitInitListExpr(S->getSyntacticForm());
     return;
   }
-  
+
   VisitExpr(S);
 }
 
@@ -363,7 +363,7 @@
       VisitName(D->getFieldName());
       continue;
     }
-    
+
     if (D->isArrayDesignator()) {
       ID.AddInteger(1);
     } else {
@@ -509,7 +509,7 @@
   VisitType(S->getDestroyedType());
 }
 
-void 
+void
 StmtProfiler::VisitUnresolvedFunctionNameExpr(UnresolvedFunctionNameExpr *S) {
   VisitExpr(S);
   VisitName(S->getName());
@@ -548,7 +548,7 @@
       const_cast<CXXDestructorDecl *>(S->getTemporary(I)->getDestructor()));
 }
 
-void 
+void
 StmtProfiler::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *S) {
   VisitExpr(S);
   VisitType(S->getTypeAsWritten());
@@ -617,7 +617,7 @@
 
 void StmtProfiler::VisitDecl(Decl *D) {
   ID.AddInteger(D? D->getKind() : 0);
-  
+
   if (Canonical && D) {
     if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) {
       ID.AddInteger(NTTP->getDepth());
@@ -625,38 +625,38 @@
       VisitType(NTTP->getType());
       return;
     }
-    
+
     if (ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
       // The Itanium C++ ABI uses the type of a parameter when mangling
       // expressions that involve function parameters, so we will use the
       // parameter's type for establishing function parameter identity. That
-      // way, our definition of "equivalent" (per C++ [temp.over.link]) 
+      // way, our definition of "equivalent" (per C++ [temp.over.link])
       // matches the definition of "equivalent" used for name mangling.
       VisitType(Parm->getType());
       return;
     }
-    
+
     if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) {
       ID.AddInteger(TTP->getDepth());
       ID.AddInteger(TTP->getIndex());
       return;
     }
-    
+
     if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
-      // The Itanium C++ ABI mangles references to a set of overloaded 
+      // The Itanium C++ ABI mangles references to a set of overloaded
       // functions using just the function name, so we do the same here.
       VisitName(Ovl->getDeclName());
       return;
     }
   }
-  
+
   ID.AddPointer(D? D->getCanonicalDecl() : 0);
 }
 
 void StmtProfiler::VisitType(QualType T) {
   if (Canonical)
     T = Context.getCanonicalType(T);
-  
+
   ID.AddPointer(T.getAsOpaquePtr());
 }
 
@@ -673,39 +673,39 @@
 void StmtProfiler::VisitTemplateName(TemplateName Name) {
   if (Canonical)
     Name = Context.getCanonicalTemplateName(Name);
-  
+
   Name.Profile(ID);
 }
 
-void StmtProfiler::VisitTemplateArguments(const TemplateArgument *Args, 
+void StmtProfiler::VisitTemplateArguments(const TemplateArgument *Args,
                                           unsigned NumArgs) {
   ID.AddInteger(NumArgs);
   for (unsigned I = 0; I != NumArgs; ++I) {
     const TemplateArgument &Arg = Args[I];
-    
+
     // Mostly repetitive with TemplateArgument::Profile!
     ID.AddInteger(Arg.getKind());
     switch (Arg.getKind()) {
       case TemplateArgument::Null:
         break;
-        
+
       case TemplateArgument::Type:
         VisitType(Arg.getAsType());
         break;
-        
+
       case TemplateArgument::Declaration:
         VisitDecl(Arg.getAsDecl());
         break;
-        
+
       case TemplateArgument::Integral:
         Arg.getAsIntegral()->Profile(ID);
         VisitType(Arg.getIntegralType());
         break;
-        
+
       case TemplateArgument::Expression:
         Visit(Arg.getAsExpr());
         break;
-        
+
       case TemplateArgument::Pack:
         VisitTemplateArguments(Arg.pack_begin(), Arg.pack_size());
         break;

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

==============================================================================
--- cfe/trunk/lib/AST/StmtViz.cpp (original)
+++ cfe/trunk/lib/AST/StmtViz.cpp Wed Sep  9 10:08:12 2009
@@ -32,26 +32,26 @@
 struct DOTGraphTraits<const Stmt*> : public DefaultDOTGraphTraits {
   static std::string getNodeLabel(const Stmt* Node, const Stmt* Graph,
                                   bool ShortNames) {
-    
+
 #ifndef NDEBUG
     std::string OutSStr;
     llvm::raw_string_ostream Out(OutSStr);
-    
+
     if (Node)
       Out << Node->getStmtClassName();
     else
       Out << "<NULL>";
-      
-    std::string OutStr = Out.str();    
+
+    std::string OutStr = Out.str();
     if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
-    
+
     // Process string output to make it nicer...
     for (unsigned i = 0; i != OutStr.length(); ++i)
       if (OutStr[i] == '\n') {                            // Left justify
         OutStr[i] = '\\';
         OutStr.insert(OutStr.begin()+i+1, 'l');
       }
-    
+
     return OutStr;
 #else
     return "";

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

==============================================================================
--- cfe/trunk/lib/AST/TemplateName.cpp (original)
+++ cfe/trunk/lib/AST/TemplateName.cpp Wed Sep  9 10:08:12 2009
@@ -22,7 +22,7 @@
 TemplateDecl *TemplateName::getAsTemplateDecl() const {
   if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
     return Template;
-  
+
   if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName())
     return QTN->getTemplateDecl();
 
@@ -30,34 +30,34 @@
 }
 
 OverloadedFunctionDecl *TemplateName::getAsOverloadedFunctionDecl() const {
-  if (OverloadedFunctionDecl *Ovl 
+  if (OverloadedFunctionDecl *Ovl
         = Storage.dyn_cast<OverloadedFunctionDecl *>())
     return Ovl;
-  
+
   if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName())
     return QTN->getOverloadedFunctionDecl();
-  
+
   return 0;
 }
 
 bool TemplateName::isDependent() const {
   if (TemplateDecl *Template = getAsTemplateDecl()) {
-    return isa<TemplateTemplateParmDecl>(Template) || 
+    return isa<TemplateTemplateParmDecl>(Template) ||
       Template->getDeclContext()->isDependentContext();
   }
 
   if (OverloadedFunctionDecl *Ovl = getAsOverloadedFunctionDecl())
     return Ovl->getDeclContext()->isDependentContext();
-  
+
   return true;
 }
 
-void 
+void
 TemplateName::print(llvm::raw_ostream &OS, const PrintingPolicy &Policy,
                     bool SuppressNNS) const {
   if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
     OS << Template->getIdentifier()->getName();
-  else if (OverloadedFunctionDecl *Ovl 
+  else if (OverloadedFunctionDecl *Ovl
              = Storage.dyn_cast<OverloadedFunctionDecl *>())
     OS << Ovl->getNameAsString();
   else if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) {
@@ -82,12 +82,12 @@
   print(llvm::errs(), PrintingPolicy(LO));
 }
 
-TemplateDecl *QualifiedTemplateName::getTemplateDecl() const { 
-  return dyn_cast<TemplateDecl>(Template); 
+TemplateDecl *QualifiedTemplateName::getTemplateDecl() const {
+  return dyn_cast<TemplateDecl>(Template);
 }
 
 OverloadedFunctionDecl *
 QualifiedTemplateName::getOverloadedFunctionDecl() const {
-  return dyn_cast<OverloadedFunctionDecl>(Template); 
+  return dyn_cast<OverloadedFunctionDecl>(Template);
 }
 

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

==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Wed Sep  9 10:08:12 2009
@@ -64,7 +64,7 @@
   C.Deallocate(this);
 }
 
-void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, 
+void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID,
                                       ASTContext &Context,
                                       QualType ET,
                                       ArraySizeModifier SizeMod,
@@ -76,8 +76,8 @@
   E->Profile(ID, Context, true);
 }
 
-void 
-DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID, 
+void
+DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID,
                                      ASTContext &Context,
                                      QualType ElementType, Expr *SizeExpr) {
   ID.AddPointer(ElementType.getAsOpaquePtr());
@@ -99,7 +99,7 @@
   // If this is directly an array type, return it.
   if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
     return ATy->getElementType().getTypePtr();
-    
+
   // If the canonical form of this type isn't the right kind, reject it.
   if (!isa<ArrayType>(CanonicalType)) {
     // Look through type qualifiers
@@ -107,7 +107,7 @@
       return AT->getElementType().getTypePtr();
     return 0;
   }
-  
+
   // If this is a typedef for an array type, strip the typedef off without
   // losing all typedef information.
   return cast<ArrayType>(getDesugaredType())->getElementType().getTypePtr();
@@ -153,7 +153,7 @@
     if (!DTT->getUnderlyingType()->isDependentType())
       return DTT->getUnderlyingType().getDesugaredType();
   }
-  if (const TemplateSpecializationType *Spec 
+  if (const TemplateSpecializationType *Spec
         = dyn_cast<TemplateSpecializationType>(this)) {
     if (ForDisplay)
       return QualType(this, 0);
@@ -262,7 +262,7 @@
       return CTy;
     return 0;
   }
-  
+
   // If the canonical form of this type isn't what we want, reject it.
   if (!isa<ComplexType>(CanonicalType)) {
     // Look through type qualifiers (e.g. ExtQualType's).
@@ -270,7 +270,7 @@
       return CanonicalType.getUnqualifiedType()->getAsComplexIntegerType();
     return 0;
   }
-  
+
   // If this is a typedef for a complex type, strip the typedef off without
   // losing all typedef information.
   return cast<ComplexType>(getDesugaredType());
@@ -306,7 +306,7 @@
       return CanonicalType.getUnqualifiedType()->getAsFunctionType();
     return 0;
   }
-  
+
   // If this is a typedef for a function type, strip the typedef off without
   // losing all typedef information.
   return cast<FunctionType>(getDesugaredType());
@@ -374,7 +374,7 @@
   if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
     if (!RT->getDecl()->isStruct())
       return 0;
-    
+
     // If this is a typedef for a structure type, strip the typedef off without
     // losing all typedef information.
     return cast<RecordType>(getDesugaredType());
@@ -385,13 +385,13 @@
   return 0;
 }
 
-const RecordType *Type::getAsUnionType() const { 
+const RecordType *Type::getAsUnionType() const {
   // If this is directly a union type, return it.
   if (const RecordType *RT = dyn_cast<RecordType>(this)) {
     if (RT->getDecl()->isUnion())
       return RT;
   }
-    
+
   // If the canonical form of this type isn't the right kind, reject it.
   if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
     if (!RT->getDecl()->isUnion())
@@ -401,7 +401,7 @@
     // losing all typedef information.
     return cast<RecordType>(getDesugaredType());
   }
-  
+
   // Look through type qualifiers
   if (isa<RecordType>(CanonicalType.getUnqualifiedType()))
     return CanonicalType.getUnqualifiedType()->getAsUnionType();
@@ -419,7 +419,7 @@
   // Are we directly a complex type?
   if (const ComplexType *CTy = dyn_cast<ComplexType>(this))
     return CTy;
-  
+
   // If the canonical form of this type isn't the right kind, reject it.
   if (!isa<ComplexType>(CanonicalType)) {
     // Look through type qualifiers
@@ -437,7 +437,7 @@
   // Are we directly a vector type?
   if (const VectorType *VTy = dyn_cast<VectorType>(this))
     return VTy;
-  
+
   // If the canonical form of this type isn't the right kind, reject it.
   if (!isa<VectorType>(CanonicalType)) {
     // Look through type qualifiers
@@ -455,9 +455,9 @@
   // Are we directly an OpenCU vector type?
   if (const ExtVectorType *VTy = dyn_cast<ExtVectorType>(this))
     return VTy;
-  
+
   // If the canonical form of this type isn't the right kind, reject it.
-  if (!isa<ExtVectorType>(CanonicalType)) {  
+  if (!isa<ExtVectorType>(CanonicalType)) {
     // Look through type qualifiers
     if (isa<ExtVectorType>(CanonicalType.getUnqualifiedType()))
       return CanonicalType.getUnqualifiedType()->getAsExtVectorType();
@@ -612,14 +612,14 @@
     return BT->getKind() >= BuiltinType::Char_S &&
            BT->getKind() <= BuiltinType::LongLong;
   }
-  
+
   if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
     return ET->getDecl()->getIntegerType()->isSignedIntegerType();
-  
+
   if (const FixedWidthIntType *FWIT =
           dyn_cast<FixedWidthIntType>(CanonicalType))
     return FWIT->isSigned();
-  
+
   if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
     return VT->getElementType()->isSignedIntegerType();
   if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
@@ -763,8 +763,8 @@
 /// isIncompleteType - Return true if this is an incomplete type (C99 6.2.5p1)
 /// - a type that can describe objects, but which lacks information needed to
 /// determine its size.
-bool Type::isIncompleteType() const { 
-  switch (CanonicalType->getTypeClass()) { 
+bool Type::isIncompleteType() const {
+  switch (CanonicalType->getTypeClass()) {
   default: return false;
   case ExtQual:
     return cast<ExtQualType>(CanonicalType)->getBaseType()->isIncompleteType();
@@ -816,7 +816,7 @@
     return true;
 
   case Record:
-    if (CXXRecordDecl *ClassDecl 
+    if (CXXRecordDecl *ClassDecl
           = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
       return ClassDecl->isPOD();
 
@@ -836,7 +836,7 @@
     case BuiltinType::Short:
     case BuiltinType::UShort:
       return true;
-    default: 
+    default:
       return false;
     }
   return false;
@@ -918,7 +918,7 @@
   ID.AddInteger(hasExceptionSpec);
   if (hasExceptionSpec) {
     ID.AddInteger(anyExceptionSpec);
-    for(unsigned i = 0; i != NumExceptions; ++i)
+    for (unsigned i = 0; i != NumExceptions; ++i)
       ID.AddPointer(Exs[i].getAsOpaquePtr());
   }
   ID.AddInteger(NoReturn);
@@ -957,14 +957,14 @@
   QualType FirstType = getDecl()->getUnderlyingType();
   if (!isa<TypedefType>(FirstType))
     return FirstType;
-  
+
   // Otherwise, do the fully general loop.
   unsigned TypeQuals = 0;
   const TypedefType *TDT = this;
   while (1) {
     QualType CurType = TDT->getDecl()->getUnderlyingType();
-    
-    
+
+
     /// FIXME:
     /// FIXME: This is incorrect for ExtQuals!
     /// FIXME:
@@ -980,25 +980,25 @@
   : Type(TypeOfExpr, can, E->isTypeDependent()), TOExpr(E) {
 }
 
-void DependentTypeOfExprType::Profile(llvm::FoldingSetNodeID &ID, 
+void DependentTypeOfExprType::Profile(llvm::FoldingSetNodeID &ID,
                                       ASTContext &Context, Expr *E) {
   E->Profile(ID, Context, true);
 }
 
 DecltypeType::DecltypeType(Expr *E, QualType underlyingType, QualType can)
-  : Type(Decltype, can, E->isTypeDependent()), E(E), 
+  : Type(Decltype, can, E->isTypeDependent()), E(E),
   UnderlyingType(underlyingType) {
 }
 
 DependentDecltypeType::DependentDecltypeType(ASTContext &Context, Expr *E)
   : DecltypeType(E, Context.DependentTy), Context(Context) { }
 
-void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID, 
+void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
                                     ASTContext &Context, Expr *E) {
   E->Profile(ID, Context, true);
 }
 
-TagType::TagType(TypeClass TC, TagDecl *D, QualType can) 
+TagType::TagType(TypeClass TC, TagDecl *D, QualType can)
   : Type(TC, can, D->isDependentType()), decl(D, 0) {}
 
 bool RecordType::classof(const TagType *TT) {
@@ -1009,7 +1009,7 @@
   return isa<EnumDecl>(TT->getDecl());
 }
 
-bool 
+bool
 TemplateSpecializationType::
 anyDependentTemplateArguments(const TemplateArgument *Args, unsigned NumArgs) {
   for (unsigned Idx = 0; Idx < NumArgs; ++Idx) {
@@ -1017,12 +1017,12 @@
     case TemplateArgument::Null:
       assert(false && "Should not have a NULL template argument");
       break;
-        
+
     case TemplateArgument::Type:
       if (Args[Idx].getAsType()->isDependentType())
         return true;
       break;
-      
+
     case TemplateArgument::Declaration:
     case TemplateArgument::Integral:
       // Never dependent
@@ -1033,7 +1033,7 @@
           Args[Idx].getAsExpr()->isValueDependent())
         return true;
       break;
-        
+
     case TemplateArgument::Pack:
       assert(0 && "FIXME: Implement!");
       break;
@@ -1044,20 +1044,19 @@
 }
 
 TemplateSpecializationType::
-TemplateSpecializationType(ASTContext &Context, TemplateName T, 
+TemplateSpecializationType(ASTContext &Context, TemplateName T,
                            const TemplateArgument *Args,
                            unsigned NumArgs, QualType Canon)
-  : Type(TemplateSpecialization, 
+  : Type(TemplateSpecialization,
          Canon.isNull()? QualType(this, 0) : Canon,
          T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)),
     Context(Context),
-    Template(T), NumArgs(NumArgs)
-{
-  assert((!Canon.isNull() || 
+    Template(T), NumArgs(NumArgs) {
+  assert((!Canon.isNull() ||
           T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)) &&
          "No canonical type for non-dependent class template specialization");
 
-  TemplateArgument *TemplateArgs 
+  TemplateArgument *TemplateArgs
     = reinterpret_cast<TemplateArgument *>(this + 1);
   for (unsigned Arg = 0; Arg < NumArgs; ++Arg)
     new (&TemplateArgs[Arg]) TemplateArgument(Args[Arg]);
@@ -1083,10 +1082,10 @@
   return getArgs()[Idx];
 }
 
-void 
-TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID, 
-                                    TemplateName T, 
-                                    const TemplateArgument *Args, 
+void
+TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
+                                    TemplateName T,
+                                    const TemplateArgument *Args,
                                     unsigned NumArgs,
                                     ASTContext &Context) {
   T.Profile(ID);
@@ -1097,7 +1096,7 @@
 const Type *QualifierSet::strip(const Type* T) {
   QualType DT = T->getDesugaredType();
   addCVR(DT.getCVRQualifiers());
-  
+
   if (const ExtQualType* EQT = dyn_cast<ExtQualType>(DT)) {
     if (EQT->getAddressSpace())
       addAddressSpace(EQT->getAddressSpace());
@@ -1162,8 +1161,8 @@
   return S;
 }
 
-void 
-QualType::getAsStringInternal(std::string &S, 
+void
+QualType::getAsStringInternal(std::string &S,
                               const PrintingPolicy &Policy) const {
   if (isNull()) {
     S += "NULL TYPE";
@@ -1186,7 +1185,7 @@
   getTypePtr()->getAsStringInternal(S, Policy);
 }
 
-void BuiltinType::getAsStringInternal(std::string &S, 
+void BuiltinType::getAsStringInternal(std::string &S,
                                       const PrintingPolicy &Policy) const {
   if (S.empty()) {
     S = getName(Policy.LangOpts);
@@ -1238,12 +1237,12 @@
 
 void PointerType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
   S = '*' + S;
-  
+
   // Handle things like 'int (*A)[4];' correctly.
   // FIXME: this should include vectors, but vectors use attributes I guess.
   if (isa<ArrayType>(getPointeeType()))
     S = '(' + S + ')';
-  
+
   getPointeeType().getAsStringInternal(S, Policy);
 }
 
@@ -1292,7 +1291,7 @@
   S += '[';
   S += llvm::utostr(getSize().getZExtValue());
   S += ']';
-  
+
   getElementType().getAsStringInternal(S, Policy);
 }
 
@@ -1327,17 +1326,17 @@
 
 void VariableArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
   S += '[';
-  
+
   if (getIndexTypeQualifier()) {
     AppendTypeQualList(S, getIndexTypeQualifier());
     S += ' ';
   }
-  
+
   if (getSizeModifier() == Static)
     S += "static";
   else if (getSizeModifier() == Star)
     S += '*';
-  
+
   if (getSizeExpr()) {
     std::string SStr;
     llvm::raw_string_ostream s(SStr);
@@ -1345,23 +1344,23 @@
     S += s.str();
   }
   S += ']';
-  
+
   getElementType().getAsStringInternal(S, Policy);
 }
 
 void DependentSizedArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
   S += '[';
-  
+
   if (getIndexTypeQualifier()) {
     AppendTypeQualList(S, getIndexTypeQualifier());
     S += ' ';
   }
-  
+
   if (getSizeModifier() == Static)
     S += "static";
   else if (getSizeModifier() == Star)
     S += '*';
-  
+
   if (getSizeExpr()) {
     std::string SStr;
     llvm::raw_string_ostream s(SStr);
@@ -1369,7 +1368,7 @@
     S += s.str();
   }
   S += ']';
-  
+
   getElementType().getAsStringInternal(S, Policy);
 }
 
@@ -1419,7 +1418,7 @@
   InnerString = "typeof(" + Tmp + ")" + InnerString;
 }
 
-void DecltypeType::getAsStringInternal(std::string &InnerString, 
+void DecltypeType::getAsStringInternal(std::string &InnerString,
                                        const PrintingPolicy &Policy) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'decltype(t) X'.
     InnerString = ' ' + InnerString;
@@ -1433,7 +1432,7 @@
   // If needed for precedence reasons, wrap the inner part in grouping parens.
   if (!S.empty())
     S = "(" + S + ")";
-  
+
   S += "()";
   if (getNoReturnAttr())
     S += " __attribute__((noreturn))";
@@ -1444,7 +1443,7 @@
   // If needed for precedence reasons, wrap the inner part in grouping parens.
   if (!S.empty())
     S = "(" + S + ")";
-  
+
   S += "(";
   std::string Tmp;
   PrintingPolicy ParamPolicy(Policy);
@@ -1455,7 +1454,7 @@
     S += Tmp;
     Tmp.clear();
   }
-  
+
   if (isVariadic()) {
     if (getNumArgs())
       S += ", ";
@@ -1464,7 +1463,7 @@
     // Do not emit int() if we have a proto, emit 'int(void)'.
     S += "void";
   }
-  
+
   S += ")";
   if (getNoReturnAttr())
     S += " __attribute__((noreturn))";
@@ -1483,13 +1482,13 @@
     InnerString = ' ' + InnerString;
 
   if (!Name)
-    InnerString = "type-parameter-" + llvm::utostr_32(Depth) + '-' + 
+    InnerString = "type-parameter-" + llvm::utostr_32(Depth) + '-' +
       llvm::utostr_32(Index) + InnerString;
   else
     InnerString = Name->getName() + InnerString;
 }
 
-std::string 
+std::string
 TemplateSpecializationType::PrintTemplateArgumentList(
                                                   const TemplateArgument *Args,
                                                   unsigned NumArgs,
@@ -1499,7 +1498,7 @@
   for (unsigned Arg = 0; Arg < NumArgs; ++Arg) {
     if (Arg)
       SpecString += ", ";
-    
+
     // Print the argument into a string.
     std::string ArgString;
     switch (Args[Arg].getKind()) {
@@ -1549,7 +1548,7 @@
   return SpecString;
 }
 
-void 
+void
 TemplateSpecializationType::
 getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
   std::string SpecString;
@@ -1573,7 +1572,7 @@
     llvm::raw_string_ostream OS(MyString);
     NNS->print(OS, Policy);
   }
-  
+
   std::string TypeStr;
   PrintingPolicy InnerPolicy(Policy);
   InnerPolicy.SuppressTagKind = true;
@@ -1600,12 +1599,12 @@
     else if (const TemplateSpecializationType *Spec = getTemplateId()) {
       Spec->getTemplateName().print(OS, Policy, true);
       OS << TemplateSpecializationType::PrintTemplateArgumentList(
-                                                               Spec->getArgs(), 
+                                                               Spec->getArgs(),
                                                             Spec->getNumArgs(),
                                                                Policy);
     }
   }
-  
+
   if (InnerString.empty())
     InnerString.swap(MyString);
   else
@@ -1614,7 +1613,7 @@
 
 void ObjCInterfaceType::Profile(llvm::FoldingSetNodeID &ID,
                                          const ObjCInterfaceDecl *Decl,
-                                         ObjCProtocolDecl **protocols, 
+                                         ObjCProtocolDecl **protocols,
                                          unsigned NumProtocols) {
   ID.AddPointer(Decl);
   for (unsigned i = 0; i != NumProtocols; i++)
@@ -1632,7 +1631,7 @@
                                            const PrintingPolicy &Policy) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'typedefname X'.
     InnerString = ' ' + InnerString;
-    
+
   std::string ObjCQIString = getDecl()->getNameAsString();
   if (getNumProtocols()) {
     ObjCQIString += '<';
@@ -1649,10 +1648,10 @@
   InnerString = ObjCQIString + InnerString;
 }
 
-void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString, 
+void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
                                                 const PrintingPolicy &Policy) const {
   std::string ObjCQIString;
-  
+
   if (isObjCIdType() || isObjCQualifiedIdType())
     ObjCQIString = "id";
   else if (isObjCClassType() || isObjCQualifiedClassType())
@@ -1677,7 +1676,7 @@
   InnerString = ObjCQIString + InnerString;
 }
 
-void ElaboratedType::getAsStringInternal(std::string &InnerString, 
+void ElaboratedType::getAsStringInternal(std::string &InnerString,
                                          const PrintingPolicy &Policy) const {
   std::string TypeStr;
   PrintingPolicy InnerPolicy(Policy);
@@ -1693,7 +1692,7 @@
 
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'typedefname X'.
     InnerString = ' ' + InnerString;
-  
+
   const char *Kind = Policy.SuppressTagKind? 0 : getDecl()->getKindName();
   const char *ID;
   if (const IdentifierInfo *II = getDecl()->getIdentifier())
@@ -1707,10 +1706,10 @@
 
   // If this is a class template specialization, print the template
   // arguments.
-  if (ClassTemplateSpecializationDecl *Spec 
+  if (ClassTemplateSpecializationDecl *Spec
         = dyn_cast<ClassTemplateSpecializationDecl>(getDecl())) {
     const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
-    std::string TemplateArgsStr 
+    std::string TemplateArgsStr
       = TemplateSpecializationType::PrintTemplateArgumentList(
                                             TemplateArgs.getFlatArgumentList(),
                                             TemplateArgs.flat_size(),
@@ -1722,13 +1721,13 @@
     // Compute the full nested-name-specifier for this type. In C,
     // this will always be empty.
     std::string ContextStr;
-    for (DeclContext *DC = getDecl()->getDeclContext(); 
+    for (DeclContext *DC = getDecl()->getDeclContext();
          !DC->isTranslationUnit(); DC = DC->getParent()) {
       std::string MyPart;
       if (NamespaceDecl *NS = dyn_cast<NamespaceDecl>(DC)) {
         if (NS->getIdentifier())
           MyPart = NS->getNameAsString();
-      } else if (ClassTemplateSpecializationDecl *Spec 
+      } else if (ClassTemplateSpecializationDecl *Spec
                    = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
         const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
         std::string TemplateArgsStr

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

==============================================================================
--- cfe/trunk/lib/AST/TypeLoc.cpp (original)
+++ cfe/trunk/lib/AST/TypeLoc.cpp Wed Sep  9 10:08:12 2009
@@ -30,7 +30,7 @@
 
   if (const DeclaratorLoc *DL = dyn_cast<DeclaratorLoc>(this))
     return DL->getTypeSpecLoc();
-  return cast<TypeSpecLoc>(*this); 
+  return cast<TypeSpecLoc>(*this);
 }
 
 /// \brief Find the TypeSpecLoc that is part of this TypeLoc and return its
@@ -46,9 +46,9 @@
 public:
 #define ABSTRACT_TYPELOC(CLASS)
 #define TYPELOC(CLASS, PARENT, TYPE) \
-    unsigned Visit##CLASS(CLASS TyLoc) { return TyLoc.getFullDataSize(); } 
+    unsigned Visit##CLASS(CLASS TyLoc) { return TyLoc.getFullDataSize(); }
 #include "clang/AST/TypeLocNodes.def"
-  
+
   unsigned VisitTypeLoc(TypeLoc TyLoc) {
     assert(0 && "A type loc wrapper was not handled!");
     return 0;
@@ -70,7 +70,7 @@
 public:
 #define TYPELOC(CLASS, PARENT, TYPE)
 #define DECLARATOR_TYPELOC(CLASS, TYPE) \
-    TypeLoc Visit##CLASS(CLASS TyLoc); 
+    TypeLoc Visit##CLASS(CLASS TyLoc);
 #include "clang/AST/TypeLocNodes.def"
 
   TypeLoc VisitTypeSpecLoc(TypeLoc TyLoc) { return TypeLoc(); }
@@ -84,16 +84,16 @@
 }
 
 TypeLoc NextLoc::VisitPointerLoc(PointerLoc TL) {
-  return TL.getPointeeLoc();  
+  return TL.getPointeeLoc();
 }
 TypeLoc NextLoc::VisitMemberPointerLoc(MemberPointerLoc TL) {
-  return TL.getPointeeLoc();  
+  return TL.getPointeeLoc();
 }
 TypeLoc NextLoc::VisitBlockPointerLoc(BlockPointerLoc TL) {
-  return TL.getPointeeLoc();  
+  return TL.getPointeeLoc();
 }
 TypeLoc NextLoc::VisitReferenceLoc(ReferenceLoc TL) {
-  return TL.getPointeeLoc();  
+  return TL.getPointeeLoc();
 }
 TypeLoc NextLoc::VisitFunctionLoc(FunctionLoc TL) {
   return TL.getResultLoc();
@@ -105,7 +105,7 @@
 /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
 /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
 TypeLoc TypeLoc::getNextTypeLoc() const {
-  return NextLoc().Visit(*this);  
+  return NextLoc().Visit(*this);
 }
 
 //===----------------------------------------------------------------------===//
@@ -119,7 +119,7 @@
 public:
 #define TYPELOC(CLASS, PARENT, TYPE)
 #define TYPESPEC_TYPELOC(CLASS, TYPE) \
-    SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); } 
+    SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); }
 #include "clang/AST/TypeLocNodes.def"
 
   SourceRange VisitTypeLoc(TypeLoc TyLoc) {
@@ -139,13 +139,13 @@
 namespace {
 class TypeSpecChecker : public TypeLocVisitor<TypeSpecChecker, bool> {
 public:
-  bool VisitTypeSpecLoc(TypeSpecLoc TyLoc) { return true; }  
+  bool VisitTypeSpecLoc(TypeSpecLoc TyLoc) { return true; }
 };
 
 }
 
 bool TypeSpecLoc::classof(const TypeLoc *TL) {
-  return TypeSpecChecker().Visit(*TL);  
+  return TypeSpecChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -159,7 +159,7 @@
 public:
 #define TYPELOC(CLASS, PARENT, TYPE)
 #define DECLARATOR_TYPELOC(CLASS, TYPE) \
-    TypeSpecLoc Visit##CLASS(CLASS TyLoc) { return TyLoc.getTypeSpecLoc(); } 
+    TypeSpecLoc Visit##CLASS(CLASS TyLoc) { return TyLoc.getTypeSpecLoc(); }
 #include "clang/AST/TypeLocNodes.def"
 
   TypeSpecLoc VisitTypeLoc(TypeLoc TyLoc) {
@@ -179,13 +179,13 @@
 
 class DeclaratorLocChecker : public TypeLocVisitor<DeclaratorLocChecker, bool> {
 public:
-  bool VisitDeclaratorLoc(DeclaratorLoc TyLoc) { return true; }  
+  bool VisitDeclaratorLoc(DeclaratorLoc TyLoc) { return true; }
 };
 
 }
 
 bool DeclaratorLoc::classof(const TypeLoc *TL) {
-  return DeclaratorLocChecker().Visit(*TL);  
+  return DeclaratorLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -197,13 +197,13 @@
 class DefaultTypeSpecLocChecker :
                         public TypeLocVisitor<DefaultTypeSpecLocChecker, bool> {
 public:
-  bool VisitDefaultTypeSpecLoc(DefaultTypeSpecLoc TyLoc) { return true; }  
+  bool VisitDefaultTypeSpecLoc(DefaultTypeSpecLoc TyLoc) { return true; }
 };
 
 }
 
 bool DefaultTypeSpecLoc::classof(const TypeLoc *TL) {
-  return DefaultTypeSpecLocChecker().Visit(*TL);  
+  return DefaultTypeSpecLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -214,13 +214,13 @@
 
 class TypedefLocChecker : public TypeLocVisitor<TypedefLocChecker, bool> {
 public:
-  bool VisitTypedefLoc(TypedefLoc TyLoc) { return true; }  
+  bool VisitTypedefLoc(TypedefLoc TyLoc) { return true; }
 };
 
 }
 
 bool TypedefLoc::classof(const TypeLoc *TL) {
-  return TypedefLocChecker().Visit(*TL);  
+  return TypedefLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -231,13 +231,13 @@
 
 class PointerLocChecker : public TypeLocVisitor<PointerLocChecker, bool> {
 public:
-  bool VisitPointerLoc(PointerLoc TyLoc) { return true; }  
+  bool VisitPointerLoc(PointerLoc TyLoc) { return true; }
 };
 
 }
 
 bool PointerLoc::classof(const TypeLoc *TL) {
-  return PointerLocChecker().Visit(*TL);  
+  return PointerLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -249,13 +249,13 @@
 class BlockPointerLocChecker :
            public TypeLocVisitor<BlockPointerLocChecker, bool> {
 public:
-  bool VisitBlockPointerLoc(BlockPointerLoc TyLoc) { return true; }  
+  bool VisitBlockPointerLoc(BlockPointerLoc TyLoc) { return true; }
 };
 
 }
 
 bool BlockPointerLoc::classof(const TypeLoc *TL) {
-  return BlockPointerLocChecker().Visit(*TL);  
+  return BlockPointerLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -267,13 +267,13 @@
 class MemberPointerLocChecker :
            public TypeLocVisitor<MemberPointerLocChecker, bool> {
 public:
-  bool VisitMemberPointerLoc(MemberPointerLoc TyLoc) { return true; }  
+  bool VisitMemberPointerLoc(MemberPointerLoc TyLoc) { return true; }
 };
 
 }
 
 bool MemberPointerLoc::classof(const TypeLoc *TL) {
-  return MemberPointerLocChecker().Visit(*TL);  
+  return MemberPointerLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -284,13 +284,13 @@
 
 class ReferenceLocChecker : public TypeLocVisitor<ReferenceLocChecker, bool> {
 public:
-  bool VisitReferenceLoc(ReferenceLoc TyLoc) { return true; }  
+  bool VisitReferenceLoc(ReferenceLoc TyLoc) { return true; }
 };
 
 }
 
 bool ReferenceLoc::classof(const TypeLoc *TL) {
-  return ReferenceLocChecker().Visit(*TL);  
+  return ReferenceLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -301,13 +301,13 @@
 
 class FunctionLocChecker : public TypeLocVisitor<FunctionLocChecker, bool> {
 public:
-  bool VisitFunctionLoc(FunctionLoc TyLoc) { return true; }  
+  bool VisitFunctionLoc(FunctionLoc TyLoc) { return true; }
 };
 
 }
 
 bool FunctionLoc::classof(const TypeLoc *TL) {
-  return FunctionLocChecker().Visit(*TL);  
+  return FunctionLocChecker().Visit(*TL);
 }
 
 //===----------------------------------------------------------------------===//
@@ -318,11 +318,11 @@
 
 class ArrayLocChecker : public TypeLocVisitor<ArrayLocChecker, bool> {
 public:
-  bool VisitArrayLoc(ArrayLoc TyLoc) { return true; }  
+  bool VisitArrayLoc(ArrayLoc TyLoc) { return true; }
 };
 
 }
 
 bool ArrayLoc::classof(const TypeLoc *TL) {
-  return ArrayLocChecker().Visit(*TL);  
+  return ArrayLocChecker().Visit(*TL);
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisContext.cpp Wed Sep  9 10:08:12 2009
@@ -45,18 +45,18 @@
 const ImplicitParamDecl *AnalysisContext::getSelfDecl() const {
   if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D))
     return MD->getSelfDecl();
-  
+
   return NULL;
 }
 
 CFG *AnalysisContext::getCFG() {
-  if (!cfg) 
+  if (!cfg)
     cfg = CFG::buildCFG(getBody(), &D->getASTContext());
   return cfg;
 }
 
 ParentMap &AnalysisContext::getParentMap() {
-  if (!PM) 
+  if (!PM)
     PM = new ParentMap(getBody());
   return *PM;
 }
@@ -66,12 +66,12 @@
     CFG *c = getCFG();
     if (!c)
       return 0;
-    
+
     liveness = new LiveVariables(D->getASTContext(), *c);
     liveness->runOnCFG(*c);
     liveness->runOnAllBlocks(*c, 0, true);
   }
-  
+
   return liveness;
 }
 
@@ -79,7 +79,7 @@
   AnalysisContext *&AC = Contexts[D];
   if (!AC)
     AC = new AnalysisContext(D);
-  
+
   return AC;
 }
 
@@ -104,14 +104,14 @@
 }
 
 StackFrameContext*
-LocationContextManager::getStackFrame(AnalysisContext *ctx, 
+LocationContextManager::getStackFrame(AnalysisContext *ctx,
                                       const LocationContext *parent,
                                       const Stmt *s) {
   llvm::FoldingSetNodeID ID;
   StackFrameContext::Profile(ID, ctx, parent, s);
   void *InsertPos;
 
-  StackFrameContext *f = 
+  StackFrameContext *f =
    cast_or_null<StackFrameContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos));
   if (!f) {
     f = new StackFrameContext(ctx, parent, s);
@@ -126,7 +126,7 @@
   llvm::FoldingSetNodeID ID;
   ScopeContext::Profile(ID, ctx, parent, s);
   void *InsertPos;
-  
+
   ScopeContext *scope =
     cast_or_null<ScopeContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos));
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisManager.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisManager.cpp Wed Sep  9 10:08:12 2009
@@ -17,12 +17,12 @@
 using namespace clang;
 
 void AnalysisManager::DisplayFunction() {
-      
+
   if (DisplayedFunction)
     return;
-  
+
   DisplayedFunction = true;
-  
+
   // FIXME: Is getCodeDecl() always a named decl?
   if (isa<FunctionDecl>(getCodeDecl()) ||
       isa<ObjCMethodDecl>(getCodeDecl())) {

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicConstraintManager.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicConstraintManager.cpp Wed Sep  9 10:08:12 2009
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines BasicConstraintManager, a class that tracks simple 
+//  This file defines BasicConstraintManager, a class that tracks simple
 //  equality and inequality constraints on symbolic values of GRState.
 //
 //===----------------------------------------------------------------------===//
@@ -27,22 +27,22 @@
 
 typedef llvm::ImmutableMap<SymbolRef,GRState::IntSetTy> ConstNotEqTy;
 typedef llvm::ImmutableMap<SymbolRef,const llvm::APSInt*> ConstEqTy;
-  
+
 static int ConstEqIndex = 0;
 static int ConstNotEqIndex = 0;
 
 namespace clang {
 template<>
 struct GRStateTrait<ConstNotEq> : public GRStatePartialTrait<ConstNotEqTy> {
-  static inline void* GDMIndex() { return &ConstNotEqIndex; }  
+  static inline void* GDMIndex() { return &ConstNotEqIndex; }
 };
 
 template<>
 struct GRStateTrait<ConstEq> : public GRStatePartialTrait<ConstEqTy> {
-  static inline void* GDMIndex() { return &ConstEqIndex; }  
+  static inline void* GDMIndex() { return &ConstEqIndex; }
 };
-}  
-  
+}
+
 namespace {
 // BasicConstraintManager only tracks equality and inequality constraints of
 // constants and integer variables.
@@ -50,7 +50,7 @@
   : public SimpleConstraintManager {
   GRState::IntSetTy::Factory ISetFactory;
 public:
-  BasicConstraintManager(GRStateManager& statemgr) 
+  BasicConstraintManager(GRStateManager& statemgr)
     : ISetFactory(statemgr.getAllocator()) {}
 
   const GRState* AssumeSymNE(const GRState* state, SymbolRef sym,
@@ -83,7 +83,7 @@
 
   const GRState* RemoveDeadBindings(const GRState* state, SymbolReaper& SymReaper);
 
-  void print(const GRState* state, llvm::raw_ostream& Out, 
+  void print(const GRState* state, llvm::raw_ostream& Out,
              const char* nl, const char *sep);
 };
 
@@ -133,7 +133,7 @@
 // These logic will be handled in another ConstraintManager.
 const GRState *BasicConstraintManager::AssumeSymLT(const GRState *state,
                                                    SymbolRef sym,
-                                                   const llvm::APSInt& V) {  
+                                                   const llvm::APSInt& V) {
   // Is 'V' the smallest possible value?
   if (V == llvm::APSInt::getMinValue(V.getBitWidth(), V.isUnsigned())) {
     // sym cannot be any value less than 'V'.  This path is infeasible.
@@ -167,14 +167,14 @@
     bool isFeasible = *X >= V;
     return isFeasible ? state : NULL;
   }
-  
+
   // Sym is not a constant, but it is worth looking to see if V is the
   // maximum integer value.
   if (V == llvm::APSInt::getMaxValue(V.getBitWidth(), V.isUnsigned())) {
     // If we know that sym != V, then this condition is infeasible since
-    // there is no other value greater than V.    
+    // there is no other value greater than V.
     bool isFeasible = !isNotEqual(state, sym, V);
-    
+
     // If the path is still feasible then as a consequence we know that
     // 'sym == V' because we cannot have 'sym > V' (no larger values).
     // Add this constraint.
@@ -193,20 +193,20 @@
     bool isFeasible = *X <= V;
     return isFeasible ? state : NULL;
   }
-  
+
   // Sym is not a constant, but it is worth looking to see if V is the
   // minimum integer value.
   if (V == llvm::APSInt::getMinValue(V.getBitWidth(), V.isUnsigned())) {
     // If we know that sym != V, then this condition is infeasible since
-    // there is no other value less than V.    
+    // there is no other value less than V.
     bool isFeasible = !isNotEqual(state, sym, V);
-    
+
     // If the path is still feasible then as a consequence we know that
     // 'sym == V' because we cannot have 'sym < V' (no smaller values).
     // Add this constraint.
     return isFeasible ? AddEQ(state, sym, V) : NULL;
   }
-    
+
   return state;
 }
 
@@ -222,10 +222,10 @@
   // First, retrieve the NE-set associated with the given symbol.
   ConstNotEqTy::data_type* T = state->get<ConstNotEq>(sym);
   GRState::IntSetTy S = T ? *T : ISetFactory.GetEmptySet();
-  
+
   // Now add V to the NE set.
   S = ISetFactory.Add(S, &V);
-  
+
   // Create a new state with the old binding replaced.
   return state->set<ConstNotEq>(sym, S);
 }
@@ -236,7 +236,7 @@
   return T ? *T : NULL;
 }
 
-bool BasicConstraintManager::isNotEqual(const GRState* state, SymbolRef sym, 
+bool BasicConstraintManager::isNotEqual(const GRState* state, SymbolRef sym,
                                         const llvm::APSInt& V) const {
 
   // Retrieve the NE-set associated with the given symbol.
@@ -273,14 +273,14 @@
   ConstNotEqTy::Factory& CNEFactory = state->get_context<ConstNotEq>();
 
   for (ConstNotEqTy::iterator I = CNE.begin(), E = CNE.end(); I != E; ++I) {
-    SymbolRef sym = I.getKey();    
+    SymbolRef sym = I.getKey();
     if (SymReaper.maybeDead(sym)) CNE = CNEFactory.Remove(CNE, sym);
   }
-  
+
   return state->set<ConstNotEq>(CNE);
 }
 
-void BasicConstraintManager::print(const GRState* state, llvm::raw_ostream& Out, 
+void BasicConstraintManager::print(const GRState* state, llvm::raw_ostream& Out,
                                    const char* nl, const char *sep) {
   // Print equality constraints.
 
@@ -293,23 +293,23 @@
   }
 
   // Print != constraints.
-  
+
   ConstNotEqTy CNE = state->get<ConstNotEq>();
-  
+
   if (!CNE.isEmpty()) {
     Out << nl << sep << "'!=' constraints:";
-  
+
     for (ConstNotEqTy::iterator I = CNE.begin(), EI = CNE.end(); I!=EI; ++I) {
       Out << nl << " $" << I.getKey() << " : ";
       bool isFirst = true;
-    
-      GRState::IntSetTy::iterator J = I.getData().begin(), 
-                                  EJ = I.getData().end();      
-      
-      for ( ; J != EJ; ++J) {        
+
+      GRState::IntSetTy::iterator J = I.getData().begin(),
+                                  EJ = I.getData().end();
+
+      for ( ; J != EJ; ++J) {
         if (isFirst) isFirst = false;
         else Out << ", ";
-      
+
         Out << (*J)->getSExtValue(); // Hack: should print to raw_ostream.
       }
     }

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp Wed Sep  9 10:08:12 2009
@@ -33,10 +33,10 @@
 
 static const ObjCInterfaceType* GetReceiverType(const ObjCMessageExpr* ME) {
   const Expr* Receiver = ME->getReceiver();
-  
+
   if (!Receiver)
     return NULL;
-  
+
   if (const ObjCObjectPointerType *PT =
       Receiver->getType()->getAsObjCObjectPointerType())
     return PT->getInterfaceType();
@@ -56,75 +56,75 @@
 public:
   APIMisuse(const char* name) : BugType(name, "API Misuse (Apple)") {}
 };
-  
+
 class VISIBILITY_HIDDEN BasicObjCFoundationChecks : public GRSimpleAPICheck {
   APIMisuse *BT;
   BugReporter& BR;
   ASTContext &Ctx;
-      
+
   bool isNSString(const ObjCInterfaceType *T, const char* suffix);
   bool AuditNSString(ExplodedNode* N, const ObjCMessageExpr* ME);
-      
-  void Warn(ExplodedNode* N, const Expr* E, const std::string& s);  
+
+  void Warn(ExplodedNode* N, const Expr* E, const std::string& s);
   void WarnNilArg(ExplodedNode* N, const Expr* E);
-  
+
   bool CheckNilArg(ExplodedNode* N, unsigned Arg);
 
 public:
-  BasicObjCFoundationChecks(ASTContext& ctx, BugReporter& br) 
+  BasicObjCFoundationChecks(ASTContext& ctx, BugReporter& br)
     : BT(0), BR(br), Ctx(ctx) {}
-        
+
   bool Audit(ExplodedNode* N, GRStateManager&);
-  
-private:  
-  void WarnNilArg(ExplodedNode* N, const ObjCMessageExpr* ME, unsigned Arg) {    
+
+private:
+  void WarnNilArg(ExplodedNode* N, const ObjCMessageExpr* ME, unsigned Arg) {
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
     os << "Argument to '" << GetReceiverNameType(ME) << "' method '"
        << ME->getSelector().getAsString() << "' cannot be nil.";
-    
+
     // Lazily create the BugType object for NilArg.  This will be owned
     // by the BugReporter object 'BR' once we call BR.EmitWarning.
     if (!BT) BT = new APIMisuse("nil argument");
-    
+
     RangedBugReport *R = new RangedBugReport(*BT, os.str().c_str(), N);
     R->addRange(ME->getArg(Arg)->getSourceRange());
     BR.EmitReport(R);
   }
 };
-  
+
 } // end anonymous namespace
 
 
 GRSimpleAPICheck*
 clang::CreateBasicObjCFoundationChecks(ASTContext& Ctx, BugReporter& BR) {
-  return new BasicObjCFoundationChecks(Ctx, BR);  
+  return new BasicObjCFoundationChecks(Ctx, BR);
 }
 
 
 
 bool BasicObjCFoundationChecks::Audit(ExplodedNode* N,
                                       GRStateManager&) {
-  
+
   const ObjCMessageExpr* ME =
     cast<ObjCMessageExpr>(cast<PostStmt>(N->getLocation()).getStmt());
 
   const ObjCInterfaceType *ReceiverType = GetReceiverType(ME);
-  
+
   if (!ReceiverType)
     return false;
-  
+
   const char* name = ReceiverType->getDecl()->getIdentifier()->getName();
-  
+
   if (!name)
     return false;
 
   if (name[0] != 'N' || name[1] != 'S')
     return false;
-      
+
   name += 2;
-  
-  // FIXME: Make all of this faster.  
+
+  // FIXME: Make all of this faster.
   if (isNSString(ReceiverType, name))
     return AuditNSString(N, ME);
 
@@ -132,7 +132,7 @@
 }
 
 static inline bool isNil(SVal X) {
-  return isa<loc::ConcreteInt>(X);  
+  return isa<loc::ConcreteInt>(X);
 }
 
 //===----------------------------------------------------------------------===//
@@ -142,14 +142,14 @@
 bool BasicObjCFoundationChecks::CheckNilArg(ExplodedNode* N, unsigned Arg) {
   const ObjCMessageExpr* ME =
     cast<ObjCMessageExpr>(cast<PostStmt>(N->getLocation()).getStmt());
-  
+
   const Expr * E = ME->getArg(Arg);
-  
+
   if (isNil(N->getState()->getSVal(E))) {
     WarnNilArg(N, ME, Arg);
     return true;
   }
-  
+
   return false;
 }
 
@@ -158,35 +158,35 @@
 //===----------------------------------------------------------------------===//
 
 bool BasicObjCFoundationChecks::isNSString(const ObjCInterfaceType *T,
-                                           const char* suffix) {  
+                                           const char* suffix) {
   return !strcmp("String", suffix) || !strcmp("MutableString", suffix);
 }
 
-bool BasicObjCFoundationChecks::AuditNSString(ExplodedNode* N, 
+bool BasicObjCFoundationChecks::AuditNSString(ExplodedNode* N,
                                               const ObjCMessageExpr* ME) {
-  
+
   Selector S = ME->getSelector();
-  
+
   if (S.isUnarySelector())
     return false;
 
   // FIXME: This is going to be really slow doing these checks with
   //  lexical comparisons.
-  
+
   std::string name = S.getAsString();
   assert (!name.empty());
   const char* cstr = &name[0];
   unsigned len = name.size();
-      
+
   switch (len) {
     default:
       break;
-    case 8:      
+    case 8:
       if (!strcmp(cstr, "compare:"))
         return CheckNilArg(N, 0);
-              
+
       break;
-      
+
     case 15:
       // FIXME: Checking for initWithFormat: will not work in most cases
       //  yet because [NSString alloc] returns id, not NSString*.  We will
@@ -194,41 +194,41 @@
       //  to find these errors.
       if (!strcmp(cstr, "initWithFormat:"))
         return CheckNilArg(N, 0);
-      
+
       break;
-    
+
     case 16:
       if (!strcmp(cstr, "compare:options:"))
         return CheckNilArg(N, 0);
-      
+
       break;
-      
+
     case 22:
       if (!strcmp(cstr, "compare:options:range:"))
         return CheckNilArg(N, 0);
-      
+
       break;
-      
+
     case 23:
-      
+
       if (!strcmp(cstr, "caseInsensitiveCompare:"))
         return CheckNilArg(N, 0);
-      
+
       break;
 
     case 29:
       if (!strcmp(cstr, "compare:options:range:locale:"))
         return CheckNilArg(N, 0);
-    
-      break;    
-      
+
+      break;
+
     case 37:
     if (!strcmp(cstr, "componentsSeparatedByCharactersInSet:"))
       return CheckNilArg(N, 0);
-    
-    break;    
+
+    break;
   }
-  
+
   return false;
 }
 
@@ -240,7 +240,7 @@
 
 class VISIBILITY_HIDDEN AuditCFNumberCreate : public GRSimpleAPICheck {
   APIMisuse* BT;
-  
+
   // FIXME: Either this should be refactored into GRSimpleAPICheck, or
   //   it should always be passed with a call to Audit.  The latter
   //   approach makes this class more stateless.
@@ -249,16 +249,16 @@
   BugReporter& BR;
 
 public:
-  AuditCFNumberCreate(ASTContext& ctx, BugReporter& br) 
+  AuditCFNumberCreate(ASTContext& ctx, BugReporter& br)
   : BT(0), Ctx(ctx), II(&Ctx.Idents.get("CFNumberCreate")), BR(br){}
-  
+
   ~AuditCFNumberCreate() {}
-  
+
   bool Audit(ExplodedNode* N, GRStateManager&);
-  
+
 private:
   void AddError(const TypedRegion* R, const Expr* Ex, ExplodedNode *N,
-                uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);  
+                uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);
 };
 } // end anonymous namespace
 
@@ -289,7 +289,7 @@
   public:
     Optional() : IsKnown(false), Val(0) {}
     Optional(const T& val) : IsKnown(true), Val(val) {}
-    
+
     bool isKnown() const { return IsKnown; }
 
     const T& getValue() const {
@@ -305,12 +305,12 @@
 
 static Optional<uint64_t> GetCFNumberSize(ASTContext& Ctx, uint64_t i) {
   static unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 };
-  
+
   if (i < kCFNumberCharType)
     return FixedSize[i-1];
-  
+
   QualType T;
-  
+
   switch (i) {
     case kCFNumberCharType:     T = Ctx.CharTy;     break;
     case kCFNumberShortType:    T = Ctx.ShortTy;    break;
@@ -322,11 +322,11 @@
     case kCFNumberCFIndexType:
     case kCFNumberNSIntegerType:
     case kCFNumberCGFloatType:
-      // FIXME: We need a way to map from names to Type*.      
+      // FIXME: We need a way to map from names to Type*.
     default:
       return Optional<uint64_t>();
   }
-  
+
   return Ctx.getTypeSize(T);
 }
 
@@ -350,72 +350,72 @@
     "kCFNumberNSIntegerType",
     "kCFNumberCGFloatType"
   };
-  
+
   return i <= kCFNumberCGFloatType ? Names[i-1] : "Invalid CFNumberType";
 }
 #endif
 
-bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){  
+bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){
   const CallExpr* CE =
     cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
-  const Expr* Callee = CE->getCallee();  
-  SVal CallV = N->getState()->getSVal(Callee);  
+  const Expr* Callee = CE->getCallee();
+  SVal CallV = N->getState()->getSVal(Callee);
   const FunctionDecl* FD = CallV.getAsFunctionDecl();
 
   if (!FD || FD->getIdentifier() != II || CE->getNumArgs()!=3)
     return false;
-  
+
   // Get the value of the "theType" argument.
   SVal TheTypeVal = N->getState()->getSVal(CE->getArg(1));
-  
+
     // FIXME: We really should allow ranges of valid theType values, and
     //   bifurcate the state appropriately.
   nonloc::ConcreteInt* V = dyn_cast<nonloc::ConcreteInt>(&TheTypeVal);
-  
+
   if (!V)
     return false;
-  
+
   uint64_t NumberKind = V->getValue().getLimitedValue();
   Optional<uint64_t> TargetSize = GetCFNumberSize(Ctx, NumberKind);
-  
+
   // FIXME: In some cases we can emit an error.
   if (!TargetSize.isKnown())
     return false;
-  
+
   // Look at the value of the integer being passed by reference.  Essentially
   // we want to catch cases where the value passed in is not equal to the
   // size of the type being created.
   SVal TheValueExpr = N->getState()->getSVal(CE->getArg(2));
-  
+
   // FIXME: Eventually we should handle arbitrary locations.  We can do this
   //  by having an enhanced memory model that does low-level typing.
   loc::MemRegionVal* LV = dyn_cast<loc::MemRegionVal>(&TheValueExpr);
 
   if (!LV)
     return false;
-  
+
   const TypedRegion* R = dyn_cast<TypedRegion>(LV->getBaseRegion());
 
   if (!R)
     return false;
 
   QualType T = Ctx.getCanonicalType(R->getValueType(Ctx));
-  
+
   // FIXME: If the pointee isn't an integer type, should we flag a warning?
   //  People can do weird stuff with pointers.
-  
-  if (!T->isIntegerType())  
+
+  if (!T->isIntegerType())
     return false;
-  
+
   uint64_t SourceSize = Ctx.getTypeSize(T);
-  
+
   // CHECK: is SourceSize == TargetSize
-  
+
   if (SourceSize == TargetSize)
     return false;
-    
+
   AddError(R, CE->getArg(2), N, SourceSize, TargetSize, NumberKind);
-  
+
   // FIXME: We can actually create an abstract "CFNumber" object that has
   //  the bits initialized to the provided values.
   return SourceSize < TargetSize;
@@ -425,23 +425,23 @@
                                    ExplodedNode *N,
                                    uint64_t SourceSize, uint64_t TargetSize,
                                    uint64_t NumberKind) {
-  
+
   std::string sbuf;
   llvm::raw_string_ostream os(sbuf);
-  
+
   os << (SourceSize == 8 ? "An " : "A ")
      << SourceSize << " bit integer is used to initialize a CFNumber "
         "object that represents "
      << (TargetSize == 8 ? "an " : "a ")
-     << TargetSize << " bit integer. ";        
+     << TargetSize << " bit integer. ";
 
   if (SourceSize < TargetSize)
     os << (TargetSize - SourceSize)
-       << " bits of the CFNumber value will be garbage." ;   
+       << " bits of the CFNumber value will be garbage." ;
   else
     os << (SourceSize - TargetSize)
        << " bits of the input integer will be lost.";
-         
+
   // Lazily create the BugType object.  This will be owned
   // by the BugReporter object 'BR' once we call BR.EmitWarning.
   if (!BT) BT = new APIMisuse("Bad use of CFNumberCreate");
@@ -451,7 +451,7 @@
 }
 
 GRSimpleAPICheck*
-clang::CreateAuditCFNumberCreate(ASTContext& Ctx, BugReporter& BR) {  
+clang::CreateAuditCFNumberCreate(ASTContext& Ctx, BugReporter& BR) {
   return new AuditCFNumberCreate(Ctx, BR);
 }
 
@@ -462,22 +462,22 @@
 namespace {
 class VISIBILITY_HIDDEN AuditCFRetainRelease : public GRSimpleAPICheck {
   APIMisuse *BT;
-  
+
   // FIXME: Either this should be refactored into GRSimpleAPICheck, or
   //   it should always be passed with a call to Audit.  The latter
   //   approach makes this class more stateless.
   ASTContext& Ctx;
   IdentifierInfo *Retain, *Release;
   BugReporter& BR;
-  
+
 public:
-  AuditCFRetainRelease(ASTContext& ctx, BugReporter& br) 
+  AuditCFRetainRelease(ASTContext& ctx, BugReporter& br)
   : BT(0), Ctx(ctx),
     Retain(&Ctx.Idents.get("CFRetain")), Release(&Ctx.Idents.get("CFRelease")),
     BR(br){}
-  
+
   ~AuditCFRetainRelease() {}
-  
+
   bool Audit(ExplodedNode* N, GRStateManager&);
 };
 } // end anonymous namespace
@@ -485,23 +485,23 @@
 
 bool AuditCFRetainRelease::Audit(ExplodedNode* N, GRStateManager&) {
   const CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
-  
+
   // If the CallExpr doesn't have exactly 1 argument just give up checking.
   if (CE->getNumArgs() != 1)
     return false;
-  
+
   // Check if we called CFRetain/CFRelease.
   const GRState* state = N->getState();
   SVal X = state->getSVal(CE->getCallee());
   const FunctionDecl* FD = X.getAsFunctionDecl();
-  
+
   if (!FD)
     return false;
-  
-  const IdentifierInfo *FuncII = FD->getIdentifier();  
+
+  const IdentifierInfo *FuncII = FD->getIdentifier();
   if (!(FuncII == Retain || FuncII == Release))
     return false;
-  
+
   // Finally, check if the argument is NULL.
   // FIXME: We should be able to bifurcate the state here, as a successful
   // check will result in the value not being NULL afterwards.
@@ -511,7 +511,7 @@
   if (state->getStateManager().isEqual(state, CE->getArg(0), 0)) {
     if (!BT)
       BT = new APIMisuse("null passed to CFRetain/CFRelease");
-    
+
     const char *description = (FuncII == Retain)
                             ? "Null pointer argument in call to CFRetain"
                             : "Null pointer argument in call to CFRelease";
@@ -524,10 +524,10 @@
 
   return false;
 }
-    
-    
+
+
 GRSimpleAPICheck*
-clang::CreateAuditCFRetainRelease(ASTContext& Ctx, BugReporter& BR) {  
+clang::CreateAuditCFRetainRelease(ASTContext& Ctx, BugReporter& BR) {
   return new AuditCFRetainRelease(Ctx, BR);
 }
 
@@ -541,8 +541,8 @@
 
   Eng.AddCheck(CreateBasicObjCFoundationChecks(Ctx, BR),
                Stmt::ObjCMessageExprClass);
-  Eng.AddCheck(CreateAuditCFNumberCreate(Ctx, BR), Stmt::CallExprClass);  
+  Eng.AddCheck(CreateAuditCFNumberCreate(Ctx, BR), Stmt::CallExprClass);
   Eng.AddCheck(CreateAuditCFRetainRelease(Ctx, BR), Stmt::CallExprClass);
-  
+
   RegisterNSErrorChecks(BR, Eng, D);
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.h (original)
+++ cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.h Wed Sep  9 10:08:12 2009
@@ -25,24 +25,24 @@
 #define LLVM_CLANG_ANALYSIS_BASICOBJCFOUNDATIONCHECKS
 
 namespace clang {
-  
+
 class GRSimpleAPICheck;
 class ASTContext;
-class GRStateManager;  
+class GRStateManager;
 class BugReporter;
 class GRExprEngine;
-  
+
 GRSimpleAPICheck *CreateBasicObjCFoundationChecks(ASTContext& Ctx,
                                                   BugReporter& BR);
-  
+
 GRSimpleAPICheck *CreateAuditCFNumberCreate(ASTContext& Ctx,
                                             BugReporter& BR);
-  
+
 GRSimpleAPICheck *CreateAuditCFRetainRelease(ASTContext& Ctx,
                                              BugReporter& BR);
-  
+
 void RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng, const Decl &D);
-  
+
 } // end clang namespace
 
 #endif

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Wed Sep  9 10:08:12 2009
@@ -20,10 +20,10 @@
 
 using namespace clang;
 
-typedef llvm::ImmutableMap<const MemRegion*,SVal> BindingsTy;  
+typedef llvm::ImmutableMap<const MemRegion*,SVal> BindingsTy;
 
 namespace {
-  
+
 class VISIBILITY_HIDDEN BasicStoreSubRegionMap : public SubRegionMap {
 public:
   BasicStoreSubRegionMap() {}
@@ -32,13 +32,13 @@
     return true; // Do nothing.  No subregions.
   }
 };
-  
+
 class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
   BindingsTy::Factory VBFactory;
 public:
   BasicStoreManager(GRStateManager& mgr)
     : StoreManager(mgr), VBFactory(mgr.getAllocator()) {}
-  
+
   ~BasicStoreManager() {}
 
   SubRegionMap *getSubRegionMap(const GRState *state) {
@@ -47,7 +47,7 @@
 
   SValuator::CastResult Retrieve(const GRState *state, Loc loc,
                                  QualType T = QualType());
-  
+
   const GRState *InvalidateRegion(const GRState *state, const MemRegion *R,
                                   const Expr *E, unsigned Count);
 
@@ -57,8 +57,8 @@
 
   Store scanForIvars(Stmt *B, const Decl* SelfDecl,
                      const MemRegion *SelfRegion, Store St);
-  
-  Store BindInternal(Store St, Loc loc, SVal V);  
+
+  Store BindInternal(Store St, Loc loc, SVal V);
   Store Remove(Store St, Loc loc);
   Store getInitialStore(const LocationContext *InitLoc);
 
@@ -66,27 +66,27 @@
   virtual Loc getLoc(const VarDecl* VD, const LocationContext *LC) {
     return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
   }
-  
+
   const GRState *BindCompoundLiteral(const GRState *state,
                                      const CompoundLiteralExpr* cl,
                                      SVal val) {
     return state;
   }
-  
+
   SVal getLValueVar(const GRState *state, const VarDecl *VD,
                     const LocationContext *LC);
   SVal getLValueString(const GRState *state, const StringLiteral *S);
   SVal getLValueCompoundLiteral(const GRState *state,
                                 const CompoundLiteralExpr *CL);
   SVal getLValueIvar(const GRState *state, const ObjCIvarDecl* D, SVal Base);
-  SVal getLValueField(const GRState *state, SVal Base, const FieldDecl *D);  
+  SVal getLValueField(const GRState *state, SVal Base, const FieldDecl *D);
   SVal getLValueElement(const GRState *state, QualType elementType,
                         SVal Base, SVal Offset);
 
   /// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
   ///  conversions between arrays and pointers.
   SVal ArrayToPointer(Loc Array) { return Array; }
-    
+
   /// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values.
   ///  It updatees the GRState object in place with the values removed.
   void RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper,
@@ -118,7 +118,7 @@
 private:
   ASTContext& getContext() { return StateMgr.getContext(); }
 };
-    
+
 } // end anonymous namespace
 
 
@@ -131,7 +131,7 @@
   return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
 }
 
-SVal BasicStoreManager::getLValueString(const GRState *state, 
+SVal BasicStoreManager::getLValueString(const GRState *state,
                                         const StringLiteral* S) {
   return ValMgr.makeLoc(MRMgr.getStringRegion(S));
 }
@@ -144,7 +144,7 @@
 SVal BasicStoreManager::getLValueIvar(const GRState *state,
                                       const ObjCIvarDecl* D,
                                       SVal Base) {
-  
+
   if (Base.isUnknownOrUndef())
     return Base;
 
@@ -154,7 +154,7 @@
     const MemRegion *BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
     return ValMgr.makeLoc(MRMgr.getObjCIvarRegion(D, BaseR));
   }
-  
+
   return UnknownVal();
 }
 
@@ -163,10 +163,10 @@
 
   if (Base.isUnknownOrUndef())
     return Base;
-  
-  Loc BaseL = cast<Loc>(Base);  
+
+  Loc BaseL = cast<Loc>(Base);
   const MemRegion* BaseR = 0;
-  
+
   switch(BaseL.getSubKind()) {
     case loc::GotoLabelKind:
       return UndefinedVal();
@@ -174,7 +174,7 @@
     case loc::MemRegionKind:
       BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
       break;
-      
+
     case loc::ConcreteIntKind:
       // While these seem funny, this can happen through casts.
       // FIXME: What we should return is the field offset.  For example,
@@ -186,7 +186,7 @@
       assert ("Unhandled Base.");
       return Base;
   }
-  
+
   return ValMgr.makeLoc(MRMgr.getFieldRegion(D, BaseR));
 }
 
@@ -196,18 +196,18 @@
 
   if (Base.isUnknownOrUndef())
     return Base;
-  
-  Loc BaseL = cast<Loc>(Base);  
+
+  Loc BaseL = cast<Loc>(Base);
   const MemRegion* BaseR = 0;
-  
+
   switch(BaseL.getSubKind()) {
     case loc::GotoLabelKind:
       // Technically we can get here if people do funny things with casts.
       return UndefinedVal();
-      
+
     case loc::MemRegionKind: {
       const MemRegion *R = cast<loc::MemRegionVal>(BaseL).getRegion();
-      
+
       if (isa<ElementRegion>(R)) {
         // int x;
         // char* y = (char*) &x;
@@ -215,12 +215,12 @@
         // y[0] = 'a';
         return Base;
       }
-      
+
       if (isa<TypedRegion>(R) || isa<SymbolicRegion>(R)) {
         BaseR = R;
         break;
       }
-      
+
       break;
     }
 
@@ -230,13 +230,13 @@
       //  add the field offset to the integer value.  That way funny things
       //  like this work properly:  &(((struct foo *) 0xa)->f)
       return Base;
-      
+
     default:
       assert ("Unhandled Base.");
       return Base;
   }
-  
-  if (BaseR) { 
+
+  if (BaseR) {
     return ValMgr.makeLoc(MRMgr.getElementRegion(elementType, UnknownVal(),
                                                  BaseR, getContext()));
   }
@@ -246,38 +246,38 @@
 
 static bool isHigherOrderRawPtr(QualType T, ASTContext &C) {
   bool foundPointer = false;
-  while (1) {  
+  while (1) {
     const PointerType *PT = T->getAs<PointerType>();
     if (!PT) {
       if (!foundPointer)
         return false;
-      
+
       // intptr_t* or intptr_t**, etc?
       if (T->isIntegerType() && C.getTypeSize(T) == C.getTypeSize(C.VoidPtrTy))
         return true;
-      
+
       QualType X = C.getCanonicalType(T).getUnqualifiedType();
       return X == C.VoidTy;
     }
-    
+
     foundPointer = true;
     T = PT->getPointeeType();
-  }  
+  }
 }
- 
+
 SValuator::CastResult BasicStoreManager::Retrieve(const GRState *state,
                                                   Loc loc, QualType T) {
-  
+
   if (isa<UnknownVal>(loc))
     return SValuator::CastResult(state, UnknownVal());
-  
+
   assert(!isa<UndefinedVal>(loc));
-  
+
   switch (loc.getSubKind()) {
 
     case loc::MemRegionKind: {
       const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
-      
+
       if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
         // Just support void**, void***, intptr_t*, intptr_t**, etc., for now.
         // This is needed to handle OSCompareAndSwapPtr() and friends.
@@ -286,45 +286,45 @@
 
         if (!isHigherOrderRawPtr(T, Ctx))
           return SValuator::CastResult(state, UnknownVal());
-        
+
         // FIXME: Should check for element 0.
         // Otherwise, strip the element region.
         R = ER->getSuperRegion();
       }
-      
+
       if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
         return SValuator::CastResult(state, UnknownVal());
-      
+
       BindingsTy B = GetBindings(state->getStore());
       BindingsTy::data_type *Val = B.lookup(R);
-      
+
       if (!Val)
         break;
-      
+
       return CastRetrievedVal(*Val, state, cast<TypedRegion>(R), T);
     }
-      
+
     case loc::ConcreteIntKind:
       // Some clients may call GetSVal with such an option simply because
       // they are doing a quick scan through their Locs (potentially to
       // invalidate their bindings).  Just return Undefined.
       return SValuator::CastResult(state, UndefinedVal());
-      
+
     default:
       assert (false && "Invalid Loc.");
       break;
   }
-  
+
   return SValuator::CastResult(state, UnknownVal());
 }
-  
-Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {    
+
+Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
   if (isa<loc::ConcreteInt>(loc))
     return store;
 
   const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
   ASTContext &C = StateMgr.getContext();
-      
+
   // Special case: handle store of pointer values (Loc) to pointers via
   // a cast to intXX_t*, void*, etc.  This is needed to handle
   // OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier.
@@ -332,20 +332,20 @@
     if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
       // FIXME: Should check for index 0.
       QualType T = ER->getLocationType(C);
-        
+
       if (isHigherOrderRawPtr(T, C))
         R = ER->getSuperRegion();
-    }      
-      
+    }
+
   if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
     return store;
 
   const TypedRegion *TyR = cast<TypedRegion>(R);
-  
+
   // Do not bind to arrays.  We need to explicitly check for this so that
   // we do not encounter any weirdness of trying to load/store from arrays.
   if (TyR->isBoundable() && TyR->getValueType(C)->isArrayType())
-    return store;  
+    return store;
 
   if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&V)) {
     // Only convert 'V' to a location iff the underlying region type
@@ -354,7 +354,7 @@
     // a pointer.  We may wish to flag a type error here if the types
     // are incompatible.  This may also cause lots of breakage
     // elsewhere. Food for thought.
-    if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType(C)))              
+    if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType(C)))
       V = X->getLoc();
   }
 
@@ -368,10 +368,10 @@
   switch (loc.getSubKind()) {
     case loc::MemRegionKind: {
       const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
-      
+
       if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
         return store;
-      
+
       return VBFactory.Remove(GetBindings(store), R).getRoot();
     }
     default:
@@ -384,11 +384,11 @@
 BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
                                       SymbolReaper& SymReaper,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
-{  
+{
   Store store = state.getStore();
   BindingsTy B = GetBindings(store);
   typedef SVal::symbol_iterator symbol_iterator;
-  
+
   // Iterate over the variable bindings.
   for (BindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
     if (const VarRegion *VR = dyn_cast<VarRegion>(I.getKey())) {
@@ -402,20 +402,20 @@
     }
     else
       continue;
-    
+
     // Mark the bindings in the data as live.
     SVal X = I.getData();
     for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)
       SymReaper.markLive(*SI);
   }
-  
+
   // Scan for live variables and live symbols.
   llvm::SmallPtrSet<const MemRegion*, 10> Marked;
-  
+
   while (!RegionRoots.empty()) {
     const MemRegion* MR = RegionRoots.back();
     RegionRoots.pop_back();
-    
+
     while (MR) {
       if (const SymbolicRegion* SymR = dyn_cast<SymbolicRegion>(MR)) {
         SymReaper.markLive(SymR->getSymbol());
@@ -424,17 +424,17 @@
       else if (isa<VarRegion>(MR) || isa<ObjCIvarRegion>(MR)) {
         if (Marked.count(MR))
           break;
-        
-        Marked.insert(MR);        
+
+        Marked.insert(MR);
         SVal X = Retrieve(&state, loc::MemRegionVal(MR)).getSVal();
-    
+
         // FIXME: We need to handle symbols nested in region definitions.
         for (symbol_iterator SI=X.symbol_begin(),SE=X.symbol_end();SI!=SE;++SI)
           SymReaper.markLive(*SI);
-    
+
         if (!isa<loc::MemRegionVal>(X))
           break;
-    
+
         const loc::MemRegionVal& LVD = cast<loc::MemRegionVal>(X);
         RegionRoots.push_back(LVD.getRegion());
         break;
@@ -445,15 +445,15 @@
         break;
     }
   }
-  
-  // Remove dead variable bindings.  
+
+  // Remove dead variable bindings.
   for (BindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
     const MemRegion* R = I.getKey();
-    
+
     if (!Marked.count(R)) {
       store = Remove(store, ValMgr.makeLoc(R));
       SVal X = I.getData();
-      
+
       for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)
         SymReaper.maybeDead(*SI);
     }
@@ -467,10 +467,10 @@
                                       const MemRegion *SelfRegion, Store St) {
   for (Stmt::child_iterator CI=B->child_begin(), CE=B->child_end();
        CI != CE; ++CI) {
-    
+
     if (!*CI)
       continue;
-    
+
     // Check if the statement is an ivar reference.  We only
     // care about self.ivar.
     if (ObjCIvarRefExpr *IV = dyn_cast<ObjCIvarRefExpr>(*CI)) {
@@ -478,8 +478,8 @@
       if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Base)) {
         if (DR->getDecl() == SelfDecl) {
           const MemRegion *IVR = MRMgr.getObjCIvarRegion(IV->getDecl(),
-                                                         SelfRegion);          
-          SVal X = ValMgr.getRegionValueSymbolVal(IVR);          
+                                                         SelfRegion);
+          SVal X = ValMgr.getRegionValueSymbolVal(IVR);
           St = BindInternal(St, ValMgr.makeLoc(IVR), X);
         }
       }
@@ -487,11 +487,11 @@
     else
       St = scanForIvars(*CI, SelfDecl, SelfRegion, St);
   }
-  
+
   return St;
 }
 
-Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) {  
+Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) {
   // The LiveVariables information already has a compilation of all VarDecls
   // used in the function.  Iterate through this set, and "symbolicate"
   // any VarDecl whose value originally comes from outside the function.
@@ -504,7 +504,7 @@
 
     // Handle implicit parameters.
     if (ImplicitParamDecl* PD = dyn_cast<ImplicitParamDecl>(ND)) {
-      const Decl& CD = *InitLoc->getDecl();      
+      const Decl& CD = *InitLoc->getDecl();
       if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(&CD)) {
         if (MD->getSelfDecl() == PD) {
           // FIXME: Just use a symbolic region, and remove ObjCObjectRegion
@@ -512,10 +512,10 @@
           const ObjCObjectRegion *SelfRegion =
             MRMgr.getObjCObjectRegion(MD->getClassInterface(),
                                       MRMgr.getHeapRegion());
-          
+
           St = BindInternal(St, ValMgr.makeLoc(MRMgr.getVarRegion(PD, InitLoc)),
                             ValMgr.makeLoc(SelfRegion));
-          
+
           // Scan the method for ivar references.  While this requires an
           // entire AST scan, the cost should not be high in practice.
           St = scanForIvars(MD->getBody(), PD, SelfRegion, St);
@@ -543,9 +543,9 @@
 Store BasicStoreManager::BindDeclInternal(Store store, const VarDecl* VD,
                                           const LocationContext *LC,
                                           SVal* InitVal) {
-                 
+
   BasicValueFactory& BasicVals = StateMgr.getBasicVals();
-                 
+
   // BasicStore does not model arrays and structs.
   if (VD->getType()->isArrayType() || VD->getType()->isStructureType())
     return store;
@@ -560,14 +560,14 @@
     // Static global variables should not be visited here.
     assert(!(VD->getStorageClass() == VarDecl::Static &&
              VD->isFileVarDecl()));
-    
+
     // Process static variables.
     if (VD->getStorageClass() == VarDecl::Static) {
       // C99: 6.7.8 Initialization
       //  If an object that has static storage duration is not initialized
-      //  explicitly, then: 
-      //   —if it has pointer type, it is initialized to a null pointer; 
-      //   —if it has arithmetic type, it is initialized to (positive or 
+      //  explicitly, then:
+      //   —if it has pointer type, it is initialized to a null pointer;
+      //   —if it has arithmetic type, it is initialized to (positive or
       //     unsigned) zero;
       if (!InitVal) {
         QualType T = VD->getType();
@@ -598,18 +598,18 @@
 
 void BasicStoreManager::print(Store store, llvm::raw_ostream& Out,
                               const char* nl, const char *sep) {
-      
+
   BindingsTy B = GetBindings(store);
   Out << "Variables:" << nl;
-  
+
   bool isFirst = true;
-  
+
   for (BindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) {
     if (isFirst)
       isFirst = false;
     else
       Out << nl;
-    
+
     Out << ' ' << I.getKey() << " : " << I.getData();
   }
 }
@@ -617,7 +617,7 @@
 
 void BasicStoreManager::iterBindings(Store store, BindingsHandler& f) {
   BindingsTy B = GetBindings(store);
-  
+
   for (BindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I)
     f.HandleBinding(*this, store, I.getKey(), I.getData());
 
@@ -634,10 +634,10 @@
                                                    const Expr *E,
                                                    unsigned Count) {
   R = R->getBaseRegion();
-  
+
   if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
       return state;
-      
+
   QualType T = cast<TypedRegion>(R)->getValueType(R->getContext());
   SVal V = ValMgr.getConjuredSymbolVal(E, T, Count);
   return Bind(state, loc::MemRegionVal(R), V);

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicValueFactory.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicValueFactory.cpp Wed Sep  9 10:08:12 2009
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 //  This file defines BasicValueFactory, a class that manages the lifetime
-//  of APSInt objects and symbolic constraints used by GRExprEngine 
+//  of APSInt objects and symbolic constraints used by GRExprEngine
 //  and related classes.
 //
 //===----------------------------------------------------------------------===//
@@ -17,7 +17,7 @@
 
 using namespace clang;
 
-void CompoundValData::Profile(llvm::FoldingSetNodeID& ID, QualType T, 
+void CompoundValData::Profile(llvm::FoldingSetNodeID& ID, QualType T,
                               llvm::ImmutableList<SVal> L) {
   T.Profile(ID);
   ID.AddPointer(L.getInternalPointer());
@@ -40,7 +40,7 @@
     ID.AddPointer( (void*) X.second);
   }
 };
-  
+
 template<> struct FoldingSetTrait<SValPair> {
   static inline void Profile(const SValPair& X, llvm::FoldingSetNodeID& ID) {
     X.first.Profile(ID);
@@ -61,8 +61,8 @@
   // frees an aux. memory allocated to represent very large constants.
   for (APSIntSetTy::iterator I=APSIntSet.begin(), E=APSIntSet.end(); I!=E; ++I)
     I->getValue().~APSInt();
-  
-  delete (PersistentSValsTy*) PersistentSVals;  
+
+  delete (PersistentSValsTy*) PersistentSVals;
   delete (PersistentSValPairsTy*) PersistentSValPairs;
 }
 
@@ -70,16 +70,16 @@
   llvm::FoldingSetNodeID ID;
   void* InsertPos;
   typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
-  
+
   X.Profile(ID);
   FoldNodeTy* P = APSIntSet.FindNodeOrInsertPos(ID, InsertPos);
-  
-  if (!P) {  
+
+  if (!P) {
     P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
     new (P) FoldNodeTy(X);
     APSIntSet.InsertNode(P, InsertPos);
   }
-  
+
   return *P;
 }
 
@@ -92,22 +92,22 @@
 const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
                                            bool isUnsigned) {
   llvm::APSInt V(BitWidth, isUnsigned);
-  V = X;  
+  V = X;
   return getValue(V);
 }
 
 const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) {
-  
+
   unsigned bits = Ctx.getTypeSize(T);
   llvm::APSInt V(bits, T->isUnsignedIntegerType() || Loc::IsLocType(T));
   V = X;
   return getValue(V);
 }
 
-const CompoundValData* 
+const CompoundValData*
 BasicValueFactory::getCompoundValData(QualType T,
                                       llvm::ImmutableList<SVal> Vals) {
-  
+
   llvm::FoldingSetNodeID ID;
   CompoundValData::Profile(ID, T, Vals);
   void* InsertPos;
@@ -129,104 +129,104 @@
   llvm::FoldingSetNodeID ID;
   LazyCompoundValData::Profile(ID, state, region);
   void* InsertPos;
-  
+
   LazyCompoundValData *D =
     LazyCompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos);
-  
+
   if (!D) {
     D = (LazyCompoundValData*) BPAlloc.Allocate<LazyCompoundValData>();
     new (D) LazyCompoundValData(state, region);
     LazyCompoundValDataSet.InsertNode(D, InsertPos);
   }
-  
+
   return D;
 }
 
 const llvm::APSInt*
 BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
                              const llvm::APSInt& V1, const llvm::APSInt& V2) {
-  
+
   switch (Op) {
     default:
       assert (false && "Invalid Opcode.");
-      
+
     case BinaryOperator::Mul:
       return &getValue( V1 * V2 );
-      
+
     case BinaryOperator::Div:
       return &getValue( V1 / V2 );
-      
+
     case BinaryOperator::Rem:
       return &getValue( V1 % V2 );
-      
+
     case BinaryOperator::Add:
       return &getValue( V1 + V2 );
-      
+
     case BinaryOperator::Sub:
       return &getValue( V1 - V2 );
-      
+
     case BinaryOperator::Shl: {
 
       // FIXME: This logic should probably go higher up, where we can
       // test these conditions symbolically.
-      
+
       // FIXME: Expand these checks to include all undefined behavior.
-      
+
       if (V2.isSigned() && V2.isNegative())
         return NULL;
-      
+
       uint64_t Amt = V2.getZExtValue();
-      
+
       if (Amt > V1.getBitWidth())
         return NULL;
-      
+
       return &getValue( V1.operator<<( (unsigned) Amt ));
     }
-      
+
     case BinaryOperator::Shr: {
-      
+
       // FIXME: This logic should probably go higher up, where we can
       // test these conditions symbolically.
-      
+
       // FIXME: Expand these checks to include all undefined behavior.
-      
+
       if (V2.isSigned() && V2.isNegative())
         return NULL;
-      
+
       uint64_t Amt = V2.getZExtValue();
-      
+
       if (Amt > V1.getBitWidth())
         return NULL;
-      
+
       return &getValue( V1.operator>>( (unsigned) Amt ));
     }
-      
+
     case BinaryOperator::LT:
       return &getTruthValue( V1 < V2 );
-      
+
     case BinaryOperator::GT:
       return &getTruthValue( V1 > V2 );
-      
+
     case BinaryOperator::LE:
       return &getTruthValue( V1 <= V2 );
-      
+
     case BinaryOperator::GE:
       return &getTruthValue( V1 >= V2 );
-      
+
     case BinaryOperator::EQ:
       return &getTruthValue( V1 == V2 );
-      
+
     case BinaryOperator::NE:
       return &getTruthValue( V1 != V2 );
-      
+
       // Note: LAnd, LOr, Comma are handled specially by higher-level logic.
-      
+
     case BinaryOperator::And:
       return &getValue( V1 & V2 );
-      
+
     case BinaryOperator::Or:
       return &getValue( V1 | V2 );
-      
+
     case BinaryOperator::Xor:
       return &getValue( V1 ^ V2 );
   }
@@ -235,21 +235,21 @@
 
 const std::pair<SVal, uintptr_t>&
 BasicValueFactory::getPersistentSValWithData(const SVal& V, uintptr_t Data) {
-  
+
   // Lazily create the folding set.
   if (!PersistentSVals) PersistentSVals = new PersistentSValsTy();
-    
+
   llvm::FoldingSetNodeID ID;
   void* InsertPos;
   V.Profile(ID);
   ID.AddPointer((void*) Data);
-  
+
   PersistentSValsTy& Map = *((PersistentSValsTy*) PersistentSVals);
-  
+
   typedef llvm::FoldingSetNodeWrapper<SValData> FoldNodeTy;
   FoldNodeTy* P = Map.FindNodeOrInsertPos(ID, InsertPos);
-  
-  if (!P) {  
+
+  if (!P) {
     P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
     new (P) FoldNodeTy(std::make_pair(V, Data));
     Map.InsertNode(P, InsertPos);
@@ -260,31 +260,31 @@
 
 const std::pair<SVal, SVal>&
 BasicValueFactory::getPersistentSValPair(const SVal& V1, const SVal& V2) {
-  
+
   // Lazily create the folding set.
   if (!PersistentSValPairs) PersistentSValPairs = new PersistentSValPairsTy();
-  
+
   llvm::FoldingSetNodeID ID;
   void* InsertPos;
   V1.Profile(ID);
   V2.Profile(ID);
-  
+
   PersistentSValPairsTy& Map = *((PersistentSValPairsTy*) PersistentSValPairs);
-  
+
   typedef llvm::FoldingSetNodeWrapper<SValPair> FoldNodeTy;
   FoldNodeTy* P = Map.FindNodeOrInsertPos(ID, InsertPos);
-  
-  if (!P) {  
+
+  if (!P) {
     P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
     new (P) FoldNodeTy(std::make_pair(V1, V2));
     Map.InsertNode(P, InsertPos);
   }
-  
+
   return P->getValue();
 }
 
 const SVal* BasicValueFactory::getPersistentSVal(SVal X) {
   return &getPersistentSValWithData(X, 0).first;
-}  
+}
 
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Sep  9 10:08:12 2009
@@ -53,7 +53,7 @@
     return SP->getStmt();
   else if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P))
     return BE->getSrc()->getTerminator();
-  
+
   return 0;
 }
 
@@ -71,7 +71,7 @@
   for (N = GetPredecessorNode(N); N; N = GetPredecessorNode(N))
     if (const Stmt *S = GetStmt(N->getLocation()))
       return S;
-  
+
   return 0;
 }
 
@@ -92,30 +92,30 @@
         default:
           break;
       }
-      
+
       // Some expressions don't have locations.
       if (S->getLocStart().isInvalid())
         continue;
-      
+
       return S;
     }
-  
+
   return 0;
 }
 
 static inline const Stmt*
-GetCurrentOrPreviousStmt(const ExplodedNode* N) {  
+GetCurrentOrPreviousStmt(const ExplodedNode* N) {
   if (const Stmt *S = GetStmt(N->getLocation()))
     return S;
-  
+
   return GetPreviousStmt(N);
 }
-        
+
 static inline const Stmt*
-GetCurrentOrNextStmt(const ExplodedNode* N) {  
+GetCurrentOrNextStmt(const ExplodedNode* N) {
   if (const Stmt *S = GetStmt(N->getLocation()))
     return S;
-          
+
   return GetNextStmt(N);
 }
 
@@ -132,63 +132,62 @@
 public:
   NodeMapClosure(NodeBackMap *m) : M(*m) {}
   ~NodeMapClosure() {}
-  
+
   const ExplodedNode* getOriginalNode(const ExplodedNode* N) {
     NodeBackMap::iterator I = M.find(N);
     return I == M.end() ? 0 : I->second;
   }
 };
-  
+
 class VISIBILITY_HIDDEN PathDiagnosticBuilder : public BugReporterContext {
   BugReport *R;
   PathDiagnosticClient *PDC;
   llvm::OwningPtr<ParentMap> PM;
   NodeMapClosure NMC;
-public:  
+public:
   PathDiagnosticBuilder(GRBugReporter &br,
-                        BugReport *r, NodeBackMap *Backmap, 
+                        BugReport *r, NodeBackMap *Backmap,
                         PathDiagnosticClient *pdc)
     : BugReporterContext(br),
-      R(r), PDC(pdc), NMC(Backmap)
-  {
+      R(r), PDC(pdc), NMC(Backmap) {
     addVisitor(R);
   }
-  
+
   PathDiagnosticLocation ExecutionContinues(const ExplodedNode* N);
-  
+
   PathDiagnosticLocation ExecutionContinues(llvm::raw_string_ostream& os,
                                             const ExplodedNode* N);
-  
+
   ParentMap& getParentMap() {
     if (PM.get() == 0)
       PM.reset(new ParentMap(getCodeDecl().getBody()));
     return *PM.get();
   }
-  
+
   const Stmt *getParent(const Stmt *S) {
     return getParentMap().getParent(S);
   }
-      
+
   virtual NodeMapClosure& getNodeResolver() { return NMC; }
   BugReport& getReport() { return *R; }
 
   PathDiagnosticLocation getEnclosingStmtLocation(const Stmt *S);
-  
+
   PathDiagnosticLocation
   getEnclosingStmtLocation(const PathDiagnosticLocation &L) {
     if (const Stmt *S = L.asStmt())
       return getEnclosingStmtLocation(S);
-    
+
     return L;
   }
-  
+
   PathDiagnosticClient::PathGenerationScheme getGenerationScheme() const {
     return PDC ? PDC->getGenerationScheme() : PathDiagnosticClient::Extensive;
   }
 
   bool supportsLogicalOpControlFlow() const {
     return PDC ? PDC->supportsLogicalOpControlFlow() : true;
-  }  
+  }
 };
 } // end anonymous namespace
 
@@ -197,10 +196,10 @@
   if (const Stmt *S = GetNextStmt(N))
     return PathDiagnosticLocation(S, getSourceManager());
 
-  return FullSourceLoc(N->getLocationContext()->getDecl()->getBodyRBrace(), 
+  return FullSourceLoc(N->getLocationContext()->getDecl()->getBodyRBrace(),
                        getSourceManager());
 }
-  
+
 PathDiagnosticLocation
 PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os,
                                           const ExplodedNode* N) {
@@ -208,9 +207,9 @@
   // Slow, but probably doesn't matter.
   if (os.str().empty())
     os << ' ';
-  
+
   const PathDiagnosticLocation &Loc = ExecutionContinues(N);
-  
+
   if (Loc.asStmt())
     os << "Execution continues on line "
        << getSourceManager().getInstantiationLineNumber(Loc.asLocation())
@@ -219,16 +218,16 @@
     os << "Execution jumps to the end of the "
        << (isa<ObjCMethodDecl>(N->getLocationContext()->getDecl()) ?
              "method" : "function") << '.';
-  
+
   return Loc;
 }
 
 static bool IsNested(const Stmt *S, ParentMap &PM) {
   if (isa<Expr>(S) && PM.isConsumedExpr(cast<Expr>(S)))
     return true;
-  
+
   const Stmt *Parent = PM.getParentIgnoreParens(S);
-  
+
   if (Parent)
     switch (Parent->getStmtClass()) {
       case Stmt::ForStmtClass:
@@ -238,29 +237,29 @@
       default:
         break;
     }
-  
-  return false;  
+
+  return false;
 }
 
 PathDiagnosticLocation
 PathDiagnosticBuilder::getEnclosingStmtLocation(const Stmt *S) {
   assert(S && "Null Stmt* passed to getEnclosingStmtLocation");
-  ParentMap &P = getParentMap(); 
+  ParentMap &P = getParentMap();
   SourceManager &SMgr = getSourceManager();
 
   while (IsNested(S, P)) {
     const Stmt *Parent = P.getParentIgnoreParens(S);
-    
+
     if (!Parent)
       break;
-    
+
     switch (Parent->getStmtClass()) {
       case Stmt::BinaryOperatorClass: {
         const BinaryOperator *B = cast<BinaryOperator>(Parent);
         if (B->isLogicalOp())
           return PathDiagnosticLocation(S, SMgr);
         break;
-      }        
+      }
       case Stmt::CompoundStmtClass:
       case Stmt::StmtExprClass:
         return PathDiagnosticLocation(S, SMgr);
@@ -270,20 +269,20 @@
         if (cast<ChooseExpr>(Parent)->getCond() == S)
           return PathDiagnosticLocation(Parent, SMgr);
         else
-          return PathDiagnosticLocation(S, SMgr);                
+          return PathDiagnosticLocation(S, SMgr);
       case Stmt::ConditionalOperatorClass:
         // For '?', if we are referring to condition, just have the edge point
         // to the entire '?' expression.
         if (cast<ConditionalOperator>(Parent)->getCond() == S)
           return PathDiagnosticLocation(Parent, SMgr);
         else
-          return PathDiagnosticLocation(S, SMgr);        
+          return PathDiagnosticLocation(S, SMgr);
       case Stmt::DoStmtClass:
-          return PathDiagnosticLocation(S, SMgr); 
+          return PathDiagnosticLocation(S, SMgr);
       case Stmt::ForStmtClass:
         if (cast<ForStmt>(Parent)->getBody() == S)
-          return PathDiagnosticLocation(S, SMgr); 
-        break;        
+          return PathDiagnosticLocation(S, SMgr);
+        break;
       case Stmt::IfStmtClass:
         if (cast<IfStmt>(Parent)->getCond() != S)
           return PathDiagnosticLocation(S, SMgr);
@@ -302,7 +301,7 @@
 
     S = Parent;
   }
-  
+
   assert(S && "Cannot have null Stmt for PathDiagnosticLocation");
 
   // Special case: DeclStmts can appear in for statement declarations, in which
@@ -315,8 +314,8 @@
           return PathDiagnosticLocation(Parent, SMgr);
         default:
           break;
-      }      
-    }    
+      }
+    }
   }
   else if (isa<BinaryOperator>(S)) {
     // Special case: the binary operator represents the initialization
@@ -339,84 +338,84 @@
 static const VarDecl*
 GetMostRecentVarDeclBinding(const ExplodedNode* N,
                             GRStateManager& VMgr, SVal X) {
-  
+
   for ( ; N ; N = N->pred_empty() ? 0 : *N->pred_begin()) {
-    
+
     ProgramPoint P = N->getLocation();
-    
+
     if (!isa<PostStmt>(P))
       continue;
-    
+
     const DeclRefExpr* DR = dyn_cast<DeclRefExpr>(cast<PostStmt>(P).getStmt());
-    
+
     if (!DR)
       continue;
-    
+
     SVal Y = N->getState()->getSVal(DR);
-    
+
     if (X != Y)
       continue;
-    
+
     const VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl());
-    
+
     if (!VD)
       continue;
-    
+
     return VD;
   }
-  
+
   return 0;
 }
 
 namespace {
-class VISIBILITY_HIDDEN NotableSymbolHandler 
+class VISIBILITY_HIDDEN NotableSymbolHandler
 : public StoreManager::BindingsHandler {
-  
+
   SymbolRef Sym;
   const GRState* PrevSt;
   const Stmt* S;
   GRStateManager& VMgr;
   const ExplodedNode* Pred;
-  PathDiagnostic& PD; 
+  PathDiagnostic& PD;
   BugReporter& BR;
-  
+
 public:
-  
+
   NotableSymbolHandler(SymbolRef sym, const GRState* prevst, const Stmt* s,
                        GRStateManager& vmgr, const ExplodedNode* pred,
                        PathDiagnostic& pd, BugReporter& br)
   : Sym(sym), PrevSt(prevst), S(s), VMgr(vmgr), Pred(pred), PD(pd), BR(br) {}
-  
+
   bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
                      SVal V) {
-    
+
     SymbolRef ScanSym = V.getAsSymbol();
-    
+
     if (ScanSym != Sym)
       return true;
-    
-    // Check if the previous state has this binding.    
+
+    // Check if the previous state has this binding.
     SVal X = PrevSt->getSVal(loc::MemRegionVal(R));
-    
+
     if (X == V) // Same binding?
       return true;
-    
+
     // Different binding.  Only handle assignments for now.  We don't pull
-    // this check out of the loop because we will eventually handle other 
+    // this check out of the loop because we will eventually handle other
     // cases.
-    
+
     VarDecl *VD = 0;
-    
+
     if (const BinaryOperator* B = dyn_cast<BinaryOperator>(S)) {
       if (!B->isAssignmentOp())
         return true;
-      
+
       // What variable did we assign to?
       DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS()->IgnoreParenCasts());
-      
+
       if (!DR)
         return true;
-      
+
       VD = dyn_cast<VarDecl>(DR->getDecl());
     }
     else if (const DeclStmt* DS = dyn_cast<DeclStmt>(S)) {
@@ -425,28 +424,28 @@
       //  holds by contruction in the CFG.
       VD = dyn_cast<VarDecl>(*DS->decl_begin());
     }
-    
+
     if (!VD)
       return true;
-    
+
     // What is the most recently referenced variable with this binding?
     const VarDecl* MostRecent = GetMostRecentVarDeclBinding(Pred, VMgr, V);
-    
+
     if (!MostRecent)
       return true;
-    
+
     // Create the diagnostic.
     FullSourceLoc L(S->getLocStart(), BR.getSourceManager());
-    
+
     if (Loc::IsLocType(VD->getType())) {
       std::string msg = "'" + std::string(VD->getNameAsString()) +
       "' now aliases '" + MostRecent->getNameAsString() + "'";
-      
+
       PD.push_front(new PathDiagnosticEventPiece(L, msg));
     }
-    
+
     return true;
-  }  
+  }
 };
 }
 
@@ -454,13 +453,13 @@
                                 const Stmt* S,
                                 SymbolRef Sym, BugReporter& BR,
                                 PathDiagnostic& PD) {
-  
+
   const ExplodedNode* Pred = N->pred_empty() ? 0 : *N->pred_begin();
   const GRState* PrevSt = Pred ? Pred->getState() : 0;
-  
+
   if (!PrevSt)
     return;
-  
+
   // Look at the region bindings of the current state that map to the
   // specified symbol.  Are any of them not in the previous state?
   GRStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager();
@@ -471,34 +470,34 @@
 namespace {
 class VISIBILITY_HIDDEN ScanNotableSymbols
 : public StoreManager::BindingsHandler {
-  
+
   llvm::SmallSet<SymbolRef, 10> AlreadyProcessed;
   const ExplodedNode* N;
   const Stmt* S;
   GRBugReporter& BR;
   PathDiagnostic& PD;
-  
+
 public:
   ScanNotableSymbols(const ExplodedNode* n, const Stmt* s,
                      GRBugReporter& br, PathDiagnostic& pd)
   : N(n), S(s), BR(br), PD(pd) {}
-  
+
   bool HandleBinding(StoreManager& SMgr, Store store,
                      const MemRegion* R, SVal V) {
-    
+
     SymbolRef ScanSym = V.getAsSymbol();
-    
+
     if (!ScanSym)
       return true;
-    
+
     if (!BR.isNotable(ScanSym))
       return true;
-    
+
     if (AlreadyProcessed.count(ScanSym))
       return true;
-    
+
     AlreadyProcessed.insert(ScanSym);
-    
+
     HandleNotableSymbol(N, S, ScanSym, BR, PD);
     return true;
   }
@@ -516,54 +515,54 @@
                                           const ExplodedNode *N) {
 
   SourceManager& SMgr = PDB.getSourceManager();
-  const ExplodedNode* NextNode = N->pred_empty() 
+  const ExplodedNode* NextNode = N->pred_empty()
                                         ? NULL : *(N->pred_begin());
   while (NextNode) {
-    N = NextNode;    
+    N = NextNode;
     NextNode = GetPredecessorNode(N);
-    
+
     ProgramPoint P = N->getLocation();
-    
+
     if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P)) {
       CFGBlock* Src = BE->getSrc();
       CFGBlock* Dst = BE->getDst();
       Stmt* T = Src->getTerminator();
-      
+
       if (!T)
         continue;
-      
+
       FullSourceLoc Start(T->getLocStart(), SMgr);
-      
+
       switch (T->getStmtClass()) {
         default:
           break;
-          
+
         case Stmt::GotoStmtClass:
-        case Stmt::IndirectGotoStmtClass: {          
+        case Stmt::IndirectGotoStmtClass: {
           const Stmt* S = GetNextStmt(N);
-          
+
           if (!S)
             continue;
-          
+
           std::string sbuf;
-          llvm::raw_string_ostream os(sbuf);          
+          llvm::raw_string_ostream os(sbuf);
           const PathDiagnosticLocation &End = PDB.getEnclosingStmtLocation(S);
-          
+
           os << "Control jumps to line "
           << End.asLocation().getInstantiationLineNumber();
           PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                            os.str()));
           break;
         }
-          
-        case Stmt::SwitchStmtClass: {          
+
+        case Stmt::SwitchStmtClass: {
           // Figure out what case arm we took.
           std::string sbuf;
           llvm::raw_string_ostream os(sbuf);
-          
+
           if (Stmt* S = Dst->getLabel()) {
             PathDiagnosticLocation End(S, SMgr);
-            
+
             switch (S->getStmtClass()) {
               default:
                 os << "No cases match in the switch statement. "
@@ -574,21 +573,21 @@
                 os << "Control jumps to the 'default' case at line "
                 << End.asLocation().getInstantiationLineNumber();
                 break;
-                
+
               case Stmt::CaseStmtClass: {
-                os << "Control jumps to 'case ";              
-                CaseStmt* Case = cast<CaseStmt>(S);              
+                os << "Control jumps to 'case ";
+                CaseStmt* Case = cast<CaseStmt>(S);
                 Expr* LHS = Case->getLHS()->IgnoreParenCasts();
-                
-                // Determine if it is an enum.              
+
+                // Determine if it is an enum.
                 bool GetRawInt = true;
-                
+
                 if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS)) {
                   // FIXME: Maybe this should be an assertion.  Are there cases
                   // were it is not an EnumConstantDecl?
                   EnumConstantDecl* D =
                   dyn_cast<EnumConstantDecl>(DR->getDecl());
-                  
+
                   if (D) {
                     GetRawInt = false;
                     os << D->getNameAsString();
@@ -608,14 +607,14 @@
           }
           else {
             os << "'Default' branch taken. ";
-            const PathDiagnosticLocation &End = PDB.ExecutionContinues(os, N);            
+            const PathDiagnosticLocation &End = PDB.ExecutionContinues(os, N);
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                              os.str()));
           }
-          
+
           break;
         }
-          
+
         case Stmt::BreakStmtClass:
         case Stmt::ContinueStmtClass: {
           std::string sbuf;
@@ -625,117 +624,117 @@
                                                            os.str()));
           break;
         }
-          
+
           // Determine control-flow for ternary '?'.
         case Stmt::ConditionalOperatorClass: {
           std::string sbuf;
           llvm::raw_string_ostream os(sbuf);
           os << "'?' condition is ";
-          
+
           if (*(Src->succ_begin()+1) == Dst)
             os << "false";
           else
             os << "true";
-          
+
           PathDiagnosticLocation End = PDB.ExecutionContinues(N);
-          
+
           if (const Stmt *S = End.asStmt())
             End = PDB.getEnclosingStmtLocation(S);
-          
+
           PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                            os.str()));
           break;
         }
-          
+
           // Determine control-flow for short-circuited '&&' and '||'.
         case Stmt::BinaryOperatorClass: {
           if (!PDB.supportsLogicalOpControlFlow())
             break;
-          
+
           BinaryOperator *B = cast<BinaryOperator>(T);
           std::string sbuf;
           llvm::raw_string_ostream os(sbuf);
           os << "Left side of '";
-          
+
           if (B->getOpcode() == BinaryOperator::LAnd) {
             os << "&&" << "' is ";
-            
+
             if (*(Src->succ_begin()+1) == Dst) {
               os << "false";
               PathDiagnosticLocation End(B->getLHS(), SMgr);
               PathDiagnosticLocation Start(B->getOperatorLoc(), SMgr);
               PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                                os.str()));
-            }            
+            }
             else {
               os << "true";
               PathDiagnosticLocation Start(B->getLHS(), SMgr);
               PathDiagnosticLocation End = PDB.ExecutionContinues(N);
               PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                                os.str()));
-            }              
+            }
           }
           else {
             assert(B->getOpcode() == BinaryOperator::LOr);
             os << "||" << "' is ";
-            
+
             if (*(Src->succ_begin()+1) == Dst) {
               os << "false";
               PathDiagnosticLocation Start(B->getLHS(), SMgr);
               PathDiagnosticLocation End = PDB.ExecutionContinues(N);
               PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
-                                                               os.str()));              
+                                                               os.str()));
             }
             else {
               os << "true";
               PathDiagnosticLocation End(B->getLHS(), SMgr);
               PathDiagnosticLocation Start(B->getOperatorLoc(), SMgr);
               PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
-                                                               os.str()));                            
+                                                               os.str()));
             }
           }
-          
+
           break;
         }
-          
-        case Stmt::DoStmtClass:  {          
+
+        case Stmt::DoStmtClass:  {
           if (*(Src->succ_begin()) == Dst) {
             std::string sbuf;
             llvm::raw_string_ostream os(sbuf);
-            
+
             os << "Loop condition is true. ";
             PathDiagnosticLocation End = PDB.ExecutionContinues(os, N);
-            
+
             if (const Stmt *S = End.asStmt())
               End = PDB.getEnclosingStmtLocation(S);
-            
+
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                              os.str()));
           }
           else {
             PathDiagnosticLocation End = PDB.ExecutionContinues(N);
-            
+
             if (const Stmt *S = End.asStmt())
               End = PDB.getEnclosingStmtLocation(S);
-            
+
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                               "Loop condition is false.  Exiting loop"));
           }
-          
+
           break;
         }
-          
+
         case Stmt::WhileStmtClass:
-        case Stmt::ForStmtClass: {          
+        case Stmt::ForStmtClass: {
           if (*(Src->succ_begin()+1) == Dst) {
             std::string sbuf;
             llvm::raw_string_ostream os(sbuf);
-            
+
             os << "Loop condition is false. ";
             PathDiagnosticLocation End = PDB.ExecutionContinues(os, N);
             if (const Stmt *S = End.asStmt())
               End = PDB.getEnclosingStmtLocation(S);
-            
+
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                              os.str()));
           }
@@ -743,32 +742,32 @@
             PathDiagnosticLocation End = PDB.ExecutionContinues(N);
             if (const Stmt *S = End.asStmt())
               End = PDB.getEnclosingStmtLocation(S);
-            
+
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                             "Loop condition is true.  Entering loop body"));
           }
-          
+
           break;
         }
-          
+
         case Stmt::IfStmtClass: {
           PathDiagnosticLocation End = PDB.ExecutionContinues(N);
-          
+
           if (const Stmt *S = End.asStmt())
             End = PDB.getEnclosingStmtLocation(S);
-          
+
           if (*(Src->succ_begin()+1) == Dst)
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                         "Taking false branch"));
-          else  
+          else
             PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                          "Taking true branch"));
-          
+
           break;
         }
       }
     }
-    
+
     if (NextNode) {
       for (BugReporterContext::visitor_iterator I = PDB.visitor_begin(),
            E = PDB.visitor_end(); I!=E; ++I) {
@@ -776,15 +775,15 @@
           PD.push_front(p);
       }
     }
-    
-    if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) {      
+
+    if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) {
       // Scan the region bindings, and see if a "notable" symbol has a new
       // lval binding.
       ScanNotableSymbols SNS(N, PS->getStmt(), PDB.getBugReporter(), PD);
       PDB.getStateManager().iterBindings(N->getState(), SNS);
     }
   }
-  
+
   // After constructing the full PathDiagnostic, do a pass over it to compact
   // PathDiagnosticPieces that occur within a macro.
   CompactPathDiagnostic(PD, PDB.getSourceManager());
@@ -796,20 +795,20 @@
 
 static bool IsControlFlowExpr(const Stmt *S) {
   const Expr *E = dyn_cast<Expr>(S);
-  
+
   if (!E)
     return false;
-  
-  E = E->IgnoreParenCasts();  
-  
+
+  E = E->IgnoreParenCasts();
+
   if (isa<ConditionalOperator>(E))
     return true;
-  
+
   if (const BinaryOperator *B = dyn_cast<BinaryOperator>(E))
     if (B->isLogicalOp())
       return true;
-  
-  return false;  
+
+  return false;
 }
 
 namespace {
@@ -818,25 +817,25 @@
 public:
   ContextLocation(const PathDiagnosticLocation &L, bool isdead = false)
     : PathDiagnosticLocation(L), IsDead(isdead) {}
-  
-  void markDead() { IsDead = true; }  
+
+  void markDead() { IsDead = true; }
   bool isDead() const { return IsDead; }
 };
-  
+
 class VISIBILITY_HIDDEN EdgeBuilder {
   std::vector<ContextLocation> CLocs;
   typedef std::vector<ContextLocation>::iterator iterator;
   PathDiagnostic &PD;
   PathDiagnosticBuilder &PDB;
   PathDiagnosticLocation PrevLoc;
-  
+
   bool IsConsumedExpr(const PathDiagnosticLocation &L);
-  
+
   bool containsLocation(const PathDiagnosticLocation &Container,
                         const PathDiagnosticLocation &Containee);
-  
+
   PathDiagnosticLocation getContextLocation(const PathDiagnosticLocation &L);
-  
+
   PathDiagnosticLocation cleanUpLocation(PathDiagnosticLocation L,
                                          bool firstCharOnly = false) {
     if (const Stmt *S = L.asStmt()) {
@@ -864,20 +863,20 @@
             firstCharOnly = true;
             continue;
         }
-        
+
         break;
       }
-      
+
       if (S != Original)
         L = PathDiagnosticLocation(S, L.getManager());
     }
-    
+
     if (firstCharOnly)
       L = PathDiagnosticLocation(L.asLocation());
 
     return L;
   }
-  
+
   void popLocation() {
     if (!CLocs.back().isDead() && CLocs.back().asLocation().isFileID()) {
       // For contexts, we only one the first character as the range.
@@ -885,18 +884,18 @@
     }
     CLocs.pop_back();
   }
-  
-  PathDiagnosticLocation IgnoreParens(const PathDiagnosticLocation &L);  
+
+  PathDiagnosticLocation IgnoreParens(const PathDiagnosticLocation &L);
 
 public:
   EdgeBuilder(PathDiagnostic &pd, PathDiagnosticBuilder &pdb)
     : PD(pd), PDB(pdb) {
-      
+
       // If the PathDiagnostic already has pieces, add the enclosing statement
       // of the first piece as a context as well.
       if (!PD.empty()) {
         PrevLoc = PD.begin()->getLocation();
-        
+
         if (const Stmt *S = PrevLoc.asStmt())
           addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());
       }
@@ -904,7 +903,7 @@
 
   ~EdgeBuilder() {
     while (!CLocs.empty()) popLocation();
-    
+
     // Finally, add an initial edge from the start location of the first
     // statement (if it doesn't already exist).
     // FIXME: Should handle CXXTryStmt if analyser starts supporting C++.
@@ -914,20 +913,20 @@
         SourceLocation Loc = (*CS->body_begin())->getLocStart();
         rawAddEdge(PathDiagnosticLocation(Loc, PDB.getSourceManager()));
       }
-    
+
   }
 
   void addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd = false);
-  
+
   void addEdge(const Stmt *S, bool alwaysAdd = false) {
     addEdge(PathDiagnosticLocation(S, PDB.getSourceManager()), alwaysAdd);
   }
-  
+
   void rawAddEdge(PathDiagnosticLocation NewLoc);
-  
+
   void addContext(const Stmt *S);
   void addExtendedContext(const Stmt *S);
-};  
+};
 } // end anonymous namespace
 
 
@@ -936,10 +935,10 @@
   if (const Stmt *S = L.asStmt()) {
     if (IsControlFlowExpr(S))
       return L;
-    
-    return PDB.getEnclosingStmtLocation(S);    
+
+    return PDB.getEnclosingStmtLocation(S);
   }
-  
+
   return L;
 }
 
@@ -948,10 +947,10 @@
 
   if (Container == Containee)
     return true;
-    
+
   if (Container.asDecl())
     return true;
-  
+
   if (const Stmt *S = Containee.asStmt())
     if (const Stmt *ContainerS = Container.asStmt()) {
       while (S) {
@@ -965,25 +964,25 @@
   // Less accurate: compare using source ranges.
   SourceRange ContainerR = Container.asRange();
   SourceRange ContaineeR = Containee.asRange();
-  
+
   SourceManager &SM = PDB.getSourceManager();
   SourceLocation ContainerRBeg = SM.getInstantiationLoc(ContainerR.getBegin());
   SourceLocation ContainerREnd = SM.getInstantiationLoc(ContainerR.getEnd());
   SourceLocation ContaineeRBeg = SM.getInstantiationLoc(ContaineeR.getBegin());
   SourceLocation ContaineeREnd = SM.getInstantiationLoc(ContaineeR.getEnd());
-  
+
   unsigned ContainerBegLine = SM.getInstantiationLineNumber(ContainerRBeg);
   unsigned ContainerEndLine = SM.getInstantiationLineNumber(ContainerREnd);
   unsigned ContaineeBegLine = SM.getInstantiationLineNumber(ContaineeRBeg);
   unsigned ContaineeEndLine = SM.getInstantiationLineNumber(ContaineeREnd);
-  
+
   assert(ContainerBegLine <= ContainerEndLine);
-  assert(ContaineeBegLine <= ContaineeEndLine);  
-  
+  assert(ContaineeBegLine <= ContaineeEndLine);
+
   return (ContainerBegLine <= ContaineeBegLine &&
           ContainerEndLine >= ContaineeEndLine &&
           (ContainerBegLine != ContaineeBegLine ||
-           SM.getInstantiationColumnNumber(ContainerRBeg) <= 
+           SM.getInstantiationColumnNumber(ContainerRBeg) <=
            SM.getInstantiationColumnNumber(ContaineeRBeg)) &&
           (ContainerEndLine != ContaineeEndLine ||
            SM.getInstantiationColumnNumber(ContainerREnd) >=
@@ -1003,13 +1002,13 @@
     PrevLoc = NewLoc;
     return;
   }
-  
+
   const PathDiagnosticLocation &NewLocClean = cleanUpLocation(NewLoc);
   const PathDiagnosticLocation &PrevLocClean = cleanUpLocation(PrevLoc);
-  
+
   if (NewLocClean.asLocation() == PrevLocClean.asLocation())
     return;
-    
+
   // FIXME: Ignore intra-macro edges for now.
   if (NewLocClean.asLocation().getInstantiationLoc() ==
       PrevLocClean.asLocation().getInstantiationLoc())
@@ -1020,15 +1019,15 @@
 }
 
 void EdgeBuilder::addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd) {
-  
+
   if (!alwaysAdd && NewLoc.asLocation().isMacroID())
     return;
-  
+
   const PathDiagnosticLocation &CLoc = getContextLocation(NewLoc);
 
   while (!CLocs.empty()) {
     ContextLocation &TopContextLoc = CLocs.back();
-    
+
     // Is the top location context the same as the one for the new location?
     if (TopContextLoc == CLoc) {
       if (alwaysAdd) {
@@ -1045,21 +1044,21 @@
     if (containsLocation(TopContextLoc, CLoc)) {
       if (alwaysAdd) {
         rawAddEdge(NewLoc);
-        
+
         if (IsConsumedExpr(CLoc) && !IsControlFlowExpr(CLoc.asStmt())) {
           CLocs.push_back(ContextLocation(CLoc, true));
           return;
         }
       }
-      
+
       CLocs.push_back(CLoc);
-      return;      
+      return;
     }
 
     // Context does not contain the location.  Flush it.
     popLocation();
   }
-  
+
   // If we reach here, there is no enclosing context.  Just add the edge.
   rawAddEdge(NewLoc);
 }
@@ -1067,15 +1066,15 @@
 bool EdgeBuilder::IsConsumedExpr(const PathDiagnosticLocation &L) {
   if (const Expr *X = dyn_cast_or_null<Expr>(L.asStmt()))
     return PDB.getParentMap().isConsumedExpr(X) && !IsControlFlowExpr(X);
-  
+
   return false;
 }
-  
+
 void EdgeBuilder::addExtendedContext(const Stmt *S) {
   if (!S)
     return;
-  
-  const Stmt *Parent = PDB.getParent(S);  
+
+  const Stmt *Parent = PDB.getParent(S);
   while (Parent) {
     if (isa<CompoundStmt>(Parent))
       Parent = PDB.getParent(Parent);
@@ -1092,16 +1091,16 @@
         break;
     }
   }
-  
+
   addContext(S);
 }
-  
+
 void EdgeBuilder::addContext(const Stmt *S) {
   if (!S)
     return;
 
   PathDiagnosticLocation L(S, PDB.getSourceManager());
-  
+
   while (!CLocs.empty()) {
     const PathDiagnosticLocation &TopContextLoc = CLocs.back();
 
@@ -1111,7 +1110,7 @@
 
     if (containsLocation(TopContextLoc, L)) {
       CLocs.push_back(L);
-      return;      
+      return;
     }
 
     // Context does not contain the location.  Flush it.
@@ -1124,11 +1123,11 @@
 static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
                                             PathDiagnosticBuilder &PDB,
                                             const ExplodedNode *N) {
-  
-  
+
+
   EdgeBuilder EB(PD, PDB);
 
-  const ExplodedNode* NextNode = N->pred_empty() 
+  const ExplodedNode* NextNode = N->pred_empty()
                                         ? NULL : *(N->pred_begin());
   while (NextNode) {
     N = NextNode;
@@ -1140,26 +1139,26 @@
       if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
         const CFGBlock &Blk = *BE->getSrc();
         const Stmt *Term = Blk.getTerminator();
-        
+
         // Are we jumping to the head of a loop?  Add a special diagnostic.
         if (const Stmt *Loop = BE->getDst()->getLoopTarget()) {
           PathDiagnosticLocation L(Loop, PDB.getSourceManager());
           const CompoundStmt *CS = NULL;
-          
+
           if (!Term) {
             if (const ForStmt *FS = dyn_cast<ForStmt>(Loop))
               CS = dyn_cast<CompoundStmt>(FS->getBody());
             else if (const WhileStmt *WS = dyn_cast<WhileStmt>(Loop))
-              CS = dyn_cast<CompoundStmt>(WS->getBody());            
+              CS = dyn_cast<CompoundStmt>(WS->getBody());
           }
-          
+
           PathDiagnosticEventPiece *p =
             new PathDiagnosticEventPiece(L,
                                         "Looping back to the head of the loop");
-          
+
           EB.addEdge(p->getLocation(), true);
           PD.push_front(p);
-          
+
           if (CS) {
             PathDiagnosticLocation BL(CS->getRBracLoc(),
                                       PDB.getSourceManager());
@@ -1167,14 +1166,14 @@
             EB.addEdge(BL);
           }
         }
-        
+
         if (Term)
           EB.addContext(Term);
-              
+
         break;
       }
 
-      if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {      
+      if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {
         if (const Stmt* S = BE->getFirstStmt()) {
          if (IsControlFlowExpr(S)) {
            // Add the proper context for '&&', '||', and '?'.
@@ -1187,10 +1186,10 @@
         break;
       }
     } while (0);
-    
+
     if (!NextNode)
       continue;
-    
+
     for (BugReporterContext::visitor_iterator I = PDB.visitor_begin(),
          E = PDB.visitor_end(); I!=E; ++I) {
       if (PathDiagnosticPiece* p = (*I)->VisitNode(N, NextNode, PDB)) {
@@ -1198,9 +1197,9 @@
         EB.addEdge(Loc, true);
         PD.push_front(p);
         if (const Stmt *S = Loc.asStmt())
-          EB.addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());      
+          EB.addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());
       }
-    }  
+    }
   }
 }
 
@@ -1216,46 +1215,46 @@
 BugReport::~BugReport() {}
 RangedBugReport::~RangedBugReport() {}
 
-const Stmt* BugReport::getStmt() const {  
-  ProgramPoint ProgP = EndNode->getLocation();  
+const Stmt* BugReport::getStmt() const {
+  ProgramPoint ProgP = EndNode->getLocation();
   const Stmt *S = NULL;
-  
+
   if (BlockEntrance* BE = dyn_cast<BlockEntrance>(&ProgP)) {
     CFGBlock &Exit = ProgP.getLocationContext()->getCFG()->getExit();
     if (BE->getBlock() == &Exit)
       S = GetPreviousStmt(EndNode);
   }
   if (!S)
-    S = GetStmt(ProgP);  
-  
-  return S;  
+    S = GetStmt(ProgP);
+
+  return S;
 }
 
 PathDiagnosticPiece*
 BugReport::getEndPath(BugReporterContext& BRC,
                       const ExplodedNode* EndPathNode) {
-  
+
   const Stmt* S = getStmt();
-  
+
   if (!S)
     return NULL;
 
   const SourceRange *Beg, *End;
-  getRanges(Beg, End);  
+  getRanges(Beg, End);
   PathDiagnosticLocation L(S, BRC.getSourceManager());
-  
+
   // Only add the statement itself as a range if we didn't specify any
   // special ranges for this report.
   PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription(),
                                                         Beg == End);
-    
+
   for (; Beg != End; ++Beg)
     P->addRange(*Beg);
-  
+
   return P;
 }
 
-void BugReport::getRanges(const SourceRange*& beg, const SourceRange*& end) {  
+void BugReport::getRanges(const SourceRange*& beg, const SourceRange*& end) {
   if (const Expr* E = dyn_cast_or_null<Expr>(getStmt())) {
     R = E->getSourceRange();
     assert(R.isValid());
@@ -1266,7 +1265,7 @@
     beg = end = 0;
 }
 
-SourceLocation BugReport::getLocation() const {  
+SourceLocation BugReport::getLocation() const {
   if (EndNode)
     if (const Stmt* S = GetCurrentOrPreviousStmt(EndNode)) {
       // For member expressions, return the location of the '.' or '->'.
@@ -1325,8 +1324,8 @@
       BugReportEquivClass& EQ = *EI;
       FlushReport(EQ);
     }
-    
-    // Delete the BugType object.  
+
+    // Delete the BugType object.
 
     // FIXME: this will *not* delete the BugReportEquivClasses, since FoldingSet
     // only deletes the buckets, not the nodes themselves.
@@ -1346,9 +1345,9 @@
 MakeReportGraph(const ExplodedGraph* G,
                 const ExplodedNode** NStart,
                 const ExplodedNode** NEnd) {
-  
+
   // Create the trimmed graph.  It will contain the shortest paths from the
-  // error nodes to the root.  In the new graph we should only have one 
+  // error nodes to the root.  In the new graph we should only have one
   // error node unless there are two or more error nodes with the same minimum
   // path length.
   ExplodedGraph* GTrim;
@@ -1356,12 +1355,12 @@
 
   llvm::DenseMap<const void*, const void*> InverseMap;
   llvm::tie(GTrim, NMap) = G->Trim(NStart, NEnd, &InverseMap);
-  
+
   // Create owning pointers for GTrim and NMap just to ensure that they are
   // released when this function exists.
   llvm::OwningPtr<ExplodedGraph> AutoReleaseGTrim(GTrim);
   llvm::OwningPtr<InterExplodedGraphMap> AutoReleaseNMap(NMap);
-  
+
   // Find the (first) error node in the trimmed graph.  We just need to consult
   // the node map (NMap) which maps from nodes in the original graph to nodes
   // in the new graph.
@@ -1376,68 +1375,68 @@
       WS.push(N);
       IndexMap[*I] = NodeIndex;
     }
-  
+
   assert(!WS.empty() && "No error node found in the trimmed graph.");
 
   // Create a new (third!) graph with a single path.  This is the graph
   // that will be returned to the caller.
   ExplodedGraph *GNew = new ExplodedGraph(GTrim->getContext());
-  
+
   // Sometimes the trimmed graph can contain a cycle.  Perform a reverse BFS
   // to the root node, and then construct a new graph that contains only
   // a single path.
   llvm::DenseMap<const void*,unsigned> Visited;
-  
+
   unsigned cnt = 0;
   const ExplodedNode* Root = 0;
-  
+
   while (!WS.empty()) {
     const ExplodedNode* Node = WS.front();
     WS.pop();
-    
+
     if (Visited.find(Node) != Visited.end())
       continue;
-    
+
     Visited[Node] = cnt++;
-    
+
     if (Node->pred_empty()) {
       Root = Node;
       break;
     }
-    
+
     for (ExplodedNode::const_pred_iterator I=Node->pred_begin(),
          E=Node->pred_end(); I!=E; ++I)
       WS.push(*I);
   }
-  
+
   assert(Root);
-  
+
   // Now walk from the root down the BFS path, always taking the successor
   // with the lowest number.
-  ExplodedNode *Last = 0, *First = 0;  
+  ExplodedNode *Last = 0, *First = 0;
   NodeBackMap *BM = new NodeBackMap();
   unsigned NodeIndex = 0;
-  
+
   for ( const ExplodedNode *N = Root ;;) {
     // Lookup the number associated with the current node.
     llvm::DenseMap<const void*,unsigned>::iterator I = Visited.find(N);
     assert(I != Visited.end());
-    
+
     // Create the equivalent node in the new graph with the same state
     // and location.
     ExplodedNode* NewN = GNew->getNode(N->getLocation(), N->getState());
-    
+
     // Store the mapping to the original node.
     llvm::DenseMap<const void*, const void*>::iterator IMitr=InverseMap.find(N);
     assert(IMitr != InverseMap.end() && "No mapping to original node.");
     (*BM)[NewN] = (const ExplodedNode*) IMitr->second;
-    
+
     // Link up the new node with the previous node.
     if (Last)
       NewN->addPredecessor(Last);
-    
+
     Last = NewN;
-    
+
     // Are we at the final node?
     IndexMapTy::iterator IMI =
       IndexMap.find((const ExplodedNode*)(IMitr->second));
@@ -1446,29 +1445,29 @@
       NodeIndex = IMI->second;
       break;
     }
-    
+
     // Find the next successor node.  We choose the node that is marked
     // with the lowest DFS number.
     ExplodedNode::const_succ_iterator SI = N->succ_begin();
     ExplodedNode::const_succ_iterator SE = N->succ_end();
     N = 0;
-    
+
     for (unsigned MinVal = 0; SI != SE; ++SI) {
-      
+
       I = Visited.find(*SI);
-      
+
       if (I == Visited.end())
         continue;
-      
+
       if (!N || I->second < MinVal) {
         N = *SI;
         MinVal = I->second;
       }
     }
-    
+
     assert(N);
   }
-  
+
   assert(First);
 
   return std::make_pair(std::make_pair(GNew, BM),
@@ -1480,23 +1479,23 @@
 static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) {
   typedef std::vector<std::pair<PathDiagnosticMacroPiece*, SourceLocation> >
           MacroStackTy;
-  
+
   typedef std::vector<PathDiagnosticPiece*>
           PiecesTy;
-  
+
   MacroStackTy MacroStack;
   PiecesTy Pieces;
-  
+
   for (PathDiagnostic::iterator I = PD.begin(), E = PD.end(); I!=E; ++I) {
     // Get the location of the PathDiagnosticPiece.
-    const FullSourceLoc Loc = I->getLocation().asLocation();    
-    
+    const FullSourceLoc Loc = I->getLocation().asLocation();
+
     // Determine the instantiation location, which is the location we group
     // related PathDiagnosticPieces.
-    SourceLocation InstantiationLoc = Loc.isMacroID() ? 
+    SourceLocation InstantiationLoc = Loc.isMacroID() ?
                                       SM.getInstantiationLoc(Loc) :
                                       SourceLocation();
-    
+
     if (Loc.isFileID()) {
       MacroStack.clear();
       Pieces.push_back(&*I);
@@ -1504,7 +1503,7 @@
     }
 
     assert(Loc.isMacroID());
-    
+
     // Is the PathDiagnosticPiece within the same macro group?
     if (!MacroStack.empty() && InstantiationLoc == MacroStack.back().second) {
       MacroStack.back().first->push_back(&*I);
@@ -1518,22 +1517,22 @@
     SourceLocation ParentInstantiationLoc = InstantiationLoc.isMacroID() ?
                                           SM.getInstantiationLoc(Loc) :
                                           SourceLocation();
-    
+
     // Walk the entire macro stack.
     while (!MacroStack.empty()) {
       if (InstantiationLoc == MacroStack.back().second) {
         MacroGroup = MacroStack.back().first;
         break;
       }
-      
+
       if (ParentInstantiationLoc == MacroStack.back().second) {
         MacroGroup = MacroStack.back().first;
         break;
       }
-      
+
       MacroStack.pop_back();
     }
-    
+
     if (!MacroGroup || ParentInstantiationLoc == MacroStack.back().second) {
       // Create a new macro group and add it to the stack.
       PathDiagnosticMacroPiece *NewGroup = new PathDiagnosticMacroPiece(Loc);
@@ -1544,7 +1543,7 @@
         assert(InstantiationLoc.isFileID());
         Pieces.push_back(NewGroup);
       }
-      
+
       MacroGroup = NewGroup;
       MacroStack.push_back(std::make_pair(MacroGroup, InstantiationLoc));
     }
@@ -1552,62 +1551,62 @@
     // Finally, add the PathDiagnosticPiece to the group.
     MacroGroup->push_back(&*I);
   }
-  
+
   // Now take the pieces and construct a new PathDiagnostic.
   PD.resetPath(false);
-    
+
   for (PiecesTy::iterator I=Pieces.begin(), E=Pieces.end(); I!=E; ++I) {
     if (PathDiagnosticMacroPiece *MP=dyn_cast<PathDiagnosticMacroPiece>(*I))
       if (!MP->containsEvent()) {
         delete MP;
         continue;
       }
-    
+
     PD.push_back(*I);
   }
 }
 
 void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
                                            BugReportEquivClass& EQ) {
- 
+
   std::vector<const ExplodedNode*> Nodes;
-  
+
   for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I) {
     const ExplodedNode* N = I->getEndNode();
     if (N) Nodes.push_back(N);
   }
-  
+
   if (Nodes.empty())
     return;
-  
+
   // Construct a new graph that contains only a single path from the error
-  // node to a root.  
+  // node to a root.
   const std::pair<std::pair<ExplodedGraph*, NodeBackMap*>,
   std::pair<ExplodedNode*, unsigned> >&
   GPair = MakeReportGraph(&getGraph(), &Nodes[0], &Nodes[0] + Nodes.size());
-  
+
   // Find the BugReport with the original location.
   BugReport *R = 0;
   unsigned i = 0;
   for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I, ++i)
     if (i == GPair.second.second) { R = *I; break; }
-  
+
   assert(R && "No original report found for sliced graph.");
-  
+
   llvm::OwningPtr<ExplodedGraph> ReportGraph(GPair.first.first);
   llvm::OwningPtr<NodeBackMap> BackMap(GPair.first.second);
   const ExplodedNode *N = GPair.second.first;
- 
-  // Start building the path diagnostic... 
+
+  // Start building the path diagnostic...
   PathDiagnosticBuilder PDB(*this, R, BackMap.get(), getPathDiagnosticClient());
-  
+
   if (PathDiagnosticPiece* Piece = R->getEndPath(PDB, N))
     PD.push_back(Piece);
   else
     return;
-  
+
   R->registerInitialVisitors(PDB, N);
-  
+
   switch (PDB.getGenerationScheme()) {
     case PathDiagnosticClient::Extensive:
       GenerateExtensivePathDiagnostic(PD, PDB, N);
@@ -1622,17 +1621,17 @@
   BugTypes = F.Add(BugTypes, BT);
 }
 
-void BugReporter::EmitReport(BugReport* R) {  
+void BugReporter::EmitReport(BugReport* R) {
   // Compute the bug report's hash to determine its equivalence class.
   llvm::FoldingSetNodeID ID;
   R->Profile(ID);
-  
-  // Lookup the equivance class.  If there isn't one, create it.  
+
+  // Lookup the equivance class.  If there isn't one, create it.
   BugType& BT = R->getBugType();
   Register(&BT);
   void *InsertPos;
-  BugReportEquivClass* EQ = BT.EQClasses.FindNodeOrInsertPos(ID, InsertPos);  
-  
+  BugReportEquivClass* EQ = BT.EQClasses.FindNodeOrInsertPos(ID, InsertPos);
+
   if (!EQ) {
     EQ = new BugReportEquivClass(R);
     BT.EQClasses.InsertNode(EQ, InsertPos);
@@ -1645,11 +1644,11 @@
   assert(!EQ.Reports.empty());
   BugReport &R = **EQ.begin();
   PathDiagnosticClient* PD = getPathDiagnosticClient();
-  
+
   // FIXME: Make sure we use the 'R' for the path that was actually used.
-  // Probably doesn't make a difference in practice.  
+  // Probably doesn't make a difference in practice.
   BugType& BT = R.getBugType();
-  
+
   llvm::OwningPtr<PathDiagnostic>
     D(new PathDiagnostic(R.getBugType().getName(),
                          !PD || PD->useVerboseDescription()
@@ -1657,16 +1656,16 @@
                          BT.getCategory()));
 
   GeneratePathDiagnostic(*D.get(), EQ);
-  
+
   // Get the meta data.
   std::pair<const char**, const char**> Meta = R.getExtraDescriptiveText();
   for (const char** s = Meta.first; s != Meta.second; ++s) D->addMeta(*s);
 
   // Emit a summary diagnostic to the regular Diagnostics engine.
   const SourceRange *Beg = 0, *End = 0;
-  R.getRanges(Beg, End);    
+  R.getRanges(Beg, End);
   Diagnostic& Diag = getDiagnostic();
-  FullSourceLoc L(R.getLocation(), getSourceManager());  
+  FullSourceLoc L(R.getLocation(), getSourceManager());
   unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
                                             R.getShortDescription().c_str());
 
@@ -1681,15 +1680,15 @@
   // Emit a full diagnostic for the path if we have a PathDiagnosticClient.
   if (!PD)
     return;
-  
-  if (D->empty()) { 
+
+  if (D->empty()) {
     PathDiagnosticPiece* piece =
       new PathDiagnosticEventPiece(L, R.getDescription());
 
     for ( ; Beg != End; ++Beg) piece->addRange(*Beg);
     D->push_back(piece);
   }
-  
+
   PD->HandlePathDiagnostic(D.take());
 }
 
@@ -1702,7 +1701,7 @@
 void BugReporter::EmitBasicReport(const char* name, const char* category,
                                   const char* str, SourceLocation Loc,
                                   SourceRange* RBeg, unsigned NumRanges) {
-  
+
   // 'BT' will be owned by BugReporter as soon as we call 'EmitReport'.
   BugType *BT = new BugType(name, category);
   FullSourceLoc L = getContext().getFullLoc(Loc);

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

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporterVisitors.cpp Wed Sep  9 10:08:12 2009
@@ -28,7 +28,7 @@
   // Pattern match for a few useful cases (do something smarter later):
   //   a[0], p->f, *p
   const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
-  
+
   if (const UnaryOperator *U = dyn_cast<UnaryOperator>(S)) {
     if (U->getOpcode() == UnaryOperator::Deref)
       return U->getSubExpr()->IgnoreParenCasts();
@@ -41,8 +41,8 @@
     // to reason about them.
     return AE->getBase();
   }
-  
-  return NULL;  
+
+  return NULL;
 }
 
 const Stmt*
@@ -91,19 +91,19 @@
 public:
   FindLastStoreBRVisitor(SVal v, const MemRegion *r)
   : R(r), V(v), satisfied(false), StoreSite(0) {}
-  
+
   PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
                                  const ExplodedNode *PrevN,
                                  BugReporterContext& BRC) {
-    
+
     if (satisfied)
       return NULL;
-    
-    if (!StoreSite) {      
+
+    if (!StoreSite) {
       const ExplodedNode *Node = N, *Last = NULL;
-      
+
       for ( ; Node ; Last = Node, Node = Node->getFirstPred()) {
-        
+
         if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
           if (const PostStmt *P = Node->getLocationAs<PostStmt>())
             if (const DeclStmt *DS = P->getStmtAs<DeclStmt>())
@@ -112,35 +112,35 @@
                 break;
               }
         }
-        
+
         if (Node->getState()->getSVal(R) != V)
           break;
       }
-      
+
       if (!Node || !Last) {
         satisfied = true;
         return NULL;
       }
-      
+
       StoreSite = Last;
     }
-    
+
     if (StoreSite != N)
       return NULL;
-    
+
     satisfied = true;
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
-    
+
     if (const PostStmt *PS = N->getLocationAs<PostStmt>()) {
       if (const DeclStmt *DS = PS->getStmtAs<DeclStmt>()) {
-        
+
         if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
           os << "Variable '" << VR->getDecl()->getNameAsString() << "' ";
         }
         else
           return NULL;
-        
+
         if (isa<loc::ConcreteInt>(V)) {
           bool b = false;
           ASTContext &C = BRC.getASTContext();
@@ -152,7 +152,7 @@
               }
             }
           }
-          
+
           if (!b)
             os << "initialized to a null pointer value";
         }
@@ -165,13 +165,13 @@
             if (VD->getInit())
               os << "initialized to a garbage value";
             else
-              os << "declared without an initial value";              
-          }          
+              os << "declared without an initial value";
+          }
         }
       }
     }
-    
-    if (os.str().empty()) {            
+
+    if (os.str().empty()) {
       if (isa<loc::ConcreteInt>(V)) {
         bool b = false;
         ASTContext &C = BRC.getASTContext();
@@ -183,7 +183,7 @@
             }
           }
         }
-        
+
         if (!b)
           os << "Null pointer value stored to ";
       }
@@ -196,18 +196,18 @@
       }
       else
         return NULL;
-      
+
       if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
         os << '\'' << VR->getDecl()->getNameAsString() << '\'';
       }
       else
         return NULL;
     }
-    
+
     // FIXME: Refactor this into BugReporterContext.
-    const Stmt *S = 0;      
+    const Stmt *S = 0;
     ProgramPoint P = N->getLocation();
-    
+
     if (BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
       CFGBlock *BSrc = BE->getSrc();
       S = BSrc->getTerminatorCondition();
@@ -215,10 +215,10 @@
     else if (PostStmt *PS = dyn_cast<PostStmt>(&P)) {
       S = PS->getStmt();
     }
-    
+
     if (!S)
       return NULL;
-    
+
     // Construct a new PathDiagnosticPiece.
     PathDiagnosticLocation L(S, BRC.getSourceManager());
     return new PathDiagnosticEventPiece(L, os.str());
@@ -238,42 +238,42 @@
 public:
   TrackConstraintBRVisitor(SVal constraint, bool assumption)
   : Constraint(constraint), Assumption(assumption), isSatisfied(false) {}
-  
+
   PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
                                  const ExplodedNode *PrevN,
                                  BugReporterContext& BRC) {
     if (isSatisfied)
       return NULL;
-    
+
     // Check if in the previous state it was feasible for this constraint
     // to *not* be true.
     if (PrevN->getState()->assume(Constraint, !Assumption)) {
-      
+
       isSatisfied = true;
-      
+
       // As a sanity check, make sure that the negation of the constraint
       // was infeasible in the current state.  If it is feasible, we somehow
       // missed the transition point.
       if (N->getState()->assume(Constraint, !Assumption))
         return NULL;
-      
+
       // We found the transition point for the constraint.  We now need to
-      // pretty-print the constraint. (work-in-progress)      
+      // pretty-print the constraint. (work-in-progress)
       std::string sbuf;
       llvm::raw_string_ostream os(sbuf);
-      
+
       if (isa<Loc>(Constraint)) {
         os << "Assuming pointer value is ";
         os << (Assumption ? "non-null" : "null");
       }
-      
+
       if (os.str().empty())
         return NULL;
-      
+
       // FIXME: Refactor this into BugReporterContext.
-      const Stmt *S = 0;      
+      const Stmt *S = 0;
       ProgramPoint P = N->getLocation();
-      
+
       if (BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
         CFGBlock *BSrc = BE->getSrc();
         S = BSrc->getTerminatorCondition();
@@ -281,65 +281,65 @@
       else if (PostStmt *PS = dyn_cast<PostStmt>(&P)) {
         S = PS->getStmt();
       }
-      
+
       if (!S)
         return NULL;
-      
+
       // Construct a new PathDiagnosticPiece.
       PathDiagnosticLocation L(S, BRC.getSourceManager());
       return new PathDiagnosticEventPiece(L, os.str());
     }
-    
+
     return NULL;
-  }  
+  }
 };
 } // end anonymous namespace
 
 static void registerTrackConstraint(BugReporterContext& BRC, SVal Constraint,
                                     bool Assumption) {
-  BRC.addVisitor(new TrackConstraintBRVisitor(Constraint, Assumption));  
+  BRC.addVisitor(new TrackConstraintBRVisitor(Constraint, Assumption));
 }
 
 void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
                                                        const void *data,
                                                        const ExplodedNode* N) {
-  
+
   const Stmt *S = static_cast<const Stmt*>(data);
-  
+
   if (!S)
     return;
-  
+
   GRStateManager &StateMgr = BRC.getStateManager();
-  const GRState *state = N->getState();  
-  
-  if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S)) {        
-    if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {                
+  const GRState *state = N->getState();
+
+  if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S)) {
+    if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
       const VarRegion *R =
       StateMgr.getRegionManager().getVarRegion(VD, N->getLocationContext());
-      
+
       // What did we load?
       SVal V = state->getSVal(S);
-      
-      if (isa<loc::ConcreteInt>(V) || isa<nonloc::ConcreteInt>(V) 
+
+      if (isa<loc::ConcreteInt>(V) || isa<nonloc::ConcreteInt>(V)
           || V.isUndef()) {
         registerFindLastStore(BRC, R, V);
       }
     }
   }
-  
+
   SVal V = state->getSValAsScalarOrLoc(S);
-  
+
   // Uncomment this to find cases where we aren't properly getting the
   // base value that was dereferenced.
   // assert(!V.isUnknownOrUndef());
-  
+
   // Is it a symbolic value?
   if (loc::MemRegionVal *L = dyn_cast<loc::MemRegionVal>(&V)) {
     const SubRegion *R = cast<SubRegion>(L->getRegion());
     while (R && !isa<SymbolicRegion>(R)) {
       R = dyn_cast<SubRegion>(R->getSuperRegion());
     }
-    
+
     if (R) {
       assert(isa<SymbolicRegion>(R));
       registerTrackConstraint(BRC, loc::MemRegionVal(R), false);

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

==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Sep  9 10:08:12 2009
@@ -133,8 +133,8 @@
   CFGBlock *createBlock(bool add_successor = true);
   bool FinishBlock(CFGBlock* B);
   CFGBlock *addStmt(Stmt *S) { return Visit(S, true); }
-  
-  
+
+
   /// TryResult - a class representing a variant over the values
   ///  'true', 'false', or 'unknown'.  This is returned by TryEvaluateBool,
   ///  and is used by the CFGBuilder to decide if a branch condition
@@ -144,7 +144,7 @@
   public:
     TryResult(bool b) : X(b ? 1 : 0) {}
     TryResult() : X(-1) {}
-    
+
     bool isTrue() const { return X == 1; }
     bool isFalse() const { return X == 0; }
     bool isKnown() const { return X >= 0; }
@@ -153,7 +153,7 @@
       X ^= 0x1;
     }
   };
-    
+
   /// TryEvaluateBool - Try and evaluate the Stmt and return 0 or 1
   /// if we can evaluate to a known value, otherwise return -1.
   TryResult TryEvaluateBool(Expr *S) {
@@ -292,109 +292,109 @@
 
     case Stmt::AddrLabelExprClass:
       return VisitAddrLabelExpr(cast<AddrLabelExpr>(S), alwaysAdd);
-      
+
     case Stmt::BinaryOperatorClass:
       return VisitBinaryOperator(cast<BinaryOperator>(S), alwaysAdd);
-      
+
     case Stmt::BlockExprClass:
       return VisitBlockExpr(cast<BlockExpr>(S), alwaysAdd);
 
     case Stmt::BlockDeclRefExprClass:
       return VisitBlockDeclRefExpr(cast<BlockDeclRefExpr>(S), alwaysAdd);
-      
+
     case Stmt::BreakStmtClass:
       return VisitBreakStmt(cast<BreakStmt>(S));
-      
+
     case Stmt::CallExprClass:
       return VisitCallExpr(cast<CallExpr>(S), alwaysAdd);
-      
+
     case Stmt::CaseStmtClass:
       return VisitCaseStmt(cast<CaseStmt>(S));
 
     case Stmt::ChooseExprClass:
       return VisitChooseExpr(cast<ChooseExpr>(S));
-    
+
     case Stmt::CompoundStmtClass:
       return VisitCompoundStmt(cast<CompoundStmt>(S));
-      
+
     case Stmt::ConditionalOperatorClass:
       return VisitConditionalOperator(cast<ConditionalOperator>(S));
-      
+
     case Stmt::ContinueStmtClass:
       return VisitContinueStmt(cast<ContinueStmt>(S));
-    
+
     case Stmt::DeclStmtClass:
       return VisitDeclStmt(cast<DeclStmt>(S));
-      
+
     case Stmt::DefaultStmtClass:
       return VisitDefaultStmt(cast<DefaultStmt>(S));
-      
+
     case Stmt::DoStmtClass:
       return VisitDoStmt(cast<DoStmt>(S));
-      
+
     case Stmt::ForStmtClass:
       return VisitForStmt(cast<ForStmt>(S));
-    
+
     case Stmt::GotoStmtClass:
       return VisitGotoStmt(cast<GotoStmt>(S));
-      
+
     case Stmt::IfStmtClass:
       return VisitIfStmt(cast<IfStmt>(S));
-    
+
     case Stmt::IndirectGotoStmtClass:
       return VisitIndirectGotoStmt(cast<IndirectGotoStmt>(S));
-      
+
     case Stmt::LabelStmtClass:
       return VisitLabelStmt(cast<LabelStmt>(S));
-    
+
     case Stmt::ObjCAtCatchStmtClass:
-      return VisitObjCAtCatchStmt(cast<ObjCAtCatchStmt>(S));   
-      
+      return VisitObjCAtCatchStmt(cast<ObjCAtCatchStmt>(S));
+
   case Stmt::CXXThrowExprClass:
     return VisitCXXThrowExpr(cast<CXXThrowExpr>(S));
 
     case Stmt::ObjCAtSynchronizedStmtClass:
       return VisitObjCAtSynchronizedStmt(cast<ObjCAtSynchronizedStmt>(S));
-      
+
     case Stmt::ObjCAtThrowStmtClass:
       return VisitObjCAtThrowStmt(cast<ObjCAtThrowStmt>(S));
-      
+
     case Stmt::ObjCAtTryStmtClass:
       return VisitObjCAtTryStmt(cast<ObjCAtTryStmt>(S));
-      
+
     case Stmt::ObjCForCollectionStmtClass:
       return VisitObjCForCollectionStmt(cast<ObjCForCollectionStmt>(S));
-            
+
     case Stmt::ParenExprClass:
       S = cast<ParenExpr>(S)->getSubExpr();
-      goto tryAgain;      
-      
+      goto tryAgain;
+
     case Stmt::NullStmtClass:
       return Block;
-      
+
     case Stmt::ReturnStmtClass:
       return VisitReturnStmt(cast<ReturnStmt>(S));
-    
+
     case Stmt::SizeOfAlignOfExprClass:
-      return VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), alwaysAdd);        
-    
+      return VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), alwaysAdd);
+
     case Stmt::StmtExprClass:
       return VisitStmtExpr(cast<StmtExpr>(S), alwaysAdd);
-      
+
     case Stmt::SwitchStmtClass:
       return VisitSwitchStmt(cast<SwitchStmt>(S));
-    
+
     case Stmt::WhileStmtClass:
       return VisitWhileStmt(cast<WhileStmt>(S));
   }
 }
-  
+
 CFGBlock *CFGBuilder::VisitStmt(Stmt *S, bool alwaysAdd) {
   if (alwaysAdd) {
     autoCreateBlock();
     Block->appendStmt(S);
   }
-  
+
   return VisitChildren(S);
 }
 
@@ -407,7 +407,7 @@
   }
   return B;
 }
-  
+
 CFGBlock *CFGBuilder::VisitAddrLabelExpr(AddrLabelExpr *A, bool alwaysAdd) {
   AddressTakenLabels.insert(A->getLabel());
 
@@ -418,26 +418,26 @@
 
   return Block;
 }
-  
+
 CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, bool alwaysAdd) {
   if (B->isLogicalOp()) { // && or ||
     CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
     ConfluenceBlock->appendStmt(B);
-    
+
     if (!FinishBlock(ConfluenceBlock))
       return 0;
-    
+
     // create the block evaluating the LHS
     CFGBlock* LHSBlock = createBlock(false);
     LHSBlock->setTerminator(B);
-    
+
     // create the block evaluating the RHS
     Succ = ConfluenceBlock;
     Block = NULL;
     CFGBlock* RHSBlock = addStmt(B->getRHS());
     if (!FinishBlock(RHSBlock))
       return 0;
-    
+
     // See if this is a known constant.
     TryResult KnownVal = TryEvaluateBool(B->getLHS());
     if (KnownVal.isKnown() && (B->getOpcode() == BinaryOperator::LOr))
@@ -447,23 +447,23 @@
     if (B->getOpcode() == BinaryOperator::LOr) {
       LHSBlock->addSuccessor(KnownVal.isTrue() ? NULL : ConfluenceBlock);
       LHSBlock->addSuccessor(KnownVal.isFalse() ? NULL : RHSBlock);
-    } else {      
+    } else {
       assert (B->getOpcode() == BinaryOperator::LAnd);
       LHSBlock->addSuccessor(KnownVal.isFalse() ? NULL : RHSBlock);
       LHSBlock->addSuccessor(KnownVal.isTrue() ? NULL : ConfluenceBlock);
     }
-    
+
     // Generate the blocks for evaluating the LHS.
     Block = LHSBlock;
     return addStmt(B->getLHS());
-  } 
+  }
   else if (B->getOpcode() == BinaryOperator::Comma) { // ,
     autoCreateBlock();
     Block->appendStmt(B);
     addStmt(B->getRHS());
     return addStmt(B->getLHS());
   }
-  
+
   return VisitStmt(B, alwaysAdd);
 }
 
@@ -477,28 +477,28 @@
   // FIXME
   return NYS();
 }
-  
+
 CFGBlock *CFGBuilder::VisitBreakStmt(BreakStmt *B) {
   // "break" is a control-flow statement.  Thus we stop processing the current
   // block.
   if (Block && !FinishBlock(Block))
       return 0;
-  
+
   // Now create a new block that ends with the break statement.
   Block = createBlock(false);
   Block->setTerminator(B);
-  
+
   // If there is no target for the break, then we are looking at an incomplete
   // AST.  This means that the CFG cannot be constructed.
   if (BreakTargetBlock)
     Block->addSuccessor(BreakTargetBlock);
   else
     badCFG = true;
-  
-  
+
+
   return Block;
 }
-  
+
 CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, bool alwaysAdd) {
   // If this is a call to a no-return function, this stops the block here.
   bool NoReturn = false;
@@ -512,17 +512,17 @@
 
   if (!NoReturn)
     return VisitStmt(C, alwaysAdd);
-    
+
   if (Block && !FinishBlock(Block))
     return 0;
-    
+
   // Create new block with no successor for the remaining pieces.
   Block = createBlock(false);
   Block->appendStmt(C);
 
   // Wire this to the exit block directly.
   Block->addSuccessor(&cfg->getExit());
-  
+
   return VisitChildren(C);
 }
 
@@ -531,42 +531,42 @@
   ConfluenceBlock->appendStmt(C);
   if (!FinishBlock(ConfluenceBlock))
     return 0;
-  
+
   Succ = ConfluenceBlock;
   Block = NULL;
   CFGBlock* LHSBlock = addStmt(C->getLHS());
   if (!FinishBlock(LHSBlock))
     return 0;
-  
+
   Succ = ConfluenceBlock;
   Block = NULL;
   CFGBlock* RHSBlock = addStmt(C->getRHS());
   if (!FinishBlock(RHSBlock))
     return 0;
-  
+
   Block = createBlock(false);
   // See if this is a known constant.
   const TryResult& KnownVal = TryEvaluateBool(C->getCond());
   Block->addSuccessor(KnownVal.isFalse() ? NULL : LHSBlock);
   Block->addSuccessor(KnownVal.isTrue() ? NULL : RHSBlock);
   Block->setTerminator(C);
-  return addStmt(C->getCond());  
+  return addStmt(C->getCond());
 }
-  
-  
-CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {  
-  CFGBlock* LastBlock = Block;  
+
+
+CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
+  CFGBlock* LastBlock = Block;
 
   for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
        I != E; ++I ) {
     LastBlock = addStmt(*I);
-    
+
     if (badCFG)
       return NULL;
-  }  
+  }
   return LastBlock;
 }
-  
+
 CFGBlock *CFGBuilder::VisitConditionalOperator(ConditionalOperator *C) {
   // Create the confluence block that will "merge" the results of the ternary
   // expression.
@@ -574,7 +574,7 @@
   ConfluenceBlock->appendStmt(C);
   if (!FinishBlock(ConfluenceBlock))
     return 0;
-  
+
   // Create a block for the LHS expression if there is an LHS expression.  A
   // GCC extension allows LHS to be NULL, causing the condition to be the
   // value that is returned instead.
@@ -588,16 +588,16 @@
       return 0;
     Block = NULL;
   }
-  
+
   // Create the block for the RHS expression.
   Succ = ConfluenceBlock;
   CFGBlock* RHSBlock = addStmt(C->getRHS());
   if (!FinishBlock(RHSBlock))
     return 0;
-  
+
   // Create the block that will contain the condition.
   Block = createBlock(false);
-  
+
   // See if this is a known constant.
   const TryResult& KnownVal = TryEvaluateBool(C->getCond());
   if (LHSBlock) {
@@ -622,8 +622,8 @@
                    ConfluenceBlock->pred_end());
     }
   }
-  
-  Block->addSuccessor(KnownVal.isTrue() ? NULL : RHSBlock);  
+
+  Block->addSuccessor(KnownVal.isTrue() ? NULL : RHSBlock);
   Block->setTerminator(C);
   return addStmt(C->getCond());
 }
@@ -635,45 +635,45 @@
     Block->appendStmt(DS);
     return VisitDeclSubExpr(DS->getSingleDecl());
   }
-  
+
   CFGBlock *B = 0;
-  
+
   // FIXME: Add a reverse iterator for DeclStmt to avoid this extra copy.
   typedef llvm::SmallVector<Decl*,10> BufTy;
   BufTy Buf(DS->decl_begin(), DS->decl_end());
-  
+
   for (BufTy::reverse_iterator I = Buf.rbegin(), E = Buf.rend(); I != E; ++I) {
     // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
     unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8
                ? 8 : llvm::AlignOf<DeclStmt>::Alignment;
-    
+
     // Allocate the DeclStmt using the BumpPtrAllocator.  It will get
     // automatically freed with the CFG.
     DeclGroupRef DG(*I);
     Decl *D = *I;
-    void *Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);    
+    void *Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
     DeclStmt *DSNew = new (Mem) DeclStmt(DG, D->getLocation(), GetEndLoc(D));
-    
+
     // Append the fake DeclStmt to block.
     Block->appendStmt(DSNew);
     B = VisitDeclSubExpr(D);
   }
-  
-  return B;  
+
+  return B;
 }
-  
+
 /// VisitDeclSubExpr - Utility method to add block-level expressions for
 ///  initializers in Decls.
 CFGBlock *CFGBuilder::VisitDeclSubExpr(Decl* D) {
   assert(Block);
 
   VarDecl *VD = dyn_cast<VarDecl>(D);
-  
+
   if (!VD)
     return Block;
-  
+
   Expr *Init = VD->getInit();
-  
+
   if (Init) {
     // Optimization: Don't create separate block-level statements for literals.
     switch (Init->getStmtClass()) {
@@ -685,12 +685,12 @@
         Block = addStmt(Init);
     }
   }
-  
+
   // If the type of VD is a VLA, then we must process its size expressions.
   for (VariableArrayType* VA = FindVA(VD->getType().getTypePtr()); VA != 0;
        VA = FindVA(VA->getElementType().getTypePtr()))
     Block = addStmt(VA->getSizeExpr());
-  
+
   return Block;
 }
 
@@ -879,7 +879,7 @@
 
   // See if this is a known constant.
   TryResult KnownVal(true);
-  
+
   if (F->getCond())
     KnownVal = TryEvaluateBool(F->getCond());
 
@@ -1171,8 +1171,8 @@
   Succ = EntryConditionBlock;
   return EntryConditionBlock;
 }
-  
-  
+
+
 CFGBlock *CFGBuilder::VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) {
   // FIXME: For now we pretend that @catch and the code it contains does not
   //  exit.
@@ -1329,7 +1329,7 @@
 
   return Block;
 }
-  
+
 CFGBlock *CFGBuilder::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E,
                                              bool alwaysAdd) {
 
@@ -1337,17 +1337,17 @@
     autoCreateBlock();
     Block->appendStmt(E);
   }
-  
+
   // VLA types have expressions that must be evaluated.
   if (E->isArgumentType()) {
     for (VariableArrayType* VA = FindVA(E->getArgumentType().getTypePtr());
          VA != 0; VA = FindVA(VA->getElementType().getTypePtr()))
       addStmt(VA->getSizeExpr());
   }
-  
+
   return Block;
 }
-  
+
 /// VisitStmtExpr - Utility method to handle (nested) statement
 ///  expressions (a GCC extension).
 CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, bool alwaysAdd) {
@@ -1416,7 +1416,7 @@
 
   if (CS->getSubStmt())
     addStmt(CS->getSubStmt());
-  
+
   CFGBlock* CaseBlock = Block;
   if (!CaseBlock)
     CaseBlock = createBlock();
@@ -1445,7 +1445,7 @@
 CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* Terminator) {
   if (Terminator->getSubStmt())
     addStmt(Terminator->getSubStmt());
-  
+
   DefaultCaseBlock = Block;
 
   if (!DefaultCaseBlock)
@@ -1454,7 +1454,7 @@
   // Default statements partition blocks, so this is the top of the basic block
   // we were processing (the "default:" is the label).
   DefaultCaseBlock->setLabel(Terminator);
-  
+
   if (!FinishBlock(DefaultCaseBlock))
     return 0;
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Wed Sep  9 10:08:12 2009
@@ -22,7 +22,7 @@
 #include "clang/Analysis/PathSensitive/BugReporter.h"
 #include "clang/Analysis/PathSensitive/SymbolManager.h"
 #include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
-#include "clang/AST/DeclObjC.h"   
+#include "clang/AST/DeclObjC.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableMap.h"
@@ -44,7 +44,7 @@
 //     MemoryMgmt/Tasks/MemoryManagementRules.html
 //
 // "You take ownership of an object if you create it using a method whose name
-//  begins with "alloc" or "new" or contains "copy" (for example, alloc, 
+//  begins with "alloc" or "new" or contains "copy" (for example, alloc,
 //  newObject, or mutableCopy), or if you send it a retain message. You are
 //  responsible for relinquishing ownership of objects you own using release
 //  or autorelease. Any other time you receive an object, you must
@@ -62,8 +62,8 @@
       || (isupper(prev) && isupper(ch) && islower(next)) // XXCreate
       || !isalpha(ch);
 }
-  
-static inline const char* parseWord(const char* s) {  
+
+static inline const char* parseWord(const char* s) {
   char ch = *s, prev = '\0';
   assert(ch != '\0');
   char next = *(s+1);
@@ -77,18 +77,18 @@
 
 static NamingConvention deriveNamingConvention(Selector S) {
   IdentifierInfo *II = S.getIdentifierInfoForSlot(0);
-  
+
   if (!II)
     return NoConvention;
-  
+
   const char *s = II->getName();
-  
+
   // A method/function name may contain a prefix.  We don't know it is there,
   // however, until we encounter the first '_'.
   bool InPossiblePrefix = true;
   bool AtBeginning = true;
   NamingConvention C = NoConvention;
-  
+
   while (*s != '\0') {
     // Skip '_'.
     if (*s == '_') {
@@ -103,24 +103,24 @@
       ++s;
       continue;
     }
-    
+
     // Skip numbers, ':', etc.
     if (!isalpha(*s)) {
       ++s;
       continue;
     }
-    
+
     const char *wordEnd = parseWord(s);
     assert(wordEnd > s);
     unsigned len = wordEnd - s;
-    
+
     switch (len) {
     default:
       break;
     case 3:
       // Methods starting with 'new' follow the create rule.
       if (AtBeginning && StringsEqualNoCase("new", s, len))
-        C = CreateRule;      
+        C = CreateRule;
       break;
     case 4:
       // Methods starting with 'alloc' or contain 'copy' follow the
@@ -136,7 +136,7 @@
         C = CreateRule;
       break;
     }
-    
+
     // If we aren't in the prefix and have a derived convention then just
     // return it now.
     if (!InPossiblePrefix && C != NoConvention)
@@ -156,10 +156,10 @@
 }
 
 static const ObjCMethodDecl*
-ResolveToInterfaceMethodDecl(const ObjCMethodDecl *MD) {  
+ResolveToInterfaceMethodDecl(const ObjCMethodDecl *MD) {
   ObjCInterfaceDecl *ID =
     const_cast<ObjCInterfaceDecl*>(MD->getClassInterface());
-  
+
   return MD->isInstanceMethod()
          ? ID->lookupInstanceMethod(MD->getSelector())
          : ID->lookupClassMethod(MD->getSelector());
@@ -178,12 +178,12 @@
 
   GenericNodeBuilder(GREndPathNodeBuilder &enb)
   : SNB(0), S(0), tag(0), ENB(&enb) {}
-  
+
   ExplodedNode *MakeNode(const GRState *state, ExplodedNode *Pred) {
     if (SNB)
-      return SNB->generateNode(PostStmt(S, Pred->getLocationContext(), tag), 
+      return SNB->generateNode(PostStmt(S, Pred->getLocationContext(), tag),
                                state, Pred);
-    
+
     assert(ENB);
     return ENB->generateNode(state, Pred);
   }
@@ -211,16 +211,16 @@
 static bool hasPrefix(const char* s, const char* prefix) {
   if (!prefix)
     return true;
-  
+
   char c = *s;
   char cP = *prefix;
-  
+
   while (c != '\0' && cP != '\0') {
     if (c != cP) break;
     c = *(++s);
     cP = *(++prefix);
   }
-  
+
   return cP == '\0';
 }
 
@@ -231,14 +231,14 @@
 
 static bool isRefType(QualType RetTy, const char* prefix,
                       ASTContext* Ctx = 0, const char* name = 0) {
-  
+
   // Recursively walk the typedef stack, allowing typedefs of reference types.
   while (1) {
     if (TypedefType* TD = dyn_cast<TypedefType>(RetTy.getTypePtr())) {
       const char* TDName = TD->getDecl()->getIdentifier()->getName();
       if (hasPrefix(TDName, prefix) && hasSuffix(TDName, "Ref"))
         return true;
-      
+
       RetTy = TD->getDecl()->getUnderlyingType();
       continue;
     }
@@ -282,14 +282,14 @@
 namespace {
 
 ///  RetEffect is used to summarize a function/method call's behavior with
-///  respect to its return value.  
+///  respect to its return value.
 class VISIBILITY_HIDDEN RetEffect {
 public:
   enum Kind { NoRet, Alias, OwnedSymbol, OwnedAllocatedSymbol,
               NotOwnedSymbol, GCNotOwnedSymbol, ReceiverAlias,
               OwnedWhenTrackedReceiver };
-    
-  enum ObjKind { CF, ObjC, AnyObj };  
+
+  enum ObjKind { CF, ObjC, AnyObj };
 
 private:
   Kind K;
@@ -298,124 +298,124 @@
 
   RetEffect(Kind k, unsigned idx = 0) : K(k), O(AnyObj), index(idx) {}
   RetEffect(Kind k, ObjKind o) : K(k), O(o), index(0) {}
-  
+
 public:
   Kind getKind() const { return K; }
 
   ObjKind getObjKind() const { return O; }
-  
-  unsigned getIndex() const { 
+
+  unsigned getIndex() const {
     assert(getKind() == Alias);
     return index;
   }
-  
+
   bool isOwned() const {
     return K == OwnedSymbol || K == OwnedAllocatedSymbol ||
            K == OwnedWhenTrackedReceiver;
   }
-    
+
   static RetEffect MakeOwnedWhenTrackedReceiver() {
     return RetEffect(OwnedWhenTrackedReceiver, ObjC);
   }
-  
+
   static RetEffect MakeAlias(unsigned Idx) {
     return RetEffect(Alias, Idx);
   }
   static RetEffect MakeReceiverAlias() {
     return RetEffect(ReceiverAlias);
-  }  
+  }
   static RetEffect MakeOwned(ObjKind o, bool isAllocated = false) {
     return RetEffect(isAllocated ? OwnedAllocatedSymbol : OwnedSymbol, o);
-  }  
+  }
   static RetEffect MakeNotOwned(ObjKind o) {
     return RetEffect(NotOwnedSymbol, o);
   }
   static RetEffect MakeGCNotOwned() {
     return RetEffect(GCNotOwnedSymbol, ObjC);
   }
-    
+
   static RetEffect MakeNoRet() {
     return RetEffect(NoRet);
   }
-  
+
   void Profile(llvm::FoldingSetNodeID& ID) const {
     ID.AddInteger((unsigned)K);
     ID.AddInteger((unsigned)O);
     ID.AddInteger(index);
   }
 };
-  
-  
+
+
 class VISIBILITY_HIDDEN RetainSummary {
   /// Args - an ordered vector of (index, ArgEffect) pairs, where index
   ///  specifies the argument (starting from 0).  This can be sparsely
   ///  populated; arguments with no entry in Args use 'DefaultArgEffect'.
   ArgEffects Args;
-  
+
   /// DefaultArgEffect - The default ArgEffect to apply to arguments that
   ///  do not have an entry in Args.
   ArgEffect   DefaultArgEffect;
-  
+
   /// Receiver - If this summary applies to an Objective-C message expression,
   ///  this is the effect applied to the state of the receiver.
   ArgEffect   Receiver;
-  
+
   /// Ret - The effect on the return value.  Used to indicate if the
   ///  function/method call returns a new tracked symbol, returns an
   ///  alias of one of the arguments in the call, and so on.
   RetEffect   Ret;
-  
+
   /// EndPath - Indicates that execution of this method/function should
   ///  terminate the simulation of a path.
   bool EndPath;
-  
+
 public:
   RetainSummary(ArgEffects A, RetEffect R, ArgEffect defaultEff,
                 ArgEffect ReceiverEff, bool endpath = false)
     : Args(A), DefaultArgEffect(defaultEff), Receiver(ReceiverEff), Ret(R),
-      EndPath(endpath) {}  
-  
+      EndPath(endpath) {}
+
   /// getArg - Return the argument effect on the argument specified by
   ///  idx (starting from 0).
   ArgEffect getArg(unsigned idx) const {
     if (const ArgEffect *AE = Args.lookup(idx))
       return *AE;
-    
+
     return DefaultArgEffect;
   }
-  
+
   /// setDefaultArgEffect - Set the default argument effect.
   void setDefaultArgEffect(ArgEffect E) {
     DefaultArgEffect = E;
   }
-  
+
   /// setArg - Set the argument effect on the argument specified by idx.
   void setArgEffect(ArgEffects::Factory& AF, unsigned idx, ArgEffect E) {
     Args = AF.Add(Args, idx, E);
   }
-  
+
   /// getRetEffect - Returns the effect on the return value of the call.
   RetEffect getRetEffect() const { return Ret; }
-  
+
   /// setRetEffect - Set the effect of the return value of the call.
   void setRetEffect(RetEffect E) { Ret = E; }
-  
+
   /// isEndPath - Returns true if executing the given method/function should
   ///  terminate the path.
   bool isEndPath() const { return EndPath; }
-  
+
   /// getReceiverEffect - Returns the effect on the receiver of the call.
   ///  This is only meaningful if the summary applies to an ObjCMessageExpr*.
   ArgEffect getReceiverEffect() const { return Receiver; }
-  
+
   /// setReceiverEffect - Set the effect on the receiver of the call.
   void setReceiverEffect(ArgEffect E) { Receiver = E; }
-  
+
   typedef ArgEffects::iterator ExprIterator;
-  
+
   ExprIterator begin_args() const { return Args.begin(); }
   ExprIterator end_args()   const { return Args.end(); }
-  
+
   static void Profile(llvm::FoldingSetNodeID& ID, ArgEffects A,
                       RetEffect RetEff, ArgEffect DefaultEff,
                       ArgEffect ReceiverEff, bool EndPath) {
@@ -425,7 +425,7 @@
     ID.AddInteger((unsigned) ReceiverEff);
     ID.AddInteger((unsigned) EndPath);
   }
-      
+
   void Profile(llvm::FoldingSetNodeID& ID) const {
     Profile(ID, Args, Ret, DefaultArgEffect, Receiver, EndPath);
   }
@@ -440,7 +440,7 @@
 class VISIBILITY_HIDDEN ObjCSummaryKey {
   IdentifierInfo* II;
   Selector S;
-public:    
+public:
   ObjCSummaryKey(IdentifierInfo* ii, Selector s)
     : II(ii), S(s) {}
 
@@ -449,10 +449,10 @@
 
   ObjCSummaryKey(const ObjCInterfaceDecl* d, IdentifierInfo *ii, Selector s)
     : II(d ? d->getIdentifier() : ii), S(s) {}
-  
+
   ObjCSummaryKey(Selector s)
     : II(0), S(s) {}
-  
+
   IdentifierInfo* getIdentifier() const { return II; }
   Selector getSelector() const { return S; }
 };
@@ -464,56 +464,56 @@
     return ObjCSummaryKey(DenseMapInfo<IdentifierInfo*>::getEmptyKey(),
                           DenseMapInfo<Selector>::getEmptyKey());
   }
-    
+
   static inline ObjCSummaryKey getTombstoneKey() {
     return ObjCSummaryKey(DenseMapInfo<IdentifierInfo*>::getTombstoneKey(),
-                          DenseMapInfo<Selector>::getTombstoneKey());      
+                          DenseMapInfo<Selector>::getTombstoneKey());
   }
-  
+
   static unsigned getHashValue(const ObjCSummaryKey &V) {
     return (DenseMapInfo<IdentifierInfo*>::getHashValue(V.getIdentifier())
-            & 0x88888888) 
+            & 0x88888888)
         | (DenseMapInfo<Selector>::getHashValue(V.getSelector())
             & 0x55555555);
   }
-  
+
   static bool isEqual(const ObjCSummaryKey& LHS, const ObjCSummaryKey& RHS) {
     return DenseMapInfo<IdentifierInfo*>::isEqual(LHS.getIdentifier(),
                                                   RHS.getIdentifier()) &&
            DenseMapInfo<Selector>::isEqual(LHS.getSelector(),
                                            RHS.getSelector());
   }
-  
+
   static bool isPod() {
     return DenseMapInfo<ObjCInterfaceDecl*>::isPod() &&
            DenseMapInfo<Selector>::isPod();
   }
 };
 } // end llvm namespace
-  
+
 namespace {
 class VISIBILITY_HIDDEN ObjCSummaryCache {
   typedef llvm::DenseMap<ObjCSummaryKey, RetainSummary*> MapTy;
   MapTy M;
 public:
   ObjCSummaryCache() {}
-    
+
   RetainSummary* find(const ObjCInterfaceDecl* D, IdentifierInfo *ClsName,
                 Selector S) {
     // Lookup the method using the decl for the class @interface.  If we
     // have no decl, lookup using the class name.
     return D ? find(D, S) : find(ClsName, S);
   }
-  
-  RetainSummary* find(const ObjCInterfaceDecl* D, Selector S) {    
+
+  RetainSummary* find(const ObjCInterfaceDecl* D, Selector S) {
     // Do a lookup with the (D,S) pair.  If we find a match return
     // the iterator.
     ObjCSummaryKey K(D, S);
     MapTy::iterator I = M.find(K);
-    
+
     if (I != M.end() || !D)
       return I->second;
-    
+
     // Walk the super chain.  If we find a hit with a parent, we'll end
     // up returning that summary.  We actually allow that key (null,S), as
     // we cache summaries for the null ObjCInterfaceDecl* to allow us to
@@ -523,62 +523,62 @@
     for (ObjCInterfaceDecl* C=D->getSuperClass() ;; C=C->getSuperClass()) {
       if ((I = M.find(ObjCSummaryKey(C, S))) != M.end())
         break;
-      
+
       if (!C)
         return NULL;
     }
-    
-    // Cache the summary with original key to make the next lookup faster 
+
+    // Cache the summary with original key to make the next lookup faster
     // and return the iterator.
     RetainSummary *Summ = I->second;
     M[K] = Summ;
     return Summ;
   }
-  
+
 
   RetainSummary* find(Expr* Receiver, Selector S) {
     return find(getReceiverDecl(Receiver), S);
   }
-  
+
   RetainSummary* find(IdentifierInfo* II, Selector S) {
     // FIXME: Class method lookup.  Right now we dont' have a good way
     // of going between IdentifierInfo* and the class hierarchy.
     MapTy::iterator I = M.find(ObjCSummaryKey(II, S));
-    
+
     if (I == M.end())
       I = M.find(ObjCSummaryKey(S));
-      
+
     return I == M.end() ? NULL : I->second;
   }
-  
-  const ObjCInterfaceDecl* getReceiverDecl(Expr* E) {    
+
+  const ObjCInterfaceDecl* getReceiverDecl(Expr* E) {
     if (const ObjCObjectPointerType* PT =
         E->getType()->getAsObjCObjectPointerType())
       return PT->getInterfaceDecl();
 
     return NULL;
   }
-  
+
   RetainSummary*& operator[](ObjCMessageExpr* ME) {
-    
+
     Selector S = ME->getSelector();
-    
+
     if (Expr* Receiver = ME->getReceiver()) {
       const ObjCInterfaceDecl* OD = getReceiverDecl(Receiver);
       return OD ? M[ObjCSummaryKey(OD->getIdentifier(), S)] : M[S];
     }
-    
+
     return M[ObjCSummaryKey(ME->getClassName(), S)];
   }
-  
+
   RetainSummary*& operator[](ObjCSummaryKey K) {
     return M[K];
   }
-  
+
   RetainSummary*& operator[](Selector S) {
     return M[ ObjCSummaryKey(S) ];
   }
-};   
+};
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
@@ -591,29 +591,29 @@
   //==-----------------------------------------------------------------==//
   //  Typedefs.
   //==-----------------------------------------------------------------==//
-  
+
   typedef llvm::DenseMap<FunctionDecl*, RetainSummary*>
           FuncSummariesTy;
-  
+
   typedef ObjCSummaryCache ObjCMethodSummariesTy;
-    
+
   //==-----------------------------------------------------------------==//
   //  Data.
   //==-----------------------------------------------------------------==//
-  
+
   /// Ctx - The ASTContext object for the analyzed ASTs.
   ASTContext& Ctx;
 
   /// CFDictionaryCreateII - An IdentifierInfo* representing the indentifier
   ///  "CFDictionaryCreate".
   IdentifierInfo* CFDictionaryCreateII;
-  
+
   /// GCEnabled - Records whether or not the analyzed code runs in GC mode.
   const bool GCEnabled;
-    
+
   /// FuncSummaries - A map from FunctionDecls to summaries.
-  FuncSummariesTy FuncSummaries; 
-  
+  FuncSummariesTy FuncSummaries;
+
   /// ObjCClassMethodSummaries - A map from selectors (for instance methods)
   ///  to summaries.
   ObjCMethodSummariesTy ObjCClassMethodSummaries;
@@ -624,34 +624,34 @@
   /// BPAlloc - A BumpPtrAllocator used for allocating summaries, ArgEffects,
   ///  and all other data used by the checker.
   llvm::BumpPtrAllocator BPAlloc;
-  
+
   /// AF - A factory for ArgEffects objects.
-  ArgEffects::Factory AF;  
-  
+  ArgEffects::Factory AF;
+
   /// ScratchArgs - A holding buffer for construct ArgEffects.
   ArgEffects ScratchArgs;
-  
+
   /// ObjCAllocRetE - Default return effect for methods returning Objective-C
   ///  objects.
   RetEffect ObjCAllocRetE;
 
-  /// ObjCInitRetE - Default return effect for init methods returning 
+  /// ObjCInitRetE - Default return effect for init methods returning
   ///   Objective-C objects.
   RetEffect ObjCInitRetE;
-  
+
   RetainSummary DefaultSummary;
   RetainSummary* StopSummary;
-  
+
   //==-----------------------------------------------------------------==//
   //  Methods.
   //==-----------------------------------------------------------------==//
-  
+
   /// getArgEffects - Returns a persistent ArgEffects object based on the
   ///  data in ScratchArgs.
   ArgEffects getArgEffects();
 
-  enum UnaryFuncKind { cfretain, cfrelease, cfmakecollectable };  
-  
+  enum UnaryFuncKind { cfretain, cfrelease, cfmakecollectable };
+
 public:
   RetEffect getObjAllocRetEffect() const { return ObjCAllocRetE; }
 
@@ -659,13 +659,13 @@
     RetainSummary *Summ = (RetainSummary*) BPAlloc.Allocate<RetainSummary>();
     return new (Summ) RetainSummary(DefaultSummary);
   }
-  
+
   RetainSummary* getUnarySummary(const FunctionType* FT, UnaryFuncKind func);
-  
+
   RetainSummary* getCFSummaryCreateRule(FunctionDecl* FD);
-  RetainSummary* getCFSummaryGetRule(FunctionDecl* FD);  
+  RetainSummary* getCFSummaryGetRule(FunctionDecl* FD);
   RetainSummary* getCFCreateGetRuleSummary(FunctionDecl* FD, const char* FName);
-  
+
   RetainSummary* getPersistentSummary(ArgEffects AE, RetEffect RetEff,
                                       ArgEffect ReceiverEff = DoNothing,
                                       ArgEffect DefaultEff = MayEscape,
@@ -676,36 +676,36 @@
                                       ArgEffect DefaultEff = MayEscape) {
     return getPersistentSummary(getArgEffects(), RE, ReceiverEff, DefaultEff);
   }
-  
+
   RetainSummary *getPersistentStopSummary() {
     if (StopSummary)
       return StopSummary;
-    
+
     StopSummary = getPersistentSummary(RetEffect::MakeNoRet(),
                                        StopTracking, StopTracking);
 
     return StopSummary;
-  }  
+  }
 
   RetainSummary *getInitMethodSummary(QualType RetTy);
 
   void InitializeClassMethodSummaries();
   void InitializeMethodSummaries();
-  
+
   bool isTrackedObjCObjectType(QualType T);
   bool isTrackedCFObjectType(QualType T);
-  
+
 private:
-  
+
   void addClsMethSummary(IdentifierInfo* ClsII, Selector S,
                          RetainSummary* Summ) {
     ObjCClassMethodSummaries[ObjCSummaryKey(ClsII, S)] = Summ;
   }
-  
+
   void addNSObjectClsMethSummary(Selector S, RetainSummary *Summ) {
     ObjCClassMethodSummaries[S] = Summ;
   }
-    
+
   void addNSObjectMethSummary(Selector S, RetainSummary *Summ) {
     ObjCMethodSummaries[S] = Summ;
   }
@@ -716,43 +716,43 @@
     Selector S = GetNullarySelector(nullaryName, Ctx);
     ObjCClassMethodSummaries[ObjCSummaryKey(ClsII, S)]  = Summ;
   }
-  
+
   void addInstMethSummary(const char* Cls, const char* nullaryName,
                           RetainSummary *Summ) {
     IdentifierInfo* ClsII = &Ctx.Idents.get(Cls);
     Selector S = GetNullarySelector(nullaryName, Ctx);
     ObjCMethodSummaries[ObjCSummaryKey(ClsII, S)]  = Summ;
   }
-  
+
   Selector generateSelector(va_list argp) {
     llvm::SmallVector<IdentifierInfo*, 10> II;
 
     while (const char* s = va_arg(argp, const char*))
       II.push_back(&Ctx.Idents.get(s));
 
-    return Ctx.Selectors.getSelector(II.size(), &II[0]);    
+    return Ctx.Selectors.getSelector(II.size(), &II[0]);
   }
-  
+
   void addMethodSummary(IdentifierInfo *ClsII, ObjCMethodSummariesTy& Summaries,
                         RetainSummary* Summ, va_list argp) {
     Selector S = generateSelector(argp);
     Summaries[ObjCSummaryKey(ClsII, S)] = Summ;
   }
-  
+
   void addInstMethSummary(const char* Cls, RetainSummary* Summ, ...) {
     va_list argp;
     va_start(argp, Summ);
     addMethodSummary(&Ctx.Idents.get(Cls), ObjCMethodSummaries, Summ, argp);
-    va_end(argp);    
+    va_end(argp);
   }
-  
+
   void addClsMethSummary(const char* Cls, RetainSummary* Summ, ...) {
     va_list argp;
     va_start(argp, Summ);
     addMethodSummary(&Ctx.Idents.get(Cls),ObjCClassMethodSummaries, Summ, argp);
     va_end(argp);
   }
-  
+
   void addClsMethSummary(IdentifierInfo *II, RetainSummary* Summ, ...) {
     va_list argp;
     va_start(argp, Summ);
@@ -769,9 +769,9 @@
     addMethodSummary(&Ctx.Idents.get(Cls), ObjCMethodSummaries, Summ, argp);
     va_end(argp);
   }
-  
+
 public:
-  
+
   RetainSummaryManager(ASTContext& ctx, bool gcenabled)
    : Ctx(ctx),
      CFDictionaryCreateII(&ctx.Idents.get("CFDictionaryCreate")),
@@ -789,17 +789,17 @@
     InitializeClassMethodSummaries();
     InitializeMethodSummaries();
   }
-  
+
   ~RetainSummaryManager();
-  
-  RetainSummary* getSummary(FunctionDecl* FD);  
-  
+
+  RetainSummary* getSummary(FunctionDecl* FD);
+
   RetainSummary* getInstanceMethodSummary(ObjCMessageExpr* ME,
                                           const ObjCInterfaceDecl* ID) {
     return getInstanceMethodSummary(ME->getSelector(), ME->getClassName(),
-                            ID, ME->getMethodDecl(), ME->getType());    
+                            ID, ME->getMethodDecl(), ME->getType());
   }
-  
+
   RetainSummary* getInstanceMethodSummary(Selector S, IdentifierInfo *ClsName,
                                           const ObjCInterfaceDecl* ID,
                                           const ObjCMethodDecl *MD,
@@ -809,7 +809,7 @@
                                        const ObjCInterfaceDecl *ID,
                                        const ObjCMethodDecl *MD,
                                        QualType RetTy);
-  
+
   RetainSummary *getClassMethodSummary(ObjCMessageExpr *ME) {
     return getClassMethodSummary(ME->getSelector(), ME->getClassName(),
                                  ME->getClassInfo().first,
@@ -824,17 +824,17 @@
     Selector S = MD->getSelector();
     IdentifierInfo *ClsName = ID->getIdentifier();
     QualType ResultTy = MD->getResultType();
-    
-    // Resolve the method decl last.    
+
+    // Resolve the method decl last.
     if (const ObjCMethodDecl *InterfaceMD = ResolveToInterfaceMethodDecl(MD))
       MD = InterfaceMD;
-    
+
     if (MD->isInstanceMethod())
       return getInstanceMethodSummary(S, ClsName, ID, MD, ResultTy);
     else
       return getClassMethodSummary(S, ClsName, ID, MD, ResultTy);
   }
-  
+
   RetainSummary* getCommonMethodSummary(const ObjCMethodDecl* MD,
                                         Selector S, QualType RetTy);
 
@@ -845,14 +845,14 @@
                                     const FunctionDecl *FD);
 
   bool isGCEnabled() const { return GCEnabled; }
-  
+
   RetainSummary *copySummary(RetainSummary *OldSumm) {
     RetainSummary *Summ = (RetainSummary*) BPAlloc.Allocate<RetainSummary>();
     new (Summ) RetainSummary(*OldSumm);
     return Summ;
-  }  
+  }
 };
-  
+
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
@@ -871,7 +871,7 @@
 RetainSummaryManager::getPersistentSummary(ArgEffects AE, RetEffect RetEff,
                                            ArgEffect ReceiverEff,
                                            ArgEffect DefaultEff,
-                                           bool isEndPath) {  
+                                           bool isEndPath) {
   // Create the summary and return it.
   RetainSummary *Summ = (RetainSummary*) BPAlloc.Allocate<RetainSummary>();
   new (Summ) RetainSummary(AE, RetEff, DefaultEff, ReceiverEff, isEndPath);
@@ -887,31 +887,31 @@
     return false;
 
   const ObjCObjectPointerType *PT = Ty->getAsObjCObjectPointerType();
-  
+
   // Can be true for objects with the 'NSObject' attribute.
   if (!PT)
     return true;
-  
+
   // We assume that id<..>, id, and "Class" all represent tracked objects.
   if (PT->isObjCIdType() || PT->isObjCQualifiedIdType() ||
       PT->isObjCClassType())
     return true;
 
-  // Does the interface subclass NSObject?    
-  // FIXME: We can memoize here if this gets too expensive.    
-  const ObjCInterfaceDecl *ID = PT->getInterfaceDecl();  
+  // Does the interface subclass NSObject?
+  // FIXME: We can memoize here if this gets too expensive.
+  const ObjCInterfaceDecl *ID = PT->getInterfaceDecl();
 
   // Assume that anything declared with a forward declaration and no
   // @interface subclasses NSObject.
   if (ID->isForwardDecl())
     return true;
-  
+
   IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
 
   for ( ; ID ; ID = ID->getSuperClass())
     if (ID->getIdentifier() == NSObjectII)
       return true;
-  
+
   return false;
 }
 
@@ -945,33 +945,33 @@
 
   // No summary?  Generate one.
   RetainSummary *S = 0;
-  
+
   do {
     // We generate "stop" summaries for implicitly defined functions.
     if (FD->isImplicit()) {
       S = getPersistentStopSummary();
       break;
     }
-    
+
     // [PR 3337] Use 'getAsFunctionType' to strip away any typedefs on the
     // function's type.
     const FunctionType* FT = FD->getType()->getAsFunctionType();
     const char* FName = FD->getIdentifier()->getName();
-    
+
     // Strip away preceding '_'.  Doing this here will effect all the checks
     // down below.
     while (*FName == '_') ++FName;
-    
+
     // Inspect the result type.
     QualType RetTy = FT->getResultType();
-    
+
     // FIXME: This should all be refactored into a chain of "summary lookup"
     //  filters.
     assert (ScratchArgs.isEmpty());
-    
+
     switch (strlen(FName)) {
       default: break;
-        
+
 
       case 17:
         // Handle: id NSMakeCollectable(CFTypeRef)
@@ -1003,10 +1003,10 @@
           // Part of <rdar://problem/6961230>. (IOKit)
           // This should be addressed using a API table.
           ScratchArgs = AF.Add(ScratchArgs, 2, DecRef);
-          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);         
+          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
         }
         break;
-        
+
       case 25:
         if (!memcmp(FName, "IORegistryEntryIDMatching", 25)) {
           // Part of <rdar://problem/6961230>. (IOKit)
@@ -1015,13 +1015,13 @@
                                    DoNothing, DoNothing);
         }
         break;
-        
+
       case 26:
         if (!memcmp(FName, "IOOpenFirmwarePathMatching", 26)) {
           // Part of <rdar://problem/6961230>. (IOKit)
           // This should be addressed using a API table.
           S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true),
-                                   DoNothing, DoNothing);          
+                                   DoNothing, DoNothing);
         }
         break;
 
@@ -1030,7 +1030,7 @@
           // Part of <rdar://problem/6961230>.
           // This should be addressed using a API table.
           ScratchArgs = AF.Add(ScratchArgs, 1, DecRef);
-          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);         
+          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
         }
         break;
 
@@ -1043,17 +1043,17 @@
           S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
         }
         break;
-        
+
       case 32:
         if (!memcmp(FName, "IOServiceAddMatchingNotification", 32)) {
           // Part of <rdar://problem/6961230>.
           // This should be addressed using a API table.
           ScratchArgs = AF.Add(ScratchArgs, 2, DecRef);
-          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);         
+          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
         }
         break;
     }
-    
+
     // Did we get a summary?
     if (S)
       break;
@@ -1063,7 +1063,7 @@
 #if 0
     // Handle: NSDeallocateObject(id anObject);
     // This method does allow 'nil' (although we don't check it now).
-    if (strcmp(FName, "NSDeallocateObject") == 0) {      
+    if (strcmp(FName, "NSDeallocateObject") == 0) {
       return RetTy == Ctx.VoidTy
         ? getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, Dealloc)
         : getPersistentStopSummary();
@@ -1077,7 +1077,7 @@
           S = getUnarySummary(FT, cfretain);
         else if (strstr(FName, "MakeCollectable"))
           S = getUnarySummary(FT, cfmakecollectable);
-        else 
+        else
           S = getCFCreateGetRuleSummary(FD, FName);
 
         break;
@@ -1100,7 +1100,7 @@
         S = getCFCreateGetRuleSummary(FD, FName);
         break;
       }
-      
+
       break;
     }
 
@@ -1112,7 +1112,7 @@
         FName += 4;
       else
         FName += 2;
-      
+
       if (isRelease(FD, FName))
         S = getUnarySummary(FT, cfrelease);
       else {
@@ -1122,9 +1122,9 @@
         // and that ownership cannot be transferred.  While this is technically
         // correct, many methods allow a tracked object to escape.  For example:
         //
-        //   CFMutableDictionaryRef x = CFDictionaryCreateMutable(...);        
+        //   CFMutableDictionaryRef x = CFDictionaryCreateMutable(...);
         //   CFDictionaryAddValue(y, key, x);
-        //   CFRelease(x); 
+        //   CFRelease(x);
         //   ... it is okay to use 'x' since 'y' has a reference to it
         //
         // We handle this and similar cases with the follow heuristic.  If the
@@ -1138,34 +1138,34 @@
                        CStrInCStrNoCase(FName, "AppendValue") ||
                        CStrInCStrNoCase(FName, "SetAttribute"))
                       ? MayEscape : DoNothing;
-        
+
         S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, E);
       }
     }
   }
   while (0);
-  
+
   if (!S)
     S = getDefaultSummary();
 
   // Annotations override defaults.
   assert(S);
   updateSummaryFromAnnotations(*S, FD);
-  
+
   FuncSummaries[FD] = S;
-  return S;  
+  return S;
 }
 
 RetainSummary*
 RetainSummaryManager::getCFCreateGetRuleSummary(FunctionDecl* FD,
                                                 const char* FName) {
-  
+
   if (strstr(FName, "Create") || strstr(FName, "Copy"))
     return getCFSummaryCreateRule(FD);
-  
+
   if (strstr(FName, "Get"))
     return getCFSummaryGetRule(FD);
-  
+
   return getDefaultSummary();
 }
 
@@ -1178,27 +1178,27 @@
   const FunctionProtoType* FTP = dyn_cast<FunctionProtoType>(FT);
   if (!FTP || FTP->getNumArgs() != 1)
     return getPersistentStopSummary();
-  
+
   assert (ScratchArgs.isEmpty());
-  
+
   switch (func) {
     case cfretain: {
       ScratchArgs = AF.Add(ScratchArgs, 0, IncRef);
       return getPersistentSummary(RetEffect::MakeAlias(0),
                                   DoNothing, DoNothing);
     }
-      
+
     case cfrelease: {
       ScratchArgs = AF.Add(ScratchArgs, 0, DecRef);
       return getPersistentSummary(RetEffect::MakeNoRet(),
                                   DoNothing, DoNothing);
     }
-      
+
     case cfmakecollectable: {
       ScratchArgs = AF.Add(ScratchArgs, 0, MakeCollectable);
-      return getPersistentSummary(RetEffect::MakeAlias(0),DoNothing, DoNothing);    
+      return getPersistentSummary(RetEffect::MakeAlias(0),DoNothing, DoNothing);
     }
-      
+
     default:
       assert (false && "Not a supported unary function.");
       return getDefaultSummary();
@@ -1207,17 +1207,17 @@
 
 RetainSummary* RetainSummaryManager::getCFSummaryCreateRule(FunctionDecl* FD) {
   assert (ScratchArgs.isEmpty());
-  
+
   if (FD->getIdentifier() == CFDictionaryCreateII) {
     ScratchArgs = AF.Add(ScratchArgs, 1, DoNothingByRef);
     ScratchArgs = AF.Add(ScratchArgs, 2, DoNothingByRef);
   }
-  
+
   return getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true));
 }
 
 RetainSummary* RetainSummaryManager::getCFSummaryGetRule(FunctionDecl* FD) {
-  assert (ScratchArgs.isEmpty());  
+  assert (ScratchArgs.isEmpty());
   return getPersistentSummary(RetEffect::MakeNotOwned(RetEffect::CF),
                               DoNothing, DoNothing);
 }
@@ -1228,12 +1228,12 @@
 
 RetainSummary*
 RetainSummaryManager::getInitMethodSummary(QualType RetTy) {
-  assert(ScratchArgs.isEmpty());    
+  assert(ScratchArgs.isEmpty());
   // 'init' methods conceptually return a newly allocated object and claim
-  // the receiver.  
+  // the receiver.
   if (isTrackedObjCObjectType(RetTy) || isTrackedCFObjectType(RetTy))
     return getPersistentSummary(ObjCInitRetE, DecRefMsg);
-  
+
   return getDefaultSummary();
 }
 
@@ -1244,7 +1244,7 @@
     return;
 
   QualType RetTy = FD->getResultType();
-  
+
   // Determine if there is a special return effect for this method.
   if (isTrackedObjCObjectType(RetTy)) {
     if (FD->getAttr<NSReturnsRetainedAttr>()) {
@@ -1268,20 +1268,20 @@
     return;
 
   bool isTrackedLoc = false;
-  
+
   // Determine if there is a special return effect for this method.
   if (isTrackedObjCObjectType(MD->getResultType())) {
     if (MD->getAttr<NSReturnsRetainedAttr>()) {
       Summ.setRetEffect(ObjCAllocRetE);
       return;
     }
-    
+
     isTrackedLoc = true;
   }
-  
+
   if (!isTrackedLoc)
     isTrackedLoc = MD->getResultType()->getAs<PointerType>() != NULL;
-    
+
   if (isTrackedLoc && MD->getAttr<CFReturnsRetainedAttr>())
     Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
 }
@@ -1304,10 +1304,10 @@
           ScratchArgs = AF.Add(ScratchArgs, i, StopTracking);
       }
   }
-  
+
   // Any special effect for the receiver?
   ArgEffect ReceiverEff = DoNothing;
-  
+
   // If one of the arguments in the selector has the keyword 'delegate' we
   // should stop tracking the reference count for the receiver.  This is
   // because the reference count is quite possibly handled by a delegate
@@ -1317,29 +1317,29 @@
     assert(!str.empty());
     if (CStrInCStrNoCase(&str[0], "delegate:")) ReceiverEff = StopTracking;
   }
-  
+
   // Look for methods that return an owned object.
-  if (isTrackedObjCObjectType(RetTy)) {    
+  if (isTrackedObjCObjectType(RetTy)) {
     // EXPERIMENTAL: Assume the Cocoa conventions for all objects returned
     //  by instance methods.
     RetEffect E = followsFundamentalRule(S)
                   ? ObjCAllocRetE : RetEffect::MakeNotOwned(RetEffect::ObjC);
-    
-    return getPersistentSummary(E, ReceiverEff, MayEscape);    
+
+    return getPersistentSummary(E, ReceiverEff, MayEscape);
   }
-  
+
   // Look for methods that return an owned core foundation object.
   if (isTrackedCFObjectType(RetTy)) {
     RetEffect E = followsFundamentalRule(S)
       ? RetEffect::MakeOwned(RetEffect::CF, true)
       : RetEffect::MakeNotOwned(RetEffect::CF);
-    
+
     return getPersistentSummary(E, ReceiverEff, MayEscape);
   }
-  
+
   if (ScratchArgs.isEmpty() && ReceiverEff == DoNothing)
     return getDefaultSummary();
-  
+
   return getPersistentSummary(RetEffect::MakeNoRet(), ReceiverEff, MayEscape);
 }
 
@@ -1352,23 +1352,23 @@
 
   // Look up a summary in our summary cache.
   RetainSummary *Summ = ObjCMethodSummaries.find(ID, ClsName, S);
-  
+
   if (!Summ) {
     assert(ScratchArgs.isEmpty());
-  
+
     // "initXXX": pass-through for receiver.
     if (deriveNamingConvention(S) == InitRule)
       Summ = getInitMethodSummary(RetTy);
     else
       Summ = getCommonMethodSummary(MD, S, RetTy);
-  
+
     // Annotations override defaults.
     updateSummaryFromAnnotations(*Summ, MD);
-  
+
     // Memoize the summary.
     ObjCMethodSummaries[ObjCSummaryKey(ID, ClsName, S)] = Summ;
   }
-  
+
   return Summ;
 }
 
@@ -1379,8 +1379,8 @@
                                             QualType RetTy) {
 
   assert(ClsName && "Class name must be specified.");
-  RetainSummary *Summ = ObjCClassMethodSummaries.find(ID, ClsName, S);  
-  
+  RetainSummary *Summ = ObjCClassMethodSummaries.find(ID, ClsName, S);
+
   if (!Summ) {
     Summ = getCommonMethodSummary(MD, S, RetTy);
     // Annotations override defaults.
@@ -1388,32 +1388,32 @@
     // Memoize the summary.
     ObjCClassMethodSummaries[ObjCSummaryKey(ID, ClsName, S)] = Summ;
   }
-  
+
   return Summ;
 }
 
-void RetainSummaryManager::InitializeClassMethodSummaries() {  
+void RetainSummaryManager::InitializeClassMethodSummaries() {
   assert(ScratchArgs.isEmpty());
   RetainSummary* Summ = getPersistentSummary(ObjCAllocRetE);
-  
+
   // Create the summaries for "alloc", "new", and "allocWithZone:" for
   // NSObject and its derivatives.
   addNSObjectClsMethSummary(GetNullarySelector("alloc", Ctx), Summ);
   addNSObjectClsMethSummary(GetNullarySelector("new", Ctx), Summ);
   addNSObjectClsMethSummary(GetUnarySelector("allocWithZone", Ctx), Summ);
-  
-  // Create the [NSAssertionHandler currentHander] summary.  
+
+  // Create the [NSAssertionHandler currentHander] summary.
   addClsMethSummary(&Ctx.Idents.get("NSAssertionHandler"),
                 GetNullarySelector("currentHandler", Ctx),
                 getPersistentSummary(RetEffect::MakeNotOwned(RetEffect::ObjC)));
-  
+
   // Create the [NSAutoreleasePool addObject:] summary.
   ScratchArgs = AF.Add(ScratchArgs, 0, Autorelease);
   addClsMethSummary(&Ctx.Idents.get("NSAutoreleasePool"),
                     GetUnarySelector("addObject", Ctx),
                     getPersistentSummary(RetEffect::MakeNoRet(),
                                          DoNothing, Autorelease));
-  
+
   // Create the summaries for [NSObject performSelector...].  We treat
   // these as 'stop tracking' for the arguments because they are often
   // used for delegates that can release the object.  When we have better
@@ -1435,7 +1435,7 @@
                     "withObject", "waitUntilDone", "modes", NULL);
   addClsMethSummary(NSObjectII, Summ, "performSelectorInBackground",
                     "withObject", NULL);
-  
+
   // Specially handle NSData.
   RetainSummary *dataWithBytesNoCopySumm =
     getPersistentSummary(RetEffect::MakeNotOwned(RetEffect::ObjC), DoNothing,
@@ -1447,43 +1447,43 @@
 }
 
 void RetainSummaryManager::InitializeMethodSummaries() {
-  
-  assert (ScratchArgs.isEmpty());  
-  
+
+  assert (ScratchArgs.isEmpty());
+
   // Create the "init" selector.  It just acts as a pass-through for the
   // receiver.
-  RetainSummary *InitSumm = getPersistentSummary(ObjCInitRetE, DecRefMsg);  
+  RetainSummary *InitSumm = getPersistentSummary(ObjCInitRetE, DecRefMsg);
   addNSObjectMethSummary(GetNullarySelector("init", Ctx), InitSumm);
 
   // awakeAfterUsingCoder: behaves basically like an 'init' method.  It
   // claims the receiver and returns a retained object.
   addNSObjectMethSummary(GetUnarySelector("awakeAfterUsingCoder", Ctx),
                          InitSumm);
-  
+
   // The next methods are allocators.
   RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);
-  RetainSummary *CFAllocSumm = 
+  RetainSummary *CFAllocSumm =
     getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true));
-  
-  // Create the "copy" selector.  
-  addNSObjectMethSummary(GetNullarySelector("copy", Ctx), AllocSumm);  
+
+  // Create the "copy" selector.
+  addNSObjectMethSummary(GetNullarySelector("copy", Ctx), AllocSumm);
 
   // Create the "mutableCopy" selector.
   addNSObjectMethSummary(GetNullarySelector("mutableCopy", Ctx), AllocSumm);
-  
+
   // Create the "retain" selector.
   RetEffect E = RetEffect::MakeReceiverAlias();
   RetainSummary *Summ = getPersistentSummary(E, IncRefMsg);
   addNSObjectMethSummary(GetNullarySelector("retain", Ctx), Summ);
-  
+
   // Create the "release" selector.
   Summ = getPersistentSummary(E, DecRefMsg);
   addNSObjectMethSummary(GetNullarySelector("release", Ctx), Summ);
-  
+
   // Create the "drain" selector.
   Summ = getPersistentSummary(E, isGCEnabled() ? DoNothing : DecRef);
   addNSObjectMethSummary(GetNullarySelector("drain", Ctx), Summ);
-  
+
   // Create the -dealloc summary.
   Summ = getPersistentSummary(RetEffect::MakeNoRet(), Dealloc);
   addNSObjectMethSummary(GetNullarySelector("dealloc", Ctx), Summ);
@@ -1491,13 +1491,13 @@
   // Create the "autorelease" selector.
   Summ = getPersistentSummary(E, Autorelease);
   addNSObjectMethSummary(GetNullarySelector("autorelease", Ctx), Summ);
-  
+
   // Specially handle NSAutoreleasePool.
   addInstMethSummary("NSAutoreleasePool", "init",
                      getPersistentSummary(RetEffect::MakeReceiverAlias(),
                                           NewAutoreleasePool));
-  
-  // For NSWindow, allocated objects are (initially) self-owned.  
+
+  // For NSWindow, allocated objects are (initially) self-owned.
   // FIXME: For now we opt for false negatives with NSWindow, as these objects
   //  self-own themselves.  However, they only do this once they are displayed.
   //  Thus, we need to track an NSWindow's display status.
@@ -1506,42 +1506,42 @@
   RetainSummary *NoTrackYet = getPersistentSummary(RetEffect::MakeNoRet(),
                                                    StopTracking,
                                                    StopTracking);
-  
+
   addClassMethSummary("NSWindow", "alloc", NoTrackYet);
 
 #if 0
   addInstMethSummary("NSWindow", NoTrackYet, "initWithContentRect",
                      "styleMask", "backing", "defer", NULL);
-  
+
   addInstMethSummary("NSWindow", NoTrackYet, "initWithContentRect",
                      "styleMask", "backing", "defer", "screen", NULL);
 #endif
-  
+
   // For NSPanel (which subclasses NSWindow), allocated objects are not
   //  self-owned.
   // FIXME: For now we don't track NSPanels. object for the same reason
   //   as for NSWindow objects.
   addClassMethSummary("NSPanel", "alloc", NoTrackYet);
-  
+
 #if 0
   addInstMethSummary("NSPanel", NoTrackYet, "initWithContentRect",
                      "styleMask", "backing", "defer", NULL);
-  
+
   addInstMethSummary("NSPanel", NoTrackYet, "initWithContentRect",
                      "styleMask", "backing", "defer", "screen", NULL);
 #endif
-  
+
   // Don't track allocated autorelease pools yet, as it is okay to prematurely
   // exit a method.
   addClassMethSummary("NSAutoreleasePool", "alloc", NoTrackYet);
 
   // Create NSAssertionHandler summaries.
   addPanicSummary("NSAssertionHandler", "handleFailureInFunction", "file",
-                  "lineNumber", "description", NULL); 
-  
+                  "lineNumber", "description", NULL);
+
   addPanicSummary("NSAssertionHandler", "handleFailureInMethod", "object",
                   "file", "lineNumber", "description", NULL);
-  
+
   // Create summaries QCRenderer/QCView -createSnapShotImageOfType:
   addInstMethSummary("QCRenderer", AllocSumm,
                      "createSnapshotImageOfType", NULL);
@@ -1554,7 +1554,7 @@
   addInstMethSummary("CIContext", CFAllocSumm,
                      "createCGImage", "fromRect", NULL);
   addInstMethSummary("CIContext", CFAllocSumm,
-                     "createCGImage", "fromRect", "format", "colorSpace", NULL);  
+                     "createCGImage", "fromRect", "format", "colorSpace", NULL);
   addInstMethSummary("CIContext", CFAllocSumm, "createCGLayerWithSize",
            "info", NULL);
 }
@@ -1564,19 +1564,19 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
-  
+
 class VISIBILITY_HIDDEN RefVal {
-public:  
+public:
   enum Kind {
-    Owned = 0, // Owning reference.    
-    NotOwned,  // Reference is not owned by still valid (not freed).    
+    Owned = 0, // Owning reference.
+    NotOwned,  // Reference is not owned by still valid (not freed).
     Released,  // Object has been released.
     ReturnedOwned, // Returned object passes ownership to caller.
     ReturnedNotOwned, // Return object does not pass ownership to caller.
     ERROR_START,
     ErrorDeallocNotOwned, // -dealloc called on non-owned object.
     ErrorDeallocGC, // Calling -dealloc with GC enabled.
-    ErrorUseAfterRelease, // Object used after released.    
+    ErrorUseAfterRelease, // Object used after released.
     ErrorReleaseNotOwned, // Release of an object that was not owned.
     ERROR_LEAK_START,
     ErrorLeak,  // A memory leak due to excessive reference counts.
@@ -1587,7 +1587,7 @@
     ErrorReturnedNotOwned
   };
 
-private:  
+private:
   Kind kind;
   RetEffect::ObjKind okind;
   unsigned Cnt;
@@ -1600,9 +1600,9 @@
   RefVal(Kind k, unsigned cnt = 0)
     : kind(k), okind(RetEffect::AnyObj), Cnt(cnt), ACnt(0) {}
 
-public:    
+public:
   Kind getKind() const { return kind; }
-  
+
   RetEffect::ObjKind getObjKind() const { return okind; }
 
   unsigned getCount() const { return Cnt; }
@@ -1611,72 +1611,72 @@
   void clearCounts() { Cnt = 0; ACnt = 0; }
   void setCount(unsigned i) { Cnt = i; }
   void setAutoreleaseCount(unsigned i) { ACnt = i; }
-  
+
   QualType getType() const { return T; }
-  
+
   // Useful predicates.
-  
+
   static bool isError(Kind k) { return k >= ERROR_START; }
-  
+
   static bool isLeak(Kind k) { return k >= ERROR_LEAK_START; }
-  
+
   bool isOwned() const {
     return getKind() == Owned;
   }
-  
+
   bool isNotOwned() const {
     return getKind() == NotOwned;
   }
-  
+
   bool isReturnedOwned() const {
     return getKind() == ReturnedOwned;
   }
-  
+
   bool isReturnedNotOwned() const {
     return getKind() == ReturnedNotOwned;
   }
-  
+
   bool isNonLeakError() const {
     Kind k = getKind();
     return isError(k) && !isLeak(k);
   }
-  
+
   static RefVal makeOwned(RetEffect::ObjKind o, QualType t,
                           unsigned Count = 1) {
     return RefVal(Owned, o, Count, 0, t);
   }
-  
+
   static RefVal makeNotOwned(RetEffect::ObjKind o, QualType t,
                              unsigned Count = 0) {
     return RefVal(NotOwned, o, Count, 0, t);
   }
-  
+
   // Comparison, profiling, and pretty-printing.
-  
+
   bool operator==(const RefVal& X) const {
     return kind == X.kind && Cnt == X.Cnt && T == X.T && ACnt == X.ACnt;
   }
-  
+
   RefVal operator-(size_t i) const {
     return RefVal(getKind(), getObjKind(), getCount() - i,
                   getAutoreleaseCount(), getType());
   }
-  
+
   RefVal operator+(size_t i) const {
     return RefVal(getKind(), getObjKind(), getCount() + i,
                   getAutoreleaseCount(), getType());
   }
-  
+
   RefVal operator^(Kind k) const {
     return RefVal(k, getObjKind(), getCount(), getAutoreleaseCount(),
                   getType());
   }
-  
+
   RefVal autorelease() const {
     return RefVal(getKind(), getObjKind(), getCount(), getAutoreleaseCount()+1,
                   getType());
   }
-    
+
   void Profile(llvm::FoldingSetNodeID& ID) const {
     ID.AddInteger((unsigned) kind);
     ID.AddInteger(Cnt);
@@ -1686,41 +1686,41 @@
 
   void print(llvm::raw_ostream& Out) const;
 };
-  
+
 void RefVal::print(llvm::raw_ostream& Out) const {
   if (!T.isNull())
     Out << "Tracked Type:" << T.getAsString() << '\n';
-    
+
   switch (getKind()) {
     default: assert(false);
-    case Owned: { 
+    case Owned: {
       Out << "Owned";
       unsigned cnt = getCount();
       if (cnt) Out << " (+ " << cnt << ")";
       break;
     }
-      
+
     case NotOwned: {
       Out << "NotOwned";
       unsigned cnt = getCount();
       if (cnt) Out << " (+ " << cnt << ")";
       break;
     }
-      
-    case ReturnedOwned: { 
+
+    case ReturnedOwned: {
       Out << "ReturnedOwned";
       unsigned cnt = getCount();
       if (cnt) Out << " (+ " << cnt << ")";
       break;
     }
-      
+
     case ReturnedNotOwned: {
       Out << "ReturnedNotOwned";
       unsigned cnt = getCount();
       if (cnt) Out << " (+ " << cnt << ")";
       break;
     }
-            
+
     case Released:
       Out << "Released";
       break;
@@ -1728,19 +1728,19 @@
     case ErrorDeallocGC:
       Out << "-dealloc (GC)";
       break;
-    
+
     case ErrorDeallocNotOwned:
       Out << "-dealloc (not-owned)";
       break;
-      
+
     case ErrorLeak:
       Out << "Leaked";
-      break;            
-      
+      break;
+
     case ErrorLeakReturned:
       Out << "Leaked (Bad naming)";
       break;
-      
+
     case ErrorGCLeakReturned:
       Out << "Leaked (GC-ed at return)";
       break;
@@ -1748,38 +1748,38 @@
     case ErrorUseAfterRelease:
       Out << "Use-After-Release [ERROR]";
       break;
-      
+
     case ErrorReleaseNotOwned:
       Out << "Release of Not-Owned [ERROR]";
       break;
-      
+
     case RefVal::ErrorOverAutorelease:
       Out << "Over autoreleased";
       break;
-      
+
     case RefVal::ErrorReturnedNotOwned:
       Out << "Non-owned object returned instead of owned";
       break;
   }
-  
+
   if (ACnt) {
     Out << " [ARC +" << ACnt << ']';
   }
 }
-  
+
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
 // RefBindings - State used to track object reference counts.
 //===----------------------------------------------------------------------===//
-  
+
 typedef llvm::ImmutableMap<SymbolRef, RefVal> RefBindings;
 static int RefBIndex = 0;
 
 namespace clang {
   template<>
   struct GRStateTrait<RefBindings> : public GRStatePartialTrait<RefBindings> {
-    static inline void* GDMIndex() { return &RefBIndex; }  
+    static inline void* GDMIndex() { return &RefBIndex; }
   };
 }
 
@@ -1800,12 +1800,12 @@
 namespace clang {
 template<> struct GRStateTrait<AutoreleaseStack>
   : public GRStatePartialTrait<ARStack> {
-  static inline void* GDMIndex() { return &AutoRBIndex; }  
+  static inline void* GDMIndex() { return &AutoRBIndex; }
 };
 
 template<> struct GRStateTrait<AutoreleasePoolContents>
   : public GRStatePartialTrait<ARPoolContents> {
-  static inline void* GDMIndex() { return &AutoRCIndex; }  
+  static inline void* GDMIndex() { return &AutoRCIndex; }
 };
 } // end clang namespace
 
@@ -1820,14 +1820,14 @@
   SymbolRef pool = GetCurrentAutoreleasePool(state);
   const ARCounts *cnts = state->get<AutoreleasePoolContents>(pool);
   ARCounts newCnts(0);
-  
+
   if (cnts) {
     const unsigned *cnt = (*cnts).lookup(sym);
     newCnts = F.Add(*cnts, sym, cnt ? *cnt  + 1 : 1);
   }
   else
     newCnts = F.Add(F.GetEmptyMap(), sym, 1);
-  
+
   return state->set<AutoreleasePoolContents>(pool, newCnts);
 }
 
@@ -1836,7 +1836,7 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
-  
+
 class VISIBILITY_HIDDEN CFRefCount : public GRTransferFuncs {
 public:
   class BindingsPrinter : public GRState::Printer {
@@ -1847,9 +1847,9 @@
 
 private:
   typedef llvm::DenseMap<const ExplodedNode*, const RetainSummary*>
-    SummaryLogTy;  
+    SummaryLogTy;
 
-  RetainSummaryManager Summaries;  
+  RetainSummaryManager Summaries;
   SummaryLogTy SummaryLog;
   const LangOptions&   LOpts;
   ARCounts::Factory    ARCountFactory;
@@ -1860,7 +1860,7 @@
   BugType *overAutorelease;
   BugType *returnNotOwnedForOwned;
   BugReporter *BR;
-  
+
   const GRState * Update(const GRState * state, SymbolRef sym, RefVal V, ArgEffect E,
                     RefVal::Kind& hasErr);
 
@@ -1870,40 +1870,40 @@
                            ExplodedNode* Pred,
                            const GRState* St,
                            RefVal::Kind hasErr, SymbolRef Sym);
-  
+
   const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V,
                                llvm::SmallVectorImpl<SymbolRef> &Leaked);
-    
+
   ExplodedNode* ProcessLeaks(const GRState * state,
                                       llvm::SmallVectorImpl<SymbolRef> &Leaked,
                                       GenericNodeBuilder &Builder,
                                       GRExprEngine &Eng,
                                       ExplodedNode *Pred = 0);
-  
-public:  
+
+public:
   CFRefCount(ASTContext& Ctx, bool gcenabled, const LangOptions& lopts)
     : Summaries(Ctx, gcenabled),
       LOpts(lopts), useAfterRelease(0), releaseNotOwned(0),
       deallocGC(0), deallocNotOwned(0),
       leakWithinFunction(0), leakAtReturn(0), overAutorelease(0),
       returnNotOwnedForOwned(0), BR(0) {}
-  
+
   virtual ~CFRefCount() {}
-  
+
   void RegisterChecks(BugReporter &BR);
- 
+
   virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {
     Printers.push_back(new BindingsPrinter());
   }
-  
+
   bool isGCEnabled() const { return Summaries.isGCEnabled(); }
   const LangOptions& getLangOptions() const { return LOpts; }
-  
+
   const RetainSummary *getSummaryOfNode(const ExplodedNode *N) const {
     SummaryLogTy::const_iterator I = SummaryLog.find(N);
     return I == SummaryLog.end() ? 0 : I->second;
   }
-  
+
   // Calls.
 
   void EvalSummary(ExplodedNodeSet& Dst,
@@ -1914,47 +1914,47 @@
                    const RetainSummary& Summ,
                    ExprIterator arg_beg, ExprIterator arg_end,
                    ExplodedNode* Pred);
-    
+
   virtual void EvalCall(ExplodedNodeSet& Dst,
                         GRExprEngine& Eng,
                         GRStmtNodeBuilder& Builder,
                         CallExpr* CE, SVal L,
-                        ExplodedNode* Pred);  
-  
-  
+                        ExplodedNode* Pred);
+
+
   virtual void EvalObjCMessageExpr(ExplodedNodeSet& Dst,
                                    GRExprEngine& Engine,
                                    GRStmtNodeBuilder& Builder,
                                    ObjCMessageExpr* ME,
                                    ExplodedNode* Pred);
-  
+
   bool EvalObjCMessageExprAux(ExplodedNodeSet& Dst,
                               GRExprEngine& Engine,
                               GRStmtNodeBuilder& Builder,
                               ObjCMessageExpr* ME,
                               ExplodedNode* Pred);
 
-  // Stores.  
+  // Stores.
   virtual void EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val);
 
   // End-of-path.
-  
+
   virtual void EvalEndPath(GRExprEngine& Engine,
                            GREndPathNodeBuilder& Builder);
-  
+
   virtual void EvalDeadSymbols(ExplodedNodeSet& Dst,
                                GRExprEngine& Engine,
                                GRStmtNodeBuilder& Builder,
                                ExplodedNode* Pred,
                                Stmt* S, const GRState* state,
                                SymbolReaper& SymReaper);
-  
+
   std::pair<ExplodedNode*, const GRState *>
   HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilder Bd,
                           ExplodedNode* Pred, GRExprEngine &Eng,
                           SymbolRef Sym, RefVal V, bool &stop);
   // Return statements.
-  
+
   virtual void EvalReturn(ExplodedNodeSet& Dst,
                           GRExprEngine& Engine,
                           GRStmtNodeBuilder& Builder,
@@ -1977,34 +1977,34 @@
   else
     Out << "<pool>";
   Out << ":{";
-    
+
   // Get the contents of the pool.
   if (const ARCounts *cnts = state->get<AutoreleasePoolContents>(Sym))
     for (ARCounts::iterator J=cnts->begin(), EJ=cnts->end(); J != EJ; ++J)
       Out << '(' << J.getKey() << ',' << J.getData() << ')';
 
-  Out << '}';  
+  Out << '}';
 }
 
 void CFRefCount::BindingsPrinter::Print(llvm::raw_ostream& Out,
                                         const GRState* state,
                                         const char* nl, const char* sep) {
-    
+
   RefBindings B = state->get<RefBindings>();
-  
+
   if (!B.isEmpty())
     Out << sep << nl;
-  
+
   for (RefBindings::iterator I=B.begin(), E=B.end(); I!=E; ++I) {
     Out << (*I).first << " : ";
     (*I).second.print(Out);
     Out << nl;
   }
-  
+
   // Print the autorelease stack.
   Out << sep << nl << "AR pool stack:";
   ARStack stack = state->get<AutoreleaseStack>();
-  
+
   PrintPool(Out, SymbolRef(), state);  // Print the caller's pool.
   for (ARStack::iterator I=stack.begin(), E=stack.end(); I!=E; ++I)
     PrintPool(Out, *I, state);
@@ -2017,117 +2017,117 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
-  
+
   //===-------------===//
   // Bug Descriptions. //
-  //===-------------===//  
-  
+  //===-------------===//
+
   class VISIBILITY_HIDDEN CFRefBug : public BugType {
   protected:
     CFRefCount& TF;
-    
-    CFRefBug(CFRefCount* tf, const char* name) 
-    : BugType(name, "Memory (Core Foundation/Objective-C)"), TF(*tf) {}    
+
+    CFRefBug(CFRefCount* tf, const char* name)
+    : BugType(name, "Memory (Core Foundation/Objective-C)"), TF(*tf) {}
   public:
-    
+
     CFRefCount& getTF() { return TF; }
     const CFRefCount& getTF() const { return TF; }
-    
+
     // FIXME: Eventually remove.
     virtual const char* getDescription() const = 0;
-    
+
     virtual bool isLeak() const { return false; }
   };
-  
+
   class VISIBILITY_HIDDEN UseAfterRelease : public CFRefBug {
   public:
     UseAfterRelease(CFRefCount* tf)
     : CFRefBug(tf, "Use-after-release") {}
-    
+
     const char* getDescription() const {
       return "Reference-counted object is used after it is released";
-    }    
+    }
   };
-  
+
   class VISIBILITY_HIDDEN BadRelease : public CFRefBug {
   public:
     BadRelease(CFRefCount* tf) : CFRefBug(tf, "Bad release") {}
-    
+
     const char* getDescription() const {
       return "Incorrect decrement of the reference count of an "
       "object is not owned at this point by the caller";
     }
   };
-  
+
   class VISIBILITY_HIDDEN DeallocGC : public CFRefBug {
   public:
     DeallocGC(CFRefCount *tf)
       : CFRefBug(tf, "-dealloc called while using garbage collection") {}
-    
+
     const char *getDescription() const {
       return "-dealloc called while using garbage collection";
     }
   };
-  
+
   class VISIBILITY_HIDDEN DeallocNotOwned : public CFRefBug {
   public:
     DeallocNotOwned(CFRefCount *tf)
       : CFRefBug(tf, "-dealloc sent to non-exclusively owned object") {}
-    
+
     const char *getDescription() const {
       return "-dealloc sent to object that may be referenced elsewhere";
     }
-  };  
-  
+  };
+
   class VISIBILITY_HIDDEN OverAutorelease : public CFRefBug {
   public:
-    OverAutorelease(CFRefCount *tf) : 
+    OverAutorelease(CFRefCount *tf) :
       CFRefBug(tf, "Object sent -autorelease too many times") {}
-    
+
     const char *getDescription() const {
       return "Object sent -autorelease too many times";
     }
   };
-  
+
   class VISIBILITY_HIDDEN ReturnedNotOwnedForOwned : public CFRefBug {
   public:
     ReturnedNotOwnedForOwned(CFRefCount *tf) :
       CFRefBug(tf, "Method should return an owned object") {}
-    
+
     const char *getDescription() const {
       return "Object with +0 retain counts returned to caller where a +1 "
              "(owning) retain count is expected";
     }
   };
-  
+
   class VISIBILITY_HIDDEN Leak : public CFRefBug {
     const bool isReturn;
   protected:
     Leak(CFRefCount* tf, const char* name, bool isRet)
     : CFRefBug(tf, name), isReturn(isRet) {}
   public:
-    
+
     const char* getDescription() const { return ""; }
-    
+
     bool isLeak() const { return true; }
   };
-  
+
   class VISIBILITY_HIDDEN LeakAtReturn : public Leak {
   public:
     LeakAtReturn(CFRefCount* tf, const char* name)
     : Leak(tf, name, true) {}
   };
-  
+
   class VISIBILITY_HIDDEN LeakWithinFunction : public Leak {
   public:
     LeakWithinFunction(CFRefCount* tf, const char* name)
     : Leak(tf, name, false) {}
-  };  
-  
+  };
+
   //===---------===//
   // Bug Reports.  //
   //===---------===//
-  
+
   class VISIBILITY_HIDDEN CFRefReport : public RangedBugReport {
   protected:
     SymbolRef Sym;
@@ -2140,30 +2140,30 @@
     CFRefReport(CFRefBug& D, const CFRefCount &tf,
                 ExplodedNode *n, SymbolRef sym, const char* endText)
       : RangedBugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {}
-    
+
     virtual ~CFRefReport() {}
-    
+
     CFRefBug& getBugType() {
       return (CFRefBug&) RangedBugReport::getBugType();
     }
     const CFRefBug& getBugType() const {
       return (const CFRefBug&) RangedBugReport::getBugType();
     }
-    
+
     virtual void getRanges(const SourceRange*& beg, const SourceRange*& end) {
       if (!getBugType().isLeak())
         RangedBugReport::getRanges(beg, end);
       else
         beg = end = 0;
     }
-    
+
     SymbolRef getSymbol() const { return Sym; }
-    
+
     PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
                                     const ExplodedNode* N);
-    
+
     std::pair<const char**,const char**> getExtraDescriptiveText();
-    
+
     PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
                                    const ExplodedNode* PrevN,
                                    BugReporterContext& BRC);
@@ -2176,36 +2176,36 @@
     CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
                     ExplodedNode *n, SymbolRef sym,
                     GRExprEngine& Eng);
-    
+
     PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
                                     const ExplodedNode* N);
-    
+
     SourceLocation getLocation() const { return AllocSite; }
-  };  
+  };
 } // end anonymous namespace
 
 void CFRefCount::RegisterChecks(BugReporter& BR) {
   useAfterRelease = new UseAfterRelease(this);
   BR.Register(useAfterRelease);
-  
+
   releaseNotOwned = new BadRelease(this);
   BR.Register(releaseNotOwned);
-  
+
   deallocGC = new DeallocGC(this);
   BR.Register(deallocGC);
-  
+
   deallocNotOwned = new DeallocNotOwned(this);
   BR.Register(deallocNotOwned);
-  
+
   overAutorelease = new OverAutorelease(this);
   BR.Register(overAutorelease);
-  
+
   returnNotOwnedForOwned = new ReturnedNotOwnedForOwned(this);
   BR.Register(returnNotOwnedForOwned);
-  
+
   // First register "return" leaks.
   const char* name = 0;
-  
+
   if (isGCEnabled())
     name = "Leak of returned object when using garbage collection";
   else if (getLangOptions().getGCMode() == LangOptions::HybridGC)
@@ -2215,13 +2215,13 @@
     assert(getLangOptions().getGCMode() == LangOptions::NonGC);
     name = "Leak of returned object";
   }
-  
+
   leakAtReturn = new LeakAtReturn(this, name);
   BR.Register(leakAtReturn);
-  
+
   // Second, register leaks within a function/method.
   if (isGCEnabled())
-    name = "Leak of object when using garbage collection";  
+    name = "Leak of object when using garbage collection";
   else if (getLangOptions().getGCMode() == LangOptions::HybridGC)
     name = "Leak of object when not using garbage collection (GC) in "
     "dual GC/non-GC code";
@@ -2229,22 +2229,22 @@
     assert(getLangOptions().getGCMode() == LangOptions::NonGC);
     name = "Leak";
   }
-  
+
   leakWithinFunction = new LeakWithinFunction(this, name);
   BR.Register(leakWithinFunction);
-  
+
   // Save the reference to the BugReporter.
   this->BR = &BR;
 }
 
 static const char* Msgs[] = {
   // GC only
-  "Code is compiled to only use garbage collection",    
+  "Code is compiled to only use garbage collection",
   // No GC.
   "Code is compiled to use reference counts",
   // Hybrid, with GC.
   "Code is compiled to use either garbage collection (GC) or reference counts"
-  " (non-GC).  The bug occurs with GC enabled",  
+  " (non-GC).  The bug occurs with GC enabled",
   // Hybrid, without GC
   "Code is compiled to use either garbage collection (GC) or reference counts"
   " (non-GC).  The bug occurs in non-GC mode"
@@ -2252,19 +2252,19 @@
 
 std::pair<const char**,const char**> CFRefReport::getExtraDescriptiveText() {
   CFRefCount& TF = static_cast<CFRefBug&>(getBugType()).getTF();
-  
+
   switch (TF.getLangOptions().getGCMode()) {
     default:
       assert(false);
-      
+
     case LangOptions::GCOnly:
       assert (TF.isGCEnabled());
-      return std::make_pair(&Msgs[0], &Msgs[0]+1);      
-      
+      return std::make_pair(&Msgs[0], &Msgs[0]+1);
+
     case LangOptions::NonGC:
       assert (!TF.isGCEnabled());
       return std::make_pair(&Msgs[1], &Msgs[1]+1);
-      
+
     case LangOptions::HybridGC:
       if (TF.isGCEnabled())
         return std::make_pair(&Msgs[2], &Msgs[2]+1);
@@ -2278,50 +2278,50 @@
   for (llvm::SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end();
        I!=E; ++I)
     if (*I == X) return true;
-  
+
   return false;
 }
 
 PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
                                             const ExplodedNode* PrevN,
                                             BugReporterContext& BRC) {
-  
+
   if (!isa<PostStmt>(N->getLocation()))
     return NULL;
-  
+
   // Check if the type state has changed.
   const GRState *PrevSt = PrevN->getState();
   const GRState *CurrSt = N->getState();
-  
-  const RefVal* CurrT = CurrSt->get<RefBindings>(Sym);  
+
+  const RefVal* CurrT = CurrSt->get<RefBindings>(Sym);
   if (!CurrT) return NULL;
-  
+
   const RefVal &CurrV = *CurrT;
   const RefVal *PrevT = PrevSt->get<RefBindings>(Sym);
-  
+
   // Create a string buffer to constain all the useful things we want
   // to tell the user.
   std::string sbuf;
   llvm::raw_string_ostream os(sbuf);
-  
+
   // This is the allocation site since the previous node had no bindings
   // for this symbol.
   if (!PrevT) {
     const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
-    
+
     if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
       // Get the name of the callee (if it is available).
       SVal X = CurrSt->getSValAsScalarOrLoc(CE->getCallee());
       if (const FunctionDecl* FD = X.getAsFunctionDecl())
         os << "Call to function '" << FD->getNameAsString() <<'\'';
       else
-        os << "function call";      
-    }          
+        os << "function call";
+    }
     else {
       assert (isa<ObjCMessageExpr>(S));
       os << "Method";
     }
-    
+
     if (CurrV.getObjKind() == RetEffect::CF) {
       os << " returns a Core Foundation object with a ";
     }
@@ -2329,10 +2329,10 @@
       assert (CurrV.getObjKind() == RetEffect::ObjC);
       os << " returns an Objective-C object with a ";
     }
-    
+
     if (CurrV.isOwned()) {
       os << "+1 retain count (owning reference).";
-      
+
       if (static_cast<CFRefBug&>(getBugType()).getTF().isGCEnabled()) {
         assert(CurrV.getObjKind() == RetEffect::CF);
         os << "  "
@@ -2343,39 +2343,39 @@
       assert (CurrV.isNotOwned());
       os << "+0 retain count (non-owning reference).";
     }
-    
+
     PathDiagnosticLocation Pos(S, BRC.getSourceManager());
     return new PathDiagnosticEventPiece(Pos, os.str());
   }
-  
+
   // Gather up the effects that were performed on the object at this
   // program point
   llvm::SmallVector<ArgEffect, 2> AEffects;
-  
+
   if (const RetainSummary *Summ =
         TF.getSummaryOfNode(BRC.getNodeResolver().getOriginalNode(N))) {
     // We only have summaries attached to nodes after evaluating CallExpr and
     // ObjCMessageExprs.
     const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
-    
+
     if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
       // Iterate through the parameter expressions and see if the symbol
       // was ever passed as an argument.
       unsigned i = 0;
-      
+
       for (CallExpr::const_arg_iterator AI=CE->arg_begin(), AE=CE->arg_end();
            AI!=AE; ++AI, ++i) {
-        
+
         // Retrieve the value of the argument.  Is it the symbol
         // we are interested in?
         if (CurrSt->getSValAsScalarOrLoc(*AI).getAsLocSymbol() != Sym)
           continue;
-        
+
         // We have an argument.  Get the effect!
         AEffects.push_back(Summ->getArg(i));
       }
     }
-    else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S)) {      
+    else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S)) {
       if (const Expr *receiver = ME->getReceiver())
         if (CurrSt->getSValAsScalarOrLoc(receiver).getAsLocSymbol() == Sym) {
           // The symbol we are tracking is the receiver.
@@ -2383,11 +2383,11 @@
         }
     }
   }
-  
+
   do {
     // Get the previous type state.
     RefVal PrevV = *PrevT;
-    
+
     // Specially handle -dealloc.
     if (!TF.isGCEnabled() && contains(AEffects, Dealloc)) {
       // Determine if the object's reference count was pushed to zero.
@@ -2400,7 +2400,7 @@
         break;
       }
     }
-    
+
     // Specially handle CFMakeCollectable and friends.
     if (contains(AEffects, MakeCollectable)) {
       // Get the name of the function.
@@ -2408,15 +2408,15 @@
       SVal X = CurrSt->getSValAsScalarOrLoc(cast<CallExpr>(S)->getCallee());
       const FunctionDecl* FD = X.getAsFunctionDecl();
       const std::string& FName = FD->getNameAsString();
-      
+
       if (TF.isGCEnabled()) {
         // Determine if the object's reference count was pushed to zero.
         assert(!(PrevV == CurrV) && "The typestate *must* have changed.");
-        
+
         os << "In GC mode a call to '" << FName
         <<  "' decrements an object's retain count and registers the "
         "object with the garbage collector. ";
-        
+
         if (CurrV.getKind() == RefVal::Released) {
           assert(CurrV.getCount() == 0);
           os << "Since it now has a 0 retain count the object can be "
@@ -2427,67 +2427,67 @@
           "After this call its retain count is +" << CurrV.getCount()
           << '.';
       }
-      else 
+      else
         os << "When GC is not enabled a call to '" << FName
         << "' has no effect on its argument.";
-      
+
       // Nothing more to say.
       break;
     }
-    
-    // Determine if the typestate has changed.  
+
+    // Determine if the typestate has changed.
     if (!(PrevV == CurrV))
       switch (CurrV.getKind()) {
         case RefVal::Owned:
         case RefVal::NotOwned:
-          
+
           if (PrevV.getCount() == CurrV.getCount()) {
             // Did an autorelease message get sent?
             if (PrevV.getAutoreleaseCount() == CurrV.getAutoreleaseCount())
               return 0;
-            
+
             assert(PrevV.getAutoreleaseCount() < CurrV.getAutoreleaseCount());
             os << "Object sent -autorelease message";
             break;
           }
-          
+
           if (PrevV.getCount() > CurrV.getCount())
             os << "Reference count decremented.";
           else
             os << "Reference count incremented.";
-          
+
           if (unsigned Count = CurrV.getCount())
             os << " The object now has a +" << Count << " retain count.";
-          
+
           if (PrevV.getKind() == RefVal::Released) {
             assert(TF.isGCEnabled() && CurrV.getCount() > 0);
             os << " The object is not eligible for garbage collection until the "
             "retain count reaches 0 again.";
           }
-          
+
           break;
-          
+
         case RefVal::Released:
           os << "Object released.";
           break;
-          
+
         case RefVal::ReturnedOwned:
           os << "Object returned to caller as an owning reference (single retain "
           "count transferred to caller).";
           break;
-          
+
         case RefVal::ReturnedNotOwned:
           os << "Object returned to caller with a +0 (non-owning) retain count.";
           break;
-          
+
         default:
           return NULL;
       }
-    
+
     // Emit any remaining diagnostics for the argument effects (if any).
     for (llvm::SmallVectorImpl<ArgEffect>::iterator I=AEffects.begin(),
          E=AEffects.end(); I != E; ++I) {
-      
+
       // A bunch of things have alternate behavior under GC.
       if (TF.isGCEnabled())
         switch (*I) {
@@ -2503,25 +2503,25 @@
             continue;
         }
     }
-  } while(0);
-  
+  } while (0);
+
   if (os.str().empty())
     return 0; // We have nothing to say!
 
   const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
   PathDiagnosticLocation Pos(S, BRC.getSourceManager());
   PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str());
-  
+
   // Add the range by scanning the children of the statement for any bindings
   // to Sym.
-  for (Stmt::const_child_iterator I = S->child_begin(), E = S->child_end(); 
+  for (Stmt::const_child_iterator I = S->child_begin(), E = S->child_end();
        I!=E; ++I)
     if (const Expr* Exp = dyn_cast_or_null<Expr>(*I))
       if (CurrSt->getSValAsScalarOrLoc(Exp).getAsLocSymbol() == Sym) {
         P->addRange(Exp->getSourceRange());
         break;
       }
-  
+
   return P;
 }
 
@@ -2531,56 +2531,56 @@
     SymbolRef Sym;
     const MemRegion* Binding;
     bool First;
-    
+
   public:
     FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {}
-    
+
     bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
                        SVal val) {
-      
-      SymbolRef SymV = val.getAsSymbol();    
+
+      SymbolRef SymV = val.getAsSymbol();
       if (!SymV || SymV != Sym)
         return true;
-      
+
       if (Binding) {
         First = false;
         return false;
       }
       else
         Binding = R;
-      
-      return true;    
+
+      return true;
     }
-    
+
     operator bool() { return First && Binding; }
     const MemRegion* getRegion() { return Binding; }
-  };  
+  };
 }
 
 static std::pair<const ExplodedNode*,const MemRegion*>
 GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode* N,
                   SymbolRef Sym) {
-  
+
   // Find both first node that referred to the tracked symbol and the
   // memory location that value was store to.
   const ExplodedNode* Last = N;
-  const MemRegion* FirstBinding = 0;  
-  
+  const MemRegion* FirstBinding = 0;
+
   while (N) {
     const GRState* St = N->getState();
     RefBindings B = St->get<RefBindings>();
-    
+
     if (!B.lookup(Sym))
       break;
-    
+
     FindUniqueBinding FB(Sym);
-    StateMgr.iterBindings(St, FB);      
-    if (FB) FirstBinding = FB.getRegion();      
-    
+    StateMgr.iterBindings(St, FB);
+    if (FB) FirstBinding = FB.getRegion();
+
     Last = N;
-    N = N->pred_empty() ? NULL : *(N->pred_begin());    
+    N = N->pred_empty() ? NULL : *(N->pred_begin());
   }
-  
+
   return std::make_pair(Last, FirstBinding);
 }
 
@@ -2596,36 +2596,36 @@
 PathDiagnosticPiece*
 CFRefLeakReport::getEndPath(BugReporterContext& BRC,
                             const ExplodedNode* EndN){
-  
+
   // Tell the BugReporterContext to report cases when the tracked symbol is
   // assigned to different variables, etc.
   BRC.addNotableSymbol(Sym);
-  
+
   // We are reporting a leak.  Walk up the graph to get to the first node where
   // the symbol appeared, and also get the first VarDecl that tracked object
   // is stored to.
   const ExplodedNode* AllocNode = 0;
   const MemRegion* FirstBinding = 0;
-  
+
   llvm::tie(AllocNode, FirstBinding) =
     GetAllocationSite(BRC.getStateManager(), EndN, Sym);
-  
-  // Get the allocate site.  
+
+  // Get the allocate site.
   assert(AllocNode);
   const Stmt* FirstStmt = cast<PostStmt>(AllocNode->getLocation()).getStmt();
-  
+
   SourceManager& SMgr = BRC.getSourceManager();
   unsigned AllocLine =SMgr.getInstantiationLineNumber(FirstStmt->getLocStart());
-  
+
   // Compute an actual location for the leak.  Sometimes a leak doesn't
   // occur at an actual statement (e.g., transition between blocks; end
   // of function) so we need to walk the graph and compute a real location.
   const ExplodedNode* LeakN = EndN;
   PathDiagnosticLocation L;
-  
+
   while (LeakN) {
     ProgramPoint P = LeakN->getLocation();
-    
+
     if (const PostStmt *PS = dyn_cast<PostStmt>(&P)) {
       L = PathDiagnosticLocation(PS->getStmt()->getLocStart(), SMgr);
       break;
@@ -2636,26 +2636,26 @@
         break;
       }
     }
-    
+
     LeakN = LeakN->succ_empty() ? 0 : *(LeakN->succ_begin());
   }
-  
+
   if (!L.isValid()) {
     const Decl &D = BRC.getCodeDecl();
     L = PathDiagnosticLocation(D.getBodyRBrace(), SMgr);
   }
-  
+
   std::string sbuf;
   llvm::raw_string_ostream os(sbuf);
-  
+
   os << "Object allocated on line " << AllocLine;
-  
+
   if (FirstBinding)
-    os << " and stored into '" << FirstBinding->getString() << '\'';  
-  
+    os << " and stored into '" << FirstBinding->getString() << '\'';
+
   // Get the retain count.
   const RefVal* RV = EndN->getState()->get<RefBindings>(Sym);
-  
+
   if (RV->getKind() == RefVal::ErrorLeakReturned) {
     // FIXME: Per comments in rdar://6320065, "create" only applies to CF
     // ojbects.  Only "copy", "alloc", "retain" and "new" transfer ownership
@@ -2678,16 +2678,15 @@
   else
     os << " is no longer referenced after this point and has a retain count of"
           " +" << RV->getCount() << " (object leaked)";
-  
+
   return new PathDiagnosticEventPiece(L, os.str());
 }
 
 CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
                                  ExplodedNode *n,
                                  SymbolRef sym, GRExprEngine& Eng)
-: CFRefReport(D, tf, n, sym)
-{
-  
+: CFRefReport(D, tf, n, sym) {
+
   // Most bug reports are cached at the location where they occured.
   // With leaks, we want to unique them by the location where they were
   // allocated, and only report a single path.  To do this, we need to find
@@ -2697,14 +2696,14 @@
   // that all ancestor nodes that represent the allocation site have the
   // same SourceLocation.
   const ExplodedNode* AllocNode = 0;
-  
+
   llvm::tie(AllocNode, AllocBinding) =  // Set AllocBinding.
     GetAllocationSite(Eng.getStateManager(), getEndNode(), getSymbol());
-  
+
   // Get the SourceLocation for the allocation site.
   ProgramPoint P = AllocNode->getLocation();
   AllocSite = cast<PostStmt>(P).getStmt()->getLocStart();
-  
+
   // Fill in the description of the bug.
   Description.clear();
   llvm::raw_string_ostream os(Description);
@@ -2713,9 +2712,9 @@
   os << "Potential leak ";
   if (tf.isGCEnabled()) {
     os << "(when using garbage collection) ";
-  }  
+  }
   os << "of an object allocated on line " << AllocLine;
-  
+
   // FIXME: AllocBinding doesn't get populated for RegionStore yet.
   if (AllocBinding)
     os << " and stored into '" << AllocBinding->getString() << '\'';
@@ -2737,16 +2736,16 @@
   /// more specific than id.
   if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(RetE))
     if (const ObjCObjectPointerType *PT = RetTy->getAsObjCObjectPointerType())
-      if (PT->isObjCQualifiedIdType() || PT->isObjCIdType() || 
+      if (PT->isObjCQualifiedIdType() || PT->isObjCIdType() ||
           PT->isObjCClassType()) {
         // At this point we know the return type of the message expression is
         // id, id<...>, or Class. If we have an ObjCInterfaceDecl, we know this
         // is a call to a class method whose type we can resolve.  In such
         // cases, promote the return type to XXX* (where XXX is the class).
-        const ObjCInterfaceDecl *D = ME->getClassInfo().first;  
+        const ObjCInterfaceDecl *D = ME->getClassInfo().first;
         return !D ? RetTy : Ctx.getPointerType(Ctx.getObjCInterfaceType(D));
       }
-  
+
   return RetTy;
 }
 
@@ -2758,7 +2757,7 @@
                              const RetainSummary& Summ,
                              ExprIterator arg_beg, ExprIterator arg_end,
                              ExplodedNode* Pred) {
-  
+
   // Get the state.
   const GRState *state = Builder.GetState(Pred);
 
@@ -2766,10 +2765,10 @@
   RefVal::Kind hasErr = (RefVal::Kind) 0;
   unsigned idx = 0;
   Expr* ErrorExpr = NULL;
-  SymbolRef ErrorSym = 0;                                        
-  
-  for (ExprIterator I = arg_beg; I != arg_end; ++I, ++idx) {    
-    SVal V = state->getSValAsScalarOrLoc(*I);    
+  SymbolRef ErrorSym = 0;
+
+  for (ExprIterator I = arg_beg; I != arg_end; ++I, ++idx) {
+    SVal V = state->getSValAsScalarOrLoc(*I);
     SymbolRef Sym = V.getAsLocSymbol();
 
     if (Sym)
@@ -2779,7 +2778,7 @@
           ErrorExpr = *I;
           ErrorSym = Sym;
           break;
-        }        
+        }
         continue;
       }
 
@@ -2787,14 +2786,14 @@
       if (loc::MemRegionVal* MR = dyn_cast<loc::MemRegionVal>(&V)) {
         if (Summ.getArg(idx) == DoNothingByRef)
           continue;
-        
-        // Invalidate the value of the variable passed by reference.        
-        
+
+        // Invalidate the value of the variable passed by reference.
+
         // FIXME: We can have collisions on the conjured symbol if the
         //  expression *I also creates conjured symbols.  We probably want
         //  to identify conjured symbols by an expression pair: the enclosing
         //  expression (the context) and the expression itself.  This should
-        //  disambiguate conjured symbols. 
+        //  disambiguate conjured symbols.
         unsigned Count = Builder.getCurrentBlockCount();
         StoreManager& StoreMgr = Eng.getStateManager().getStoreManager();
 
@@ -2825,9 +2824,9 @@
 
         // Is the invalidated variable something that we were tracking?
         SymbolRef Sym = state->getSValAsScalarOrLoc(R).getAsLocSymbol();
-        
+
         // Remove any existing reference-count binding.
-        if (Sym) 
+        if (Sym)
           state = state->remove<RefBindings>(Sym);
 
         state = StoreMgr.InvalidateRegion(state, R, *I, Count);
@@ -2845,9 +2844,9 @@
       // We should bind it to UnknownVal explicitly. Otherwise default value
       // may be loaded.
       state = state->unbindLoc(cast<nonloc::LocAsInteger>(V).getLoc());
-  } 
-  
-  // Evaluate the effect on the message receiver.  
+  }
+
+  // Evaluate the effect on the message receiver.
   if (!ErrorExpr && Receiver) {
     SymbolRef Sym = state->getSValAsScalarOrLoc(Receiver).getAsLocSymbol();
     if (Sym) {
@@ -2860,17 +2859,17 @@
       }
     }
   }
-  
-  // Process any errors.  
+
+  // Process any errors.
   if (hasErr) {
     ProcessNonLeakError(Dst, Builder, Ex, ErrorExpr, Pred, state,
                         hasErr, ErrorSym);
     return;
   }
-  
-  // Consult the summary for the return value.  
+
+  // Consult the summary for the return value.
   RetEffect RE = Summ.getRetEffect();
-  
+
   if (RE.getKind() == RetEffect::OwnedWhenTrackedReceiver) {
     assert(Receiver);
     SVal V = state->getSValAsScalarOrLoc(Receiver);
@@ -2883,32 +2882,32 @@
 
     if (!found)
       RE = RetEffect::MakeNoRet();
-  } 
-  
+  }
+
   switch (RE.getKind()) {
     default:
       assert (false && "Unhandled RetEffect."); break;
-      
-    case RetEffect::NoRet: {      
+
+    case RetEffect::NoRet: {
       // Make up a symbol for the return value (not reference counted).
       // FIXME: Most of this logic is not specific to the retain/release
       // checker.
-      
+
       // FIXME: We eventually should handle structs and other compound types
       // that are returned by value.
-      
+
       QualType T = Ex->getType();
-      
+
       if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
         unsigned Count = Builder.getCurrentBlockCount();
         ValueManager &ValMgr = Eng.getValueManager();
         SVal X = ValMgr.getConjuredSymbolVal(Ex, T, Count);
         state = state->BindExpr(Ex, X, false);
-      }      
-      
+      }
+
       break;
     }
-      
+
     case RetEffect::Alias: {
       unsigned idx = RE.getIndex();
       assert (arg_end >= arg_beg);
@@ -2917,20 +2916,20 @@
       state = state->BindExpr(Ex, V, false);
       break;
     }
-      
+
     case RetEffect::ReceiverAlias: {
       assert (Receiver);
       SVal V = state->getSValAsScalarOrLoc(Receiver);
       state = state->BindExpr(Ex, V, false);
       break;
     }
-      
+
     case RetEffect::OwnedAllocatedSymbol:
     case RetEffect::OwnedSymbol: {
       unsigned Count = Builder.getCurrentBlockCount();
-      ValueManager &ValMgr = Eng.getValueManager();      
+      ValueManager &ValMgr = Eng.getValueManager();
       SymbolRef Sym = ValMgr.getConjuredSymbol(Ex, Count);
-      QualType RetT = GetReturnType(Ex, ValMgr.getContext());      
+      QualType RetT = GetReturnType(Ex, ValMgr.getContext());
       state = state->set<RefBindings>(Sym, RefVal::makeOwned(RE.getObjKind(),
                                                             RetT));
       state = state->BindExpr(Ex, ValMgr.makeLoc(Sym), false);
@@ -2941,31 +2940,31 @@
       if (RE.getKind() == RetEffect::OwnedAllocatedSymbol) {
         bool isFeasible;
         state = state.Assume(loc::SymbolVal(Sym), true, isFeasible);
-        assert(isFeasible && "Cannot assume fresh symbol is non-null.");        
+        assert(isFeasible && "Cannot assume fresh symbol is non-null.");
       }
 #endif
-      
+
       break;
     }
-    
+
     case RetEffect::GCNotOwnedSymbol:
     case RetEffect::NotOwnedSymbol: {
       unsigned Count = Builder.getCurrentBlockCount();
       ValueManager &ValMgr = Eng.getValueManager();
       SymbolRef Sym = ValMgr.getConjuredSymbol(Ex, Count);
-      QualType RetT = GetReturnType(Ex, ValMgr.getContext());      
+      QualType RetT = GetReturnType(Ex, ValMgr.getContext());
       state = state->set<RefBindings>(Sym, RefVal::makeNotOwned(RE.getObjKind(),
                                                                RetT));
       state = state->BindExpr(Ex, ValMgr.makeLoc(Sym), false);
       break;
     }
   }
-  
+
   // Generate a sink node if we are at the end of a path.
   ExplodedNode *NewNode =
     Summ.isEndPath() ? Builder.MakeSinkNode(Dst, Ex, Pred, state)
                      : Builder.MakeNode(Dst, Ex, Pred, state);
-  
+
   // Annotate the edge with summary we used.
   if (NewNode) SummaryLog[NewNode] = &Summ;
 }
@@ -2977,9 +2976,9 @@
                           CallExpr* CE, SVal L,
                           ExplodedNode* Pred) {
   const FunctionDecl* FD = L.getAsFunctionDecl();
-  RetainSummary* Summ = !FD ? Summaries.getDefaultSummary() 
+  RetainSummary* Summ = !FD ? Summaries.getDefaultSummary()
                         : Summaries.getSummary(const_cast<FunctionDecl*>(FD));
-  
+
   assert(Summ);
   EvalSummary(Dst, Eng, Builder, CE, 0, *Summ,
               CE->arg_begin(), CE->arg_end(), Pred);
@@ -2989,9 +2988,9 @@
                                      GRExprEngine& Eng,
                                      GRStmtNodeBuilder& Builder,
                                      ObjCMessageExpr* ME,
-                                     ExplodedNode* Pred) {  
+                                     ExplodedNode* Pred) {
   RetainSummary* Summ = 0;
-  
+
   if (Expr* Receiver = ME->getReceiver()) {
     // We need the type-information of the tracked receiver object
     // Retrieve it from the state.
@@ -3005,7 +3004,7 @@
     SVal V = St->getSValAsScalarOrLoc(Receiver);
 
     SymbolRef Sym = V.getAsLocSymbol();
-    
+
     if (Sym) {
       if (const RefVal* T  = St->get<RefBindings>(Sym)) {
         if (const ObjCObjectPointerType* PT =
@@ -3028,21 +3027,21 @@
 
     // Special-case: are we sending a mesage to "self"?
     //  This is a hack.  When we have full-IP this should be removed.
-    if (isa<ObjCMethodDecl>(Pred->getLocationContext()->getDecl())) {      
+    if (isa<ObjCMethodDecl>(Pred->getLocationContext()->getDecl())) {
       if (Expr* Receiver = ME->getReceiver()) {
         SVal X = St->getSValAsScalarOrLoc(Receiver);
-        if (loc::MemRegionVal* L = dyn_cast<loc::MemRegionVal>(&X)) {          
+        if (loc::MemRegionVal* L = dyn_cast<loc::MemRegionVal>(&X)) {
           // Get the region associated with 'self'.
-          const LocationContext *LC = Pred->getLocationContext();          
+          const LocationContext *LC = Pred->getLocationContext();
           if (const ImplicitParamDecl *SelfDecl = LC->getSelfDecl()) {
-            SVal SelfVal = St->getSVal(St->getRegion(SelfDecl, LC));          
+            SVal SelfVal = St->getSVal(St->getRegion(SelfDecl, LC));
             if (L->getBaseRegion() == SelfVal.getAsRegion()) {
               // Update the summary to make the default argument effect
               // 'StopTracking'.
               Summ = Summaries.copySummary(Summ);
               Summ->setDefaultArgEffect(StopTracking);
             }
-          } 
+          }
         }
       }
     }
@@ -3070,18 +3069,18 @@
   }
 };
 } // end anonymous namespace
-  
 
-void CFRefCount::EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {  
-  // Are we storing to something that causes the value to "escape"?  
+
+void CFRefCount::EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {
+  // Are we storing to something that causes the value to "escape"?
   bool escapes = false;
-  
+
   // A value escapes in three possible cases (this may change):
   //
   // (1) we are binding to something that is not a memory region.
   // (2) we are binding to a memregion that does not have stack storage
   // (3) we are binding to a memregion with stack storage that the store
-  //     does not understand.  
+  //     does not understand.
   const GRState *state = B.getState();
 
   if (!isa<loc::MemRegionVal>(location))
@@ -3089,7 +3088,7 @@
   else {
     const MemRegion* R = cast<loc::MemRegionVal>(location).getRegion();
     escapes = !R->hasStackStorage();
-    
+
     if (!escapes) {
       // To test (3), generate a new state with the binding removed.  If it is
       // the same state, then it escapes (since the store cannot represent
@@ -3116,35 +3115,35 @@
                             GRStmtNodeBuilder& Builder,
                             ReturnStmt* S,
                             ExplodedNode* Pred) {
-  
+
   Expr* RetE = S->getRetValue();
   if (!RetE)
     return;
-  
+
   const GRState *state = Builder.GetState(Pred);
   SymbolRef Sym = state->getSValAsScalarOrLoc(RetE).getAsLocSymbol();
-  
+
   if (!Sym)
     return;
-  
+
   // Get the reference count binding (if any).
   const RefVal* T = state->get<RefBindings>(Sym);
-  
+
   if (!T)
     return;
-  
-  // Change the reference count.  
-  RefVal X = *T;  
-  
-  switch (X.getKind()) { 
-    case RefVal::Owned: { 
+
+  // Change the reference count.
+  RefVal X = *T;
+
+  switch (X.getKind()) {
+    case RefVal::Owned: {
       unsigned cnt = X.getCount();
       assert (cnt > 0);
       X.setCount(cnt - 1);
       X = X ^ RefVal::ReturnedOwned;
       break;
     }
-      
+
     case RefVal::NotOwned: {
       unsigned cnt = X.getCount();
       if (cnt) {
@@ -3156,39 +3155,39 @@
       }
       break;
     }
-      
-    default: 
+
+    default:
       return;
   }
-  
+
   // Update the binding.
   state = state->set<RefBindings>(Sym, X);
   Pred = Builder.MakeNode(Dst, S, Pred, state);
-  
+
   // Did we cache out?
   if (!Pred)
     return;
-  
+
   // Update the autorelease counts.
   static unsigned autoreleasetag = 0;
   GenericNodeBuilder Bd(Builder, S, &autoreleasetag);
   bool stop = false;
   llvm::tie(Pred, state) = HandleAutoreleaseCounts(state , Bd, Pred, Eng, Sym,
                                                    X, stop);
-  
+
   // Did we cache out?
   if (!Pred || stop)
     return;
-  
+
   // Get the updated binding.
   T = state->get<RefBindings>(Sym);
   assert(T);
   X = *T;
-    
+
   // Any leaks or other errors?
   if (X.isReturnedOwned() && X.getCount() == 0) {
-    const Decl *CD = Eng.getAnalysisManager().getCodeDecl();    
-    if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {      
+    const Decl *CD = Eng.getAnalysisManager().getCodeDecl();
+    if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
       const RetainSummary &Summ = *Summaries.getMethodSummary(MD);
       RetEffect RE = Summ.getRetEffect();
       bool hasError = false;
@@ -3200,20 +3199,20 @@
           // a leak (as the caller expects a GC'ed object) because no
           // method should return ownership unless it returns a CF object.
           X = X ^ RefVal::ErrorGCLeakReturned;
-          
+
           // Keep this false until this is properly tested.
           hasError = true;
         }
         else if (!RE.isOwned()) {
           // Either we are using GC and the returned object is a CF type
           // or we aren't using GC.  In either case, we expect that the
-          // enclosing method is expected to return ownership.        
+          // enclosing method is expected to return ownership.
           hasError = true;
           X = X ^ RefVal::ErrorLeakReturned;
         }
       }
-      
-      if (hasError) {        
+
+      if (hasError) {
         // Generate an error node.
         static int ReturnOwnLeakTag = 0;
         state = state->set<RefBindings>(Sym, X);
@@ -3227,16 +3226,16 @@
           BR->EmitReport(report);
         }
       }
-    } 
+    }
   }
   else if (X.isReturnedNotOwned()) {
-    const Decl *CD = Eng.getAnalysisManager().getCodeDecl();    
+    const Decl *CD = Eng.getAnalysisManager().getCodeDecl();
     if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
       const RetainSummary &Summ = *Summaries.getMethodSummary(MD);
       if (Summ.getRetEffect().isOwned()) {
         // Trying to return a not owned object to a caller expecting an
         // owned object.
-        
+
         static int ReturnNotOwnedForOwnedTag = 0;
         state = state->set<RefBindings>(Sym, X ^ RefVal::ErrorReturnedNotOwned);
         if (ExplodedNode *N =
@@ -3261,18 +3260,18 @@
   // FIXME: We may add to the interface of EvalAssume the list of symbols
   //  whose assumptions have changed.  For now we just iterate through the
   //  bindings and check if any of the tracked symbols are NULL.  This isn't
-  //  too bad since the number of symbols we will track in practice are 
+  //  too bad since the number of symbols we will track in practice are
   //  probably small and EvalAssume is only called at branches and a few
   //  other places.
   RefBindings B = state->get<RefBindings>();
-  
+
   if (B.isEmpty())
     return state;
-  
-  bool changed = false;  
+
+  bool changed = false;
   RefBindings::Factory& RefBFactory = state->get_context<RefBindings>();
 
-  for (RefBindings::iterator I=B.begin(), E=B.end(); I!=E; ++I) {    
+  for (RefBindings::iterator I=B.begin(), E=B.end(); I!=E; ++I) {
     // Check if the symbol is null (or equal to any constant).
     // If this is the case, stop tracking the symbol.
     if (state->getSymVal(I.getKey())) {
@@ -3280,10 +3279,10 @@
       B = RefBFactory.Remove(B, I.getKey());
     }
   }
-  
+
   if (changed)
     state = state->set<RefBindings>(B);
-  
+
   return state;
 }
 
@@ -3297,21 +3296,21 @@
     case IncRefMsg: E = isGCEnabled() ? DoNothing : IncRef; break;
     case DecRefMsg: E = isGCEnabled() ? DoNothing : DecRef; break;
     case MakeCollectable: E = isGCEnabled() ? DecRef : DoNothing; break;
-    case NewAutoreleasePool: E = isGCEnabled() ? DoNothing : 
+    case NewAutoreleasePool: E = isGCEnabled() ? DoNothing :
                                                  NewAutoreleasePool; break;
   }
-  
+
   // Handle all use-after-releases.
   if (!isGCEnabled() && V.getKind() == RefVal::Released) {
     V = V ^ RefVal::ErrorUseAfterRelease;
     hasErr = V.getKind();
     return state->set<RefBindings>(sym, V);
-  }      
-  
+  }
+
   switch (E) {
     default:
       assert (false && "Unhandled CFRef transition.");
-      
+
     case Dealloc:
       // Any use of -dealloc in GC is *bad*.
       if (isGCEnabled()) {
@@ -3319,7 +3318,7 @@
         hasErr = V.getKind();
         break;
       }
-      
+
       switch (V.getKind()) {
         default:
           assert(false && "Invalid case.");
@@ -3332,13 +3331,13 @@
           V = V ^ RefVal::ErrorDeallocNotOwned;
           hasErr = V.getKind();
           break;
-      }      
+      }
       break;
 
     case NewAutoreleasePool:
       assert(!isGCEnabled());
       return state->add<AutoreleaseStack>(sym);
-      
+
     case MayEscape:
       if (V.getKind() == RefVal::Owned) {
         V = V ^ RefVal::NotOwned;
@@ -3346,7 +3345,7 @@
       }
 
       // Fall-through.
-      
+
     case DoNothingByRef:
     case DoNothing:
       return state;
@@ -3354,7 +3353,7 @@
     case Autorelease:
       if (isGCEnabled())
         return state;
-      
+
       // Update the autorelease counts.
       state = SendAutorelease(state, ARCountFactory, sym);
       V = V.autorelease();
@@ -3363,7 +3362,7 @@
     case StopTracking:
       return state->remove<RefBindings>(sym);
 
-    case IncRef:      
+    case IncRef:
       switch (V.getKind()) {
         default:
           assert(false);
@@ -3371,15 +3370,15 @@
         case RefVal::Owned:
         case RefVal::NotOwned:
           V = V + 1;
-          break;          
+          break;
         case RefVal::Released:
           // Non-GC cases are handled above.
           assert(isGCEnabled());
           V = (V ^ RefVal::Owned) + 1;
           break;
-      }      
+      }
       break;
-      
+
     case SelfOwn:
       V = V ^ RefVal::NotOwned;
       // Fall-through.
@@ -3394,23 +3393,23 @@
           if (V.getCount() == 1) V = V ^ RefVal::Released;
           V = V - 1;
           break;
-          
+
         case RefVal::NotOwned:
           if (V.getCount() > 0)
             V = V - 1;
           else {
             V = V ^ RefVal::ErrorReleaseNotOwned;
             hasErr = V.getKind();
-          }          
+          }
           break;
-          
+
         case RefVal::Released:
           // Non-GC cases are handled above.
           assert(isGCEnabled());
           V = V ^ RefVal::ErrorUseAfterRelease;
           hasErr = V.getKind();
-          break;  
-      }      
+          break;
+      }
       break;
   }
   return state->set<RefBindings>(sym, V);
@@ -3425,22 +3424,22 @@
                                     ExplodedNode* Pred,
                                     GRExprEngine &Eng,
                                     SymbolRef Sym, RefVal V, bool &stop) {
- 
+
   unsigned ACnt = V.getAutoreleaseCount();
   stop = false;
 
   // No autorelease counts?  Nothing to be done.
   if (!ACnt)
     return std::make_pair(Pred, state);
-  
-  assert(!isGCEnabled() && "Autorelease counts in GC mode?");  
+
+  assert(!isGCEnabled() && "Autorelease counts in GC mode?");
   unsigned Cnt = V.getCount();
-  
+
   // FIXME: Handle sending 'autorelease' to already released object.
 
   if (V.getKind() == RefVal::ReturnedOwned)
     ++Cnt;
-  
+
   if (ACnt <= Cnt) {
     if (ACnt == Cnt) {
       V.clearCounts();
@@ -3457,7 +3456,7 @@
     ExplodedNode *N = Bd.MakeNode(state, Pred);
     stop = (N == 0);
     return std::make_pair(N, state);
-  }    
+  }
 
   // Woah!  More autorelease counts then retain counts left.
   // Emit hard error.
@@ -3467,7 +3466,7 @@
 
   if (ExplodedNode *N = Bd.MakeNode(state, Pred)) {
     N->markAsSink();
-    
+
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
     os << "Object over-autoreleased: object was sent -autorelease";
@@ -3479,26 +3478,26 @@
     else
       os << "+" << V.getCount();
     os << " retain counts";
-    
+
     CFRefReport *report =
       new CFRefReport(*static_cast<CFRefBug*>(overAutorelease),
                       *this, N, Sym, os.str().c_str());
     BR->EmitReport(report);
   }
-  
+
   return std::make_pair((ExplodedNode*)0, state);
 }
 
 const GRState *
 CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V,
                               llvm::SmallVectorImpl<SymbolRef> &Leaked) {
-  
-  bool hasLeak = V.isOwned() || 
+
+  bool hasLeak = V.isOwned() ||
   ((V.isNotOwned() || V.isReturnedOwned()) && V.getCount() > 0);
-  
+
   if (!hasLeak)
     return state->remove<RefBindings>(sid);
-  
+
   Leaked.push_back(sid);
   return state->set<RefBindings>(sid, V ^ RefVal::ErrorLeak);
 }
@@ -3509,49 +3508,49 @@
                          GenericNodeBuilder &Builder,
                          GRExprEngine& Eng,
                          ExplodedNode *Pred) {
-  
+
   if (Leaked.empty())
     return Pred;
-  
+
   // Generate an intermediate node representing the leak point.
   ExplodedNode *N = Builder.MakeNode(state, Pred);
-  
+
   if (N) {
     for (llvm::SmallVectorImpl<SymbolRef>::iterator
          I = Leaked.begin(), E = Leaked.end(); I != E; ++I) {
-      
-      CFRefBug *BT = static_cast<CFRefBug*>(Pred ? leakWithinFunction 
+
+      CFRefBug *BT = static_cast<CFRefBug*>(Pred ? leakWithinFunction
                                                  : leakAtReturn);
       assert(BT && "BugType not initialized.");
       CFRefLeakReport* report = new CFRefLeakReport(*BT, *this, N, *I, Eng);
       BR->EmitReport(report);
     }
   }
-  
+
   return N;
 }
 
 void CFRefCount::EvalEndPath(GRExprEngine& Eng,
                              GREndPathNodeBuilder& Builder) {
-  
+
   const GRState *state = Builder.getState();
   GenericNodeBuilder Bd(Builder);
-  RefBindings B = state->get<RefBindings>();  
+  RefBindings B = state->get<RefBindings>();
   ExplodedNode *Pred = 0;
 
   for (RefBindings::iterator I = B.begin(), E = B.end(); I != E; ++I) {
     bool stop = false;
     llvm::tie(Pred, state) = HandleAutoreleaseCounts(state, Bd, Pred, Eng,
                                                      (*I).first,
-                                                     (*I).second, stop);   
+                                                     (*I).second, stop);
 
     if (stop)
       return;
   }
-  
-  B = state->get<RefBindings>();  
-  llvm::SmallVector<SymbolRef, 10> Leaked;  
-  
+
+  B = state->get<RefBindings>();
+  llvm::SmallVector<SymbolRef, 10> Leaked;
+
   for (RefBindings::iterator I = B.begin(), E = B.end(); I != E; ++I)
     state = HandleSymbolDeath(state, (*I).first, (*I).second, Leaked);
 
@@ -3567,7 +3566,7 @@
                                  SymbolReaper& SymReaper) {
 
   RefBindings B = state->get<RefBindings>();
-  
+
   // Update counts from autorelease pools
   for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(),
        E = SymReaper.dead_end(); I != E; ++I) {
@@ -3583,32 +3582,32 @@
         return;
     }
   }
-  
+
   B = state->get<RefBindings>();
   llvm::SmallVector<SymbolRef, 10> Leaked;
-  
+
   for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(),
-       E = SymReaper.dead_end(); I != E; ++I) {    
+       E = SymReaper.dead_end(); I != E; ++I) {
       if (const RefVal* T = B.lookup(*I))
         state = HandleSymbolDeath(state, *I, *T, Leaked);
-  }    
-  
+  }
+
   static unsigned LeakPPTag = 0;
   {
     GenericNodeBuilder Bd(Builder, S, &LeakPPTag);
     Pred = ProcessLeaks(state, Leaked, Bd, Eng, Pred);
   }
-  
+
   // Did we cache out?
   if (!Pred)
     return;
-  
+
   // Now generate a new node that nukes the old bindings.
   RefBindings::Factory& F = state->get_context<RefBindings>();
-  
+
   for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(),
        E = SymReaper.dead_end(); I!=E; ++I) B = F.Remove(B, *I);
-  
+
   state = state->set<RefBindings>(B);
   Builder.MakeNode(Dst, S, Pred, state);
 }
@@ -3621,19 +3620,19 @@
                                      RefVal::Kind hasErr, SymbolRef Sym) {
   Builder.BuildSinks = true;
   ExplodedNode *N  = Builder.MakeNode(Dst, NodeExpr, Pred, St);
-  
+
   if (!N)
     return;
-  
+
   CFRefBug *BT = 0;
-  
+
   switch (hasErr) {
     default:
       assert(false && "Unhandled error.");
       return;
     case RefVal::ErrorUseAfterRelease:
       BT = static_cast<CFRefBug*>(useAfterRelease);
-      break;      
+      break;
     case RefVal::ErrorReleaseNotOwned:
       BT = static_cast<CFRefBug*>(releaseNotOwned);
       break;
@@ -3644,7 +3643,7 @@
       BT = static_cast<CFRefBug*>(deallocNotOwned);
       break;
   }
-    
+
   CFRefReport *report = new CFRefReport(*BT, *this, N, Sym);
   report->addRange(ErrorExpr->getSourceRange());
   BR->EmitReport(report);
@@ -3657,4 +3656,4 @@
 GRTransferFuncs* clang::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
                                          const LangOptions& lopts) {
   return new CFRefCount(Ctx, GCEnabled, lopts);
-}  
+}

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

==============================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/CallGraph.cpp Wed Sep  9 10:08:12 2009
@@ -41,8 +41,8 @@
 
   void VisitChildren(Stmt *S) {
     for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I != E;++I)
-      if (*I) 
-        static_cast<CGBuilder*>(this)->Visit(*I);    
+      if (*I)
+        static_cast<CGBuilder*>(this)->Visit(*I);
   }
 };
 }
@@ -53,7 +53,7 @@
     CallGraphNode *CalleeNode = G.getOrInsertFunction(Ent);
 
     Decl *Parent = ASTLocation::FindImmediateParent(FD, CE);
-    
+
     CallerNode->addCallee(ASTLocation(Parent, CE), CalleeNode);
   }
 }
@@ -92,7 +92,7 @@
         // Set root node to 'main' function.
         if (FD->getNameAsString() == "main")
           Root = Node;
-        
+
         CGBuilder builder(*this, FD, Ent, Node);
         builder.Visit(FD->getBody());
       }
@@ -118,9 +118,9 @@
 void CallGraph::print(llvm::raw_ostream &os) {
   for (iterator I = begin(), E = end(); I != E; ++I) {
     if (I->second->hasCallee()) {
-      os << "function: " << I->first.getPrintableName() 
+      os << "function: " << I->first.getPrintableName()
          << " calls:\n";
-      for (CallGraphNode::iterator CI = I->second->begin(), 
+      for (CallGraphNode::iterator CI = I->second->begin(),
              CE = I->second->end(); CI != CE; ++CI) {
         os << "    " << CI->second->getName().c_str();
       }
@@ -139,13 +139,13 @@
 
 namespace llvm {
 
-template <> 
+template <>
 struct DOTGraphTraits<CallGraph> : public DefaultDOTGraphTraits {
 
-  static std::string getNodeLabel(const CallGraphNode *Node, 
+  static std::string getNodeLabel(const CallGraphNode *Node,
                                   const CallGraph &CG, bool ShortNames) {
     return Node->getName();
-    
+
   }
 
 };

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckDeadStores.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckDeadStores.cpp Wed Sep  9 10:08:12 2009
@@ -33,14 +33,14 @@
   BugReporter& BR;
   ParentMap& Parents;
   llvm::SmallPtrSet<VarDecl*, 20> Escaped;
-  
+
   enum DeadStoreKind { Standard, Enclosing, DeadIncrement, DeadInit };
-    
+
 public:
   DeadStoreObs(ASTContext &ctx, BugReporter& br, ParentMap& parents,
                llvm::SmallPtrSet<VarDecl*, 20> &escaped)
     : Ctx(ctx), BR(br), Parents(parents), Escaped(escaped) {}
-  
+
   virtual ~DeadStoreObs() {}
 
   void Report(VarDecl* V, DeadStoreKind dsk, SourceLocation L, SourceRange R) {
@@ -48,27 +48,27 @@
       return;
 
     std::string name = V->getNameAsString();
-    
+
     const char* BugType = 0;
     std::string msg;
-    
+
     switch (dsk) {
       default:
         assert(false && "Impossible dead store type.");
-        
+
       case DeadInit:
         BugType = "Dead initialization";
         msg = "Value stored to '" + name +
           "' during its initialization is never read";
         break;
-        
+
       case DeadIncrement:
         BugType = "Dead increment";
       case Standard:
         if (!BugType) BugType = "Dead assignment";
         msg = "Value stored to '" + name + "' is never read";
         break;
-        
+
       case Enclosing:
         BugType = "Dead nested assignment";
         msg = "Although the value stored to '" + name +
@@ -76,10 +76,10 @@
           " read from '" + name + "'";
         break;
     }
-      
-    BR.EmitBasicReport(BugType, "Dead store", msg.c_str(), L, R);      
+
+    BR.EmitBasicReport(BugType, "Dead store", msg.c_str(), L, R);
   }
-  
+
   void CheckVarDecl(VarDecl* VD, Expr* Ex, Expr* Val,
                     DeadStoreKind dsk,
                     const LiveVariables::AnalysisDataTy& AD,
@@ -87,60 +87,60 @@
 
     if (VD->hasLocalStorage() && !Live(VD, AD) && !VD->getAttr<UnusedAttr>())
       Report(VD, dsk, Ex->getSourceRange().getBegin(),
-             Val->getSourceRange());      
+             Val->getSourceRange());
   }
-  
+
   void CheckDeclRef(DeclRefExpr* DR, Expr* Val, DeadStoreKind dsk,
                     const LiveVariables::AnalysisDataTy& AD,
                     const LiveVariables::ValTy& Live) {
-    
+
     if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl()))
       CheckVarDecl(VD, DR, Val, dsk, AD, Live);
   }
-  
+
   bool isIncrement(VarDecl* VD, BinaryOperator* B) {
     if (B->isCompoundAssignmentOp())
       return true;
-    
+
     Expr* RHS = B->getRHS()->IgnoreParenCasts();
     BinaryOperator* BRHS = dyn_cast<BinaryOperator>(RHS);
-    
+
     if (!BRHS)
       return false;
-    
+
     DeclRefExpr *DR;
-    
+
     if ((DR = dyn_cast<DeclRefExpr>(BRHS->getLHS()->IgnoreParenCasts())))
       if (DR->getDecl() == VD)
         return true;
-    
+
     if ((DR = dyn_cast<DeclRefExpr>(BRHS->getRHS()->IgnoreParenCasts())))
       if (DR->getDecl() == VD)
         return true;
-    
+
     return false;
   }
-  
+
   virtual void ObserveStmt(Stmt* S,
                            const LiveVariables::AnalysisDataTy& AD,
                            const LiveVariables::ValTy& Live) {
-    
+
     // Skip statements in macros.
     if (S->getLocStart().isMacroID())
       return;
-    
-    if (BinaryOperator* B = dyn_cast<BinaryOperator>(S)) {    
+
+    if (BinaryOperator* B = dyn_cast<BinaryOperator>(S)) {
       if (!B->isAssignmentOp()) return; // Skip non-assignments.
-      
+
       if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS()))
         if (VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
           Expr* RHS = B->getRHS()->IgnoreParenCasts();
-          
+
           // Special case: check for assigning null to a pointer.
-          //  This is a common form of defensive programming.          
+          //  This is a common form of defensive programming.
           if (VD->getType()->isPointerType()) {
             if (IntegerLiteral* L = dyn_cast<IntegerLiteral>(RHS))
-              // FIXME: Probably should have an Expr::isNullPointerConstant.              
+              // FIXME: Probably should have an Expr::isNullPointerConstant.
               if (L->getValue() == 0)
                 return;
           }
@@ -149,19 +149,19 @@
           if (DeclRefExpr* RhsDR = dyn_cast<DeclRefExpr>(RHS))
             if (VD == dyn_cast<VarDecl>(RhsDR->getDecl()))
               return;
-            
+
           // Otherwise, issue a warning.
           DeadStoreKind dsk = Parents.isConsumedExpr(B)
-                              ? Enclosing 
+                              ? Enclosing
                               : (isIncrement(VD,B) ? DeadIncrement : Standard);
-          
+
           CheckVarDecl(VD, DR, B->getRHS(), dsk, AD, Live);
-        }              
+        }
     }
     else if (UnaryOperator* U = dyn_cast<UnaryOperator>(S)) {
       if (!U->isIncrementOp())
         return;
-      
+
       // Handle: ++x within a subexpression.  The solution is not warn
       //  about preincrements to dead variables when the preincrement occurs
       //  as a subexpression.  This can lead to false negatives, e.g. "(++x);"
@@ -170,21 +170,21 @@
         return;
 
       Expr *Ex = U->getSubExpr()->IgnoreParenCasts();
-      
+
       if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(Ex))
         CheckDeclRef(DR, U, DeadIncrement, AD, Live);
-    }    
+    }
     else if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
       // Iterate through the decls.  Warn if any initializers are complex
       // expressions that are not live (never used).
       for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
            DI != DE; ++DI) {
-        
+
         VarDecl* V = dyn_cast<VarDecl>(*DI);
 
         if (!V)
           continue;
-        
+
         if (V->hasLocalStorage())
           if (Expr* E = V->getInit()) {
             // A dead initialization is a variable that is dead after it
@@ -200,7 +200,7 @@
               // due to defensive programming.
               if (E->isConstantInitializer(Ctx))
                 return;
-              
+
               // Special case: check for initializations from constant
               //  variables.
               //
@@ -211,14 +211,14 @@
                 if (VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl()))
                   if (VD->hasGlobalStorage() &&
                       VD->getType().isConstQualified()) return;
-              
+
               Report(V, DeadInit, V->getLocation(), E->getSourceRange());
             }
           }
       }
   }
 };
-  
+
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
@@ -230,9 +230,9 @@
   CFG *cfg;
 public:
   FindEscaped(CFG *c) : cfg(c) {}
-  
+
   CFG& getCFG() { return *cfg; }
-  
+
   llvm::SmallPtrSet<VarDecl*, 20> Escaped;
 
   void VisitUnaryOperator(UnaryOperator* U) {
@@ -249,11 +249,11 @@
   }
 };
 } // end anonymous namespace
-  
+
 
 void clang::CheckDeadStores(LiveVariables& L, BugReporter& BR) {
   FindEscaped FS(BR.getCFG());
-  FS.getCFG().VisitBlockStmts(FS);  
+  FS.getCFG().VisitBlockStmts(FS);
   DeadStoreObs A(BR.getContext(), BR, BR.getParentMap(), FS.Escaped);
   L.runOnAllBlocks(*BR.getCFG(), &A);
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckNSError.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckNSError.cpp Wed Sep  9 10:08:12 2009
@@ -32,37 +32,37 @@
   const bool isNSErrorWarning;
   IdentifierInfo * const II;
   GRExprEngine &Eng;
-  
+
   void CheckSignature(const ObjCMethodDecl& MD, QualType& ResultTy,
                       llvm::SmallVectorImpl<VarDecl*>& ErrorParams);
-  
+
   void CheckSignature(const FunctionDecl& MD, QualType& ResultTy,
                       llvm::SmallVectorImpl<VarDecl*>& ErrorParams);
 
   bool CheckNSErrorArgument(QualType ArgTy);
   bool CheckCFErrorArgument(QualType ArgTy);
-  
+
   void CheckParamDeref(const VarDecl *V, const LocationContext *LC,
                        const GRState *state, BugReporter& BR);
-  
+
   void EmitRetTyWarning(BugReporter& BR, const Decl& CodeDecl);
-  
+
 public:
   NSErrorCheck(const Decl &D, bool isNSError, GRExprEngine& eng)
-    : BugType(isNSError ? "NSError** null dereference" 
+    : BugType(isNSError ? "NSError** null dereference"
                         : "CFErrorRef* null dereference",
               "Coding conventions (Apple)"),
     CodeDecl(D),
-    isNSErrorWarning(isNSError), 
+    isNSErrorWarning(isNSError),
     II(&eng.getContext().Idents.get(isNSErrorWarning ? "NSError":"CFErrorRef")),
     Eng(eng) {}
-  
+
   void FlushReports(BugReporter& BR);
-};  
-  
+};
+
 } // end anonymous namespace
 
-void clang::RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng, 
+void clang::RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng,
                                   const Decl &D) {
   BR.Register(new NSErrorCheck(D, true, Eng));
   BR.Register(new NSErrorCheck(D, false, Eng));
@@ -71,7 +71,7 @@
 void NSErrorCheck::FlushReports(BugReporter& BR) {
   // Get the analysis engine and the exploded analysis graph.
   ExplodedGraph& G = Eng.getGraph();
-  
+
   // Get the ASTContext, which is useful for querying type information.
   ASTContext &Ctx = BR.getContext();
 
@@ -84,17 +84,17 @@
     CheckSignature(*FD, ResultTy, ErrorParams);
   else
     return;
-  
+
   if (ErrorParams.empty())
     return;
-  
+
   if (ResultTy == Ctx.VoidTy) EmitRetTyWarning(BR, CodeDecl);
-  
-  for (ExplodedGraph::roots_iterator RI=G.roots_begin(), RE=G.roots_end(); 
+
+  for (ExplodedGraph::roots_iterator RI=G.roots_begin(), RE=G.roots_end();
        RI!=RE; ++RI) {
     // Scan the parameters for an implicit null dereference.
     for (llvm::SmallVectorImpl<VarDecl*>::iterator I=ErrorParams.begin(),
-          E=ErrorParams.end(); I!=E; ++I)    
+          E=ErrorParams.end(); I!=E; ++I)
         CheckParamDeref(*I, (*RI)->getLocationContext(), (*RI)->getState(), BR);
   }
 }
@@ -102,17 +102,17 @@
 void NSErrorCheck::EmitRetTyWarning(BugReporter& BR, const Decl& CodeDecl) {
   std::string sbuf;
   llvm::raw_string_ostream os(sbuf);
-  
+
   if (isa<ObjCMethodDecl>(CodeDecl))
     os << "Method";
   else
-    os << "Function";      
-  
+    os << "Function";
+
   os << " accepting ";
   os << (isNSErrorWarning ? "NSError**" : "CFErrorRef*");
   os << " should have a non-void return value to indicate whether or not an "
         "error occurred";
-  
+
   BR.EmitBasicReport(isNSErrorWarning
                      ? "Bad return type when passing NSError**"
                      : "Bad return type when passing CFError*",
@@ -125,11 +125,11 @@
                              llvm::SmallVectorImpl<VarDecl*>& ErrorParams) {
 
   ResultTy = M.getResultType();
-  
-  for (ObjCMethodDecl::param_iterator I=M.param_begin(), 
+
+  for (ObjCMethodDecl::param_iterator I=M.param_begin(),
        E=M.param_end(); I!=E; ++I)  {
 
-    QualType T = (*I)->getType();    
+    QualType T = (*I)->getType();
 
     if (isNSErrorWarning) {
       if (CheckNSErrorArgument(T)) ErrorParams.push_back(*I);
@@ -142,14 +142,14 @@
 void
 NSErrorCheck::CheckSignature(const FunctionDecl& F, QualType& ResultTy,
                              llvm::SmallVectorImpl<VarDecl*>& ErrorParams) {
-  
+
   ResultTy = F.getResultType();
-  
-  for (FunctionDecl::param_const_iterator I = F.param_begin(), 
+
+  for (FunctionDecl::param_const_iterator I = F.param_begin(),
                                           E = F.param_end(); I != E; ++I)  {
-    
-    QualType T = (*I)->getType();    
-    
+
+    QualType T = (*I)->getType();
+
     if (isNSErrorWarning) {
       if (CheckNSErrorArgument(T)) ErrorParams.push_back(*I);
     }
@@ -160,31 +160,31 @@
 
 
 bool NSErrorCheck::CheckNSErrorArgument(QualType ArgTy) {
-  
+
   const PointerType* PPT = ArgTy->getAs<PointerType>();
   if (!PPT)
     return false;
-  
+
   const ObjCObjectPointerType* PT =
     PPT->getPointeeType()->getAsObjCObjectPointerType();
 
   if (!PT)
     return false;
-  
+
   const ObjCInterfaceDecl *ID = PT->getInterfaceDecl();
-  
+
   // FIXME: Can ID ever be NULL?
   if (ID)
     return II == ID->getIdentifier();
-  
+
   return false;
 }
 
 bool NSErrorCheck::CheckCFErrorArgument(QualType ArgTy) {
-  
+
   const PointerType* PPT = ArgTy->getAs<PointerType>();
   if (!PPT) return false;
-  
+
   const TypedefType* TT = PPT->getPointeeType()->getAsTypedefType();
   if (!TT) return false;
 
@@ -195,24 +195,24 @@
                                    const LocationContext *LC,
                                    const GRState *rootState,
                                    BugReporter& BR) {
-  
+
   SVal ParamL = rootState->getLValue(Param, LC);
   const MemRegion* ParamR = cast<loc::MemRegionVal>(ParamL).getRegionAs<VarRegion>();
   assert (ParamR && "Parameters always have VarRegions.");
   SVal ParamSVal = rootState->getSVal(ParamR);
-  
+
   // FIXME: For now assume that ParamSVal is symbolic.  We need to generalize
   // this later.
   SymbolRef ParamSym = ParamSVal.getAsLocSymbol();
   if (!ParamSym)
     return;
-  
+
   // Iterate over the implicit-null dereferences.
   for (GRExprEngine::null_deref_iterator I=Eng.implicit_null_derefs_begin(),
        E=Eng.implicit_null_derefs_end(); I!=E; ++I) {
-    
+
     const GRState *state = (*I)->getState();
-    const SVal* X = state->get<GRState::NullDerefTag>();    
+    const SVal* X = state->get<GRState::NullDerefTag>();
 
     if (!X || X->getAsSymbol() != ParamSym)
       continue;
@@ -221,14 +221,14 @@
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
       os << "Potential null dereference.  According to coding standards ";
-    
+
     if (isNSErrorWarning)
       os << "in 'Creating and Returning NSError Objects' the parameter '";
     else
       os << "documented in CoreFoundation/CFError.h the parameter '";
-    
+
     os << Param->getNameAsString() << "' may be null.";
-    
+
     BugReport *report = new BugReport(*this, os.str().c_str(), *I);
     // FIXME: Notable symbols are now part of the report.  We should
     //  add support for notable symbols in BugReport.

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp Wed Sep  9 10:08:12 2009
@@ -24,11 +24,11 @@
 
 using namespace clang;
 
-static bool scan_dealloc(Stmt* S, Selector Dealloc) {  
-  
+static bool scan_dealloc(Stmt* S, Selector Dealloc) {
+
   if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
     if (ME->getSelector() == Dealloc)
-      if(ME->getReceiver())
+      if (ME->getReceiver())
         if (Expr* Receiver = ME->getReceiver()->IgnoreParenCasts())
           return isa<ObjCSuperExpr>(Receiver);
 
@@ -37,20 +37,20 @@
   for (Stmt::child_iterator I = S->child_begin(), E= S->child_end(); I!=E; ++I)
     if (*I && scan_dealloc(*I, Dealloc))
       return true;
-  
+
   return false;
 }
 
-static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID, 
-                              const ObjCPropertyDecl* PD, 
-                              Selector Release, 
+static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
+                              const ObjCPropertyDecl* PD,
+                              Selector Release,
                               IdentifierInfo* SelfII,
-                              ASTContext& Ctx) {  
-  
+                              ASTContext& Ctx) {
+
   // [mMyIvar release]
   if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
     if (ME->getSelector() == Release)
-      if(ME->getReceiver())
+      if (ME->getReceiver())
         if (Expr* Receiver = ME->getReceiver()->IgnoreParenCasts())
           if (ObjCIvarRefExpr* E = dyn_cast<ObjCIvarRefExpr>(Receiver))
             if (E->getDecl() == ID)
@@ -58,7 +58,7 @@
 
   // [self setMyIvar:nil];
   if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
-    if(ME->getReceiver())
+    if (ME->getReceiver())
       if (Expr* Receiver = ME->getReceiver()->IgnoreParenCasts())
         if (DeclRefExpr* E = dyn_cast<DeclRefExpr>(Receiver))
           if (E->getDecl()->getIdentifier() == SelfII)
@@ -66,19 +66,19 @@
                 ME->getNumArgs() == 1 &&
                 ME->getArg(0)->isNullPointerConstant(Ctx))
               return true;
-  
+
   // self.myIvar = nil;
   if (BinaryOperator* BO = dyn_cast<BinaryOperator>(S))
     if (BO->isAssignmentOp())
-      if(ObjCPropertyRefExpr* PRE = 
+      if (ObjCPropertyRefExpr* PRE =
          dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
-          if(PRE->getProperty() == PD)
-            if(BO->getRHS()->isNullPointerConstant(Ctx)) {
+          if (PRE->getProperty() == PD)
+            if (BO->getRHS()->isNullPointerConstant(Ctx)) {
               // This is only a 'release' if the property kind is not
               // 'assign'.
               return PD->getSetterKind() != ObjCPropertyDecl::Assign;;
             }
-  
+
   // Recurse to children.
   for (Stmt::child_iterator I = S->child_begin(), E= S->child_end(); I!=E; ++I)
     if (*I && scan_ivar_release(*I, ID, PD, Release, SelfII, Ctx))
@@ -91,39 +91,39 @@
                              const LangOptions& LOpts, BugReporter& BR) {
 
   assert (LOpts.getGCMode() != LangOptions::GCOnly);
-  
+
   ASTContext& Ctx = BR.getContext();
   const ObjCInterfaceDecl* ID = D->getClassInterface();
-    
+
   // Does the class contain any ivars that are pointers (or id<...>)?
   // If not, skip the check entirely.
   // NOTE: This is motivated by PR 2517:
   //        http://llvm.org/bugs/show_bug.cgi?id=2517
-  
+
   bool containsPointerIvar = false;
-  
+
   for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end();
        I!=E; ++I) {
-    
+
     ObjCIvarDecl* ID = *I;
     QualType T = ID->getType();
-    
+
     if (!T->isObjCObjectPointerType() ||
         ID->getAttr<IBOutletAttr>()) // Skip IBOutlets.
       continue;
-    
+
     containsPointerIvar = true;
     break;
   }
-  
+
   if (!containsPointerIvar)
     return;
-  
+
   // Determine if the class subclasses NSObject.
   IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
   IdentifierInfo* SenTestCaseII = &Ctx.Idents.get("SenTestCase");
 
-  
+
   for ( ; ID ; ID = ID->getSuperClass()) {
     IdentifierInfo *II = ID->getIdentifier();
 
@@ -137,118 +137,118 @@
     if (II == SenTestCaseII)
       return;
   }
-    
+
   if (!ID)
     return;
-  
+
   // Get the "dealloc" selector.
   IdentifierInfo* II = &Ctx.Idents.get("dealloc");
-  Selector S = Ctx.Selectors.getSelector(0, &II);  
+  Selector S = Ctx.Selectors.getSelector(0, &II);
   ObjCMethodDecl* MD = 0;
-  
+
   // Scan the instance methods for "dealloc".
   for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(),
        E = D->instmeth_end(); I!=E; ++I) {
-    
+
     if ((*I)->getSelector() == S) {
       MD = *I;
       break;
-    }    
+    }
   }
-  
+
   if (!MD) { // No dealloc found.
-    
-    const char* name = LOpts.getGCMode() == LangOptions::NonGC 
-                       ? "missing -dealloc" 
+
+    const char* name = LOpts.getGCMode() == LangOptions::NonGC
+                       ? "missing -dealloc"
                        : "missing -dealloc (Hybrid MM, non-GC)";
-    
+
     std::string buf;
     llvm::raw_string_ostream os(buf);
     os << "Objective-C class '" << D->getNameAsString()
        << "' lacks a 'dealloc' instance method";
-    
+
     BR.EmitBasicReport(name, os.str().c_str(), D->getLocStart());
     return;
   }
-  
+
   // dealloc found.  Scan for missing [super dealloc].
   if (MD->getBody() && !scan_dealloc(MD->getBody(), S)) {
-    
+
     const char* name = LOpts.getGCMode() == LangOptions::NonGC
                        ? "missing [super dealloc]"
                        : "missing [super dealloc] (Hybrid MM, non-GC)";
-    
+
     std::string buf;
     llvm::raw_string_ostream os(buf);
     os << "The 'dealloc' instance method in Objective-C class '"
        << D->getNameAsString()
        << "' does not send a 'dealloc' message to its super class"
            " (missing [super dealloc])";
-    
+
     BR.EmitBasicReport(name, os.str().c_str(), D->getLocStart());
     return;
-  }   
-  
+  }
+
   // Get the "release" selector.
   IdentifierInfo* RII = &Ctx.Idents.get("release");
-  Selector RS = Ctx.Selectors.getSelector(0, &RII);  
-  
+  Selector RS = Ctx.Selectors.getSelector(0, &RII);
+
   // Get the "self" identifier
   IdentifierInfo* SelfII = &Ctx.Idents.get("self");
-  
+
   // Scan for missing and extra releases of ivars used by implementations
   // of synthesized properties
   for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(),
        E = D->propimpl_end(); I!=E; ++I) {
 
     // We can only check the synthesized properties
-    if((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize)
+    if ((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize)
       continue;
-    
+
     ObjCIvarDecl* ID = (*I)->getPropertyIvarDecl();
     if (!ID)
       continue;
-    
+
     QualType T = ID->getType();
     if (!T->isObjCObjectPointerType()) // Skip non-pointer ivars
       continue;
 
     const ObjCPropertyDecl* PD = (*I)->getPropertyDecl();
-    if(!PD)
+    if (!PD)
       continue;
-    
+
     // ivars cannot be set via read-only properties, so we'll skip them
-    if(PD->isReadOnly())
+    if (PD->isReadOnly())
        continue;
-              
+
     // ivar must be released if and only if the kind of setter was not 'assign'
     bool requiresRelease = PD->getSetterKind() != ObjCPropertyDecl::Assign;
-    if(scan_ivar_release(MD->getBody(), ID, PD, RS, SelfII, Ctx) 
+    if (scan_ivar_release(MD->getBody(), ID, PD, RS, SelfII, Ctx)
        != requiresRelease) {
       const char *name;
       const char* category = "Memory (Core Foundation/Objective-C)";
-      
+
       std::string buf;
       llvm::raw_string_ostream os(buf);
 
-      if(requiresRelease) {
+      if (requiresRelease) {
         name = LOpts.getGCMode() == LangOptions::NonGC
                ? "missing ivar release (leak)"
                : "missing ivar release (Hybrid MM, non-GC)";
-        
+
         os << "The '" << ID->getNameAsString()
            << "' instance variable was retained by a synthesized property but "
-              "wasn't released in 'dealloc'";        
+              "wasn't released in 'dealloc'";
       } else {
         name = LOpts.getGCMode() == LangOptions::NonGC
                ? "extra ivar release (use-after-release)"
                : "extra ivar release (Hybrid MM, non-GC)";
-        
+
         os << "The '" << ID->getNameAsString()
            << "' instance variable was not retained by a synthesized property "
               "but was released in 'dealloc'";
       }
-      
+
       BR.EmitBasicReport(name, category,
                          os.str().c_str(), (*I)->getLocation());
     }

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckObjCInstMethSignature.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckObjCInstMethSignature.cpp Wed Sep  9 10:08:12 2009
@@ -40,14 +40,14 @@
                                const ObjCMethodDecl *MethAncestor,
                                BugReporter &BR, ASTContext &Ctx,
                                const ObjCImplementationDecl *ID) {
-    
+
   QualType ResDerived  = MethDerived->getResultType();
-  QualType ResAncestor = MethAncestor->getResultType(); 
-  
+  QualType ResAncestor = MethAncestor->getResultType();
+
   if (!AreTypesCompatible(ResDerived, ResAncestor, Ctx)) {
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
-    
+
     os << "The Objective-C class '"
        << MethDerived->getClassInterface()->getNameAsString()
        << "', which is derived from class '"
@@ -63,7 +63,7 @@
        << ResAncestor.getAsString()
        << "'.  These two types are incompatible, and may result in undefined "
           "behavior for clients of these classes.";
-    
+
     BR.EmitBasicReport("Incompatible instance method return type",
                        os.str().c_str(), MethDerived->getLocStart());
   }
@@ -71,23 +71,23 @@
 
 void clang::CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
                                        BugReporter& BR) {
-  
+
   const ObjCInterfaceDecl* D = ID->getClassInterface();
   const ObjCInterfaceDecl* C = D->getSuperClass();
 
   if (!C)
     return;
-  
+
   ASTContext& Ctx = BR.getContext();
-  
+
   // Build a DenseMap of the methods for quick querying.
   typedef llvm::DenseMap<Selector,ObjCMethodDecl*> MapTy;
   MapTy IMeths;
   unsigned NumMethods = 0;
-  
+
   for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(),
-       E=ID->instmeth_end(); I!=E; ++I) {    
-    
+       E=ID->instmeth_end(); I!=E; ++I) {
+
     ObjCMethodDecl* M = *I;
     IMeths[M->getSelector()] = M;
     ++NumMethods;
@@ -101,19 +101,19 @@
 
       ObjCMethodDecl* M = *I;
       Selector S = M->getSelector();
-      
+
       MapTy::iterator MI = IMeths.find(S);
 
       if (MI == IMeths.end() || MI->second == 0)
         continue;
-      
+
       --NumMethods;
       ObjCMethodDecl* MethDerived = MI->second;
       MI->second = 0;
-      
+
       CompareReturnTypes(MethDerived, M, BR, Ctx, ID);
     }
-    
+
     C = C->getSuperClass();
   }
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckObjCUnusedIVars.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckObjCUnusedIVars.cpp Wed Sep  9 10:08:12 2009
@@ -29,7 +29,7 @@
 static void Scan(IvarUsageMap& M, const Stmt* S) {
   if (!S)
     return;
-  
+
   if (const ObjCIvarRefExpr *Ex = dyn_cast<ObjCIvarRefExpr>(S)) {
     const ObjCIvarDecl *D = Ex->getDecl();
     IvarUsageMap::iterator I = M.find(D);
@@ -37,7 +37,7 @@
       I->second = Used;
     return;
   }
-  
+
   // Blocks can reference an instance variable of a class.
   if (const BlockExpr *BE = dyn_cast<BlockExpr>(S)) {
     Scan(M, BE->getBody());
@@ -51,12 +51,12 @@
 static void Scan(IvarUsageMap& M, const ObjCPropertyImplDecl* D) {
   if (!D)
     return;
-  
+
   const ObjCIvarDecl* ID = D->getPropertyIvarDecl();
 
   if (!ID)
     return;
-  
+
   IvarUsageMap::iterator I = M.find(ID);
   if (I != M.end())
     I->second = Used;
@@ -71,9 +71,9 @@
   // Iterate over the ivars.
   for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(),
         E=ID->ivar_end(); I!=E; ++I) {
-    
+
     const ObjCIvarDecl* ID = *I;
-    
+
     // Ignore ivars that aren't private.
     if (ID->getAccessControl() != ObjCIvarDecl::Private)
       continue;
@@ -81,31 +81,31 @@
     // Skip IB Outlets.
     if (ID->getAttr<IBOutletAttr>())
       continue;
-    
+
     M[ID] = Unused;
   }
 
   if (M.empty())
     return;
-  
+
   // Now scan the methods for accesses.
   for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(),
         E = D->instmeth_end(); I!=E; ++I)
     Scan(M, (*I)->getBody());
-  
+
   // Scan for @synthesized property methods that act as setters/getters
   // to an ivar.
   for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(),
        E = D->propimpl_end(); I!=E; ++I)
-    Scan(M, *I);  
-  
+    Scan(M, *I);
+
   // Find ivars that are unused.
   for (IvarUsageMap::iterator I = M.begin(), E = M.end(); I!=E; ++I)
     if (I->second == Unused) {
       std::string sbuf;
       llvm::raw_string_ostream os(sbuf);
       os << "Instance variable '" << I->first->getNameAsString()
-         << "' in class '" << ID->getNameAsString() 
+         << "' in class '" << ID->getNameAsString()
          << "' is never used by the methods in its @implementation "
             "(although it may be used by category methods).";
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/CheckSecuritySyntaxOnly.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckSecuritySyntaxOnly.cpp Wed Sep  9 10:08:12 2009
@@ -21,18 +21,18 @@
 
 namespace {
 class VISIBILITY_HIDDEN WalkAST : public StmtVisitor<WalkAST> {
-  BugReporter &BR;  
+  BugReporter &BR;
   IdentifierInfo *II_gets;
   enum { num_rands = 9 };
   IdentifierInfo *II_rand[num_rands];
   IdentifierInfo *II_random;
   enum { num_setids = 6 };
   IdentifierInfo *II_setid[num_setids];
-  
+
 public:
   WalkAST(BugReporter &br) : BR(br),
     II_gets(0), II_rand(), II_random(0), II_setid() {}
-  
+
   // Statement visitor methods.
   void VisitCallExpr(CallExpr *CE);
   void VisitForStmt(ForStmt *S);
@@ -40,10 +40,10 @@
   void VisitStmt(Stmt *S) { VisitChildren(S); }
 
   void VisitChildren(Stmt *S);
-  
+
   // Helpers.
   IdentifierInfo *GetIdentifier(IdentifierInfo *& II, const char *str);
-    
+
   // Checker-specific methods.
   void CheckLoopConditionForFloat(const ForStmt *FS);
   void CheckCall_gets(const CallExpr *CE, const FunctionDecl *FD);
@@ -60,8 +60,8 @@
 IdentifierInfo *WalkAST::GetIdentifier(IdentifierInfo *& II, const char *str) {
   if (!II)
     II = &BR.getContext().Idents.get(str);
-  
-  return II;  
+
+  return II;
 }
 
 //===----------------------------------------------------------------------===//
@@ -80,23 +80,22 @@
     CheckCall_rand(CE, FD);
     CheckCall_random(CE, FD);
   }
-  
+
   // Recurse and check children.
   VisitChildren(CE);
 }
 
 void WalkAST::VisitCompoundStmt(CompoundStmt *S) {
   for (Stmt::child_iterator I = S->child_begin(), E = S->child_end(); I!=E; ++I)
-    if (Stmt *child = *I)
-      {
-	if (CallExpr *CE = dyn_cast<CallExpr>(child))
-	  CheckUncheckedReturnValue(CE);
-	Visit(child);
-      }
+    if (Stmt *child = *I) {
+      if (CallExpr *CE = dyn_cast<CallExpr>(child))
+        CheckUncheckedReturnValue(CE);
+      Visit(child);
+    }
 }
 
 void WalkAST::VisitForStmt(ForStmt *FS) {
-  CheckLoopConditionForFloat(FS);  
+  CheckLoopConditionForFloat(FS);
 
   // Recurse and check children.
   VisitChildren(FS);
@@ -111,26 +110,26 @@
 static const DeclRefExpr*
 GetIncrementedVar(const Expr *expr, const VarDecl *x, const VarDecl *y) {
   expr = expr->IgnoreParenCasts();
-  
-  if (const BinaryOperator *B = dyn_cast<BinaryOperator>(expr)) {      
+
+  if (const BinaryOperator *B = dyn_cast<BinaryOperator>(expr)) {
     if (!(B->isAssignmentOp() || B->isCompoundAssignmentOp() ||
           B->getOpcode() == BinaryOperator::Comma))
       return NULL;
-      
+
     if (const DeclRefExpr *lhs = GetIncrementedVar(B->getLHS(), x, y))
       return lhs;
-      
+
     if (const DeclRefExpr *rhs = GetIncrementedVar(B->getRHS(), x, y))
       return rhs;
-      
+
     return NULL;
   }
-    
+
   if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(expr)) {
     const NamedDecl *ND = DR->getDecl();
     return ND == x || ND == y ? DR : NULL;
   }
-   
+
   if (const UnaryOperator *U = dyn_cast<UnaryOperator>(expr))
     return U->isIncrementDecrementOp()
       ? GetIncrementedVar(U->getSubExpr(), x, y) : NULL;
@@ -145,68 +144,68 @@
 void WalkAST::CheckLoopConditionForFloat(const ForStmt *FS) {
   // Does the loop have a condition?
   const Expr *condition = FS->getCond();
-  
+
   if (!condition)
     return;
 
   // Does the loop have an increment?
   const Expr *increment = FS->getInc();
-  
+
   if (!increment)
     return;
-    
+
   // Strip away '()' and casts.
   condition = condition->IgnoreParenCasts();
   increment = increment->IgnoreParenCasts();
-  
+
   // Is the loop condition a comparison?
   const BinaryOperator *B = dyn_cast<BinaryOperator>(condition);
 
   if (!B)
     return;
-  
+
   // Is this a comparison?
   if (!(B->isRelationalOp() || B->isEqualityOp()))
     return;
-      
+
   // Are we comparing variables?
   const DeclRefExpr *drLHS = dyn_cast<DeclRefExpr>(B->getLHS()->IgnoreParens());
   const DeclRefExpr *drRHS = dyn_cast<DeclRefExpr>(B->getRHS()->IgnoreParens());
-  
+
   // Does at least one of the variables have a floating point type?
   drLHS = drLHS && drLHS->getType()->isFloatingType() ? drLHS : NULL;
   drRHS = drRHS && drRHS->getType()->isFloatingType() ? drRHS : NULL;
-  
+
   if (!drLHS && !drRHS)
     return;
 
   const VarDecl *vdLHS = drLHS ? dyn_cast<VarDecl>(drLHS->getDecl()) : NULL;
   const VarDecl *vdRHS = drRHS ? dyn_cast<VarDecl>(drRHS->getDecl()) : NULL;
-  
+
   if (!vdLHS && !vdRHS)
-    return;  
-  
+    return;
+
   // Does either variable appear in increment?
   const DeclRefExpr *drInc = GetIncrementedVar(increment, vdLHS, vdRHS);
-  
+
   if (!drInc)
     return;
-  
+
   // Emit the error.  First figure out which DeclRefExpr in the condition
   // referenced the compared variable.
   const DeclRefExpr *drCond = vdLHS == drInc->getDecl() ? drLHS : drRHS;
 
-  llvm::SmallVector<SourceRange, 2> ranges;  
+  llvm::SmallVector<SourceRange, 2> ranges;
   std::string sbuf;
   llvm::raw_string_ostream os(sbuf);
-  
+
   os << "Variable '" << drCond->getDecl()->getNameAsCString()
      << "' with floating point type '" << drCond->getType().getAsString()
      << "' should not be used as a loop counter";
 
   ranges.push_back(drCond->getSourceRange());
   ranges.push_back(drInc->getSourceRange());
-  
+
   const char *bugType = "Floating point variable used as loop counter";
   BR.EmitBasicReport(bugType, "Security", os.str().c_str(),
                      FS->getLocStart(), ranges.data(), ranges.size());
@@ -221,11 +220,11 @@
 void WalkAST::CheckCall_gets(const CallExpr *CE, const FunctionDecl *FD) {
   if (FD->getIdentifier() != GetIdentifier(II_gets, "gets"))
     return;
-  
+
   const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FD->getType());
   if (!FTP)
     return;
-  
+
   // Verify that the function takes a single argument.
   if (FTP->getNumArgs() != 1)
     return;
@@ -234,10 +233,10 @@
   const PointerType *PT = dyn_cast<PointerType>(FTP->getArgType(0));
   if (!PT)
     return;
-  
+
   if (PT->getPointeeType().getUnqualifiedType() != BR.getContext().CharTy)
     return;
-  
+
   // Issue a warning.
   SourceRange R = CE->getCallee()->getSourceRange();
   BR.EmitBasicReport("Potential buffer overflow in call to 'gets'",
@@ -261,11 +260,11 @@
       "lcong48",
       "rand", "rand_r"
     };
-      
+
     for (size_t i = 0; i < num_rands; i++)
-      II_rand[i] = &BR.getContext().Idents.get(identifiers[i]);  
+      II_rand[i] = &BR.getContext().Idents.get(identifiers[i]);
   }
-  
+
   const IdentifierInfo *id = FD->getIdentifier();
   size_t identifierid;
 
@@ -275,24 +274,24 @@
 
   if (identifierid >= num_rands)
     return;
-  
+
   const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FD->getType());
   if (!FTP)
     return;
-  
+
   if (FTP->getNumArgs() == 1) {
     // Is the argument an 'unsigned short *'?
     // (Actually any integer type is allowed.)
     const PointerType *PT = dyn_cast<PointerType>(FTP->getArgType(0));
     if (!PT)
       return;
-      
+
     if (! PT->getPointeeType()->isIntegerType())
       return;
   }
-  else if (FTP->getNumArgs() != 0) 
+  else if (FTP->getNumArgs() != 0)
     return;
-  
+
   // Issue a warning.
   std::string buf1;
   llvm::raw_string_ostream os1(buf1);
@@ -305,7 +304,7 @@
       << "  Use 'arc4random' instead";
 
   SourceRange R = CE->getCallee()->getSourceRange();
-  
+
   BR.EmitBasicReport(os1.str().c_str(), "Security", os2.str().c_str(),
                      CE->getLocStart(), &R, 1);
 }
@@ -318,15 +317,15 @@
 void WalkAST::CheckCall_random(const CallExpr *CE, const FunctionDecl *FD) {
   if (FD->getIdentifier() != GetIdentifier(II_random, "random"))
     return;
-  
+
   const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FD->getType());
   if (!FTP)
     return;
-  
+
   // Verify that the function takes no argument.
   if (FTP->getNumArgs() != 0)
     return;
-  
+
   // Issue a warning.
   SourceRange R = CE->getCallee()->getSourceRange();
   BR.EmitBasicReport("'random' is not a secure random number generator",
@@ -352,11 +351,11 @@
       "setuid", "setgid", "seteuid", "setegid",
       "setreuid", "setregid"
     };
-      
+
     for (size_t i = 0; i < num_setids; i++)
-      II_setid[i] = &BR.getContext().Idents.get(identifiers[i]);  
+      II_setid[i] = &BR.getContext().Idents.get(identifiers[i]);
   }
-  
+
   const IdentifierInfo *id = FD->getIdentifier();
   size_t identifierid;
 
@@ -366,11 +365,11 @@
 
   if (identifierid >= num_setids)
     return;
-  
+
   const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FD->getType());
   if (!FTP)
     return;
-  
+
   // Verify that the function takes one or two arguments (depending on
   //   the function).
   if (FTP->getNumArgs() != (identifierid < 4 ? 1 : 2))
@@ -395,7 +394,7 @@
       << "', the following code may execute with unexpected privileges";
 
   SourceRange R = CE->getCallee()->getSourceRange();
-  
+
   BR.EmitBasicReport(os1.str().c_str(), "Security", os2.str().c_str(),
                      CE->getLocStart(), &R, 1);
 }
@@ -404,7 +403,7 @@
 // Entry point for check.
 //===----------------------------------------------------------------------===//
 
-void clang::CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR) {  
+void clang::CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR) {
   WalkAST walker(BR);
-  walker.Visit(D->getBody());  
+  walker.Visit(D->getBody());
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/Environment.cpp (original)
+++ cfe/trunk/lib/Analysis/Environment.cpp Wed Sep  9 10:08:12 2009
@@ -18,61 +18,61 @@
 using namespace clang;
 
 SVal Environment::GetSVal(const Stmt *E, ValueManager& ValMgr) const {
-  
+
   for (;;) {
-    
+
     switch (E->getStmtClass()) {
-        
-      case Stmt::AddrLabelExprClass:        
+
+      case Stmt::AddrLabelExprClass:
         return ValMgr.makeLoc(cast<AddrLabelExpr>(E));
-        
+
         // ParenExprs are no-ops.
-        
-      case Stmt::ParenExprClass:        
+
+      case Stmt::ParenExprClass:
         E = cast<ParenExpr>(E)->getSubExpr();
         continue;
-        
+
       case Stmt::CharacterLiteralClass: {
         const CharacterLiteral* C = cast<CharacterLiteral>(E);
         return ValMgr.makeIntVal(C->getValue(), C->getType());
       }
-        
+
       case Stmt::IntegerLiteralClass: {
         return ValMgr.makeIntVal(cast<IntegerLiteral>(E));
       }
-        
+
       // Casts where the source and target type are the same
       // are no-ops.  We blast through these to get the descendant
       // subexpression that has a value.
-       
+
       case Stmt::ImplicitCastExprClass:
       case Stmt::CStyleCastExprClass: {
         const CastExpr* C = cast<CastExpr>(E);
         QualType CT = C->getType();
-        
+
         if (CT->isVoidType())
           return UnknownVal();
-        
+
         break;
       }
-        
+
         // Handle all other Stmt* using a lookup.
-        
+
       default:
         break;
     };
-    
+
     break;
   }
-  
+
   return LookupExpr(E);
 }
 
 Environment EnvironmentManager::BindExpr(Environment Env, const Stmt *S,
-                                         SVal V, bool Invalidate) {  
+                                         SVal V, bool Invalidate) {
   assert(S);
-  
-  if (V.isUnknown()) {    
+
+  if (V.isUnknown()) {
     if (Invalidate)
       return Environment(F.Remove(Env.ExprBindings, S), Env.ACtx);
     else
@@ -86,7 +86,7 @@
 class VISIBILITY_HIDDEN MarkLiveCallback : public SymbolVisitor {
   SymbolReaper &SymReaper;
 public:
-  MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {}  
+  MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {}
   bool VisitSymbol(SymbolRef sym) { SymReaper.markLive(sym); return true; }
 };
 } // end anonymous namespace
@@ -95,45 +95,45 @@
 //  - Remove subexpression bindings.
 //  - Remove dead block expression bindings.
 //  - Keep live block expression bindings:
-//   - Mark their reachable symbols live in SymbolReaper, 
+//   - Mark their reachable symbols live in SymbolReaper,
 //     see ScanReachableSymbols.
 //   - Mark the region in DRoots if the binding is a loc::MemRegionVal.
 
-Environment 
+Environment
 EnvironmentManager::RemoveDeadBindings(Environment Env, const Stmt *S,
                                        SymbolReaper &SymReaper,
                                        const GRState *ST,
                               llvm::SmallVectorImpl<const MemRegion*> &DRoots) {
-  
+
   CFG &C = *Env.getAnalysisContext().getCFG();
-  
+
   // We construct a new Environment object entirely, as this is cheaper than
   // individually removing all the subexpression bindings (which will greatly
   // outnumber block-level expression bindings).
   Environment NewEnv = getInitialEnvironment(&Env.getAnalysisContext());
-  
+
   // Iterate over the block-expr bindings.
-  for (Environment::iterator I = Env.begin(), E = Env.end(); 
+  for (Environment::iterator I = Env.begin(), E = Env.end();
        I != E; ++I) {
-    
+
     const Stmt *BlkExpr = I.getKey();
-    
+
     // Not a block-level expression?
     if (!C.isBlkExpr(BlkExpr))
       continue;
-    
+
     const SVal &X = I.getData();
-        
+
     if (SymReaper.isLive(S, BlkExpr)) {
       // Copy the binding to the new map.
       NewEnv.ExprBindings = F.Add(NewEnv.ExprBindings, BlkExpr, X);
-      
+
       // If the block expr's value is a memory region, then mark that region.
       if (isa<loc::MemRegionVal>(X)) {
         const MemRegion* R = cast<loc::MemRegionVal>(X).getRegion();
         DRoots.push_back(R);
         // Mark the super region of the RX as live.
-        // e.g.: int x; char *y = (char*) &x; if (*y) ... 
+        // e.g.: int x; char *y = (char*) &x; if (*y) ...
         // 'y' => element region. 'x' is its super region.
         // We only add one level super region for now.
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/ExplodedGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/ExplodedGraph.cpp Wed Sep  9 10:08:12 2009
@@ -64,10 +64,10 @@
 }
 
 void ExplodedNode::NodeGroup::addNode(ExplodedNode* N) {
-  
+
   assert ((reinterpret_cast<uintptr_t>(N) & Mask) == 0x0);
   assert (!getFlag());
-  
+
   if (getKind() == Size1) {
     if (ExplodedNode* NOld = getNode()) {
       std::vector<ExplodedNode*>* V = new std::vector<ExplodedNode*>();
@@ -93,7 +93,7 @@
 unsigned ExplodedNode::NodeGroup::size() const {
   if (getFlag())
     return 0;
-  
+
   if (getKind() == Size1)
     return getNode() ? 1 : 0;
   else
@@ -103,7 +103,7 @@
 ExplodedNode** ExplodedNode::NodeGroup::begin() const {
   if (getFlag())
     return NULL;
-  
+
   if (getKind() == Size1)
     return (ExplodedNode**) (getPtr() ? &P : NULL);
   else
@@ -113,7 +113,7 @@
 ExplodedNode** ExplodedNode::NodeGroup::end() const {
   if (getFlag())
     return NULL;
-  
+
   if (getKind() == Size1)
     return (ExplodedNode**) (getPtr() ? &P+1 : NULL);
   else {
@@ -127,47 +127,47 @@
   if (getKind() == SizeOther) delete &getVector(getPtr());
 }
 
-ExplodedNode *ExplodedGraph::getNode(const ProgramPoint& L, 
+ExplodedNode *ExplodedGraph::getNode(const ProgramPoint& L,
                                      const GRState* State, bool* IsNew) {
   // Profile 'State' to determine if we already have an existing node.
-  llvm::FoldingSetNodeID profile;    
+  llvm::FoldingSetNodeID profile;
   void* InsertPos = 0;
-  
+
   NodeTy::Profile(profile, L, State);
   NodeTy* V = Nodes.FindNodeOrInsertPos(profile, InsertPos);
-  
+
   if (!V) {
     // Allocate a new node.
     V = (NodeTy*) Allocator.Allocate<NodeTy>();
     new (V) NodeTy(L, State);
-    
+
     // Insert the node into the node set and return it.
     Nodes.InsertNode(V, InsertPos);
-    
+
     ++NumNodes;
-    
+
     if (IsNew) *IsNew = true;
   }
   else
     if (IsNew) *IsNew = false;
-  
+
   return V;
 }
 
 std::pair<ExplodedGraph*, InterExplodedGraphMap*>
 ExplodedGraph::Trim(const NodeTy* const* NBeg, const NodeTy* const* NEnd,
                llvm::DenseMap<const void*, const void*> *InverseMap) const {
-  
+
   if (NBeg == NEnd)
     return std::make_pair((ExplodedGraph*) 0,
                           (InterExplodedGraphMap*) 0);
-  
+
   assert (NBeg < NEnd);
 
   llvm::OwningPtr<InterExplodedGraphMap> M(new InterExplodedGraphMap());
-  
+
   ExplodedGraph* G = TrimInternal(NBeg, NEnd, M.get(), InverseMap);
-  
+
   return std::make_pair(static_cast<ExplodedGraph*>(G), M.take());
 }
 
@@ -179,10 +179,10 @@
 
   typedef llvm::DenseSet<const ExplodedNode*> Pass1Ty;
   Pass1Ty Pass1;
-  
+
   typedef llvm::DenseMap<const ExplodedNode*, ExplodedNode*> Pass2Ty;
   Pass2Ty& Pass2 = M->M;
-  
+
   llvm::SmallVector<const ExplodedNode*, 10> WL1, WL2;
 
   // ===- Pass 1 (reverse DFS) -===
@@ -190,59 +190,59 @@
     assert(*I);
     WL1.push_back(*I);
   }
-    
+
   // Process the first worklist until it is empty.  Because it is a std::list
   // it acts like a FIFO queue.
   while (!WL1.empty()) {
     const ExplodedNode *N = WL1.back();
     WL1.pop_back();
-    
+
     // Have we already visited this node?  If so, continue to the next one.
     if (Pass1.count(N))
       continue;
 
     // Otherwise, mark this node as visited.
     Pass1.insert(N);
-    
+
     // If this is a root enqueue it to the second worklist.
     if (N->Preds.empty()) {
       WL2.push_back(N);
       continue;
     }
-      
+
     // Visit our predecessors and enqueue them.
     for (ExplodedNode** I=N->Preds.begin(), **E=N->Preds.end(); I!=E; ++I)
       WL1.push_back(*I);
   }
-  
+
   // We didn't hit a root? Return with a null pointer for the new graph.
   if (WL2.empty())
     return 0;
 
   // Create an empty graph.
   ExplodedGraph* G = MakeEmptyGraph();
-  
-  // ===- Pass 2 (forward DFS to construct the new graph) -===  
+
+  // ===- Pass 2 (forward DFS to construct the new graph) -===
   while (!WL2.empty()) {
     const ExplodedNode* N = WL2.back();
     WL2.pop_back();
-    
+
     // Skip this node if we have already processed it.
     if (Pass2.find(N) != Pass2.end())
       continue;
-    
+
     // Create the corresponding node in the new graph and record the mapping
     // from the old node to the new node.
     ExplodedNode* NewN = G->getNode(N->getLocation(), N->State, NULL);
     Pass2[N] = NewN;
-    
+
     // Also record the reverse mapping from the new node to the old node.
     if (InverseMap) (*InverseMap)[NewN] = N;
-    
+
     // If this node is a root, designate it as such in the graph.
     if (N->Preds.empty())
       G->addRoot(NewN);
-    
+
     // In the case that some of the intended predecessors of NewN have already
     // been created, we should hook them up as predecessors.
 
@@ -252,7 +252,7 @@
       Pass2Ty::iterator PI = Pass2.find(*I);
       if (PI == Pass2.end())
         continue;
-      
+
       NewN->addPredecessor(PI->second);
     }
 
@@ -261,7 +261,7 @@
     // the new nodes from the original graph that should have nodes created
     // in the new graph.
     for (ExplodedNode **I=N->Succs.begin(), **E=N->Succs.end(); I!=E; ++I) {
-      Pass2Ty::iterator PI = Pass2.find(*I);      
+      Pass2Ty::iterator PI = Pass2.find(*I);
       if (PI != Pass2.end()) {
         PI->second->addPredecessor(NewN);
         continue;
@@ -271,12 +271,12 @@
       if (Pass1.count(*I))
         WL2.push_back(*I);
     }
-    
+
     // Finally, explictly mark all nodes without any successors as sinks.
     if (N->isSink())
       NewN->markAsSink();
   }
-    
+
   return G;
 }
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRBlockCounter.cpp (original)
+++ cfe/trunk/lib/Analysis/GRBlockCounter.cpp Wed Sep  9 10:08:12 2009
@@ -1,5 +1,5 @@
 //==- GRBlockCounter.h - ADT for counting block visits -------------*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRCoreEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRCoreEngine.cpp Wed Sep  9 10:08:12 2009
@@ -1,5 +1,5 @@
 //==- GRCoreEngine.cpp - Path-Sensitive Dataflow Engine ------------*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
@@ -48,27 +48,27 @@
     return U;
   }
 };
-  
+
 class VISIBILITY_HIDDEN BFS : public GRWorkList {
   std::queue<GRWorkListUnit> Queue;
 public:
   virtual bool hasWork() const {
     return !Queue.empty();
   }
-  
+
   virtual void Enqueue(const GRWorkListUnit& U) {
     Queue.push(U);
   }
-  
+
   virtual GRWorkListUnit Dequeue() {
     // Don't use const reference.  The subsequent pop_back() might make it
     // unsafe.
-    GRWorkListUnit U = Queue.front(); 
+    GRWorkListUnit U = Queue.front();
     Queue.pop();
     return U;
   }
 };
-  
+
 } // end anonymous namespace
 
 // Place the dstor for GRWorkList here because it contains virtual member
@@ -86,14 +86,14 @@
     virtual bool hasWork() const {
       return !Queue.empty() || !Stack.empty();
     }
-    
+
     virtual void Enqueue(const GRWorkListUnit& U) {
       if (isa<BlockEntrance>(U.getNode()->getLocation()))
         Queue.push(U);
       else
         Stack.push_back(U);
     }
-    
+
     virtual GRWorkListUnit Dequeue() {
       // Process all basic blocks to completion.
       if (!Stack.empty()) {
@@ -101,13 +101,13 @@
         Stack.pop_back(); // This technically "invalidates" U, but we are fine.
         return U;
       }
-      
+
       assert(!Queue.empty());
       // Don't use const reference.  The subsequent pop_back() might make it
       // unsafe.
-      GRWorkListUnit U = Queue.front(); 
+      GRWorkListUnit U = Queue.front();
       Queue.pop();
-      return U;      
+      return U;
     }
   };
 } // end anonymous namespace
@@ -128,13 +128,13 @@
 }
 
 bool GRCoreEngine::ProcessBlockEntrance(CFGBlock* Blk, const GRState* State,
-                                        GRBlockCounter BC) {    
+                                        GRBlockCounter BC) {
   return SubEngine.ProcessBlockEntrance(Blk, State, BC);
 }
 
 void GRCoreEngine::ProcessBranch(Stmt* Condition, Stmt* Terminator,
                    GRBranchNodeBuilder& Builder) {
-  SubEngine.ProcessBranch(Condition, Terminator, Builder);    
+  SubEngine.ProcessBranch(Condition, Terminator, Builder);
 }
 
 void GRCoreEngine::ProcessIndirectGoto(GRIndirectGotoNodeBuilder& Builder) {
@@ -147,52 +147,52 @@
 
 /// ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
 bool GRCoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps) {
-  
+
   if (G->num_roots() == 0) { // Initialize the analysis by constructing
     // the root if none exists.
-    
+
     CFGBlock* Entry = &(L->getCFG()->getEntry());
-    
-    assert (Entry->empty() && 
+
+    assert (Entry->empty() &&
             "Entry block must be empty.");
-    
+
     assert (Entry->succ_size() == 1 &&
             "Entry block must have 1 successor.");
-    
+
     // Get the solitary successor.
-    CFGBlock* Succ = *(Entry->succ_begin());   
-    
+    CFGBlock* Succ = *(Entry->succ_begin());
+
     // Construct an edge representing the
     // starting location in the function.
     BlockEdge StartLoc(Entry, Succ, L);
-    
+
     // Set the current block counter to being empty.
     WList->setBlockCounter(BCounterFactory.GetEmptyCounter());
-    
+
     // Generate the root.
     GenerateNode(StartLoc, getInitialState(L), 0);
   }
-  
+
   while (Steps && WList->hasWork()) {
     --Steps;
     const GRWorkListUnit& WU = WList->Dequeue();
-    
+
     // Set the current block counter.
     WList->setBlockCounter(WU.getBlockCounter());
 
     // Retrieve the node.
     ExplodedNode* Node = WU.getNode();
-    
+
     // Dispatch on the location type.
     switch (Node->getLocation().getKind()) {
       case ProgramPoint::BlockEdgeKind:
         HandleBlockEdge(cast<BlockEdge>(Node->getLocation()), Node);
         break;
-        
+
       case ProgramPoint::BlockEntranceKind:
         HandleBlockEntrance(cast<BlockEntrance>(Node->getLocation()), Node);
         break;
-        
+
       case ProgramPoint::BlockExitKind:
         assert (false && "BlockExit location never occur in forward analysis.");
         break;
@@ -201,22 +201,22 @@
         assert(isa<PostStmt>(Node->getLocation()));
         HandlePostStmt(cast<PostStmt>(Node->getLocation()), WU.getBlock(),
                        WU.getIndex(), Node);
-        break;        
+        break;
     }
   }
-  
+
   return WList->hasWork();
 }
 
 
 void GRCoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
-  
+
   CFGBlock* Blk = L.getDst();
-  
-  // Check if we are entering the EXIT block. 
+
+  // Check if we are entering the EXIT block.
   if (Blk == &(Pred->getLocationContext()->getCFG()->getExit())) {
-    
-    assert (Pred->getLocationContext()->getCFG()->getExit().size() == 0 
+
+    assert (Pred->getLocationContext()->getCFG()->getExit().size() == 0
             && "EXIT block cannot contain Stmts.");
 
     // Process the final state transition.
@@ -228,81 +228,81 @@
   }
 
   // FIXME: Should we allow ProcessBlockEntrance to also manipulate state?
-  
+
   if (ProcessBlockEntrance(Blk, Pred->State, WList->getBlockCounter()))
     GenerateNode(BlockEntrance(Blk, Pred->getLocationContext()), Pred->State, Pred);
 }
 
 void GRCoreEngine::HandleBlockEntrance(const BlockEntrance& L,
                                        ExplodedNode* Pred) {
-  
+
   // Increment the block counter.
   GRBlockCounter Counter = WList->getBlockCounter();
   Counter = BCounterFactory.IncrementCount(Counter, L.getBlock()->getBlockID());
   WList->setBlockCounter(Counter);
-  
-  // Process the entrance of the block.  
+
+  // Process the entrance of the block.
   if (Stmt* S = L.getFirstStmt()) {
-    GRStmtNodeBuilder Builder(L.getBlock(), 0, Pred, this, 
+    GRStmtNodeBuilder Builder(L.getBlock(), 0, Pred, this,
                               SubEngine.getStateManager());
     ProcessStmt(S, Builder);
   }
-  else 
+  else
     HandleBlockExit(L.getBlock(), Pred);
 }
 
 void GRCoreEngine::HandleBlockExit(CFGBlock * B, ExplodedNode* Pred) {
-  
+
   if (Stmt* Term = B->getTerminator()) {
     switch (Term->getStmtClass()) {
       default:
         assert(false && "Analysis for this terminator not implemented.");
         break;
-                
+
       case Stmt::BinaryOperatorClass: // '&&' and '||'
         HandleBranch(cast<BinaryOperator>(Term)->getLHS(), Term, B, Pred);
         return;
-        
+
       case Stmt::ConditionalOperatorClass:
         HandleBranch(cast<ConditionalOperator>(Term)->getCond(), Term, B, Pred);
         return;
-        
+
         // FIXME: Use constant-folding in CFG construction to simplify this
         // case.
-        
+
       case Stmt::ChooseExprClass:
         HandleBranch(cast<ChooseExpr>(Term)->getCond(), Term, B, Pred);
         return;
-        
+
       case Stmt::DoStmtClass:
         HandleBranch(cast<DoStmt>(Term)->getCond(), Term, B, Pred);
         return;
-        
+
       case Stmt::ForStmtClass:
         HandleBranch(cast<ForStmt>(Term)->getCond(), Term, B, Pred);
         return;
-      
+
       case Stmt::ContinueStmtClass:
       case Stmt::BreakStmtClass:
-      case Stmt::GotoStmtClass:        
+      case Stmt::GotoStmtClass:
         break;
-        
+
       case Stmt::IfStmtClass:
         HandleBranch(cast<IfStmt>(Term)->getCond(), Term, B, Pred);
         return;
-               
+
       case Stmt::IndirectGotoStmtClass: {
         // Only 1 successor: the indirect goto dispatch block.
         assert (B->succ_size() == 1);
-        
+
         GRIndirectGotoNodeBuilder
            builder(Pred, B, cast<IndirectGotoStmt>(Term)->getTarget(),
                    *(B->succ_begin()), this);
-        
+
         ProcessIndirectGoto(builder);
         return;
       }
-        
+
       case Stmt::ObjCForCollectionStmtClass: {
         // In the case of ObjCForCollectionStmt, it appears twice in a CFG:
         //
@@ -317,15 +317,15 @@
         HandleBranch(Term, Term, B, Pred);
         return;
       }
-        
+
       case Stmt::SwitchStmtClass: {
         GRSwitchNodeBuilder builder(Pred, B, cast<SwitchStmt>(Term)->getCond(),
                                     this);
-        
+
         ProcessSwitch(builder);
         return;
       }
-        
+
       case Stmt::WhileStmtClass:
         HandleBranch(cast<WhileStmt>(Term)->getCond(), Term, B, Pred);
         return;
@@ -334,8 +334,8 @@
 
   assert (B->succ_size() == 1 &&
           "Blocks with no terminator should have at most 1 successor.");
-    
-  GenerateNode(BlockEdge(B, *(B->succ_begin()), Pred->getLocationContext()), 
+
+  GenerateNode(BlockEdge(B, *(B->succ_begin()), Pred->getLocationContext()),
                Pred->State, Pred);
 }
 
@@ -345,19 +345,19 @@
 
   GRBranchNodeBuilder Builder(B, *(B->succ_begin()), *(B->succ_begin()+1),
                               Pred, this);
-  
+
   ProcessBranch(Cond, Term, Builder);
 }
 
 void GRCoreEngine::HandlePostStmt(const PostStmt& L, CFGBlock* B,
                                   unsigned StmtIdx, ExplodedNode* Pred) {
-  
+
   assert (!B->empty());
 
   if (StmtIdx == B->size())
     HandleBlockExit(B, Pred);
   else {
-    GRStmtNodeBuilder Builder(B, StmtIdx, Pred, this, 
+    GRStmtNodeBuilder Builder(B, StmtIdx, Pred, this,
                               SubEngine.getStateManager());
     ProcessStmt((*B)[StmtIdx], Builder);
   }
@@ -365,19 +365,19 @@
 
 /// GenerateNode - Utility method to generate nodes, hook up successors,
 ///  and add nodes to the worklist.
-void GRCoreEngine::GenerateNode(const ProgramPoint& Loc, 
+void GRCoreEngine::GenerateNode(const ProgramPoint& Loc,
                                 const GRState* State, ExplodedNode* Pred) {
-  
+
   bool IsNew;
   ExplodedNode* Node = G->getNode(Loc, State, &IsNew);
-  
-  if (Pred) 
+
+  if (Pred)
     Node->addPredecessor(Pred);  // Link 'Node' with its predecessor.
   else {
     assert (IsNew);
     G->addRoot(Node);  // 'Node' has no predecessor.  Make it a root.
   }
-  
+
   // Only add 'Node' to the worklist if it was freshly generated.
   if (IsNew) WList->Enqueue(Node);
 }
@@ -385,7 +385,7 @@
 GRStmtNodeBuilder::GRStmtNodeBuilder(CFGBlock* b, unsigned idx,
                                      ExplodedNode* N, GRCoreEngine* e,
                                      GRStateManager &mgr)
-  : Eng(*e), B(*b), Idx(idx), Pred(N), LastNode(N), Mgr(mgr), Auditor(0), 
+  : Eng(*e), B(*b), Idx(idx), Pred(N), LastNode(N), Mgr(mgr), Auditor(0),
     PurgingDeadSymbols(false), BuildSinks(false), HasGeneratedNode(false),
     PointKind(ProgramPoint::PostStmtKind), Tag(0) {
   Deferred.insert(N);
@@ -400,16 +400,16 @@
 
 void GRStmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) {
   assert (!N->isSink());
-  
+
   PostStmt Loc(getStmt(), N->getLocationContext());
-  
+
   if (Loc == N->getLocation()) {
     // Note: 'N' should be a fresh node because otherwise it shouldn't be
     // a member of Deferred.
     Eng.WList->Enqueue(N, B, Idx+1);
     return;
   }
-  
+
   bool IsNew;
   ExplodedNode* Succ = Eng.G->getNode(Loc, N->State, &IsNew);
   Succ->addPredecessor(N);
@@ -423,10 +423,10 @@
   switch (K) {
     default:
       assert(false && "Invalid PostXXXKind.");
-      
+
     case ProgramPoint::PostStmtKind:
       return PostStmt(S, L, tag);
-      
+
     case ProgramPoint::PostLoadKind:
       return PostLoad(S, L, tag);
 
@@ -435,19 +435,19 @@
 
     case ProgramPoint::PostLocationChecksSucceedKind:
       return PostLocationChecksSucceed(S, L, tag);
-      
+
     case ProgramPoint::PostOutOfBoundsCheckFailedKind:
       return PostOutOfBoundsCheckFailed(S, L, tag);
-      
+
     case ProgramPoint::PostNullCheckFailedKind:
       return PostNullCheckFailed(S, L, tag);
-      
+
     case ProgramPoint::PostStoreKind:
       return PostStore(S, L, tag);
-      
+
     case ProgramPoint::PostLValueKind:
       return PostLValue(S, L, tag);
-      
+
     case ProgramPoint::PostPurgeDeadSymbolsKind:
       return PostPurgeDeadSymbols(S, L, tag);
   }
@@ -459,10 +459,10 @@
                                         ProgramPoint::Kind K,
                                         const void *tag) {
   return K == ProgramPoint::PreStmtKind
-         ? generateNodeInternal(PreStmt(S, Pred->getLocationContext(),tag), 
+         ? generateNodeInternal(PreStmt(S, Pred->getLocationContext(),tag),
                                 State, Pred)
        : generateNodeInternal(GetPostLoc(S, K, Pred->getLocationContext(), tag),
-                              State, Pred); 
+                              State, Pred);
 }
 
 ExplodedNode*
@@ -473,49 +473,49 @@
   ExplodedNode* N = Eng.G->getNode(Loc, State, &IsNew);
   N->addPredecessor(Pred);
   Deferred.erase(Pred);
-  
+
   if (IsNew) {
     Deferred.insert(N);
     LastNode = N;
     return N;
   }
-  
+
   LastNode = NULL;
-  return NULL;  
+  return NULL;
 }
 
 ExplodedNode* GRBranchNodeBuilder::generateNode(const GRState* State,
                                                 bool branch) {
-  
+
   // If the branch has been marked infeasible we should not generate a node.
   if (!isFeasible(branch))
     return NULL;
-  
+
   bool IsNew;
-  
+
   ExplodedNode* Succ =
     Eng.G->getNode(BlockEdge(Src,branch ? DstT:DstF,Pred->getLocationContext()),
                    State, &IsNew);
-  
+
   Succ->addPredecessor(Pred);
-  
+
   if (branch)
     GeneratedTrue = true;
   else
-    GeneratedFalse = true;  
-  
+    GeneratedFalse = true;
+
   if (IsNew) {
     Deferred.push_back(Succ);
     return Succ;
   }
-  
+
   return NULL;
 }
 
 GRBranchNodeBuilder::~GRBranchNodeBuilder() {
   if (!GeneratedTrue) generateNode(Pred->State, true);
   if (!GeneratedFalse) generateNode(Pred->State, false);
-  
+
   for (DeferredTy::iterator I=Deferred.begin(), E=Deferred.end(); I!=E; ++I)
     if (!(*I)->isSink()) Eng.WList->Enqueue(*I);
 }
@@ -525,22 +525,22 @@
 GRIndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St,
                                         bool isSink) {
   bool IsNew;
-  
-  ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(), 
+
+  ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
                                       Pred->getLocationContext()), St, &IsNew);
-              
+
   Succ->addPredecessor(Pred);
-  
+
   if (IsNew) {
-    
+
     if (isSink)
       Succ->markAsSink();
     else
       Eng.WList->Enqueue(Succ);
-    
+
     return Succ;
   }
-                       
+
   return NULL;
 }
 
@@ -549,42 +549,42 @@
 GRSwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){
 
   bool IsNew;
-  
+
   ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
                                        Pred->getLocationContext()), St, &IsNew);
   Succ->addPredecessor(Pred);
-  
+
   if (IsNew) {
     Eng.WList->Enqueue(Succ);
     return Succ;
   }
-  
+
   return NULL;
 }
 
 
 ExplodedNode*
 GRSwitchNodeBuilder::generateDefaultCaseNode(const GRState* St, bool isSink) {
-  
+
   // Get the block for the default case.
   assert (Src->succ_rbegin() != Src->succ_rend());
   CFGBlock* DefaultBlock = *Src->succ_rbegin();
-  
+
   bool IsNew;
-  
+
   ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, DefaultBlock,
                                        Pred->getLocationContext()), St, &IsNew);
   Succ->addPredecessor(Pred);
-  
+
   if (IsNew) {
     if (isSink)
       Succ->markAsSink();
     else
       Eng.WList->Enqueue(Succ);
-    
+
     return Succ;
   }
-  
+
   return NULL;
 }
 
@@ -596,18 +596,18 @@
 ExplodedNode*
 GREndPathNodeBuilder::generateNode(const GRState* State, const void *tag,
                                    ExplodedNode* P) {
-  HasGeneratedNode = true;    
+  HasGeneratedNode = true;
   bool IsNew;
-  
-  ExplodedNode* Node = Eng.G->getNode(BlockEntrance(&B, 
+
+  ExplodedNode* Node = Eng.G->getNode(BlockEntrance(&B,
                                Pred->getLocationContext(), tag), State, &IsNew);
-  
+
   Node->addPredecessor(P ? P : Pred);
-  
+
   if (IsNew) {
     Eng.G->addEndOfPath(Node);
     return Node;
   }
-  
+
   return NULL;
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Sep  9 10:08:12 2009
@@ -44,7 +44,7 @@
 class VISIBILITY_HIDDEN MappedBatchAuditor : public GRSimpleAPICheck {
   typedef llvm::ImmutableList<GRSimpleAPICheck*> Checks;
   typedef llvm::DenseMap<void*,Checks> MapTy;
-  
+
   MapTy M;
   Checks::Factory F;
   Checks AllStmts;
@@ -52,18 +52,18 @@
 public:
   MappedBatchAuditor(llvm::BumpPtrAllocator& Alloc) :
     F(Alloc), AllStmts(F.GetEmptyList()) {}
-  
+
   virtual ~MappedBatchAuditor() {
     llvm::DenseSet<GRSimpleAPICheck*> AlreadyVisited;
-    
+
     for (MapTy::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
       for (Checks::iterator I=MI->second.begin(), E=MI->second.end(); I!=E;++I){
 
         GRSimpleAPICheck* check = *I;
-        
+
         if (AlreadyVisited.count(check))
           continue;
-        
+
         AlreadyVisited.insert(check);
         delete check;
       }
@@ -75,10 +75,10 @@
     MapTy::iterator I = M.find(key);
     M[key] = F.Concat(A, I == M.end() ? F.GetEmptyList() : I->second);
   }
-  
+
   void AddCheck(GRSimpleAPICheck *A) {
     assert (A && "Check cannot be null.");
-    AllStmts = F.Concat(A, AllStmts);    
+    AllStmts = F.Concat(A, AllStmts);
   }
 
   virtual bool Audit(ExplodedNode* N, GRStateManager& VMgr) {
@@ -86,17 +86,17 @@
     bool isSink = false;
     for (Checks::iterator I = AllStmts.begin(), E = AllStmts.end(); I!=E; ++I)
       isSink |= (*I)->Audit(N, VMgr);
-    
+
     // Next handle the auditors that accept only specific statements.
     const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
     void* key = reinterpret_cast<void*>((uintptr_t) S->getStmtClass());
     MapTy::iterator MI = M.find(key);
-    if (MI != M.end()) {    
+    if (MI != M.end()) {
       for (Checks::iterator I=MI->second.begin(), E=MI->second.end(); I!=E; ++I)
         isSink |= (*I)->Audit(N, VMgr);
     }
-    
-    return isSink;    
+
+    return isSink;
   }
 };
 
@@ -105,30 +105,30 @@
 //===----------------------------------------------------------------------===//
 // Checker worklist routines.
 //===----------------------------------------------------------------------===//
-  
-void GRExprEngine::CheckerVisit(Stmt *S, ExplodedNodeSet &Dst, 
+
+void GRExprEngine::CheckerVisit(Stmt *S, ExplodedNodeSet &Dst,
                                 ExplodedNodeSet &Src, bool isPrevisit) {
-  
+
   if (Checkers.empty()) {
     Dst = Src;
     return;
   }
-  
+
   ExplodedNodeSet Tmp;
   ExplodedNodeSet *PrevSet = &Src;
-  
+
   for (std::vector<Checker*>::iterator I = Checkers.begin(), E = Checkers.end();
        I != E; ++I) {
 
-    ExplodedNodeSet *CurrSet = (I+1 == E) ? &Dst 
+    ExplodedNodeSet *CurrSet = (I+1 == E) ? &Dst
                                           : (PrevSet == &Tmp) ? &Src : &Tmp;
     CurrSet->clear();
     Checker *checker = *I;
-    
+
     for (ExplodedNodeSet::iterator NI = PrevSet->begin(), NE = PrevSet->end();
          NI != NE; ++NI)
       checker->GR_Visit(*CurrSet, *Builder, *this, S, *NI, isPrevisit);
-    
+
     // Update which NodeSet is the current one.
     PrevSet = CurrSet;
   }
@@ -149,20 +149,20 @@
 
 GRExprEngine::GRExprEngine(AnalysisManager &mgr)
   : AMgr(mgr),
-    CoreEngine(mgr.getASTContext(), *this), 
+    CoreEngine(mgr.getASTContext(), *this),
     G(CoreEngine.getGraph()),
     Builder(NULL),
-    StateMgr(G.getContext(), mgr.getStoreManagerCreator(), 
+    StateMgr(G.getContext(), mgr.getStoreManagerCreator(),
              mgr.getConstraintManagerCreator(), G.getAllocator()),
     SymMgr(StateMgr.getSymbolManager()),
     ValMgr(StateMgr.getValueManager()),
     SVator(ValMgr.getSValuator()),
     CurrentStmt(NULL),
     NSExceptionII(NULL), NSExceptionInstanceRaiseSelectors(NULL),
-    RaiseSel(GetNullarySelector("raise", G.getContext())), 
+    RaiseSel(GetNullarySelector("raise", G.getContext())),
     BR(mgr, *this) {}
 
-GRExprEngine::~GRExprEngine() {    
+GRExprEngine::~GRExprEngine() {
   BR.FlushReports();
   delete [] NSExceptionInstanceRaiseSelectors;
   for (std::vector<Checker*>::iterator I=Checkers.begin(), E=Checkers.end();
@@ -184,7 +184,7 @@
 void GRExprEngine::AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C) {
   if (!BatchAuditor)
     BatchAuditor.reset(new MappedBatchAuditor(getGraph().getAllocator()));
-  
+
   ((MappedBatchAuditor*) BatchAuditor.get())->AddCheck(A, C);
 }
 
@@ -197,7 +197,7 @@
 
 const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
   const GRState *state = StateMgr.getInitialState(InitLoc);
-  
+
   // Precondition: the first argument of 'main' is an integer guaranteed
   //  to be > 0.
   // FIXME: It would be nice if we had a more general mechanism to add
@@ -212,13 +212,13 @@
           SVal V = state->getSVal(loc::MemRegionVal(R));
           SVal Constraint = EvalBinOp(state, BinaryOperator::GT, V,
                                       ValMgr.makeZeroVal(T),
-                                      getContext().IntTy);          
+                                      getContext().IntTy);
 
           if (const GRState *newState = state->assume(Constraint, true))
             state = newState;
         }
     }
-  
+
   return state;
 }
 
@@ -227,31 +227,31 @@
 //===----------------------------------------------------------------------===//
 
 void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
-  
+
   PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
                                 S->getLocStart(),
                                 "Error evaluating statement");
-  
+
   Builder = &builder;
   EntryNode = builder.getLastNode();
-  
+
   // FIXME: Consolidate.
   CurrentStmt = S;
   StateMgr.CurrentStmt = S;
-  
+
   // Set up our simple checks.
   if (BatchAuditor)
     Builder->setAuditor(BatchAuditor.get());
-    
-  // Create the cleaned state.  
-  SymbolReaper SymReaper(*AMgr.getLiveVariables(), SymMgr);  
+
+  // Create the cleaned state.
+  SymbolReaper SymReaper(*AMgr.getLiveVariables(), SymMgr);
   CleanedState = AMgr.shouldPurgeDead()
     ? StateMgr.RemoveDeadBindings(EntryNode->getState(), CurrentStmt, SymReaper)
     : EntryNode->getState();
 
   // Process any special transfer function for dead symbols.
   ExplodedNodeSet Tmp;
-  
+
   if (!SymReaper.hasDeadSymbols())
     Tmp.Add(EntryNode);
   else {
@@ -260,36 +260,36 @@
 
     SaveAndRestore<bool> OldPurgeDeadSymbols(Builder->PurgingDeadSymbols);
     Builder->PurgingDeadSymbols = true;
-    
-    getTF().EvalDeadSymbols(Tmp, *this, *Builder, EntryNode, S, 
+
+    getTF().EvalDeadSymbols(Tmp, *this, *Builder, EntryNode, S,
                             CleanedState, SymReaper);
 
     if (!Builder->BuildSinks && !Builder->HasGeneratedNode)
       Tmp.Add(EntryNode);
   }
-  
+
   bool HasAutoGenerated = false;
 
   for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
 
     ExplodedNodeSet Dst;
-    
-    // Set the cleaned state.  
+
+    // Set the cleaned state.
     Builder->SetCleanedState(*I == EntryNode ? CleanedState : GetState(*I));
-    
-    // Visit the statement.  
+
+    // Visit the statement.
     Visit(S, *I, Dst);
 
     // Do we need to auto-generate a node?  We only need to do this to generate
     // a node with a "cleaned" state; GRCoreEngine will actually handle
-    // auto-transitions for other cases.    
+    // auto-transitions for other cases.
     if (Dst.size() == 1 && *Dst.begin() == EntryNode
         && !Builder->HasGeneratedNode && !HasAutoGenerated) {
       HasAutoGenerated = true;
       builder.generateNode(S, GetState(EntryNode), *I);
     }
   }
-  
+
   // NULL out these variables to cleanup.
   CleanedState = NULL;
   EntryNode = NULL;
@@ -297,11 +297,11 @@
   // FIXME: Consolidate.
   StateMgr.CurrentStmt = 0;
   CurrentStmt = 0;
-  
+
   Builder = NULL;
 }
 
-void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {  
+void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
   PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
                                 S->getLocStart(),
                                 "Error evaluating statement");
@@ -309,32 +309,32 @@
   // FIXME: add metadata to the CFG so that we can disable
   //  this check when we KNOW that there is no block-level subexpression.
   //  The motivation is that this check requires a hashtable lookup.
-  
+
   if (S != CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(S)) {
     Dst.Add(Pred);
     return;
   }
-  
+
   switch (S->getStmtClass()) {
-      
+
     default:
       // Cases we intentionally have "default" handle:
       //   AddrLabelExpr, IntegerLiteral, CharacterLiteral
-      
+
       Dst.Add(Pred); // No-op. Simply propagate the current state unchanged.
       break;
-    
+
     case Stmt::ArraySubscriptExprClass:
       VisitArraySubscriptExpr(cast<ArraySubscriptExpr>(S), Pred, Dst, false);
       break;
-      
+
     case Stmt::AsmStmtClass:
       VisitAsmStmt(cast<AsmStmt>(S), Pred, Dst);
       break;
-      
+
     case Stmt::BinaryOperatorClass: {
       BinaryOperator* B = cast<BinaryOperator>(S);
-      
+
       if (B->isLogicalOp()) {
         VisitLogicalExpr(B, Pred, Dst);
         break;
@@ -348,7 +348,7 @@
       if (AMgr.shouldEagerlyAssume() && (B->isRelationalOp() || B->isEqualityOp())) {
         ExplodedNodeSet Tmp;
         VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Tmp);
-        EvalEagerlyAssume(Dst, Tmp, cast<Expr>(S));        
+        EvalEagerlyAssume(Dst, Tmp, cast<Expr>(S));
       }
       else
         VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Dst);
@@ -365,13 +365,13 @@
 
       // FIXME: ChooseExpr is really a constant.  We need to fix
       //        the CFG do not model them as explicit control-flow.
-      
+
     case Stmt::ChooseExprClass: { // __builtin_choose_expr
       ChooseExpr* C = cast<ChooseExpr>(S);
       VisitGuardedExpr(C, C->getLHS(), C->getRHS(), Pred, Dst);
       break;
     }
-      
+
     case Stmt::CompoundAssignOperatorClass:
       VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Dst);
       break;
@@ -379,22 +379,22 @@
     case Stmt::CompoundLiteralExprClass:
       VisitCompoundLiteralExpr(cast<CompoundLiteralExpr>(S), Pred, Dst, false);
       break;
-      
+
     case Stmt::ConditionalOperatorClass: { // '?' operator
       ConditionalOperator* C = cast<ConditionalOperator>(S);
       VisitGuardedExpr(C, C->getLHS(), C->getRHS(), Pred, Dst);
       break;
     }
-      
+
     case Stmt::DeclRefExprClass:
     case Stmt::QualifiedDeclRefExprClass:
       VisitDeclRefExpr(cast<DeclRefExpr>(S), Pred, Dst, false);
       break;
-      
+
     case Stmt::DeclStmtClass:
       VisitDeclStmt(cast<DeclStmt>(S), Pred, Dst);
       break;
-      
+
     case Stmt::ImplicitCastExprClass:
     case Stmt::CStyleCastExprClass: {
       CastExpr* C = cast<CastExpr>(S);
@@ -405,11 +405,11 @@
     case Stmt::InitListExprClass:
       VisitInitListExpr(cast<InitListExpr>(S), Pred, Dst);
       break;
-      
+
     case Stmt::MemberExprClass:
       VisitMemberExpr(cast<MemberExpr>(S), Pred, Dst, false);
       break;
-      
+
     case Stmt::ObjCIvarRefExprClass:
       VisitObjCIvarRefExpr(cast<ObjCIvarRefExpr>(S), Pred, Dst, false);
       break;
@@ -417,12 +417,12 @@
     case Stmt::ObjCForCollectionStmtClass:
       VisitObjCForCollectionStmt(cast<ObjCForCollectionStmt>(S), Pred, Dst);
       break;
-      
+
     case Stmt::ObjCMessageExprClass: {
       VisitObjCMessageExpr(cast<ObjCMessageExpr>(S), Pred, Dst);
       break;
     }
-      
+
     case Stmt::ObjCAtThrowStmtClass: {
       // FIXME: This is not complete.  We basically treat @throw as
       // an abort.
@@ -431,19 +431,19 @@
       MakeNode(Dst, S, Pred, GetState(Pred));
       break;
     }
-      
+
     case Stmt::ParenExprClass:
       Visit(cast<ParenExpr>(S)->getSubExpr()->IgnoreParens(), Pred, Dst);
       break;
-      
+
     case Stmt::ReturnStmtClass:
       VisitReturnStmt(cast<ReturnStmt>(S), Pred, Dst);
       break;
-      
+
     case Stmt::SizeOfAlignOfExprClass:
       VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), Pred, Dst);
       break;
-      
+
     case Stmt::StmtExprClass: {
       StmtExpr* SE = cast<StmtExpr>(S);
 
@@ -454,21 +454,21 @@
         Dst.Add(Pred);
         break;
       }
-               
+
       if (Expr* LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin())) {
         const GRState* state = GetState(Pred);
         MakeNode(Dst, SE, Pred, state->BindExpr(SE, state->getSVal(LastExpr)));
       }
       else
         Dst.Add(Pred);
-      
+
       break;
     }
 
     case Stmt::StringLiteralClass:
       VisitLValue(cast<StringLiteral>(S), Pred, Dst);
       break;
-      
+
     case Stmt::UnaryOperatorClass: {
       UnaryOperator *U = cast<UnaryOperator>(S);
       if (AMgr.shouldEagerlyAssume() && (U->getOpcode() == UnaryOperator::LNot)) {
@@ -483,43 +483,43 @@
   }
 }
 
-void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred, 
+void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred,
                                ExplodedNodeSet& Dst) {
-  
+
   Ex = Ex->IgnoreParens();
-  
+
   if (Ex != CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(Ex)) {
     Dst.Add(Pred);
     return;
   }
-  
+
   switch (Ex->getStmtClass()) {
-      
+
     case Stmt::ArraySubscriptExprClass:
       VisitArraySubscriptExpr(cast<ArraySubscriptExpr>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::DeclRefExprClass:
     case Stmt::QualifiedDeclRefExprClass:
       VisitDeclRefExpr(cast<DeclRefExpr>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::ObjCIvarRefExprClass:
       VisitObjCIvarRefExpr(cast<ObjCIvarRefExpr>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::UnaryOperatorClass:
       VisitUnaryOperator(cast<UnaryOperator>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::MemberExprClass:
       VisitMemberExpr(cast<MemberExpr>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::CompoundLiteralExprClass:
       VisitCompoundLiteralExpr(cast<CompoundLiteralExpr>(Ex), Pred, Dst, true);
       return;
-      
+
     case Stmt::ObjCPropertyRefExprClass:
     case Stmt::ObjCImplicitSetterGetterRefExprClass:
       // FIXME: Property assignments are lvalues, but not really "locations".
@@ -542,7 +542,7 @@
       MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V));
       return;
     }
-      
+
     default:
       // Arbitrary subexpressions can return aggregate temporaries that
       // can be used in a lvalue context.  We need to enhance our support
@@ -551,7 +551,7 @@
       assert ((Ex->getType()->isAggregateType()) &&
               "Other kinds of expressions with non-aggregate/union types do"
               " not have lvalues.");
-      
+
       Visit(Ex, Pred, Dst);
   }
 }
@@ -562,7 +562,7 @@
 
 bool GRExprEngine::ProcessBlockEntrance(CFGBlock* B, const GRState*,
                                         GRBlockCounter BC) {
-  
+
   return BC.getNumVisited(B->getBlockID()) < 3;
 }
 
@@ -586,53 +586,53 @@
 const GRState* GRExprEngine::MarkBranch(const GRState* state,
                                            Stmt* Terminator,
                                            bool branchTaken) {
-  
+
   switch (Terminator->getStmtClass()) {
     default:
       return state;
-      
+
     case Stmt::BinaryOperatorClass: { // '&&' and '||'
-      
+
       BinaryOperator* B = cast<BinaryOperator>(Terminator);
       BinaryOperator::Opcode Op = B->getOpcode();
-      
+
       assert (Op == BinaryOperator::LAnd || Op == BinaryOperator::LOr);
-      
+
       // For &&, if we take the true branch, then the value of the whole
       // expression is that of the RHS expression.
       //
       // For ||, if we take the false branch, then the value of the whole
       // expression is that of the RHS expression.
-      
+
       Expr* Ex = (Op == BinaryOperator::LAnd && branchTaken) ||
-                 (Op == BinaryOperator::LOr && !branchTaken)  
+                 (Op == BinaryOperator::LOr && !branchTaken)
                ? B->getRHS() : B->getLHS();
-        
+
       return state->BindExpr(B, UndefinedVal(Ex));
     }
-      
+
     case Stmt::ConditionalOperatorClass: { // ?:
-      
+
       ConditionalOperator* C = cast<ConditionalOperator>(Terminator);
-      
+
       // For ?, if branchTaken == true then the value is either the LHS or
       // the condition itself. (GNU extension).
-      
-      Expr* Ex;      
-      
+
+      Expr* Ex;
+
       if (branchTaken)
-        Ex = C->getLHS() ? C->getLHS() : C->getCond();        
+        Ex = C->getLHS() ? C->getLHS() : C->getCond();
       else
         Ex = C->getRHS();
-      
+
       return state->BindExpr(C, UndefinedVal(Ex));
     }
-      
+
     case Stmt::ChooseExprClass: { // ?:
-      
+
       ChooseExpr* C = cast<ChooseExpr>(Terminator);
-      
-      Expr* Ex = branchTaken ? C->getLHS() : C->getRHS();      
+
+      Expr* Ex = branchTaken ? C->getLHS() : C->getRHS();
       return state->BindExpr(C, UndefinedVal(Ex));
     }
   }
@@ -652,19 +652,19 @@
 
   uint64_t bits = 0;
   bool bitsInit = false;
-    
+
   while (CastExpr *CE = dyn_cast<CastExpr>(Ex)) {
     QualType T = CE->getType();
 
     if (!T->isIntegerType())
       return UnknownVal();
-    
+
     uint64_t newBits = Ctx.getTypeSize(T);
     if (!bitsInit || newBits < bits) {
       bitsInit = true;
       bits = newBits;
     }
-      
+
     Ex = CE->getSubExpr();
   }
 
@@ -673,26 +673,26 @@
 
   if (!bitsInit || !T->isIntegerType() || Ctx.getTypeSize(T) > bits)
     return UnknownVal();
-  
+
   return state->getSVal(Ex);
 }
 
 void GRExprEngine::ProcessBranch(Stmt* Condition, Stmt* Term,
                                  GRBranchNodeBuilder& builder) {
-  
+
   // Check for NULL conditions; e.g. "for(;;)"
-  if (!Condition) { 
+  if (!Condition) {
     builder.markInfeasible(false);
     return;
   }
-  
+
   PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
                                 Condition->getLocStart(),
                                 "Error evaluating branch");
 
-  const GRState* PrevState = builder.getState();  
+  const GRState* PrevState = builder.getState();
   SVal V = PrevState->getSVal(Condition);
-  
+
   switch (V.getBaseKind()) {
     default:
       break;
@@ -707,32 +707,32 @@
           SVal recovered = RecoverCastedSymbol(getStateManager(),
                                                builder.getState(), Condition,
                                                getContext());
-            
+
           if (!recovered.isUnknown()) {
             V = recovered;
             break;
           }
         }
       }
-    
+
       builder.generateNode(MarkBranch(PrevState, Term, true), true);
       builder.generateNode(MarkBranch(PrevState, Term, false), false);
       return;
     }
-      
-    case SVal::UndefinedKind: {      
+
+    case SVal::UndefinedKind: {
       ExplodedNode* N = builder.generateNode(PrevState, true);
 
       if (N) {
         N->markAsSink();
         UndefBranches.insert(N);
       }
-      
+
       builder.markInfeasible(false);
       return;
-    }      
+    }
   }
-    
+
   // Process the true branch.
   if (builder.isFeasible(true)) {
     if (const GRState *state = PrevState->assume(V, true))
@@ -740,8 +740,8 @@
     else
       builder.markInfeasible(true);
   }
-      
-  // Process the false branch.  
+
+  // Process the false branch.
   if (builder.isFeasible(false)) {
     if (const GRState *state = PrevState->assume(V, false))
       builder.generateNode(MarkBranch(state, Term, false), false);
@@ -754,28 +754,28 @@
 ///  nodes by processing the 'effects' of a computed goto jump.
 void GRExprEngine::ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) {
 
-  const GRState *state = builder.getState();  
+  const GRState *state = builder.getState();
   SVal V = state->getSVal(builder.getTarget());
-  
+
   // Three possibilities:
   //
   //   (1) We know the computed label.
   //   (2) The label is NULL (or some other constant), or Undefined.
   //   (3) We have no clue about the label.  Dispatch to all targets.
   //
-  
+
   typedef GRIndirectGotoNodeBuilder::iterator iterator;
 
   if (isa<loc::GotoLabel>(V)) {
     LabelStmt* L = cast<loc::GotoLabel>(V).getLabel();
-    
+
     for (iterator I=builder.begin(), E=builder.end(); I != E; ++I) {
       if (I.getLabel() == L) {
         builder.generateNode(I, state);
         return;
       }
     }
-    
+
     assert (false && "No block with label.");
     return;
   }
@@ -786,10 +786,10 @@
     UndefBranches.insert(N);
     return;
   }
-  
+
   // This is really a catch-all.  We don't support symbolics yet.
   // FIXME: Implement dispatch for symbolic pointers.
-  
+
   for (iterator I=builder.begin(), E=builder.end(); I != E; ++I)
     builder.generateNode(I, state);
 }
@@ -797,27 +797,27 @@
 
 void GRExprEngine::VisitGuardedExpr(Expr* Ex, Expr* L, Expr* R,
                                     ExplodedNode* Pred, ExplodedNodeSet& Dst) {
-  
+
   assert (Ex == CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
-  
+
   const GRState* state = GetState(Pred);
   SVal X = state->getSVal(Ex);
-  
+
   assert (X.isUndef());
-  
+
   Expr *SE = (Expr*) cast<UndefinedVal>(X).getData();
-  assert(SE);  
+  assert(SE);
   X = state->getSVal(SE);
-  
+
   // Make sure that we invalidate the previous binding.
   MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, X, true));
 }
 
 /// ProcessSwitch - Called by GRCoreEngine.  Used to generate successor
 ///  nodes by processing the 'effects' of a switch statement.
-void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) {  
-  typedef GRSwitchNodeBuilder::iterator iterator;  
-  const GRState* state = builder.getState();  
+void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) {
+  typedef GRSwitchNodeBuilder::iterator iterator;
+  const GRState* state = builder.getState();
   Expr* CondE = builder.getCondition();
   SVal  CondV = state->getSVal(CondE);
 
@@ -827,55 +827,55 @@
     return;
   }
 
-  const GRState*  DefaultSt = state;  
+  const GRState*  DefaultSt = state;
   bool defaultIsFeasible = false;
-  
+
   for (iterator I = builder.begin(), EI = builder.end(); I != EI; ++I) {
     CaseStmt* Case = cast<CaseStmt>(I.getCase());
 
     // Evaluate the LHS of the case value.
     Expr::EvalResult V1;
-    bool b = Case->getLHS()->Evaluate(V1, getContext());    
-    
+    bool b = Case->getLHS()->Evaluate(V1, getContext());
+
     // Sanity checks.  These go away in Release builds.
-    assert(b && V1.Val.isInt() && !V1.HasSideEffects 
+    assert(b && V1.Val.isInt() && !V1.HasSideEffects
              && "Case condition must evaluate to an integer constant.");
-    b = b; // silence unused variable warning    
-    assert(V1.Val.getInt().getBitWidth() == 
+    b = b; // silence unused variable warning
+    assert(V1.Val.getInt().getBitWidth() ==
            getContext().getTypeSize(CondE->getType()));
-           
+
     // Get the RHS of the case, if it exists.
     Expr::EvalResult V2;
-    
+
     if (Expr* E = Case->getRHS()) {
       b = E->Evaluate(V2, getContext());
-      assert(b && V2.Val.isInt() && !V2.HasSideEffects 
+      assert(b && V2.Val.isInt() && !V2.HasSideEffects
              && "Case condition must evaluate to an integer constant.");
       b = b; // silence unused variable warning
     }
     else
       V2 = V1;
-    
+
     // FIXME: Eventually we should replace the logic below with a range
     //  comparison, rather than concretize the values within the range.
     //  This should be easy once we have "ranges" for NonLVals.
-        
+
     do {
-      nonloc::ConcreteInt CaseVal(getBasicVals().getValue(V1.Val.getInt()));      
+      nonloc::ConcreteInt CaseVal(getBasicVals().getValue(V1.Val.getInt()));
       SVal Res = EvalBinOp(DefaultSt, BinaryOperator::EQ, CondV, CaseVal,
                            getContext().IntTy);
-      
-      // Now "assume" that the case matches.      
+
+      // Now "assume" that the case matches.
       if (const GRState* stateNew = state->assume(Res, true)) {
         builder.generateCaseStmtNode(I, stateNew);
-       
+
         // If CondV evaluates to a constant, then we know that this
         // is the *only* case that we can take, so stop evaluating the
         // others.
         if (isa<nonloc::ConcreteInt>(CondV))
           return;
       }
-      
+
       // Now "assume" that the case doesn't match.  Add this state
       // to the default state (if it is feasible).
       if (const GRState *stateNew = DefaultSt->assume(Res, false)) {
@@ -886,15 +886,15 @@
       // Concretize the next value in the range.
       if (V1.Val.getInt() == V2.Val.getInt())
         break;
-      
+
       ++V1.Val.getInt();
       assert (V1.Val.getInt() <= V2.Val.getInt());
-      
+
     } while (true);
   }
-  
+
   // If we reach here, than we know that the default branch is
-  // possible.  
+  // possible.
   if (defaultIsFeasible) builder.generateDefaultCaseNode(DefaultSt);
 }
 
@@ -904,62 +904,62 @@
 
 void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, ExplodedNode* Pred,
                                     ExplodedNodeSet& Dst) {
-  
+
   assert(B->getOpcode() == BinaryOperator::LAnd ||
          B->getOpcode() == BinaryOperator::LOr);
-  
+
   assert(B == CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
-  
+
   const GRState* state = GetState(Pred);
   SVal X = state->getSVal(B);
   assert(X.isUndef());
-  
+
   Expr* Ex = (Expr*) cast<UndefinedVal>(X).getData();
-  
+
   assert(Ex);
-  
+
   if (Ex == B->getRHS()) {
-    
+
     X = state->getSVal(Ex);
-    
+
     // Handle undefined values.
-    
+
     if (X.isUndef()) {
       MakeNode(Dst, B, Pred, state->BindExpr(B, X));
       return;
     }
-    
+
     // We took the RHS.  Because the value of the '&&' or '||' expression must
     // evaluate to 0 or 1, we must assume the value of the RHS evaluates to 0
     // or 1.  Alternatively, we could take a lazy approach, and calculate this
     // value later when necessary.  We don't have the machinery in place for
     // this right now, and since most logical expressions are used for branches,
-    // the payoff is not likely to be large.  Instead, we do eager evaluation.        
+    // the payoff is not likely to be large.  Instead, we do eager evaluation.
     if (const GRState *newState = state->assume(X, true))
-      MakeNode(Dst, B, Pred, 
+      MakeNode(Dst, B, Pred,
                newState->BindExpr(B, ValMgr.makeIntVal(1U, B->getType())));
-      
+
     if (const GRState *newState = state->assume(X, false))
-      MakeNode(Dst, B, Pred, 
+      MakeNode(Dst, B, Pred,
                newState->BindExpr(B, ValMgr.makeIntVal(0U, B->getType())));
   }
   else {
     // We took the LHS expression.  Depending on whether we are '&&' or
     // '||' we know what the value of the expression is via properties of
     // the short-circuiting.
-    X = ValMgr.makeIntVal(B->getOpcode() == BinaryOperator::LAnd ? 0U : 1U, 
+    X = ValMgr.makeIntVal(B->getOpcode() == BinaryOperator::LAnd ? 0U : 1U,
                           B->getType());
     MakeNode(Dst, B, Pred, state->BindExpr(B, X));
   }
 }
- 
+
 //===----------------------------------------------------------------------===//
 // Transfer functions: Loads and stores.
 //===----------------------------------------------------------------------===//
 
-void GRExprEngine::VisitDeclRefExpr(DeclRefExpr *Ex, ExplodedNode *Pred, 
+void GRExprEngine::VisitDeclRefExpr(DeclRefExpr *Ex, ExplodedNode *Pred,
                                     ExplodedNodeSet &Dst, bool asLValue) {
-  
+
   const GRState* state = GetState(Pred);
 
   const NamedDecl* D = Ex->getDecl();
@@ -989,20 +989,20 @@
              ProgramPoint::PostLValueKind);
     return;
   }
-  
+
   assert (false &&
           "ValueDecl support for this ValueDecl not implemented.");
 }
 
 /// VisitArraySubscriptExpr - Transfer function for array accesses
-void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A, 
+void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A,
                                            ExplodedNode* Pred,
                                            ExplodedNodeSet& Dst, bool asLValue){
-  
+
   Expr* Base = A->getBase()->IgnoreParens();
   Expr* Idx  = A->getIdx()->IgnoreParens();
   ExplodedNodeSet Tmp;
-  
+
   if (Base->getType()->isVectorType()) {
     // For vector types get its lvalue.
     // FIXME: This may not be correct.  Is the rvalue of a vector its location?
@@ -1010,13 +1010,13 @@
     // semantics.
     VisitLValue(Base, Pred, Tmp);
   }
-  else  
+  else
     Visit(Base, Pred, Tmp);   // Get Base's rvalue, which should be an LocVal.
-  
+
   for (ExplodedNodeSet::iterator I1=Tmp.begin(), E1=Tmp.end(); I1!=E1; ++I1) {
     ExplodedNodeSet Tmp2;
     Visit(Idx, *I1, Tmp2);     // Evaluate the index.
-      
+
     for (ExplodedNodeSet::iterator I2=Tmp2.begin(),E2=Tmp2.end();I2!=E2; ++I2) {
       const GRState* state = GetState(*I2);
       SVal V = state->getLValue(A->getType(), state->getSVal(Base),
@@ -1034,15 +1034,15 @@
 /// VisitMemberExpr - Transfer function for member expressions.
 void GRExprEngine::VisitMemberExpr(MemberExpr* M, ExplodedNode* Pred,
                                    ExplodedNodeSet& Dst, bool asLValue) {
-  
+
   Expr* Base = M->getBase()->IgnoreParens();
   ExplodedNodeSet Tmp;
-  
-  if (M->isArrow()) 
+
+  if (M->isArrow())
     Visit(Base, Pred, Tmp);        // p->f = ...  or   ... = p->f
   else
     VisitLValue(Base, Pred, Tmp);  // x.f = ...   or   ... = x.f
-    
+
   FieldDecl *Field = dyn_cast<FieldDecl>(M->getMemberDecl());
   if (!Field) // FIXME: skipping member expressions for non-fields
     return;
@@ -1068,7 +1068,7 @@
                             const GRState* state, SVal location, SVal Val) {
 
   const GRState* newState = 0;
-  
+
   if (location.isUnknown()) {
     // We know that the new state will be the same as the old state since
     // the location of the binding is "unknown".  Consequently, there
@@ -1086,7 +1086,7 @@
   // doesn't do anything, just auto-propagate the current state.
   GRStmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, Pred, newState, Ex,
                                   newState != state);
-    
+
   getTF().EvalBind(BuilderRef, location, Val);
 }
 
@@ -1099,19 +1099,19 @@
 void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred,
                              const GRState* state, SVal location, SVal Val,
                              const void *tag) {
-  
+
   assert (Builder && "GRStmtNodeBuilder must be defined.");
-  
+
   // Evaluate the location (checks for bad dereferences).
   Pred = EvalLocation(Ex, Pred, state, location, tag);
-  
+
   if (!Pred)
     return;
 
   assert (!location.isUndef());
   state = GetState(Pred);
 
-  // Proceed with the store.  
+  // Proceed with the store.
   SaveAndRestore<ProgramPoint::Kind> OldSPointKind(Builder->PointKind);
   SaveAndRestore<const void*> OldTag(Builder->Tag);
   Builder->PointKind = ProgramPoint::PostStoreKind;
@@ -1123,14 +1123,14 @@
                             const GRState* state, SVal location,
                             const void *tag) {
 
-  // Evaluate the location (checks for bad dereferences).  
+  // Evaluate the location (checks for bad dereferences).
   Pred = EvalLocation(Ex, Pred, state, location, tag);
-  
+
   if (!Pred)
     return;
-  
+
   state = GetState(Pred);
-  
+
   // Proceed with the load.
   ProgramPoint::Kind K = ProgramPoint::PostLoadKind;
 
@@ -1144,7 +1144,7 @@
   }
   else {
     SVal V = state->getSVal(cast<Loc>(location), Ex->getType());
-    
+
     // Casts can create weird scenarios where a location must be implicitly
     // converted to something else.  For example:
     //
@@ -1152,19 +1152,19 @@
     //  int *y = (int*) &x; // void** -> int* cast.
     //  invalidate(y);  // 'x' now binds to a symbolic region
     //  int z = *y;
-    //    
+    //
     //if (isa<Loc>(V) && !Loc::IsLocType(Ex->getType())) {
     //  V = EvalCast(V, Ex->getType());
     //}
-    
+
     MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V), K, tag);
   }
 }
 
-void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr* Ex, Expr* StoreE, 
-                             ExplodedNode* Pred, const GRState* state, 
+void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr* Ex, Expr* StoreE,
+                             ExplodedNode* Pred, const GRState* state,
                              SVal location, SVal Val, const void *tag) {
- 
+
   ExplodedNodeSet TmpDst;
   EvalStore(TmpDst, StoreE, Pred, state, location, Val, tag);
 
@@ -1175,60 +1175,60 @@
 ExplodedNode* GRExprEngine::EvalLocation(Stmt* Ex, ExplodedNode* Pred,
                                          const GRState* state, SVal location,
                                          const void *tag) {
-  
+
   SaveAndRestore<const void*> OldTag(Builder->Tag);
   Builder->Tag = tag;
-  
-  // Check for loads/stores from/to undefined values.  
+
+  // Check for loads/stores from/to undefined values.
   if (location.isUndef()) {
     ExplodedNode* N =
       Builder->generateNode(Ex, state, Pred,
                             ProgramPoint::PostUndefLocationCheckFailedKind);
-    
+
     if (N) {
       N->markAsSink();
       UndefDeref.insert(N);
     }
-    
+
     return 0;
   }
-  
+
   // Check for loads/stores from/to unknown locations.  Treat as No-Ops.
   if (location.isUnknown())
     return Pred;
-  
+
   // During a load, one of two possible situations arise:
   //  (1) A crash, because the location (pointer) was NULL.
   //  (2) The location (pointer) is not NULL, and the dereference works.
-  // 
+  //
   // We add these assumptions.
-  
-  Loc LV = cast<Loc>(location);    
-  
+
+  Loc LV = cast<Loc>(location);
+
   // "Assume" that the pointer is not NULL.
   const GRState *StNotNull = state->assume(LV, true);
-  
+
   // "Assume" that the pointer is NULL.
   const GRState *StNull = state->assume(LV, false);
 
-  if (StNull) {    
+  if (StNull) {
     // Use the Generic Data Map to mark in the state what lval was null.
     const SVal* PersistentLV = getBasicVals().getPersistentSVal(LV);
     StNull = StNull->set<GRState::NullDerefTag>(PersistentLV);
-    
+
     // We don't use "MakeNode" here because the node will be a sink
     // and we have no intention of processing it later.
     ExplodedNode* NullNode =
-      Builder->generateNode(Ex, StNull, Pred, 
+      Builder->generateNode(Ex, StNull, Pred,
                             ProgramPoint::PostNullCheckFailedKind);
 
-    if (NullNode) {      
-      NullNode->markAsSink();      
+    if (NullNode) {
+      NullNode->markAsSink();
       if (StNotNull) ImplicitNullDeref.insert(NullNode);
       else ExplicitNullDeref.insert(NullNode);
     }
   }
-  
+
   if (!StNotNull)
     return NULL;
 
@@ -1245,9 +1245,9 @@
       SVal NumElements = getStoreManager().getSizeInElements(StNotNull,
                                                           ER->getSuperRegion());
 
-      const GRState * StInBound = StNotNull->assumeInBound(Idx, NumElements, 
+      const GRState * StInBound = StNotNull->assumeInBound(Idx, NumElements,
                                                            true);
-      const GRState* StOutBound = StNotNull->assumeInBound(Idx, NumElements, 
+      const GRState* StOutBound = StNotNull->assumeInBound(Idx, NumElements,
                                                            false);
 
       if (StOutBound) {
@@ -1273,7 +1273,7 @@
     }
   }
 #endif
-  
+
   // Generate a new node indicating the checks succeed.
   return Builder->generateNode(Ex, StNotNull, Pred,
                                ProgramPoint::PostLocationChecksSucceedKind);
@@ -1292,45 +1292,45 @@
 static bool EvalOSAtomicCompareAndSwap(ExplodedNodeSet& Dst,
                                        GRExprEngine& Engine,
                                        GRStmtNodeBuilder& Builder,
-                                       CallExpr* CE, SVal L,                 
+                                       CallExpr* CE, SVal L,
                                        ExplodedNode* Pred) {
 
   // Not enough arguments to match OSAtomicCompareAndSwap?
   if (CE->getNumArgs() != 3)
     return false;
-  
+
   ASTContext &C = Engine.getContext();
   Expr *oldValueExpr = CE->getArg(0);
   QualType oldValueType = C.getCanonicalType(oldValueExpr->getType());
 
   Expr *newValueExpr = CE->getArg(1);
   QualType newValueType = C.getCanonicalType(newValueExpr->getType());
-  
+
   // Do the types of 'oldValue' and 'newValue' match?
   if (oldValueType != newValueType)
     return false;
-  
+
   Expr *theValueExpr = CE->getArg(2);
   const PointerType *theValueType =
     theValueExpr->getType()->getAs<PointerType>();
-  
+
   // theValueType not a pointer?
   if (!theValueType)
     return false;
-  
+
   QualType theValueTypePointee =
     C.getCanonicalType(theValueType->getPointeeType()).getUnqualifiedType();
-  
+
   // The pointee must match newValueType and oldValueType.
   if (theValueTypePointee != newValueType)
     return false;
-  
+
   static unsigned magic_load = 0;
   static unsigned magic_store = 0;
 
   const void *OSAtomicLoadTag = &magic_load;
   const void *OSAtomicStoreTag = &magic_store;
-  
+
   // Load 'theValue'.
   const GRState *state = Pred->getState();
   ExplodedNodeSet Tmp;
@@ -1339,41 +1339,41 @@
 
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end();
        I != E; ++I) {
-  
+
     ExplodedNode *N = *I;
     const GRState *stateLoad = N->getState();
     SVal theValueVal = stateLoad->getSVal(theValueExpr);
     SVal oldValueVal = stateLoad->getSVal(oldValueExpr);
-    
+
     // FIXME: Issue an error.
     if (theValueVal.isUndef() || oldValueVal.isUndef()) {
-      return false;      
+      return false;
     }
-    
+
     SValuator &SVator = Engine.getSValuator();
-        
+
     // Perform the comparison.
     SVal Cmp = SVator.EvalBinOp(stateLoad, BinaryOperator::EQ, theValueVal,
                                 oldValueVal, Engine.getContext().IntTy);
 
     const GRState *stateEqual = stateLoad->assume(Cmp, true);
-    
+
     // Were they equal?
     if (stateEqual) {
       // Perform the store.
       ExplodedNodeSet TmpStore;
       SVal val = stateEqual->getSVal(newValueExpr);
-      
+
       // Handle implicit value casts.
       if (const TypedRegion *R =
           dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
         llvm::tie(state, val) = SVator.EvalCast(val, state, R->getValueType(C),
                                                 newValueExpr->getType());
-      }      
-      
-      Engine.EvalStore(TmpStore, theValueExpr, N, stateEqual, location, 
+      }
+
+      Engine.EvalStore(TmpStore, theValueExpr, N, stateEqual, location,
                        val, OSAtomicStoreTag);
-      
+
       // Now bind the result of the comparison.
       for (ExplodedNodeSet::iterator I2 = TmpStore.begin(),
            E2 = TmpStore.end(); I2 != E2; ++I2) {
@@ -1383,14 +1383,14 @@
         Engine.MakeNode(Dst, CE, predNew, stateNew->BindExpr(CE, Res));
       }
     }
-    
+
     // Were they not equal?
     if (const GRState *stateNotEqual = stateLoad->assume(Cmp, false)) {
       SVal Res = Engine.getValueManager().makeTruthVal(false, CE->getType());
       Engine.MakeNode(Dst, CE, N, stateNotEqual->BindExpr(CE, Res));
     }
   }
-      
+
   return true;
 }
 
@@ -1404,7 +1404,7 @@
     return false;
 
   const char *FName = FD->getNameAsCString();
-  
+
   // Check for compare and swap.
   if (strncmp(FName, "OSAtomicCompareAndSwap", 22) == 0 ||
       strncmp(FName, "objc_atomicCompareAndSwap", 25) == 0)
@@ -1418,12 +1418,12 @@
 // Transfer function: Function calls.
 //===----------------------------------------------------------------------===//
 static void MarkNoReturnFunction(const FunctionDecl *FD, CallExpr *CE,
-                                 const GRState *state, 
+                                 const GRState *state,
                                  GRStmtNodeBuilder *Builder) {
   if (!FD)
     return;
 
-  if (FD->getAttr<NoReturnAttr>() || 
+  if (FD->getAttr<NoReturnAttr>() ||
       FD->getAttr<AnalyzerNoReturnAttr>())
     Builder->BuildSinks = true;
   else {
@@ -1432,11 +1432,11 @@
     //  potentially cache these results.
     const char* s = FD->getIdentifier()->getName();
     unsigned n = strlen(s);
-        
+
     switch (n) {
     default:
       break;
-            
+
     case 4:
       if (!memcmp(s, "exit", 4)) Builder->BuildSinks = true;
       break;
@@ -1460,37 +1460,37 @@
         Builder->BuildSinks = true;
         break;
       }
-            
+
       // FIXME: This is just a wrapper around throwing an exception.
       //  Eventually inter-procedural analysis should handle this easily.
       if (!memcmp(s, "ziperr", 6)) Builder->BuildSinks = true;
 
       break;
-          
+
     case 7:
       if (!memcmp(s, "assfail", 7)) Builder->BuildSinks = true;
       break;
-            
+
     case 8:
-      if (!memcmp(s ,"db_error", 8) || 
+      if (!memcmp(s ,"db_error", 8) ||
           !memcmp(s, "__assert", 8))
         Builder->BuildSinks = true;
       break;
-          
+
     case 12:
       if (!memcmp(s, "__assert_rtn", 12)) Builder->BuildSinks = true;
       break;
-            
+
     case 13:
       if (!memcmp(s, "__assert_fail", 13)) Builder->BuildSinks = true;
       break;
-            
+
     case 14:
       if (!memcmp(s, "dtrace_assfail", 14) ||
           !memcmp(s, "yy_fatal_error", 14))
         Builder->BuildSinks = true;
       break;
-            
+
     case 26:
       if (!memcmp(s, "_XCAssertionFailureHandler", 26) ||
           !memcmp(s, "_DTAssertionFailureHandler", 26) ||
@@ -1499,7 +1499,7 @@
 
       break;
     }
-        
+
   }
 }
 
@@ -1508,7 +1508,7 @@
                                        ExplodedNodeSet &Dst) {
   if (!FD)
     return false;
-      
+
   unsigned id = FD->getBuiltinID(getContext());
   if (!id)
     return false;
@@ -1518,18 +1518,18 @@
   switch (id) {
   case Builtin::BI__builtin_expect: {
     // For __builtin_expect, just return the value of the subexpression.
-    assert (CE->arg_begin() != CE->arg_end());            
+    assert (CE->arg_begin() != CE->arg_end());
     SVal X = state->getSVal(*(CE->arg_begin()));
     MakeNode(Dst, CE, Pred, state->BindExpr(CE, X));
     return true;
   }
-            
+
   case Builtin::BI__builtin_alloca: {
     // FIXME: Refactor into StoreManager itself?
     MemRegionManager& RM = getStateManager().getRegionManager();
     const MemRegion* R =
       RM.getAllocaRegion(CE, Builder->getCurrentBlockCount());
-    
+
     // Set the extent of the region in bytes. This enables us to use the
     // SVal of the argument directly. If we save the extent in bits, we
     // cannot represent values like symbol*8.
@@ -1543,22 +1543,21 @@
   return false;
 }
 
-void GRExprEngine::EvalCall(ExplodedNodeSet& Dst, CallExpr* CE, SVal L, 
+void GRExprEngine::EvalCall(ExplodedNodeSet& Dst, CallExpr* CE, SVal L,
                             ExplodedNode* Pred) {
   assert (Builder && "GRStmtNodeBuilder must be defined.");
-  
+
   // FIXME: Allow us to chain together transfer functions.
   if (EvalOSAtomic(Dst, *this, *Builder, CE, L, Pred))
       return;
-      
+
   getTF().EvalCall(Dst, *this, *Builder, CE, L, Pred);
 }
 
 void GRExprEngine::VisitCall(CallExpr* CE, ExplodedNode* Pred,
                              CallExpr::arg_iterator AI,
                              CallExpr::arg_iterator AE,
-                             ExplodedNodeSet& Dst)
-{
+                             ExplodedNodeSet& Dst) {
   // Determine the type of function we're calling (if available).
   const FunctionProtoType *Proto = NULL;
   QualType FnType = CE->getCallee()->IgnoreParens()->getType();
@@ -1571,10 +1570,10 @@
 void GRExprEngine::VisitCallRec(CallExpr* CE, ExplodedNode* Pred,
                                 CallExpr::arg_iterator AI,
                                 CallExpr::arg_iterator AE,
-                                ExplodedNodeSet& Dst, 
-                                const FunctionProtoType *Proto, 
+                                ExplodedNodeSet& Dst,
+                                const FunctionProtoType *Proto,
                                 unsigned ParamIdx) {
-  
+
   // Process the arguments.
   if (AI != AE) {
     // If the call argument is being bound to a reference parameter,
@@ -1583,17 +1582,17 @@
     if (Proto && ParamIdx < Proto->getNumArgs())
       VisitAsLvalue = Proto->getArgType(ParamIdx)->isReferenceType();
 
-    ExplodedNodeSet DstTmp;  
+    ExplodedNodeSet DstTmp;
     if (VisitAsLvalue)
-      VisitLValue(*AI, Pred, DstTmp);    
+      VisitLValue(*AI, Pred, DstTmp);
     else
-      Visit(*AI, Pred, DstTmp);    
+      Visit(*AI, Pred, DstTmp);
     ++AI;
-    
+
     for (ExplodedNodeSet::iterator DI=DstTmp.begin(), DE=DstTmp.end(); DI != DE;
          ++DI)
       VisitCallRec(CE, *DI, AI, AE, Dst, Proto, ParamIdx + 1);
-    
+
     return;
   }
 
@@ -1601,17 +1600,17 @@
   // the callee expression.
   ExplodedNodeSet DstTmp;
   Expr* Callee = CE->getCallee()->IgnoreParens();
-  
+
   { // Enter new scope to make the lifetime of 'DstTmp2' bounded.
     ExplodedNodeSet DstTmp2;
     Visit(Callee, Pred, DstTmp2);
-    
+
     // Perform the previsit of the CallExpr, storing the results in DstTmp.
     CheckerVisit(CE, DstTmp, DstTmp2, true);
   }
-  
+
   // Finally, evaluate the function call.
-  for (ExplodedNodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end(); 
+  for (ExplodedNodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end();
        DI != DE; ++DI) {
 
     const GRState* state = GetState(*DI);
@@ -1621,25 +1620,25 @@
     //  function pointer values that are symbolic).
 
     // Check for the "noreturn" attribute.
-    
+
     SaveAndRestore<bool> OldSink(Builder->BuildSinks);
     const FunctionDecl* FD = L.getAsFunctionDecl();
 
     MarkNoReturnFunction(FD, CE, state, Builder);
-    
+
     // Evaluate the call.
     if (EvalBuiltinFunction(FD, CE, *DI, Dst))
       continue;
 
-    // Dispatch to the plug-in transfer function.      
-    
+    // Dispatch to the plug-in transfer function.
+
     unsigned size = Dst.size();
     SaveOr OldHasGen(Builder->HasGeneratedNode);
     EvalCall(Dst, CE, L, *DI);
-    
+
     // Handle the case where no nodes where generated.  Auto-generate that
     // contains the updated state if we aren't generating sinks.
-    
+
     if (!Builder->BuildSinks && Dst.size() == size &&
         !Builder->HasGeneratedNode)
       MakeNode(Dst, CE, *DI, state);
@@ -1656,31 +1655,31 @@
 void GRExprEngine::EvalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src, Expr *Ex) {
   for (ExplodedNodeSet::iterator I=Src.begin(), E=Src.end(); I!=E; ++I) {
     ExplodedNode *Pred = *I;
-    
+
     // Test if the previous node was as the same expression.  This can happen
     // when the expression fails to evaluate to anything meaningful and
     // (as an optimization) we don't generate a node.
-    ProgramPoint P = Pred->getLocation();    
+    ProgramPoint P = Pred->getLocation();
     if (!isa<PostStmt>(P) || cast<PostStmt>(P).getStmt() != Ex) {
-      Dst.Add(Pred);      
+      Dst.Add(Pred);
       continue;
-    }    
+    }
 
-    const GRState* state = Pred->getState();    
-    SVal V = state->getSVal(Ex);    
+    const GRState* state = Pred->getState();
+    SVal V = state->getSVal(Ex);
     if (isa<nonloc::SymExprVal>(V)) {
       // First assume that the condition is true.
       if (const GRState *stateTrue = state->assume(V, true)) {
-        stateTrue = stateTrue->BindExpr(Ex, 
+        stateTrue = stateTrue->BindExpr(Ex,
                                         ValMgr.makeIntVal(1U, Ex->getType()));
-        Dst.Add(Builder->generateNode(PostStmtCustom(Ex, 
+        Dst.Add(Builder->generateNode(PostStmtCustom(Ex,
                                 &EagerlyAssumeTag, Pred->getLocationContext()),
                                       stateTrue, Pred));
       }
-        
+
       // Next, assume that the condition is false.
       if (const GRState *stateFalse = state->assume(V, false)) {
-        stateFalse = stateFalse->BindExpr(Ex, 
+        stateFalse = stateFalse->BindExpr(Ex,
                                           ValMgr.makeIntVal(0U, Ex->getType()));
         Dst.Add(Builder->generateNode(PostStmtCustom(Ex, &EagerlyAssumeTag,
                                                    Pred->getLocationContext()),
@@ -1699,16 +1698,16 @@
 void GRExprEngine::VisitObjCIvarRefExpr(ObjCIvarRefExpr* Ex,
                                             ExplodedNode* Pred, ExplodedNodeSet& Dst,
                                             bool asLValue) {
-  
+
   Expr* Base = cast<Expr>(Ex->getBase());
   ExplodedNodeSet Tmp;
   Visit(Base, Pred, Tmp);
-  
+
   for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
     const GRState* state = GetState(*I);
     SVal BaseVal = state->getSVal(Base);
     SVal location = state->getLValue(Ex->getDecl(), BaseVal);
-    
+
     if (asLValue)
       MakeNode(Dst, Ex, *I, state->BindExpr(Ex, location));
     else
@@ -1722,7 +1721,7 @@
 
 void GRExprEngine::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S,
                                               ExplodedNode* Pred, ExplodedNodeSet& Dst) {
-    
+
   // ObjCForCollectionStmts are processed in two places.  This method
   // handles the case where an ObjCForCollectionStmt* occurs as one of the
   // statements within a basic block.  This transfer function does two things:
@@ -1734,7 +1733,7 @@
   //      whether or not the container has any more elements.  This value
   //      will be tested in ProcessBranch.  We need to explicitly bind
   //      this value because a container can contain nil elements.
-  //  
+  //
   // FIXME: Eventually this logic should actually do dispatches to
   //   'countByEnumeratingWithState:objects:count:' (NSFastEnumeration).
   //   This will require simulating a temporary NSFastEnumerationState, either
@@ -1747,10 +1746,10 @@
   //  For now: simulate (1) by assigning either a symbol or nil if the
   //    container is empty.  Thus this transfer function will by default
   //    result in state splitting.
-  
+
   Stmt* elem = S->getElement();
   SVal ElementV;
-    
+
   if (DeclStmt* DS = dyn_cast<DeclStmt>(elem)) {
     VarDecl* ElemD = cast<VarDecl>(DS->getSingleDecl());
     assert (ElemD->getInit() == 0);
@@ -1761,7 +1760,7 @@
 
   ExplodedNodeSet Tmp;
   VisitLValue(cast<Expr>(elem), Pred, Tmp);
-  
+
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
     const GRState* state = GetState(*I);
     VisitObjCForCollectionStmtAux(S, *I, Dst, state->getSVal(elem));
@@ -1771,27 +1770,27 @@
 void GRExprEngine::VisitObjCForCollectionStmtAux(ObjCForCollectionStmt* S,
                                                  ExplodedNode* Pred, ExplodedNodeSet& Dst,
                                                  SVal ElementV) {
-    
 
-  
+
+
   // Get the current state.  Use 'EvalLocation' to determine if it is a null
   // pointer, etc.
   Stmt* elem = S->getElement();
-  
+
   Pred = EvalLocation(elem, Pred, GetState(Pred), ElementV);
   if (!Pred)
     return;
-    
+
   const GRState *state = GetState(Pred);
 
   // Handle the case where the container still has elements.
   SVal TrueV = ValMgr.makeTruthVal(1);
   const GRState *hasElems = state->BindExpr(S, TrueV);
-  
+
   // Handle the case where the container has no elements.
   SVal FalseV = ValMgr.makeTruthVal(0);
   const GRState *noElems = state->BindExpr(S, FalseV);
-  
+
   if (loc::MemRegionVal* MV = dyn_cast<loc::MemRegionVal>(&ElementV))
     if (const TypedRegion* R = dyn_cast<TypedRegion>(MV->getRegion())) {
       // FIXME: The proper thing to do is to really iterate over the
@@ -1805,10 +1804,10 @@
       hasElems = hasElems->bindLoc(ElementV, V);
 
       // Bind the location to 'nil' on the false branch.
-      SVal nilV = ValMgr.makeIntVal(0, T);      
-      noElems = noElems->bindLoc(ElementV, nilV);      
+      SVal nilV = ValMgr.makeIntVal(0, T);
+      noElems = noElems->bindLoc(ElementV, nilV);
     }
-  
+
   // Create the new nodes.
   MakeNode(Dst, S, Pred, hasElems);
   MakeNode(Dst, S, Pred, noElems);
@@ -1820,38 +1819,38 @@
 
 void GRExprEngine::VisitObjCMessageExpr(ObjCMessageExpr* ME, ExplodedNode* Pred,
                                         ExplodedNodeSet& Dst){
-  
+
   VisitObjCMessageExprArgHelper(ME, ME->arg_begin(), ME->arg_end(),
                                 Pred, Dst);
-}  
+}
 
 void GRExprEngine::VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
                                               ObjCMessageExpr::arg_iterator AI,
                                               ObjCMessageExpr::arg_iterator AE,
                                               ExplodedNode* Pred, ExplodedNodeSet& Dst) {
   if (AI == AE) {
-    
+
     // Process the receiver.
-    
+
     if (Expr* Receiver = ME->getReceiver()) {
       ExplodedNodeSet Tmp;
       Visit(Receiver, Pred, Tmp);
-      
+
       for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
         VisitObjCMessageExprDispatchHelper(ME, *NI, Dst);
-      
+
       return;
     }
-    
+
     VisitObjCMessageExprDispatchHelper(ME, Pred, Dst);
     return;
   }
-  
+
   ExplodedNodeSet Tmp;
   Visit(*AI, Pred, Tmp);
-  
+
   ++AI;
-  
+
   for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
     VisitObjCMessageExprArgHelper(ME, AI, AE, *NI, Dst);
 }
@@ -1859,53 +1858,53 @@
 void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
                                                       ExplodedNode* Pred,
                                                       ExplodedNodeSet& Dst) {
-  
-  // FIXME: More logic for the processing the method call. 
-  
+
+  // FIXME: More logic for the processing the method call.
+
   const GRState* state = GetState(Pred);
   bool RaisesException = false;
-  
-  
+
+
   if (Expr* Receiver = ME->getReceiver()) {
-    
+
     SVal L = state->getSVal(Receiver);
-    
-    // Check for undefined control-flow.    
+
+    // Check for undefined control-flow.
     if (L.isUndef()) {
       ExplodedNode* N = Builder->generateNode(ME, state, Pred);
-      
+
       if (N) {
         N->markAsSink();
         UndefReceivers.insert(N);
       }
-      
+
       return;
     }
-    
-    // "Assume" that the receiver is not NULL.    
+
+    // "Assume" that the receiver is not NULL.
     const GRState *StNotNull = state->assume(L, true);
-    
-    // "Assume" that the receiver is NULL.    
+
+    // "Assume" that the receiver is NULL.
     const GRState *StNull = state->assume(L, false);
-    
+
     if (StNull) {
       QualType RetTy = ME->getType();
-      
+
       // Check if the receiver was nil and the return value a struct.
-      if(RetTy->isRecordType()) {
+      if (RetTy->isRecordType()) {
         if (BR.getParentMap().isConsumedExpr(ME)) {
           // The [0 ...] expressions will return garbage.  Flag either an
           // explicit or implicit error.  Because of the structure of this
           // function we currently do not bifurfacte the state graph at
           // this point.
           // FIXME: We should bifurcate and fill the returned struct with
-          //  garbage.                
+          //  garbage.
           if (ExplodedNode* N = Builder->generateNode(ME, StNull, Pred)) {
             N->markAsSink();
             if (StNotNull)
               NilReceiverStructRetImplicit.insert(N);
             else
-              NilReceiverStructRetExplicit.insert(N);            
+              NilReceiverStructRetExplicit.insert(N);
           }
         }
       }
@@ -1918,13 +1917,13 @@
             // sizeof(return type)
             const uint64_t returnTypeSize = Ctx.getTypeSize(ME->getType());
 
-            if(voidPtrSize < returnTypeSize) {
+            if (voidPtrSize < returnTypeSize) {
               if (ExplodedNode* N = Builder->generateNode(ME, StNull, Pred)) {
                 N->markAsSink();
-                if(StNotNull)
+                if (StNotNull)
                   NilReceiverLargerThanVoidPtrRetImplicit.insert(N);
                 else
-                  NilReceiverLargerThanVoidPtrRetExplicit.insert(N);            
+                  NilReceiverLargerThanVoidPtrRetExplicit.insert(N);
               }
             }
             else if (!StNotNull) {
@@ -1952,99 +1951,99 @@
       // of this method should assume that the receiver is not nil.
       if (!StNotNull)
         return;
-       
+
       state = StNotNull;
     }
-    
+
     // Check if the "raise" message was sent.
     if (ME->getSelector() == RaiseSel)
       RaisesException = true;
   }
   else {
-    
+
     IdentifierInfo* ClsName = ME->getClassName();
     Selector S = ME->getSelector();
-    
+
     // Check for special instance methods.
-        
-    if (!NSExceptionII) {      
+
+    if (!NSExceptionII) {
       ASTContext& Ctx = getContext();
-      
+
       NSExceptionII = &Ctx.Idents.get("NSException");
     }
-    
+
     if (ClsName == NSExceptionII) {
-        
+
       enum { NUM_RAISE_SELECTORS = 2 };
-      
+
       // Lazily create a cache of the selectors.
 
       if (!NSExceptionInstanceRaiseSelectors) {
-        
+
         ASTContext& Ctx = getContext();
-        
+
         NSExceptionInstanceRaiseSelectors = new Selector[NUM_RAISE_SELECTORS];
-      
+
         llvm::SmallVector<IdentifierInfo*, NUM_RAISE_SELECTORS> II;
         unsigned idx = 0;
-        
-        // raise:format:      
+
+        // raise:format:
         II.push_back(&Ctx.Idents.get("raise"));
-        II.push_back(&Ctx.Idents.get("format"));      
+        II.push_back(&Ctx.Idents.get("format"));
         NSExceptionInstanceRaiseSelectors[idx++] =
-          Ctx.Selectors.getSelector(II.size(), &II[0]);      
-        
-        // raise:format::arguments:      
+          Ctx.Selectors.getSelector(II.size(), &II[0]);
+
+        // raise:format::arguments:
         II.push_back(&Ctx.Idents.get("arguments"));
         NSExceptionInstanceRaiseSelectors[idx++] =
           Ctx.Selectors.getSelector(II.size(), &II[0]);
       }
-      
+
       for (unsigned i = 0; i < NUM_RAISE_SELECTORS; ++i)
         if (S == NSExceptionInstanceRaiseSelectors[i]) {
           RaisesException = true; break;
         }
     }
   }
-  
+
   // Check for any arguments that are uninitialized/undefined.
-  
+
   for (ObjCMessageExpr::arg_iterator I = ME->arg_begin(), E = ME->arg_end();
        I != E; ++I) {
-    
+
     if (state->getSVal(*I).isUndef()) {
-      
+
       // Generate an error node for passing an uninitialized/undefined value
       // as an argument to a message expression.  This node is a sink.
       ExplodedNode* N = Builder->generateNode(ME, state, Pred);
-      
+
       if (N) {
         N->markAsSink();
         MsgExprUndefArgs[N] = *I;
       }
-      
+
       return;
-    }    
+    }
   }
-  
+
   // Check if we raise an exception.  For now treat these as sinks.  Eventually
   // we will want to handle exceptions properly.
-  
+
   SaveAndRestore<bool> OldSink(Builder->BuildSinks);
 
   if (RaisesException)
     Builder->BuildSinks = true;
-  
+
   // Dispatch to plug-in transfer function.
-  
+
   unsigned size = Dst.size();
   SaveOr OldHasGen(Builder->HasGeneratedNode);
- 
+
   EvalObjCMessageExpr(Dst, ME, Pred);
-  
+
   // Handle the case where no nodes where generated.  Auto-generate that
   // contains the updated state if we aren't generating sinks.
-  
+
   if (!Builder->BuildSinks && Dst.size() == size && !Builder->HasGeneratedNode)
     MakeNode(Dst, ME, Pred, state);
 }
@@ -2065,9 +2064,9 @@
     VisitLValue(Ex, Pred, S1);
   else
     Visit(Ex, Pred, S1);
-  
+
   // Check for casting to "void".
-  if (T->isVoidType()) {    
+  if (T->isVoidType()) {
     for (ExplodedNodeSet::iterator I1 = S1.begin(), E1 = S1.end(); I1 != E1; ++I1)
       Dst.Add(*I1);
 
@@ -2085,13 +2084,13 @@
 }
 
 void GRExprEngine::VisitCompoundLiteralExpr(CompoundLiteralExpr* CL,
-                                            ExplodedNode* Pred, 
-                                            ExplodedNodeSet& Dst, 
+                                            ExplodedNode* Pred,
+                                            ExplodedNodeSet& Dst,
                                             bool asLValue) {
   InitListExpr* ILE = cast<InitListExpr>(CL->getInitializer()->IgnoreParens());
   ExplodedNodeSet Tmp;
   Visit(ILE, Pred, Tmp);
-  
+
   for (ExplodedNodeSet::iterator I = Tmp.begin(), EI = Tmp.end(); I!=EI; ++I) {
     const GRState* state = GetState(*I);
     SVal ILV = state->getSVal(ILE);
@@ -2105,15 +2104,15 @@
 }
 
 void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
-                                 ExplodedNodeSet& Dst) {  
+                                 ExplodedNodeSet& Dst) {
 
-  // The CFG has one DeclStmt per Decl.  
+  // The CFG has one DeclStmt per Decl.
   Decl* D = *DS->decl_begin();
-  
+
   if (!D || !isa<VarDecl>(D))
     return;
-  
-  const VarDecl* VD = dyn_cast<VarDecl>(D);    
+
+  const VarDecl* VD = dyn_cast<VarDecl>(D);
   Expr* InitEx = const_cast<Expr*>(VD->getInit());
 
   // FIXME: static variables may have an initializer, but the second
@@ -2124,7 +2123,7 @@
     Visit(InitEx, Pred, Tmp);
   else
     Tmp.Add(Pred);
-  
+
   for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
     const GRState* state = GetState(*I);
     unsigned Count = Builder->getCurrentBlockCount();
@@ -2133,58 +2132,58 @@
     QualType T = getContext().getCanonicalType(VD->getType());
     if (VariableArrayType* VLA = dyn_cast<VariableArrayType>(T)) {
       // FIXME: Handle multi-dimensional VLAs.
-      
+
       Expr* SE = VLA->getSizeExpr();
       SVal Size = state->getSVal(SE);
-      
+
       if (Size.isUndef()) {
         if (ExplodedNode* N = Builder->generateNode(DS, state, Pred)) {
-          N->markAsSink();          
+          N->markAsSink();
           ExplicitBadSizedVLA.insert(N);
         }
         continue;
       }
-      
-      const GRState* zeroState =  state->assume(Size, false);      
+
+      const GRState* zeroState =  state->assume(Size, false);
       state = state->assume(Size, true);
-      
+
       if (zeroState) {
         if (ExplodedNode* N = Builder->generateNode(DS, zeroState, Pred)) {
-          N->markAsSink();          
+          N->markAsSink();
           if (state)
             ImplicitBadSizedVLA.insert(N);
           else
             ExplicitBadSizedVLA.insert(N);
         }
       }
-      
+
       if (!state)
-        continue;      
+        continue;
     }
-    
+
     // Decls without InitExpr are not initialized explicitly.
     const LocationContext *LC = (*I)->getLocationContext();
 
     if (InitEx) {
       SVal InitVal = state->getSVal(InitEx);
       QualType T = VD->getType();
-      
+
       // Recover some path-sensitivity if a scalar value evaluated to
       // UnknownVal.
-      if (InitVal.isUnknown() || 
+      if (InitVal.isUnknown() ||
           !getConstraintManager().canReasonAbout(InitVal)) {
         InitVal = ValMgr.getConjuredSymbolVal(InitEx, Count);
-      }        
-      
+      }
+
       state = state->bindDecl(VD, LC, InitVal);
-      
+
       // The next thing to do is check if the GRTransferFuncs object wants to
       // update the state based on the new binding.  If the GRTransferFunc
       // object doesn't do anything, just auto-propagate the current state.
       GRStmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, *I, state, DS,true);
       getTF().EvalBind(BuilderRef, loc::MemRegionVal(state->getRegion(VD, LC)),
-                       InitVal);      
-    } 
+                       InitVal);
+    }
     else {
       state = state->bindDeclWithNoInit(VD, LC);
       MakeNode(Dst, DS, *I, state);
@@ -2200,7 +2199,7 @@
   llvm::ImmutableList<SVal> Vals;
   ExplodedNode* N;
   InitListExpr::reverse_iterator Itr;
-  
+
   InitListWLItem(ExplodedNode* n, llvm::ImmutableList<SVal> vals,
                  InitListExpr::reverse_iterator itr)
   : Vals(vals), N(n), Itr(itr) {}
@@ -2208,52 +2207,52 @@
 }
 
 
-void GRExprEngine::VisitInitListExpr(InitListExpr* E, ExplodedNode* Pred, 
+void GRExprEngine::VisitInitListExpr(InitListExpr* E, ExplodedNode* Pred,
                                      ExplodedNodeSet& Dst) {
 
   const GRState* state = GetState(Pred);
   QualType T = getContext().getCanonicalType(E->getType());
-  unsigned NumInitElements = E->getNumInits();  
+  unsigned NumInitElements = E->getNumInits();
 
   if (T->isArrayType() || T->isStructureType() ||
       T->isUnionType() || T->isVectorType()) {
 
     llvm::ImmutableList<SVal> StartVals = getBasicVals().getEmptySValList();
-    
+
     // Handle base case where the initializer has no elements.
     // e.g: static int* myArray[] = {};
     if (NumInitElements == 0) {
       SVal V = ValMgr.makeCompoundVal(T, StartVals);
       MakeNode(Dst, E, Pred, state->BindExpr(E, V));
       return;
-    }      
-    
+    }
+
     // Create a worklist to process the initializers.
     llvm::SmallVector<InitListWLItem, 10> WorkList;
-    WorkList.reserve(NumInitElements);  
-    WorkList.push_back(InitListWLItem(Pred, StartVals, E->rbegin()));    
+    WorkList.reserve(NumInitElements);
+    WorkList.push_back(InitListWLItem(Pred, StartVals, E->rbegin()));
     InitListExpr::reverse_iterator ItrEnd = E->rend();
-    
+
     // Process the worklist until it is empty.
     while (!WorkList.empty()) {
       InitListWLItem X = WorkList.back();
       WorkList.pop_back();
-      
+
       ExplodedNodeSet Tmp;
       Visit(*X.Itr, X.N, Tmp);
-      
+
       InitListExpr::reverse_iterator NewItr = X.Itr + 1;
 
       for (ExplodedNodeSet::iterator NI=Tmp.begin(), NE=Tmp.end(); NI!=NE; ++NI) {
         // Get the last initializer value.
         state = GetState(*NI);
         SVal InitV = state->getSVal(cast<Expr>(*X.Itr));
-        
+
         // Construct the new list of values by prepending the new value to
         // the already constructed list.
         llvm::ImmutableList<SVal> NewVals =
           getBasicVals().consVals(InitV, X.Vals);
-        
+
         if (NewItr == ItrEnd) {
           // Now we have a list holding all init values. Make CompoundValData.
           SVal V = ValMgr.makeCompoundVal(T, NewVals);
@@ -2267,7 +2266,7 @@
         }
       }
     }
-    
+
     return;
   }
 
@@ -2293,10 +2292,10 @@
                                           ExplodedNode* Pred,
                                           ExplodedNodeSet& Dst) {
   QualType T = Ex->getTypeOfArgument();
-  uint64_t amt;  
-  
+  uint64_t amt;
+
   if (Ex->isSizeOf()) {
-    if (T == getContext().VoidTy) {          
+    if (T == getContext().VoidTy) {
       // sizeof(void) == 1 byte.
       amt = 1;
     }
@@ -2307,17 +2306,17 @@
     else if (T->isObjCInterfaceType()) {
       // Some code tries to take the sizeof an ObjCInterfaceType, relying that
       // the compiler has laid out its representation.  Just report Unknown
-      // for these.      
+      // for these.
       return;
     }
     else {
       // All other cases.
       amt = getContext().getTypeSize(T) / 8;
-    }    
+    }
   }
   else  // Get alignment of the type.
     amt = getContext().getTypeAlign(T) / 8;
-  
+
   MakeNode(Dst, Ex, Pred,
            GetState(Pred)->BindExpr(Ex, ValMgr.makeIntVal(amt, Ex->getType())));
 }
@@ -2327,61 +2326,61 @@
                                       ExplodedNodeSet& Dst, bool asLValue) {
 
   switch (U->getOpcode()) {
-      
+
     default:
       break;
-          
+
     case UnaryOperator::Deref: {
-      
+
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       Visit(Ex, Pred, Tmp);
-      
+
       for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
-        
+
         const GRState* state = GetState(*I);
         SVal location = state->getSVal(Ex);
-        
+
         if (asLValue)
           MakeNode(Dst, U, *I, state->BindExpr(U, location),
                    ProgramPoint::PostLValueKind);
         else
           EvalLoad(Dst, U, *I, state, location);
-      } 
+      }
 
       return;
     }
-      
+
     case UnaryOperator::Real: {
-      
+
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       Visit(Ex, Pred, Tmp);
-      
+
       for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
-        
+
         // FIXME: We don't have complex SValues yet.
         if (Ex->getType()->isAnyComplexType()) {
           // Just report "Unknown."
           Dst.Add(*I);
           continue;
         }
-        
+
         // For all other types, UnaryOperator::Real is an identity operation.
         assert (U->getType() == Ex->getType());
         const GRState* state = GetState(*I);
         MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
-      } 
-      
+      }
+
       return;
     }
-      
+
     case UnaryOperator::Imag: {
-      
+
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       Visit(Ex, Pred, Tmp);
-      
+
       for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
         // FIXME: We don't have complex SValues yet.
         if (Ex->getType()->isAnyComplexType()) {
@@ -2389,25 +2388,25 @@
           Dst.Add(*I);
           continue;
         }
-        
+
         // For all other types, UnaryOperator::Float returns 0.
         assert (Ex->getType()->isIntegerType());
         const GRState* state = GetState(*I);
         SVal X = ValMgr.makeZeroVal(Ex->getType());
         MakeNode(Dst, U, *I, state->BindExpr(U, X));
       }
-      
+
       return;
     }
-      
-      // FIXME: Just report "Unknown" for OffsetOf.      
+
+      // FIXME: Just report "Unknown" for OffsetOf.
     case UnaryOperator::OffsetOf:
       Dst.Add(Pred);
       return;
-      
+
     case UnaryOperator::Plus: assert (!asLValue);  // FALL-THROUGH.
     case UnaryOperator::Extension: {
-      
+
       // Unary "+" is a no-op, similar to a parentheses.  We still have places
       // where it may be a block-level expression, so we need to
       // generate an extra node that just propagates the value of the
@@ -2416,44 +2415,44 @@
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       Visit(Ex, Pred, Tmp);
-      
-      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {        
+
+      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
         const GRState* state = GetState(*I);
         MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
       }
-      
+
       return;
     }
-    
+
     case UnaryOperator::AddrOf: {
-      
+
       assert(!asLValue);
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       VisitLValue(Ex, Pred, Tmp);
-     
-      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {        
+
+      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
         const GRState* state = GetState(*I);
         SVal V = state->getSVal(Ex);
         state = state->BindExpr(U, V);
         MakeNode(Dst, U, *I, state);
       }
 
-      return; 
+      return;
     }
-      
+
     case UnaryOperator::LNot:
     case UnaryOperator::Minus:
     case UnaryOperator::Not: {
-      
+
       assert (!asLValue);
       Expr* Ex = U->getSubExpr()->IgnoreParens();
       ExplodedNodeSet Tmp;
       Visit(Ex, Pred, Tmp);
-      
-      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {        
+
+      for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
         const GRState* state = GetState(*I);
-        
+
         // Get the value of the subexpression.
         SVal V = state->getSVal(Ex);
 
@@ -2461,41 +2460,41 @@
           MakeNode(Dst, U, *I, state->BindExpr(U, V));
           continue;
         }
-        
+
 //        QualType DstT = getContext().getCanonicalType(U->getType());
 //        QualType SrcT = getContext().getCanonicalType(Ex->getType());
-//        
+//
 //        if (DstT != SrcT) // Perform promotions.
-//          V = EvalCast(V, DstT); 
-//        
+//          V = EvalCast(V, DstT);
+//
 //        if (V.isUnknownOrUndef()) {
 //          MakeNode(Dst, U, *I, BindExpr(St, U, V));
 //          continue;
 //        }
-        
+
         switch (U->getOpcode()) {
           default:
             assert(false && "Invalid Opcode.");
             break;
-            
+
           case UnaryOperator::Not:
             // FIXME: Do we need to handle promotions?
             state = state->BindExpr(U, EvalComplement(cast<NonLoc>(V)));
-            break;            
-            
+            break;
+
           case UnaryOperator::Minus:
             // FIXME: Do we need to handle promotions?
             state = state->BindExpr(U, EvalMinus(cast<NonLoc>(V)));
-            break;   
-            
-          case UnaryOperator::LNot:   
-            
+            break;
+
+          case UnaryOperator::LNot:
+
             // C99 6.5.3.3: "The expression !E is equivalent to (0==E)."
             //
             //  Note: technically we do "E == 0", but this is the same in the
             //    transfer functions as "0 == E".
             SVal Result;
-            
+
             if (isa<Loc>(V)) {
               Loc X = ValMgr.makeNull();
               Result = EvalBinOp(state, BinaryOperator::EQ, cast<Loc>(V), X,
@@ -2506,15 +2505,15 @@
               Result = EvalBinOp(BinaryOperator::EQ, cast<NonLoc>(V), X,
                                  U->getType());
             }
-            
+
             state = state->BindExpr(U, Result);
-            
+
             break;
         }
-        
+
         MakeNode(Dst, U, *I, state);
       }
-      
+
       return;
     }
   }
@@ -2525,28 +2524,28 @@
   ExplodedNodeSet Tmp;
   Expr* Ex = U->getSubExpr()->IgnoreParens();
   VisitLValue(Ex, Pred, Tmp);
-  
+
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
-    
+
     const GRState* state = GetState(*I);
     SVal V1 = state->getSVal(Ex);
-    
-    // Perform a load.      
+
+    // Perform a load.
     ExplodedNodeSet Tmp2;
     EvalLoad(Tmp2, Ex, *I, state, V1);
 
     for (ExplodedNodeSet::iterator I2 = Tmp2.begin(), E2 = Tmp2.end(); I2!=E2; ++I2) {
-        
+
       state = GetState(*I2);
       SVal V2 = state->getSVal(Ex);
-        
-      // Propagate unknown and undefined values.      
+
+      // Propagate unknown and undefined values.
       if (V2.isUnknownOrUndef()) {
         MakeNode(Dst, U, *I2, state->BindExpr(U, V2));
         continue;
       }
-      
-      // Handle all other values.      
+
+      // Handle all other values.
       BinaryOperator::Opcode Op = U->isIncrementOp() ? BinaryOperator::Add
                                                      : BinaryOperator::Sub;
 
@@ -2560,37 +2559,37 @@
       else
         RHS = ValMgr.makeIntVal(1, U->getType());
 
-      SVal Result = EvalBinOp(state, Op, V2, RHS, U->getType());    
-      
+      SVal Result = EvalBinOp(state, Op, V2, RHS, U->getType());
+
       // Conjure a new symbol if necessary to recover precision.
       if (Result.isUnknown() || !getConstraintManager().canReasonAbout(Result)){
         Result = ValMgr.getConjuredSymbolVal(Ex,
                                              Builder->getCurrentBlockCount());
-        
+
         // If the value is a location, ++/-- should always preserve
         // non-nullness.  Check if the original value was non-null, and if so
-        // propagate that constraint.        
+        // propagate that constraint.
         if (Loc::IsLocType(U->getType())) {
           SVal Constraint = EvalBinOp(state, BinaryOperator::EQ, V2,
                                       ValMgr.makeZeroVal(U->getType()),
-                                      getContext().IntTy);          
-          
+                                      getContext().IntTy);
+
           if (!state->assume(Constraint, true)) {
             // It isn't feasible for the original value to be null.
             // Propagate this constraint.
             Constraint = EvalBinOp(state, BinaryOperator::EQ, Result,
                                    ValMgr.makeZeroVal(U->getType()),
                                    getContext().IntTy);
-            
+
             state = state->assume(Constraint, false);
             assert(state);
-          }            
-        }        
+          }
+        }
       }
-      
+
       state = state->BindExpr(U, U->isPostfix() ? V2 : Result);
 
-      // Perform the store.      
+      // Perform the store.
       EvalStore(Dst, U, *I2, state, V1, Result);
     }
   }
@@ -2598,7 +2597,7 @@
 
 void GRExprEngine::VisitAsmStmt(AsmStmt* A, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
   VisitAsmStmtHelperOutputs(A, A->begin_outputs(), A->end_outputs(), Pred, Dst);
-}  
+}
 
 void GRExprEngine::VisitAsmStmtHelperOutputs(AsmStmt* A,
                                              AsmStmt::outputs_iterator I,
@@ -2608,12 +2607,12 @@
     VisitAsmStmtHelperInputs(A, A->begin_inputs(), A->end_inputs(), Pred, Dst);
     return;
   }
-  
+
   ExplodedNodeSet Tmp;
   VisitLValue(*I, Pred, Tmp);
-  
+
   ++I;
-  
+
   for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
     VisitAsmStmtHelperOutputs(A, I, E, *NI, Dst);
 }
@@ -2623,35 +2622,35 @@
                                             AsmStmt::inputs_iterator E,
                                             ExplodedNode* Pred, ExplodedNodeSet& Dst) {
   if (I == E) {
-    
+
     // We have processed both the inputs and the outputs.  All of the outputs
     // should evaluate to Locs.  Nuke all of their values.
-    
+
     // FIXME: Some day in the future it would be nice to allow a "plug-in"
     // which interprets the inline asm and stores proper results in the
     // outputs.
-    
+
     const GRState* state = GetState(Pred);
-    
+
     for (AsmStmt::outputs_iterator OI = A->begin_outputs(),
                                    OE = A->end_outputs(); OI != OE; ++OI) {
-      
-      SVal X = state->getSVal(*OI);      
+
+      SVal X = state->getSVal(*OI);
       assert (!isa<NonLoc>(X));  // Should be an Lval, or unknown, undef.
-      
+
       if (isa<Loc>(X))
         state = state->bindLoc(cast<Loc>(X), UnknownVal());
     }
-    
+
     MakeNode(Dst, A, Pred, state);
     return;
   }
-  
+
   ExplodedNodeSet Tmp;
   Visit(*I, Pred, Tmp);
-  
+
   ++I;
-  
+
   for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI!=NE; ++NI)
     VisitAsmStmtHelperInputs(A, I, E, *NI, Dst);
 }
@@ -2659,16 +2658,16 @@
 void GRExprEngine::EvalReturn(ExplodedNodeSet& Dst, ReturnStmt* S,
                               ExplodedNode* Pred) {
   assert (Builder && "GRStmtNodeBuilder must be defined.");
-  
-  unsigned size = Dst.size();  
+
+  unsigned size = Dst.size();
 
   SaveAndRestore<bool> OldSink(Builder->BuildSinks);
   SaveOr OldHasGen(Builder->HasGeneratedNode);
 
   getTF().EvalReturn(Dst, *this, *Builder, S, Pred);
-  
+
   // Handle the case where no nodes where generated.
-  
+
   if (!Builder->BuildSinks && Dst.size() == size && !Builder->HasGeneratedNode)
     MakeNode(Dst, S, Pred, GetState(Pred));
 }
@@ -2677,7 +2676,7 @@
                                    ExplodedNodeSet& Dst) {
 
   Expr* R = S->getRetValue();
-  
+
   if (!R) {
     EvalReturn(Dst, S, Pred);
     return;
@@ -2688,12 +2687,12 @@
 
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I != E; ++I) {
     SVal X = (*I)->getState()->getSVal(R);
-    
+
     // Check if we return the address of a stack variable.
     if (isa<loc::MemRegionVal>(X)) {
       // Determine if the value is on the stack.
       const MemRegion* R = cast<loc::MemRegionVal>(&X)->getRegion();
-      
+
       if (R && R->hasStackStorage()) {
         // Create a special node representing the error.
         if (ExplodedNode* N = Builder->generateNode(S, GetState(*I), *I)) {
@@ -2711,7 +2710,7 @@
       }
       continue;
     }
-    
+
     EvalReturn(Dst, S, *I);
   }
 }
@@ -2727,13 +2726,13 @@
   ExplodedNodeSet Tmp1;
   Expr* LHS = B->getLHS()->IgnoreParens();
   Expr* RHS = B->getRHS()->IgnoreParens();
-  
+
   // FIXME: Add proper support for ObjCImplicitSetterGetterRefExpr.
   if (isa<ObjCImplicitSetterGetterRefExpr>(LHS)) {
-    Visit(RHS, Pred, Dst);   
+    Visit(RHS, Pred, Dst);
     return;
   }
-  
+
   if (B->isAssignmentOp())
     VisitLValue(LHS, Pred, Tmp1);
   else
@@ -2742,18 +2741,18 @@
   for (ExplodedNodeSet::iterator I1=Tmp1.begin(), E1=Tmp1.end(); I1!=E1; ++I1) {
 
     SVal LeftV = (*I1)->getState()->getSVal(LHS);
-    
+
     // Process the RHS.
-    
+
     ExplodedNodeSet Tmp2;
     Visit(RHS, *I1, Tmp2);
 
     ExplodedNodeSet CheckedSet;
     CheckerVisit(B, CheckedSet, Tmp2, true);
-    
+
     // With both the LHS and RHS evaluated, process the operation itself.
-    
-    for (ExplodedNodeSet::iterator I2=CheckedSet.begin(), E2=CheckedSet.end(); 
+
+    for (ExplodedNodeSet::iterator I2=CheckedSet.begin(), E2=CheckedSet.end();
          I2 != E2; ++I2) {
 
       const GRState* state = GetState(*I2);
@@ -2761,41 +2760,41 @@
 
       SVal RightV = state->getSVal(RHS);
       BinaryOperator::Opcode Op = B->getOpcode();
-      
+
       switch (Op) {
-          
+
         case BinaryOperator::Assign: {
-          
+
           // EXPERIMENTAL: "Conjured" symbols.
           // FIXME: Handle structs.
           QualType T = RHS->getType();
-          
-          if ((RightV.isUnknown() || 
-               !getConstraintManager().canReasonAbout(RightV))              
-              && (Loc::IsLocType(T) || 
+
+          if ((RightV.isUnknown() ||
+               !getConstraintManager().canReasonAbout(RightV))
+              && (Loc::IsLocType(T) ||
                   (T->isScalarType() && T->isIntegerType()))) {
-            unsigned Count = Builder->getCurrentBlockCount();            
+            unsigned Count = Builder->getCurrentBlockCount();
             RightV = ValMgr.getConjuredSymbolVal(B->getRHS(), Count);
           }
-          
+
           // Simulate the effects of a "store":  bind the value of the RHS
-          // to the L-Value represented by the LHS.          
-          EvalStore(Dst, B, LHS, *I2, state->BindExpr(B, RightV), 
+          // to the L-Value represented by the LHS.
+          EvalStore(Dst, B, LHS, *I2, state->BindExpr(B, RightV),
                     LeftV, RightV);
           continue;
         }
-          
+
           // FALL-THROUGH.
 
         default: {
-      
+
           if (B->isAssignmentOp())
             break;
-          
+
           // Process non-assignments except commas or short-circuited
-          // logical expressions (LAnd and LOr).          
+          // logical expressions (LAnd and LOr).
           SVal Result = EvalBinOp(state, Op, LeftV, RightV, B->getType());
-          
+
           if (Result.isUnknown()) {
             if (OldSt != state) {
               // Generate a new node if we have already created a new state.
@@ -2803,30 +2802,30 @@
             }
             else
               Dst.Add(*I2);
-            
+
             continue;
           }
-          
+
           if (Result.isUndef() && !LeftV.isUndef() && !RightV.isUndef()) {
-            
+
             // The operands were *not* undefined, but the result is undefined.
             // This is a special node that should be flagged as an error.
-            
+
             if (ExplodedNode* UndefNode = Builder->generateNode(B, state, *I2)){
-              UndefNode->markAsSink();            
+              UndefNode->markAsSink();
               UndefResults.insert(UndefNode);
             }
-            
+
             continue;
           }
-          
+
           // Otherwise, create a new node.
-          
+
           MakeNode(Dst, B, *I2, state->BindExpr(B, Result));
           continue;
         }
       }
-    
+
       assert (B->isCompoundAssignmentOp());
 
       switch (Op) {
@@ -2843,26 +2842,26 @@
         case BinaryOperator::XorAssign: Op = BinaryOperator::Xor; break;
         case BinaryOperator::OrAssign:  Op = BinaryOperator::Or;  break;
       }
-          
+
       // Perform a load (the LHS).  This performs the checks for
       // null dereferences, and so on.
       ExplodedNodeSet Tmp3;
       SVal location = state->getSVal(LHS);
       EvalLoad(Tmp3, LHS, *I2, state, location);
-      
-      for (ExplodedNodeSet::iterator I3=Tmp3.begin(), E3=Tmp3.end(); I3!=E3; 
+
+      for (ExplodedNodeSet::iterator I3=Tmp3.begin(), E3=Tmp3.end(); I3!=E3;
            ++I3) {
-        
+
         state = GetState(*I3);
         SVal V = state->getSVal(LHS);
 
-        // Propagate undefined values (left-side).          
+        // Propagate undefined values (left-side).
         if (V.isUndef()) {
-          EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, V), 
+          EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, V),
                     location, V);
           continue;
         }
-        
+
         // Propagate unknown values (left and right-side).
         if (RightV.isUnknown() || V.isUnknown()) {
           EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, UnknownVal()),
@@ -2874,7 +2873,7 @@
         //
         //  The LHS is not Undef/Unknown.
         //  The RHS is not Unknown.
-        
+
         // Get the computation type.
         QualType CTy =
           cast<CompoundAssignOperator>(B)->getComputationResultType();
@@ -2890,24 +2889,24 @@
         // Promote LHS.
         llvm::tie(state, V) = SVator.EvalCast(V, state, CLHSTy, LTy);
 
-        // Evaluate operands and promote to result type.                    
-        if (RightV.isUndef()) {            
-          // Propagate undefined values (right-side).          
+        // Evaluate operands and promote to result type.
+        if (RightV.isUndef()) {
+          // Propagate undefined values (right-side).
           EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, RightV), location,
                     RightV);
           continue;
         }
-      
-        // Compute the result of the operation.      
+
+        // Compute the result of the operation.
         SVal Result;
         llvm::tie(state, Result) = SVator.EvalCast(EvalBinOp(state, Op, V,
                                                              RightV, CTy),
                                                    state, B->getType(), CTy);
-          
+
         if (Result.isUndef()) {
           // The operands were not undefined, but the result is undefined.
           if (ExplodedNode* UndefNode = Builder->generateNode(B, state, *I3)) {
-            UndefNode->markAsSink();            
+            UndefNode->markAsSink();
             UndefResults.insert(UndefNode);
           }
           continue;
@@ -2915,21 +2914,21 @@
 
         // EXPERIMENTAL: "Conjured" symbols.
         // FIXME: Handle structs.
-        
+
         SVal LHSVal;
-        
-        if ((Result.isUnknown() || 
+
+        if ((Result.isUnknown() ||
              !getConstraintManager().canReasonAbout(Result))
-            && (Loc::IsLocType(CTy) 
+            && (Loc::IsLocType(CTy)
                 || (CTy->isScalarType() && CTy->isIntegerType()))) {
-          
+
           unsigned Count = Builder->getCurrentBlockCount();
-          
+
           // The symbolic value is actually for the type of the left-hand side
           // expression, not the computation type, as this is the value the
           // LValue on the LHS will bind to.
           LHSVal = ValMgr.getConjuredSymbolVal(B->getRHS(), LTy, Count);
-          
+
           // However, we need to convert the symbol to the computation type.
           llvm::tie(state, Result) = SVator.EvalCast(LHSVal, state, CTy, LTy);
         }
@@ -2938,8 +2937,8 @@
           // computation type.
           llvm::tie(state, LHSVal) = SVator.EvalCast(Result, state, LTy, CTy);
         }
-          
-        EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, Result), 
+
+        EvalStore(Dst, B, LHS, *I3, state->BindExpr(B, Result),
                   location, LHSVal);
       }
     }
@@ -2958,9 +2957,9 @@
 template<>
 struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
   public DefaultDOTGraphTraits {
-    
+
   static std::string getNodeAttributes(const ExplodedNode* N, void*) {
-    
+
     if (GraphPrintCheckerState->isImplicitNullDeref(N) ||
         GraphPrintCheckerState->isExplicitNullDeref(N) ||
         GraphPrintCheckerState->isUndefDeref(N) ||
@@ -2972,50 +2971,50 @@
         GraphPrintCheckerState->isBadCall(N) ||
         GraphPrintCheckerState->isUndefArg(N))
       return "color=\"red\",style=\"filled\"";
-    
+
     if (GraphPrintCheckerState->isNoReturnCall(N))
       return "color=\"blue\",style=\"filled\"";
-    
+
     return "";
   }
-    
+
   static std::string getNodeLabel(const ExplodedNode* N, void*,bool ShortNames){
-    
+
     std::string sbuf;
     llvm::raw_string_ostream Out(sbuf);
 
     // Program Location.
     ProgramPoint Loc = N->getLocation();
-    
+
     switch (Loc.getKind()) {
       case ProgramPoint::BlockEntranceKind:
-        Out << "Block Entrance: B" 
+        Out << "Block Entrance: B"
             << cast<BlockEntrance>(Loc).getBlock()->getBlockID();
         break;
-      
+
       case ProgramPoint::BlockExitKind:
         assert (false);
         break;
-        
+
       default: {
         if (StmtPoint *L = dyn_cast<StmtPoint>(&Loc)) {
           const Stmt* S = L->getStmt();
           SourceLocation SLoc = S->getLocStart();
 
-          Out << S->getStmtClassName() << ' ' << (void*) S << ' ';        
+          Out << S->getStmtClassName() << ' ' << (void*) S << ' ';
           LangOptions LO; // FIXME.
           S->printPretty(Out, 0, PrintingPolicy(LO));
-          
-          if (SLoc.isFileID()) {        
+
+          if (SLoc.isFileID()) {
             Out << "\\lline="
               << GraphPrintSourceManager->getInstantiationLineNumber(SLoc)
               << " col="
               << GraphPrintSourceManager->getInstantiationColumnNumber(SLoc)
               << "\\l";
           }
-          
+
           if (isa<PreStmt>(Loc))
-            Out << "\\lPreStmt\\l;";          
+            Out << "\\lPreStmt\\l;";
           else if (isa<PostLoad>(Loc))
             Out << "\\lPostLoad\\l;";
           else if (isa<PostStore>(Loc))
@@ -3026,7 +3025,7 @@
             Out << "\\lPostLocationChecksSucceed\\l";
           else if (isa<PostNullCheckFailed>(Loc))
             Out << "\\lPostNullCheckFailed\\l";
-          
+
           if (GraphPrintCheckerState->isImplicitNullDeref(N))
             Out << "\\|Implicit-Null Dereference.\\l";
           else if (GraphPrintCheckerState->isExplicitNullDeref(N))
@@ -3047,43 +3046,43 @@
             Out << "\\|Call to NULL/Undefined.";
           else if (GraphPrintCheckerState->isUndefArg(N))
             Out << "\\|Argument in call is undefined";
-          
+
           break;
         }
 
         const BlockEdge& E = cast<BlockEdge>(Loc);
         Out << "Edge: (B" << E.getSrc()->getBlockID() << ", B"
             << E.getDst()->getBlockID()  << ')';
-        
+
         if (Stmt* T = E.getSrc()->getTerminator()) {
-          
+
           SourceLocation SLoc = T->getLocStart();
-         
+
           Out << "\\|Terminator: ";
           LangOptions LO; // FIXME.
           E.getSrc()->printTerminator(Out, LO);
-          
+
           if (SLoc.isFileID()) {
             Out << "\\lline="
               << GraphPrintSourceManager->getInstantiationLineNumber(SLoc)
               << " col="
               << GraphPrintSourceManager->getInstantiationColumnNumber(SLoc);
           }
-            
+
           if (isa<SwitchStmt>(T)) {
             Stmt* Label = E.getDst()->getLabel();
-            
-            if (Label) {                        
+
+            if (Label) {
               if (CaseStmt* C = dyn_cast<CaseStmt>(Label)) {
                 Out << "\\lcase ";
                 LangOptions LO; // FIXME.
                 C->getLHS()->printPretty(Out, 0, PrintingPolicy(LO));
-              
+
                 if (Stmt* RHS = C->getRHS()) {
                   Out << " .. ";
                   RHS->printPretty(Out, 0, PrintingPolicy(LO));
                 }
-                
+
                 Out << ":";
               }
               else {
@@ -3091,7 +3090,7 @@
                 Out << "\\ldefault:";
               }
             }
-            else 
+            else
               Out << "\\l(implicit) default:";
           }
           else if (isa<IndirectGotoStmt>(T)) {
@@ -3102,28 +3101,28 @@
             if (*E.getSrc()->succ_begin() == E.getDst())
               Out << "true";
             else
-              Out << "false";                        
+              Out << "false";
           }
-          
+
           Out << "\\l";
         }
-        
+
         if (GraphPrintCheckerState->isUndefControlFlow(N)) {
           Out << "\\|Control-flow based on\\lUndefined value.\\l";
         }
       }
     }
-    
+
     Out << "\\|StateID: " << (void*) N->getState() << "\\|";
 
     const GRState *state = N->getState();
     state->printDOT(Out);
-      
+
     Out << "\\l";
     return Out.str();
   }
 };
-} // end llvm namespace    
+} // end llvm namespace
 #endif
 
 #ifndef NDEBUG
@@ -3138,7 +3137,7 @@
 #endif
 
 void GRExprEngine::ViewGraph(bool trim) {
-#ifndef NDEBUG  
+#ifndef NDEBUG
   if (trim) {
     std::vector<ExplodedNode*> Src;
 
@@ -3150,14 +3149,14 @@
     // Iterate through the reports and get their nodes.
     for (BugReporter::iterator I=BR.begin(), E=BR.end(); I!=E; ++I) {
       for (BugType::const_iterator I2=(*I)->begin(), E2=(*I)->end();
-           I2!=E2; ++I2) {        
+           I2!=E2; ++I2) {
         const BugReportEquivClass& EQ = *I2;
         const BugReport &R = **EQ.begin();
         ExplodedNode *N = const_cast<ExplodedNode*>(R.getEndNode());
         if (N) Src.push_back(N);
       }
     }
-    
+
     ViewGraph(&Src[0], &Src[0]+Src.size());
   }
   else {
@@ -3165,7 +3164,7 @@
     GraphPrintSourceManager = &getContext().getSourceManager();
 
     llvm::ViewGraph(*G.roots_begin(), "GRExprEngine");
-    
+
     GraphPrintCheckerState = NULL;
     GraphPrintSourceManager = NULL;
   }
@@ -3176,14 +3175,14 @@
 #ifndef NDEBUG
   GraphPrintCheckerState = this;
   GraphPrintSourceManager = &getContext().getSourceManager();
-    
+
   std::auto_ptr<ExplodedGraph> TrimmedG(G.Trim(Beg, End).first);
 
   if (!TrimmedG.get())
     llvm::errs() << "warning: Trimmed ExplodedGraph is empty.\n";
   else
-    llvm::ViewGraph(*TrimmedG->roots_begin(), "TrimmedGRExprEngine");    
-  
+    llvm::ViewGraph(*TrimmedG->roots_begin(), "TrimmedGRExprEngine");
+
   GraphPrintCheckerState = NULL;
   GraphPrintSourceManager = NULL;
 #endif

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp Wed Sep  9 10:08:12 2009
@@ -48,15 +48,15 @@
   BuiltinBugReport(BugType& bt, const char* desc,
                    ExplodedNode *n)
   : RangedBugReport(bt, desc, n) {}
-  
+
   BuiltinBugReport(BugType& bt, const char *shortDesc, const char *desc,
                    ExplodedNode *n)
-  : RangedBugReport(bt, shortDesc, desc, n) {}  
-  
+  : RangedBugReport(bt, shortDesc, desc, n) {}
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N);
-};  
-  
+};
+
 class VISIBILITY_HIDDEN BuiltinBug : public BugType {
   GRExprEngine &Eng;
 protected:
@@ -69,30 +69,30 @@
     : BugType(n, "Logic errors"), Eng(*eng), desc(n) {}
 
   const std::string &getDescription() const { return desc; }
-  
+
   virtual void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {}
 
   void FlushReports(BugReporter& BR) { FlushReportsImpl(BR, Eng); }
-  
+
   virtual void registerInitialVisitors(BugReporterContext& BRC,
                                        const ExplodedNode* N,
                                        BuiltinBugReport *R) {}
-  
+
   template <typename ITER> void Emit(BugReporter& BR, ITER I, ITER E);
 };
-  
-  
+
+
 template <typename ITER>
 void BuiltinBug::Emit(BugReporter& BR, ITER I, ITER E) {
   for (; I != E; ++I) BR.EmitReport(new BuiltinBugReport(*this, desc.c_str(),
                                                          GetNode(I)));
-}  
+}
 
 void BuiltinBugReport::registerInitialVisitors(BugReporterContext& BRC,
                                                const ExplodedNode* N) {
   static_cast<BuiltinBug&>(getBugType()).registerInitialVisitors(BRC, N, this);
-}  
-  
+}
+
 class VISIBILITY_HIDDEN NullDeref : public BuiltinBug {
 public:
   NullDeref(GRExprEngine* eng)
@@ -101,14 +101,14 @@
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     Emit(BR, Eng.null_derefs_begin(), Eng.null_derefs_end());
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, GetDerefExpr(N), N);
   }
 };
-  
+
 class VISIBILITY_HIDDEN NilReceiverStructRet : public BuiltinBug {
 public:
   NilReceiverStructRet(GRExprEngine* eng) :
@@ -133,7 +133,7 @@
       BR.EmitReport(R);
     }
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
@@ -146,12 +146,12 @@
   NilReceiverLargerThanVoidPtrRet(GRExprEngine* eng) :
     BuiltinBug(eng,
                "'nil' receiver with return type larger than sizeof(void *)") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::nil_receiver_larger_than_voidptr_ret_iterator
          I=Eng.nil_receiver_larger_than_voidptr_ret_begin(),
          E=Eng.nil_receiver_larger_than_voidptr_ret_end(); I!=E; ++I) {
-      
+
       std::string sbuf;
       llvm::raw_string_ostream os(sbuf);
       PostStmt P = cast<PostStmt>((*I)->getLocation());
@@ -162,28 +162,28 @@
       << "' and of size "
       << Eng.getContext().getTypeSize(ME->getType()) / 8
       << " bytes) to be garbage or otherwise undefined.";
-      
+
       BuiltinBugReport *R = new BuiltinBugReport(*this, os.str().c_str(), *I);
       R->addRange(ME->getReceiver()->getSourceRange());
       BR.EmitReport(R);
     }
-  }    
+  }
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, GetReceiverExpr(N), N);
   }
 };
-  
+
 class VISIBILITY_HIDDEN UndefinedDeref : public BuiltinBug {
 public:
   UndefinedDeref(GRExprEngine* eng)
     : BuiltinBug(eng,"Dereference of undefined pointer value") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     Emit(BR, Eng.undef_derefs_begin(), Eng.undef_derefs_end());
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
@@ -196,30 +196,30 @@
   DivZero(GRExprEngine* eng = 0)
     : BuiltinBug(eng,"Division-by-zero",
                  "Division by zero or undefined value.") {}
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, GetDenomExpr(N), N);
   }
 };
-  
+
 class VISIBILITY_HIDDEN UndefResult : public BuiltinBug {
 public:
   UndefResult(GRExprEngine* eng) : BuiltinBug(eng,"Undefined result",
                              "Result of operation is undefined.") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     Emit(BR, Eng.undef_results_begin(), Eng.undef_results_end());
   }
 };
-  
+
 class VISIBILITY_HIDDEN BadCall : public BuiltinBug {
 public:
   BadCall(GRExprEngine *eng = 0)
   : BuiltinBug(eng, "Invalid function call",
         "Called function pointer is a null or undefined pointer value") {}
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
@@ -234,57 +234,57 @@
   ArgReport(BugType& bt, const char* desc, ExplodedNode *n,
          const Stmt *arg)
   : BuiltinBugReport(bt, desc, n), Arg(arg) {}
-  
+
   ArgReport(BugType& bt, const char *shortDesc, const char *desc,
                    ExplodedNode *n, const Stmt *arg)
-  : BuiltinBugReport(bt, shortDesc, desc, n), Arg(arg) {}  
-  
-  const Stmt *getArg() const { return Arg; }  
+  : BuiltinBugReport(bt, shortDesc, desc, n), Arg(arg) {}
+
+  const Stmt *getArg() const { return Arg; }
 };
 
 class VISIBILITY_HIDDEN BadArg : public BuiltinBug {
-public:  
-  BadArg(GRExprEngine* eng=0) : BuiltinBug(eng,"Uninitialized argument",  
+public:
+  BadArg(GRExprEngine* eng=0) : BuiltinBug(eng,"Uninitialized argument",
     "Pass-by-value argument in function call is undefined.") {}
 
   BadArg(GRExprEngine* eng, const char* d)
     : BuiltinBug(eng,"Uninitialized argument", d) {}
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, static_cast<ArgReport*>(R)->getArg(),
                                   N);
-  }  
+  }
 };
-  
+
 class VISIBILITY_HIDDEN BadMsgExprArg : public BadArg {
 public:
-  BadMsgExprArg(GRExprEngine* eng) 
+  BadMsgExprArg(GRExprEngine* eng)
     : BadArg(eng,"Pass-by-value argument in message expression is undefined"){}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::UndefArgsTy::iterator I=Eng.msg_expr_undef_arg_begin(),
-         E = Eng.msg_expr_undef_arg_end(); I!=E; ++I) {      
+         E = Eng.msg_expr_undef_arg_end(); I!=E; ++I) {
       // Generate a report for this bug.
       ArgReport *report = new ArgReport(*this, desc.c_str(), I->first,
                                         I->second);
       report->addRange(I->second->getSourceRange());
       BR.EmitReport(report);
-    }    
-  } 
+    }
+  }
 };
-  
+
 class VISIBILITY_HIDDEN BadReceiver : public BuiltinBug {
-public:  
+public:
   BadReceiver(GRExprEngine* eng)
   : BuiltinBug(eng,"Uninitialized receiver",
                "Receiver in message expression is an uninitialized value") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::ErrorNodes::iterator I=Eng.undef_receivers_begin(),
          End = Eng.undef_receivers_end(); I!=End; ++I) {
-      
+
       // Generate a report for this bug.
       BuiltinBugReport *report = new BuiltinBugReport(*this, desc.c_str(), *I);
       ExplodedNode* N = *I;
@@ -300,14 +300,14 @@
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, GetReceiverExpr(N), N);
-  } 
+  }
 };
 
 class VISIBILITY_HIDDEN RetStack : public BuiltinBug {
 public:
   RetStack(GRExprEngine* eng)
     : BuiltinBug(eng, "Return of address to stack-allocated memory") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::ret_stackaddr_iterator I=Eng.ret_stackaddr_begin(),
          End = Eng.ret_stackaddr_end(); I!=End; ++I) {
@@ -316,42 +316,42 @@
       const Stmt *S = cast<PostStmt>(N->getLocation()).getStmt();
       const Expr* E = cast<ReturnStmt>(S)->getRetValue();
       assert(E && "Return expression cannot be NULL");
-      
+
       // Get the value associated with E.
       loc::MemRegionVal V = cast<loc::MemRegionVal>(N->getState()->getSVal(E));
-      
+
       // Generate a report for this bug.
       std::string buf;
       llvm::raw_string_ostream os(buf);
       SourceRange R;
-      
+
       // Check if the region is a compound literal.
-      if (const CompoundLiteralRegion* CR = 
+      if (const CompoundLiteralRegion* CR =
             dyn_cast<CompoundLiteralRegion>(V.getRegion())) {
-        
+
         const CompoundLiteralExpr* CL = CR->getLiteralExpr();
         os << "Address of stack memory associated with a compound literal "
               "declared on line "
             << BR.getSourceManager()
                     .getInstantiationLineNumber(CL->getLocStart())
             << " returned.";
-        
+
         R = CL->getSourceRange();
       }
       else if (const AllocaRegion* AR = dyn_cast<AllocaRegion>(V.getRegion())) {
         const Expr* ARE = AR->getExpr();
         SourceLocation L = ARE->getLocStart();
         R = ARE->getSourceRange();
-        
+
         os << "Address of stack memory allocated by call to alloca() on line "
            << BR.getSourceManager().getInstantiationLineNumber(L)
            << " returned.";
-      }      
-      else {        
+      }
+      else {
         os << "Address of stack memory associated with local variable '"
            << V.getRegion()->getString() << "' returned.";
       }
-      
+
       RangedBugReport *report = new RangedBugReport(*this, os.str().c_str(), N);
       report->addRange(E->getSourceRange());
       if (R.isValid()) report->addRange(R);
@@ -359,51 +359,51 @@
     }
   }
 };
-  
+
 class VISIBILITY_HIDDEN RetUndef : public BuiltinBug {
 public:
   RetUndef(GRExprEngine* eng) : BuiltinBug(eng, "Uninitialized return value",
               "Uninitialized or undefined value returned to caller.") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     Emit(BR, Eng.ret_undef_begin(), Eng.ret_undef_end());
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
     registerTrackNullOrUndefValue(BRC, GetRetValExpr(N), N);
-  }    
+  }
 };
 
 class VISIBILITY_HIDDEN UndefBranch : public BuiltinBug {
   struct VISIBILITY_HIDDEN FindUndefExpr {
     GRStateManager& VM;
     const GRState* St;
-    
+
     FindUndefExpr(GRStateManager& V, const GRState* S) : VM(V), St(S) {}
-    
-    Expr* FindExpr(Expr* Ex) {      
+
+    Expr* FindExpr(Expr* Ex) {
       if (!MatchesCriteria(Ex))
         return 0;
-      
+
       for (Stmt::child_iterator I=Ex->child_begin(), E=Ex->child_end();I!=E;++I)
         if (Expr* ExI = dyn_cast_or_null<Expr>(*I)) {
           Expr* E2 = FindExpr(ExI);
           if (E2) return E2;
         }
-      
+
       return Ex;
     }
-    
+
     bool MatchesCriteria(Expr* Ex) { return St->getSVal(Ex).isUndef(); }
   };
-  
+
 public:
   UndefBranch(GRExprEngine *eng)
     : BuiltinBug(eng,"Use of uninitialized value",
                  "Branch condition evaluates to an uninitialized value.") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::undef_branch_iterator I=Eng.undef_branches_begin(),
          E=Eng.undef_branches_end(); I!=E; ++I) {
@@ -442,7 +442,7 @@
       BR.EmitReport(R);
     }
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
@@ -461,12 +461,12 @@
     Emit(BR, Eng.explicit_oob_memacc_begin(), Eng.explicit_oob_memacc_end());
   }
 };
-  
+
 class VISIBILITY_HIDDEN BadSizeVLA : public BuiltinBug {
 public:
   BadSizeVLA(GRExprEngine* eng) :
     BuiltinBug(eng, "Bad variable-length array (VLA) size") {}
-  
+
   void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
     for (GRExprEngine::ErrorNodes::iterator
           I = Eng.ExplicitBadSizedVLA.begin(),
@@ -475,26 +475,26 @@
       // Determine whether this was a 'zero-sized' VLA or a VLA with an
       // undefined size.
       ExplodedNode* N = *I;
-      PostStmt PS = cast<PostStmt>(N->getLocation());      
+      PostStmt PS = cast<PostStmt>(N->getLocation());
       const DeclStmt *DS = cast<DeclStmt>(PS.getStmt());
       VarDecl* VD = cast<VarDecl>(*DS->decl_begin());
       QualType T = Eng.getContext().getCanonicalType(VD->getType());
       VariableArrayType* VT = cast<VariableArrayType>(T);
       Expr* SizeExpr = VT->getSizeExpr();
-      
+
       std::string buf;
       llvm::raw_string_ostream os(buf);
       os << "The expression used to specify the number of elements in the "
             "variable-length array (VLA) '"
          << VD->getNameAsString() << "' evaluates to ";
-      
+
       bool isUndefined = N->getState()->getSVal(SizeExpr).isUndef();
-      
+
       if (isUndefined)
         os << "an undefined or garbage value.";
       else
         os << "0. VLAs with no elements have undefined behavior.";
-      
+
       std::string shortBuf;
       llvm::raw_string_ostream os_short(shortBuf);
       os_short << "Variable-length array '" << VD->getNameAsString() << "' "
@@ -508,7 +508,7 @@
       BR.EmitReport(report);
     }
   }
-  
+
   void registerInitialVisitors(BugReporterContext& BRC,
                                const ExplodedNode* N,
                                BuiltinBugReport *R) {
@@ -524,7 +524,7 @@
     public CheckerVisitor<CheckAttrNonNull> {
 
   BugType *BT;
-  
+
 public:
   CheckAttrNonNull() : BT(0) {}
   ~CheckAttrNonNull() {}
@@ -537,73 +537,73 @@
   void PreVisitCallExpr(CheckerContext &C, const CallExpr *CE) {
     const GRState *state = C.getState();
     const GRState *originalState = state;
-    
+
     // Check if the callee has a 'nonnull' attribute.
     SVal X = state->getSVal(CE->getCallee());
-    
+
     const FunctionDecl* FD = X.getAsFunctionDecl();
     if (!FD)
       return;
 
-    const NonNullAttr* Att = FD->getAttr<NonNullAttr>();    
+    const NonNullAttr* Att = FD->getAttr<NonNullAttr>();
     if (!Att)
       return;
-    
+
     // Iterate through the arguments of CE and check them for null.
     unsigned idx = 0;
-    
+
     for (CallExpr::const_arg_iterator I=CE->arg_begin(), E=CE->arg_end(); I!=E;
          ++I, ++idx) {
-    
+
       if (!Att->isNonNull(idx))
         continue;
-      
+
       const SVal &V = state->getSVal(*I);
       const DefinedSVal *DV = dyn_cast<DefinedSVal>(&V);
-      
+
       if (!DV)
         continue;
-      
+
       ConstraintManager &CM = C.getConstraintManager();
       const GRState *stateNotNull, *stateNull;
       llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, *DV);
-      
+
       if (stateNull && !stateNotNull) {
         // Generate an error node.  Check for a null node in case
         // we cache out.
         if (ExplodedNode *errorNode = C.GenerateNode(CE, stateNull, true)) {
-                  
+
           // Lazily allocate the BugType object if it hasn't already been
           // created. Ownership is transferred to the BugReporter object once
           // the BugReport is passed to 'EmitWarning'.
           if (!BT)
             BT = new BugType("Argument with 'nonnull' attribute passed null",
                              "API");
-          
+
           EnhancedBugReport *R =
             new EnhancedBugReport(*BT,
                                   "Null pointer passed as an argument to a "
                                   "'nonnull' parameter", errorNode);
-          
+
           // Highlight the range of the argument that was null.
           const Expr *arg = *I;
           R->addRange(arg->getSourceRange());
           R->addVisitorCreator(registerTrackNullOrUndefValue, arg);
-          
+
           // Emit the bug report.
           C.EmitReport(R);
         }
-        
+
         // Always return.  Either we cached out or we just emitted an error.
         return;
       }
-      
+
       // If a pointer value passed the check we should assume that it is
       // indeed not null from this point forward.
       assert(stateNotNull);
       state = stateNotNull;
     }
-   
+
     // If we reach here all of the arguments passed the nonnull check.
     // If 'state' has been updated generated a new node.
     if (state != originalState)
@@ -614,7 +614,7 @@
 
 // Undefined arguments checking.
 namespace {
-class VISIBILITY_HIDDEN CheckUndefinedArg 
+class VISIBILITY_HIDDEN CheckUndefinedArg
   : public CheckerVisitor<CheckUndefinedArg> {
 
   BadArg *BT;
@@ -690,7 +690,7 @@
   void PreVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
 };
 
-void CheckBadDiv::PreVisitBinaryOperator(CheckerContext &C, 
+void CheckBadDiv::PreVisitBinaryOperator(CheckerContext &C,
                                          const BinaryOperator *B) {
   BinaryOperator::Opcode Op = B->getOpcode();
   if (Op != BinaryOperator::Div &&
@@ -719,19 +719,19 @@
   // Handle the case where 'Denom' is UnknownVal.
   const DefinedSVal *DV = dyn_cast<DefinedSVal>(&Denom);
 
-  if (!DV)  
+  if (!DV)
     return;
 
   // Check for divide by zero.
   ConstraintManager &CM = C.getConstraintManager();
   const GRState *stateNotZero, *stateZero;
   llvm::tie(stateNotZero, stateZero) = CM.AssumeDual(C.getState(), *DV);
-  
+
   if (stateZero && !stateNotZero) {
     if (ExplodedNode *N = C.GenerateNode(B, stateZero, true)) {
       if (!BT)
         BT = new DivZero();
-   
+
       C.EmitReport(new BuiltinBugReport(*BT, BT->getDescription().c_str(), N));
     }
     return;
@@ -764,7 +764,7 @@
   BR.Register(new BadSizeVLA(this));
   BR.Register(new NilReceiverStructRet(this));
   BR.Register(new NilReceiverLargerThanVoidPtrRet(this));
-  
+
   // The following checks do not need to have their associated BugTypes
   // explicitly registered with the BugReporter.  If they issue any BugReports,
   // their associated BugType will get registered with the BugReporter

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRState.cpp (original)
+++ cfe/trunk/lib/Analysis/GRState.cpp Wed Sep  9 10:08:12 2009
@@ -27,7 +27,7 @@
   for (std::vector<GRState::Printer*>::iterator I=Printers.begin(),
         E=Printers.end(); I!=E; ++I)
     delete *I;
-  
+
   for (GDMContextsTy::iterator I=GDMContexts.begin(), E=GDMContexts.end();
        I!=E; ++I)
     I->second.second(I->second.first);
@@ -59,13 +59,13 @@
 const GRState *GRState::unbindLoc(Loc LV) const {
   Store OldStore = getStore();
   Store NewStore = getStateManager().StoreMgr->Remove(OldStore, LV);
-  
+
   if (NewStore == OldStore)
     return this;
-  
+
   GRState NewSt = *this;
   NewSt.St = NewStore;
-  return getStateManager().getPersistentState(NewSt);    
+  return getStateManager().getPersistentState(NewSt);
 }
 
 SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const {
@@ -87,7 +87,7 @@
 
 const GRState *GRState::BindExpr(const Stmt* Ex, SVal V, bool Invalidate) const{
   Environment NewEnv = getStateManager().EnvMgr.BindExpr(Env, Ex, V,
-                                                         Invalidate);  
+                                                         Invalidate);
   if (NewEnv == Env)
     return this;
 
@@ -98,7 +98,7 @@
 
 const GRState* GRStateManager::getInitialState(const LocationContext *InitLoc) {
   GRState State(this,
-                EnvMgr.getInitialEnvironment(InitLoc->getAnalysisContext()), 
+                EnvMgr.getInitialEnvironment(InitLoc->getAnalysisContext()),
                 StoreMgr->getInitialStore(InitLoc),
                 GDMFactory.GetEmptyMap());
 
@@ -106,16 +106,16 @@
 }
 
 const GRState* GRStateManager::getPersistentState(GRState& State) {
-  
+
   llvm::FoldingSetNodeID ID;
-  State.Profile(ID);  
+  State.Profile(ID);
   void* InsertPos;
-  
+
   if (GRState* I = StateSet.FindNodeOrInsertPos(ID, InsertPos))
     return I;
-  
+
   GRState* I = (GRState*) Alloc.Allocate<GRState>();
-  new (I) GRState(State);  
+  new (I) GRState(State);
   StateSet.InsertNode(I, InsertPos);
   return I;
 }
@@ -131,32 +131,32 @@
 //===----------------------------------------------------------------------===//
 
 void GRState::print(llvm::raw_ostream& Out, const char* nl,
-                    const char* sep) const {  
+                    const char* sep) const {
   // Print the store.
   GRStateManager &Mgr = getStateManager();
   Mgr.getStoreManager().print(getStore(), Out, nl, sep);
-  
+
   CFG &C = *getAnalysisContext().getCFG();
-  
+
   // Print Subexpression bindings.
   bool isFirst = true;
-  
-  for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) {    
+
+  for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) {
     if (C.isBlkExpr(I.getKey()))
       continue;
-    
+
     if (isFirst) {
       Out << nl << nl << "Sub-Expressions:" << nl;
       isFirst = false;
     }
     else { Out << nl; }
-    
+
     Out << " (" << (void*) I.getKey() << ") ";
     LangOptions LO; // FIXME.
     I.getKey()->printPretty(Out, 0, PrintingPolicy(LO));
     Out << " : " << I.getData();
   }
-  
+
   // Print block-expression bindings.
   isFirst = true;
 
@@ -169,15 +169,15 @@
       isFirst = false;
     }
     else { Out << nl; }
-    
+
     Out << " (" << (void*) I.getKey() << ") ";
     LangOptions LO; // FIXME.
     I.getKey()->printPretty(Out, 0, PrintingPolicy(LO));
     Out << " : " << I.getData();
   }
-  
+
   Mgr.getConstraintManager().print(this, Out, nl, sep);
-  
+
   // Print checker-specific data.
   for (std::vector<Printer*>::iterator I = Mgr.Printers.begin(),
                                        E = Mgr.Printers.end(); I != E; ++I) {
@@ -205,23 +205,23 @@
 GRStateManager::FindGDMContext(void* K,
                                void* (*CreateContext)(llvm::BumpPtrAllocator&),
                                void (*DeleteContext)(void*)) {
-  
+
   std::pair<void*, void (*)(void*)>& p = GDMContexts[K];
   if (!p.first) {
     p.first = CreateContext(Alloc);
     p.second = DeleteContext;
   }
-  
+
   return p.first;
 }
 
 const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){
   GRState::GenericDataMap M1 = St->getGDM();
   GRState::GenericDataMap M2 = GDMFactory.Add(M1, Key, Data);
-  
+
   if (M1 == M2)
     return St;
-  
+
   GRState NewSt = *St;
   NewSt.GDM = M2;
   return getPersistentState(NewSt);
@@ -240,14 +240,14 @@
   SymbolVisitor &visitor;
   llvm::OwningPtr<SubRegionMap> SRM;
 public:
-  
+
   ScanReachableSymbols(const GRState *st, SymbolVisitor& v)
     : state(st), visitor(v) {}
-  
+
   bool scan(nonloc::CompoundVal val);
   bool scan(SVal val);
   bool scan(const MemRegion *R);
-    
+
   // From SubRegionMap::Visitor.
   bool Visit(const MemRegion* Parent, const MemRegion* SubRegion) {
     return scan(SubRegion);
@@ -262,44 +262,44 @@
 
   return true;
 }
-    
+
 bool ScanReachableSymbols::scan(SVal val) {
   if (loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(&val))
     return scan(X->getRegion());
 
   if (SymbolRef Sym = val.getAsSymbol())
     return visitor.VisitSymbol(Sym);
-  
+
   if (nonloc::CompoundVal *X = dyn_cast<nonloc::CompoundVal>(&val))
     return scan(*X);
-  
+
   return true;
 }
-  
+
 bool ScanReachableSymbols::scan(const MemRegion *R) {
   if (isa<MemSpaceRegion>(R) || visited.count(R))
     return true;
-  
+
   visited.insert(R);
 
   // If this is a symbolic region, visit the symbol for the region.
   if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R))
     if (!visitor.VisitSymbol(SR->getSymbol()))
       return false;
-  
+
   // If this is a subregion, also visit the parent regions.
   if (const SubRegion *SR = dyn_cast<SubRegion>(R))
     if (!scan(SR->getSuperRegion()))
       return false;
-  
+
   // Now look at the binding to this region (if any).
   if (!scan(state->getSValAsScalarOrLoc(R)))
     return false;
-  
+
   // Now look at the subregions.
   if (!SRM.get())
    SRM.reset(state->getStateManager().getStoreManager().getSubRegionMap(state));
-  
+
   return SRM->iterSubRegions(R, *this);
 }
 
@@ -314,21 +314,21 @@
 
 bool GRStateManager::isEqual(const GRState* state, const Expr* Ex,
                              const llvm::APSInt& Y) {
-  
+
   SVal V = state->getSVal(Ex);
-  
+
   if (loc::ConcreteInt* X = dyn_cast<loc::ConcreteInt>(&V))
     return X->getValue() == Y;
 
   if (nonloc::ConcreteInt* X = dyn_cast<nonloc::ConcreteInt>(&V))
     return X->getValue() == Y;
-    
+
   if (SymbolRef Sym = V.getAsSymbol())
     return ConstraintMgr->isEqual(state, Sym, Y);
 
   return false;
 }
-  
+
 bool GRStateManager::isEqual(const GRState* state, const Expr* Ex, uint64_t x) {
   return isEqual(state, Ex, getBasicVals().getValue(x, Ex->getType()));
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Wed Sep  9 10:08:12 2009
@@ -29,35 +29,35 @@
 
 //===----------------------------------------------------------------------===//
 // Useful constants.
-//===----------------------------------------------------------------------===//      
+//===----------------------------------------------------------------------===//
 
 static const bool Alive = true;
-static const bool Dead = false; 
+static const bool Dead = false;
 
 //===----------------------------------------------------------------------===//
 // Dataflow initialization logic.
-//===----------------------------------------------------------------------===//      
+//===----------------------------------------------------------------------===//
 
 namespace {
-class VISIBILITY_HIDDEN RegisterDecls 
+class VISIBILITY_HIDDEN RegisterDecls
   : public CFGRecStmtDeclVisitor<RegisterDecls> {
-    
+
   LiveVariables::AnalysisDataTy& AD;
-  
+
   typedef llvm::SmallVector<VarDecl*, 20> AlwaysLiveTy;
   AlwaysLiveTy AlwaysLive;
 
-    
+
 public:
   RegisterDecls(LiveVariables::AnalysisDataTy& ad) : AD(ad) {}
 
   ~RegisterDecls() {
 
     AD.AlwaysLive.resetValues(AD);
-    
+
     for (AlwaysLiveTy::iterator I = AlwaysLive.begin(), E = AlwaysLive.end();
-         I != E; ++ I)       
-      AD.AlwaysLive(*I, AD) = Alive;      
+         I != E; ++ I)
+      AD.AlwaysLive(*I, AD) = Alive;
   }
 
   void VisitImplicitParamDecl(ImplicitParamDecl* IPD) {
@@ -68,12 +68,12 @@
   void VisitVarDecl(VarDecl* VD) {
     // Register the VarDecl for tracking.
     AD.Register(VD);
-    
+
     // Does the variable have global storage?  If so, it is always live.
     if (VD->hasGlobalStorage())
-      AlwaysLive.push_back(VD);    
+      AlwaysLive.push_back(VD);
   }
-  
+
   CFG& getCFG() { return AD.getCFG(); }
 };
 } // end anonymous namespace
@@ -82,14 +82,14 @@
   // Register all referenced VarDecls.
   getAnalysisData().setCFG(cfg);
   getAnalysisData().setContext(Ctx);
-  
+
   RegisterDecls R(getAnalysisData());
   cfg.VisitBlockStmts(R);
 }
 
 //===----------------------------------------------------------------------===//
 // Transfer functions.
-//===----------------------------------------------------------------------===//      
+//===----------------------------------------------------------------------===//
 
 namespace {
 
@@ -101,85 +101,85 @@
 
   LiveVariables::ValTy& getVal() { return LiveState; }
   CFG& getCFG() { return AD.getCFG(); }
-  
+
   void VisitDeclRefExpr(DeclRefExpr* DR);
   void VisitBinaryOperator(BinaryOperator* B);
   void VisitAssign(BinaryOperator* B);
   void VisitDeclStmt(DeclStmt* DS);
   void BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S);
   void VisitUnaryOperator(UnaryOperator* U);
-  void Visit(Stmt *S);    
-  void VisitTerminator(CFGBlock* B); 
-  
+  void Visit(Stmt *S);
+  void VisitTerminator(CFGBlock* B);
+
   void SetTopValue(LiveVariables::ValTy& V) {
     V = AD.AlwaysLive;
   }
-  
+
 };
-      
+
 void TransferFuncs::Visit(Stmt *S) {
-  
+
   if (S == getCurrentBlkStmt()) {
-    
+
     if (AD.Observer)
       AD.Observer->ObserveStmt(S,AD,LiveState);
-    
+
     if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead;
     StmtVisitor<TransferFuncs,void>::Visit(S);
   }
   else if (!getCFG().isBlkExpr(S)) {
-    
+
     if (AD.Observer)
       AD.Observer->ObserveStmt(S,AD,LiveState);
-    
+
     StmtVisitor<TransferFuncs,void>::Visit(S);
-    
+
   }
   else {
     // For block-level expressions, mark that they are live.
     LiveState(S,AD) = Alive;
   }
 }
-  
+
 void TransferFuncs::VisitTerminator(CFGBlock* B) {
-    
+
   const Stmt* E = B->getTerminatorCondition();
 
   if (!E)
     return;
-  
+
   assert (getCFG().isBlkExpr(E));
   LiveState(E, AD) = Alive;
 }
 
 void TransferFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
-  if (VarDecl* V = dyn_cast<VarDecl>(DR->getDecl())) 
+  if (VarDecl* V = dyn_cast<VarDecl>(DR->getDecl()))
     LiveState(V,AD) = Alive;
 }
-  
-void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {     
+
+void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
   if (B->isAssignmentOp()) VisitAssign(B);
   else VisitStmt(B);
 }
 
 void
 TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
-  
+
   // This is a block-level expression.  Its value is 'dead' before this point.
   LiveState(S, AD) = Dead;
 
   // This represents a 'use' of the collection.
   Visit(S->getCollection());
-  
+
   // This represents a 'kill' for the variable.
   Stmt* Element = S->getElement();
   DeclRefExpr* DR = 0;
   VarDecl* VD = 0;
-  
+
   if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
     VD = cast<VarDecl>(DS->getSingleDecl());
   else {
-    Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();    
+    Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
     if ((DR = dyn_cast<DeclRefExpr>(ElemExpr)))
       VD = cast<VarDecl>(DR->getDecl());
     else {
@@ -194,10 +194,10 @@
   }
 }
 
-  
+
 void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
   Expr *E = U->getSubExpr();
-  
+
   switch (U->getOpcode()) {
   case UnaryOperator::PostInc:
   case UnaryOperator::PostDec:
@@ -206,7 +206,7 @@
     // Walk through the subexpressions, blasting through ParenExprs
     // until we either find a DeclRefExpr or some non-DeclRefExpr
     // expression.
-    if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParens())) 
+    if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParens()))
       if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl())) {
         // Treat the --/++ operator as a kill.
         if (AD.Observer) { AD.Observer->ObserverKill(DR); }
@@ -215,24 +215,24 @@
       }
 
     // Fall-through.
-  
+
   default:
     return Visit(E);
   }
 }
-  
-void TransferFuncs::VisitAssign(BinaryOperator* B) {    
+
+void TransferFuncs::VisitAssign(BinaryOperator* B) {
   Expr* LHS = B->getLHS();
 
   // Assigning to a variable?
   if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS->IgnoreParens())) {
-    
+
     // Update liveness inforamtion.
     unsigned bit = AD.getIdx(DR->getDecl());
     LiveState.getDeclBit(bit) = Dead | AD.AlwaysLive.getDeclBit(bit);
-    
+
     if (AD.Observer) { AD.Observer->ObserverKill(DR); }
-    
+
     // Handle things like +=, etc., which also generate "uses"
     // of a variable.  Do this just by visiting the subexpression.
     if (B->getOpcode() != BinaryOperator::Assign)
@@ -240,7 +240,7 @@
   }
   else // Not assigning to a variable.  Process LHS as usual.
     Visit(LHS);
-  
+
   Visit(B->getRHS());
 }
 
@@ -255,44 +255,44 @@
       // transfer function for this expression first.
       if (Expr* Init = VD->getInit())
         Visit(Init);
-      
+
       if (const VariableArrayType* VT =
             AD.getContext().getAsVariableArrayType(VD->getType())) {
         StmtIterator I(const_cast<VariableArrayType*>(VT));
-        StmtIterator E;        
+        StmtIterator E;
         for (; I != E; ++I) Visit(*I);
       }
-      
+
       // Update liveness information by killing the VarDecl.
       unsigned bit = AD.getIdx(VD);
       LiveState.getDeclBit(bit) = Dead | AD.AlwaysLive.getDeclBit(bit);
     }
 }
-  
+
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
 // Merge operator: if something is live on any successor block, it is live
 //  in the current block (a set union).
-//===----------------------------------------------------------------------===//      
+//===----------------------------------------------------------------------===//
 
 namespace {
 
 struct Merge {
-  typedef StmtDeclBitVector_Types::ValTy ValTy; 
-    
+  typedef StmtDeclBitVector_Types::ValTy ValTy;
+
   void operator()(ValTy& Dst, const ValTy& Src) {
     Dst.OrDeclBits(Src);
     Dst.OrBlkExprBits(Src);
   }
 };
-  
+
 typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
 } // end anonymous namespace
 
 //===----------------------------------------------------------------------===//
 // External interface to run Liveness analysis.
-//===----------------------------------------------------------------------===//      
+//===----------------------------------------------------------------------===//
 
 void LiveVariables::runOnCFG(CFG& cfg) {
   Solver S(*this);
@@ -337,22 +337,22 @@
 
 void LiveVariables::dumpLiveness(const ValTy& V, SourceManager& SM) const {
   const AnalysisDataTy& AD = getAnalysisData();
-  
+
   for (AnalysisDataTy::decl_iterator I = AD.begin_decl(),
                                      E = AD.end_decl(); I!=E; ++I)
-    if (V.getDeclBit(I->second)) {      
+    if (V.getDeclBit(I->second)) {
       fprintf(stderr, "  %s <", I->first->getIdentifier()->getName());
       I->first->getLocation().dump(SM);
       fprintf(stderr, ">\n");
     }
-}                                  
+}
 
 void LiveVariables::dumpBlockLiveness(SourceManager& M) const {
   for (BlockDataMapTy::iterator I = getBlockDataMap().begin(),
        E = getBlockDataMap().end(); I!=E; ++I) {
     fprintf(stderr, "\n[ B%d (live variables at block exit) ]\n",
             I->first->getBlockID());
-            
+
     dumpLiveness(I->second,M);
   }
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Wed Sep  9 10:08:12 2009
@@ -55,8 +55,8 @@
   ID.AddInteger((unsigned)getKind());
 }
 
-void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, 
-                                 const StringLiteral* Str, 
+void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
+                                 const StringLiteral* Str,
                                  const MemRegion* superRegion) {
   ID.AddInteger((unsigned) StringRegionKind);
   ID.AddPointer(Str);
@@ -114,7 +114,7 @@
 }
 
 void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
-                                  QualType ElementType, SVal Idx, 
+                                  QualType ElementType, SVal Idx,
                                   const MemRegion* superRegion) {
   ID.AddInteger(MemRegion::ElementRegionKind);
   ID.Add(ElementType);
@@ -182,7 +182,7 @@
   os << "ivar{" << superRegion << ',' << getDecl()->getNameAsString() << '}';
 }
 
-void StringRegion::dumpToStream(llvm::raw_ostream& os) const {  
+void StringRegion::dumpToStream(llvm::raw_ostream& os) const {
   Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions()));
 }
 
@@ -206,8 +206,8 @@
 // MemRegionManager methods.
 //===----------------------------------------------------------------------===//
 
-MemSpaceRegion* MemRegionManager::LazyAllocate(MemSpaceRegion*& region) {  
-  if (!region) {  
+MemSpaceRegion* MemRegionManager::LazyAllocate(MemSpaceRegion*& region) {
+  if (!region) {
     region = (MemSpaceRegion*) A.Allocate<MemSpaceRegion>();
     new (region) MemSpaceRegion(this);
   }
@@ -249,13 +249,13 @@
 
 VarRegion* MemRegionManager::getVarRegion(const VarDecl *D,
                                           const LocationContext *LC) {
-  
+
   // FIXME: Once we implement scope handling, we will need to properly lookup
   // 'D' to the proper LocationContext.  For now, just strip down to the
   // StackFrame.
   while (!isa<StackFrameContext>(LC))
     LC = LC->getParent();
-  
+
   return getRegion<VarRegion>(D, LC);
 }
 
@@ -320,12 +320,12 @@
 const MemSpaceRegion *MemRegion::getMemorySpace() const {
   const MemRegion *R = this;
   const SubRegion* SR = dyn_cast<SubRegion>(this);
-  
+
   while (SR) {
     R = SR->getSuperRegion();
     SR = dyn_cast<SubRegion>(R);
   }
-  
+
   return dyn_cast<MemSpaceRegion>(R);
 }
 
@@ -365,7 +365,7 @@
 bool MemRegion::hasParametersStorage() const {
   if (const MemSpaceRegion *MS = getMemorySpace())
     return MS == getMemRegionManager()->getStackArgumentsRegion();
-  
+
   return false;
 }
 
@@ -385,7 +385,7 @@
 const MemRegion *MemRegion::getBaseRegion() const {
   const MemRegion *R = this;
   while (true) {
-    if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {      
+    if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
       // FIXME: generalize.  Essentially we want to strip away ElementRegions
       // that were layered on a symbolic region because of casts.  We only
       // want to strip away ElementRegions, however, where the index is 0.
@@ -418,27 +418,27 @@
   const ElementRegion *ER = this;
   const MemRegion *superR = NULL;
   ASTContext &C = getContext();
-  
+
   // FIXME: Handle multi-dimensional arrays.
 
   while (ER) {
     superR = ER->getSuperRegion();
-    
+
     // FIXME: generalize to symbolic offsets.
     SVal index = ER->getIndex();
     if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&index)) {
       // Update the offset.
       int64_t i = CI->getValue().getSExtValue();
-      
+
       if (i != 0) {
         QualType elemType = ER->getElementType();
-        
+
         // If we are pointing to an incomplete type, go no further.
         if (!IsCompleteType(C, elemType)) {
           superR = ER;
           break;
         }
-        
+
         int64_t size = (int64_t) (C.getTypeSize(elemType) / 8);
         offset += (i * size);
       }
@@ -447,10 +447,10 @@
       ER = dyn_cast<ElementRegion>(superR);
       continue;
     }
-    
+
     return NULL;
   }
-  
+
   assert(superR && "super region cannot be NULL");
   return RegionRawOffset(superR, offset);
 }

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

==============================================================================
--- cfe/trunk/lib/Analysis/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/Analysis/PathDiagnostic.cpp Wed Sep  9 10:08:12 2009
@@ -27,7 +27,7 @@
   for (const_iterator I = begin(), E = end(); I!=E; ++I) {
     if (isa<PathDiagnosticEventPiece>(*I))
       return true;
-    
+
     if (PathDiagnosticMacroPiece *MP = dyn_cast<PathDiagnosticMacroPiece>(*I))
       if (MP->containsEvent())
         return true;
@@ -38,14 +38,14 @@
 
 static size_t GetNumCharsToLastNonPeriod(const char *s) {
   const char *start = s;
-  const char *lastNonPeriod = 0;  
+  const char *lastNonPeriod = 0;
 
   for ( ; *s != '\0' ; ++s)
     if (*s != '.') lastNonPeriod = s;
-  
+
   if (!lastNonPeriod)
     return 0;
-  
+
   return (lastNonPeriod - start) + 1;
 }
 
@@ -84,7 +84,7 @@
   if (deletePieces)
     for (iterator I=begin(), E=end(); I!=E; ++I)
       delete &*I;
-  
+
   path.clear();
 }
 
@@ -97,7 +97,7 @@
     Category(category, GetNumCharsToLastNonPeriod(category)) {}
 
 PathDiagnostic::PathDiagnostic(const std::string& bugtype,
-                               const std::string& desc, 
+                               const std::string& desc,
                                const std::string& category)
   : Size(0),
     BugType(bugtype, 0, GetNumCharsToLastNonPeriod(bugtype)),
@@ -106,11 +106,11 @@
 
 void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
                                             const DiagnosticInfo &Info) {
-  
+
   // Create a PathDiagnostic with a single piece.
-  
+
   PathDiagnostic* D = new PathDiagnostic();
-  
+
   const char *LevelStr;
   switch (DiagLevel) {
   default:
@@ -124,18 +124,18 @@
   llvm::SmallString<100> StrC;
   StrC += LevelStr;
   Info.FormatDiagnostic(StrC);
-  
+
   PathDiagnosticPiece *P =
     new PathDiagnosticEventPiece(Info.getLocation(),
                             std::string(StrC.begin(), StrC.end()));
-  
+
   for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i)
     P->addRange(Info.getRange(i));
   for (unsigned i = 0, e = Info.getNumCodeModificationHints(); i != e; ++i)
     P->addCodeModificationHint(Info.getCodeModificationHint(i));
   D->push_front(P);
 
-  HandlePathDiagnostic(D);  
+  HandlePathDiagnostic(D);
 }
 
 //===----------------------------------------------------------------------===//
@@ -155,7 +155,7 @@
     case DeclK:
       return FullSourceLoc(D->getLocation(), const_cast<SourceManager&>(*SM));
   }
-  
+
   return FullSourceLoc(R.getBegin(), const_cast<SourceManager&>(*SM));
 }
 
@@ -178,7 +178,7 @@
           if (DS->isSingleDecl()) {
             // Should always be the case, but we'll be defensive.
             return SourceRange(DS->getLocStart(),
-                               DS->getSingleDecl()->getLocation());            
+                               DS->getSingleDecl()->getLocation());
           }
           break;
         }
@@ -197,7 +197,7 @@
           return SourceRange(L, L);
         }
       }
-      
+
       return S->getSourceRange();
     }
     case DeclK:
@@ -219,7 +219,7 @@
         return PathDiagnosticRange(SourceRange(L, L), true);
       }
   }
-  
+
   return R;
 }
 

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

==============================================================================
--- cfe/trunk/lib/Analysis/RangeConstraintManager.cpp (original)
+++ cfe/trunk/lib/Analysis/RangeConstraintManager.cpp Wed Sep  9 10:08:12 2009
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines RangeConstraintManager, a class that tracks simple 
+//  This file defines RangeConstraintManager, a class that tracks simple
 //  equality and inequality constraints on symbolic values of GRState.
 //
 //===----------------------------------------------------------------------===//
@@ -66,7 +66,7 @@
   // consistent (instead of comparing by pointer values) and can potentially
   // be used to speed up some of the operations in RangeSet.
   static inline bool isLess(key_type_ref lhs, key_type_ref rhs) {
-    return *lhs.first < *rhs.first || (!(*rhs.first < *lhs.first) && 
+    return *lhs.first < *rhs.first || (!(*rhs.first < *lhs.first) &&
                                        *lhs.second < *rhs.second);
   }
 };
@@ -78,7 +78,7 @@
   typedef llvm::ImmutableSet<Range, RangeTrait> PrimRangeSet;
   PrimRangeSet ranges; // no need to make const, since it is an
                        // ImmutableSet - this allows default operator=
-                       // to work.    
+                       // to work.
 public:
   typedef PrimRangeSet::Factory Factory;
   typedef PrimRangeSet::iterator iterator;
@@ -88,13 +88,13 @@
 
   iterator begin() const { return ranges.begin(); }
   iterator end() const { return ranges.end(); }
-  
+
   bool isEmpty() const { return ranges.isEmpty(); }
-  
+
   /// Construct a new RangeSet representing '{ [from, to] }'.
   RangeSet(Factory &F, const llvm::APSInt &from, const llvm::APSInt &to)
     : ranges(F.Add(F.GetEmptySet(), Range(from, to))) {}
-  
+
   /// Profile - Generates a hash profile of this RangeSet for use
   ///  by FoldingSet.
   void Profile(llvm::FoldingSetNodeID &ID) const { ranges.Profile(ID); }
@@ -122,7 +122,7 @@
   ///  value be not be equal to V.
   RangeSet AddNE(BasicValueFactory &BV, Factory &F, const llvm::APSInt &V) {
     PrimRangeSet newRanges = ranges;
-    
+
     // FIXME: We can perhaps enhance ImmutableSet to do this search for us
     // in log(N) time using the sorted property of the internal AVL tree.
     for (iterator i = begin(), e = end(); i != e; ++i) {
@@ -134,11 +134,11 @@
           newRanges = F.Add(newRanges, Range(i->From(), BV.Sub1(V)));
         if (V != i->To())
           newRanges = F.Add(newRanges, Range(BV.Add1(V), i->To()));
-        // All of the ranges are non-overlapping, so we can stop.        
+        // All of the ranges are non-overlapping, so we can stop.
         break;
       }
     }
-    
+
     return newRanges;
   }
 
@@ -153,7 +153,7 @@
       else if (i->To() < V)
         newRanges = F.Add(newRanges, *i);
     }
-    
+
     return newRanges;
   }
 
@@ -168,7 +168,7 @@
       else if (i->To() <= V)
         newRanges = F.Add(newRanges, *i);
     }
-    
+
     return newRanges;
   }
 
@@ -181,7 +181,7 @@
       else if (i->From() > V)
         newRanges = F.Add(newRanges, *i);
     }
-    
+
     return newRanges;
   }
 
@@ -208,13 +208,13 @@
         isFirst = false;
       else
         os << ", ";
-      
+
       os << '[' << i->From().toString(10) << ", " << i->To().toString(10)
          << ']';
     }
-    os << " }";  
+    os << " }";
   }
-  
+
   bool operator==(const RangeSet &other) const {
     return ranges == other.ranges;
   }
@@ -227,13 +227,13 @@
 template<>
 struct GRStateTrait<ConstraintRange>
   : public GRStatePartialTrait<ConstraintRangeTy> {
-  static inline void* GDMIndex() { return &ConstraintRangeIndex; }  
+  static inline void* GDMIndex() { return &ConstraintRangeIndex; }
 };
-}  
-  
+}
+
 namespace {
 class VISIBILITY_HIDDEN RangeConstraintManager : public SimpleConstraintManager{
-  RangeSet GetRange(const GRState *state, SymbolRef sym);      
+  RangeSet GetRange(const GRState *state, SymbolRef sym);
 public:
   RangeConstraintManager() {}
 
@@ -256,7 +256,7 @@
                              const llvm::APSInt& V);
 
   const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) const;
-    
+
   // FIXME: Refactor into SimpleConstraintManager?
   bool isEqual(const GRState* St, SymbolRef sym, const llvm::APSInt& V) const {
     const llvm::APSInt *i = getSymVal(St, sym);
@@ -265,7 +265,7 @@
 
   const GRState* RemoveDeadBindings(const GRState* St, SymbolReaper& SymReaper);
 
-  void print(const GRState* St, llvm::raw_ostream& Out, 
+  void print(const GRState* St, llvm::raw_ostream& Out,
              const char* nl, const char *sep);
 
 private:
@@ -294,11 +294,11 @@
   ConstraintRangeTy::Factory& CRFactory = state->get_context<ConstraintRange>();
 
   for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) {
-    SymbolRef sym = I.getKey();    
+    SymbolRef sym = I.getKey();
     if (SymReaper.maybeDead(sym))
       CR = CRFactory.Remove(CR, sym);
   }
-  
+
   return state->set<ConstraintRange>(CR);
 }
 
@@ -310,11 +310,11 @@
 RangeConstraintManager::GetRange(const GRState *state, SymbolRef sym) {
   if (ConstraintRangeTy::data_type* V = state->get<ConstraintRange>(sym))
     return *V;
-  
+
   // Lazily generate a new RangeSet representing all possible values for the
   // given symbol type.
   QualType T = state->getSymbolManager().getType(sym);
-  BasicValueFactory& BV = state->getBasicVals();  
+  BasicValueFactory& BV = state->getBasicVals();
   return RangeSet(F, BV.getMinValue(T), BV.getMaxValue(T));
 }
 
@@ -341,16 +341,16 @@
 // Pretty-printing.
 //===------------------------------------------------------------------------===/
 
-void RangeConstraintManager::print(const GRState* St, llvm::raw_ostream& Out, 
+void RangeConstraintManager::print(const GRState* St, llvm::raw_ostream& Out,
                                    const char* nl, const char *sep) {
-  
+
   ConstraintRangeTy Ranges = St->get<ConstraintRange>();
-  
+
   if (Ranges.isEmpty())
     return;
-  
+
   Out << nl << sep << "ranges of symbol values:";
-  
+
   for (ConstraintRangeTy::iterator I=Ranges.begin(), E=Ranges.end(); I!=E; ++I){
     Out << nl << ' ' << I.getKey() << " : ";
     I.getData().print(Out);





More information about the cfe-commits mailing list