Преглед на файлове

Remove tabs, and whitespace cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
Mike Stump преди 16 години
родител
ревизия
1eb4433ac4
променени са 100 файла, в които са добавени 4409 реда и са изтрити 4429 реда
  1. 20 20
      include/clang/AST/APValue.h
  2. 6 6
      include/clang/AST/ASTConsumer.h
  3. 131 131
      include/clang/AST/ASTContext.h
  4. 1 1
      include/clang/AST/ASTDiagnostic.h
  5. 49 49
      include/clang/AST/Attr.h
  6. 148 163
      include/clang/AST/CanonicalType.h
  7. 146 146
      include/clang/AST/Decl.h
  8. 61 61
      include/clang/AST/DeclBase.h
  9. 189 189
      include/clang/AST/DeclCXX.h
  10. 15 15
      include/clang/AST/DeclContextInternals.h
  11. 19 19
      include/clang/AST/DeclGroup.h
  12. 192 192
      include/clang/AST/DeclObjC.h
  13. 149 153
      include/clang/AST/DeclTemplate.h
  14. 18 18
      include/clang/AST/DeclarationName.h
  15. 200 200
      include/clang/AST/Expr.h
  16. 206 206
      include/clang/AST/ExprCXX.h
  17. 102 102
      include/clang/AST/ExprObjC.h
  18. 4 4
      include/clang/AST/ExternalASTSource.h
  19. 16 16
      include/clang/AST/NestedNameSpecifier.h
  20. 5 5
      include/clang/AST/ParentMap.h
  21. 1 1
      include/clang/AST/PrettyPrinter.h
  22. 33 33
      include/clang/AST/RecordLayout.h
  23. 6 6
      include/clang/AST/Redeclarable.h
  24. 198 198
      include/clang/AST/Stmt.h
  25. 14 14
      include/clang/AST/StmtGraphTraits.h
  26. 31 31
      include/clang/AST/StmtIterator.h
  27. 95 95
      include/clang/AST/StmtObjC.h
  28. 10 10
      include/clang/AST/StmtVisitor.h
  29. 19 19
      include/clang/AST/TemplateName.h
  30. 181 181
      include/clang/AST/Type.h
  31. 5 5
      include/clang/AST/TypeLoc.h
  32. 3 3
      include/clang/AST/TypeOrdering.h
  33. 4 4
      include/clang/AST/TypeVisitor.h
  34. 21 21
      include/clang/Analysis/Analyses/LiveVariables.h
  35. 12 12
      include/clang/Analysis/Analyses/UninitializedValues.h
  36. 1 1
      include/clang/Analysis/AnalysisDiagnostic.h
  37. 66 66
      include/clang/Analysis/CFG.h
  38. 50 50
      include/clang/Analysis/FlowSensitive/DataflowSolver.h
  39. 28 28
      include/clang/Analysis/FlowSensitive/DataflowValues.h
  40. 10 10
      include/clang/Analysis/LocalCheckers.h
  41. 104 104
      include/clang/Analysis/PathDiagnostic.h
  42. 10 10
      include/clang/Analysis/PathSensitive/AnalysisContext.h
  43. 21 21
      include/clang/Analysis/PathSensitive/AnalysisManager.h
  44. 30 30
      include/clang/Analysis/PathSensitive/BasicValueFactory.h
  45. 96 96
      include/clang/Analysis/PathSensitive/BugReporter.h
  46. 16 16
      include/clang/Analysis/PathSensitive/Checker.h
  47. 5 5
      include/clang/Analysis/PathSensitive/CheckerVisitor.h
  48. 7 7
      include/clang/Analysis/PathSensitive/ConstraintManager.h
  49. 16 16
      include/clang/Analysis/PathSensitive/Environment.h
  50. 71 71
      include/clang/Analysis/PathSensitive/ExplodedGraph.h
  51. 4 4
      include/clang/Analysis/PathSensitive/GRAuditor.h
  52. 8 8
      include/clang/Analysis/PathSensitive/GRBlockCounter.h
  53. 95 95
      include/clang/Analysis/PathSensitive/GRCoreEngine.h
  54. 148 148
      include/clang/Analysis/PathSensitive/GRExprEngine.h
  55. 8 8
      include/clang/Analysis/PathSensitive/GRExprEngineBuilders.h
  56. 3 3
      include/clang/Analysis/PathSensitive/GRSimpleAPICheck.h
  57. 122 122
      include/clang/Analysis/PathSensitive/GRState.h
  58. 41 41
      include/clang/Analysis/PathSensitive/GRStateTrait.h
  59. 9 9
      include/clang/Analysis/PathSensitive/GRSubEngine.h
  60. 16 16
      include/clang/Analysis/PathSensitive/GRTransferFuncs.h
  61. 13 13
      include/clang/Analysis/PathSensitive/GRWorkList.h
  62. 141 141
      include/clang/Analysis/PathSensitive/MemRegion.h
  63. 80 80
      include/clang/Analysis/PathSensitive/SVals.h
  64. 11 11
      include/clang/Analysis/PathSensitive/SValuator.h
  65. 26 26
      include/clang/Analysis/PathSensitive/Store.h
  66. 69 69
      include/clang/Analysis/PathSensitive/SymbolManager.h
  67. 29 30
      include/clang/Analysis/PathSensitive/ValueManager.h
  68. 55 55
      include/clang/Analysis/ProgramPoint.h
  69. 63 63
      include/clang/Analysis/Support/BlkExprDeclBitVector.h
  70. 6 6
      include/clang/Analysis/Support/Optional.h
  71. 3 3
      include/clang/Analysis/Support/SaveAndRestore.h
  72. 7 7
      include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
  73. 2 2
      include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
  74. 30 30
      include/clang/Analysis/Visitors/CFGStmtVisitor.h
  75. 10 10
      include/clang/Analysis/Visitors/CFGVarDeclVisitor.h
  76. 8 8
      include/clang/Basic/Builtins.h
  77. 12 12
      include/clang/Basic/ConvertUTF.h
  78. 67 67
      include/clang/Basic/Diagnostic.h
  79. 17 17
      include/clang/Basic/FileManager.h
  80. 59 59
      include/clang/Basic/IdentifierTable.h
  81. 15 15
      include/clang/Basic/LangOptions.h
  82. 44 44
      include/clang/Basic/OnDiskHashTable.h
  83. 45 45
      include/clang/Basic/SourceLocation.h
  84. 105 105
      include/clang/Basic/SourceManager.h
  85. 12 12
      include/clang/Basic/SourceManagerInternals.h
  86. 40 40
      include/clang/Basic/TargetInfo.h
  87. 1 1
      include/clang/Basic/TokenKinds.h
  88. 3 3
      include/clang/CodeGen/ModuleBuilder.h
  89. 19 19
      include/clang/Driver/Action.h
  90. 23 23
      include/clang/Driver/Arg.h
  91. 13 13
      include/clang/Driver/ArgList.h
  92. 5 5
      include/clang/Driver/Compilation.h
  93. 8 8
      include/clang/Driver/Driver.h
  94. 1 1
      include/clang/Driver/DriverDiagnostic.h
  95. 9 9
      include/clang/Driver/HostInfo.h
  96. 11 11
      include/clang/Driver/Job.h
  97. 44 44
      include/clang/Driver/Option.h
  98. 2 2
      include/clang/Driver/Options.h
  99. 4 4
      include/clang/Driver/Tool.h
  100. 2 2
      include/clang/Frontend/ASTConsumers.h

+ 20 - 20
include/clang/AST/APValue.h

@@ -37,16 +37,16 @@ public:
   };
 private:
   ValueKind Kind;
-  
-  struct ComplexAPSInt { 
-    APSInt Real, Imag; 
+
+  struct ComplexAPSInt {
+    APSInt Real, Imag;
     ComplexAPSInt() : Real(1), Imag(1) {}
   };
   struct ComplexAPFloat {
     APFloat Real, Imag;
     ComplexAPFloat() : Real(0.0), Imag(0.0) {}
   };
-  
+
   struct LV {
     Expr* Base;
     uint64_t Offset;
@@ -57,9 +57,9 @@ private:
     Vec() : Elts(0), NumElts(0) {}
     ~Vec() { delete[] Elts; }
   };
-  
+
   enum {
-    MaxSize = (sizeof(ComplexAPSInt) > sizeof(ComplexAPFloat) ? 
+    MaxSize = (sizeof(ComplexAPSInt) > sizeof(ComplexAPFloat) ?
                sizeof(ComplexAPSInt) : sizeof(ComplexAPFloat))
   };
 
@@ -94,7 +94,7 @@ public:
   ~APValue() {
     MakeUninit();
   }
-  
+
   ValueKind getKind() const { return Kind; }
   bool isUninit() const { return Kind == Uninitialized; }
   bool isInt() const { return Kind == Int; }
@@ -103,10 +103,10 @@ public:
   bool isComplexFloat() const { return Kind == ComplexFloat; }
   bool isLValue() const { return Kind == LValue; }
   bool isVector() const { return Kind == Vector; }
-  
+
   void print(llvm::raw_ostream &OS) const;
   void dump() const;
-  
+
   APSInt &getInt() {
     assert(isInt() && "Invalid accessor");
     return *(APSInt*)(char*)Data;
@@ -114,7 +114,7 @@ public:
   const APSInt &getInt() const {
     return const_cast<APValue*>(this)->getInt();
   }
-  
+
   APFloat &getFloat() {
     assert(isFloat() && "Invalid accessor");
     return *(APFloat*)(char*)Data;
@@ -122,7 +122,7 @@ public:
   const APFloat &getFloat() const {
     return const_cast<APValue*>(this)->getFloat();
   }
-  
+
   APValue &getVectorElt(unsigned i) const {
     assert(isVector() && "Invalid accessor");
     return ((Vec*)(char*)Data)->Elts[i];
@@ -131,7 +131,7 @@ public:
     assert(isVector() && "Invalid accessor");
     return ((Vec*)(void *)Data)->NumElts;
   }
-  
+
   APSInt &getComplexIntReal() {
     assert(isComplexInt() && "Invalid accessor");
     return ((ComplexAPSInt*)(char*)Data)->Real;
@@ -139,7 +139,7 @@ public:
   const APSInt &getComplexIntReal() const {
     return const_cast<APValue*>(this)->getComplexIntReal();
   }
-  
+
   APSInt &getComplexIntImag() {
     assert(isComplexInt() && "Invalid accessor");
     return ((ComplexAPSInt*)(char*)Data)->Imag;
@@ -147,7 +147,7 @@ public:
   const APSInt &getComplexIntImag() const {
     return const_cast<APValue*>(this)->getComplexIntImag();
   }
-  
+
   APFloat &getComplexFloatReal() {
     assert(isComplexFloat() && "Invalid accessor");
     return ((ComplexAPFloat*)(char*)Data)->Real;
@@ -172,7 +172,7 @@ public:
     assert(isLValue() && "Invalid accessor");
     return ((const LV*)(const void*)Data)->Offset;
   }
-  
+
   void setInt(const APSInt &I) {
     assert(isInt() && "Invalid accessor");
     *(APSInt*)(char*)Data = I;
@@ -189,14 +189,14 @@ public:
       ((Vec*)(char*)Data)->Elts[i] = E[i];
   }
   void setComplexInt(const APSInt &R, const APSInt &I) {
-    assert(R.getBitWidth() == I.getBitWidth() && 
+    assert(R.getBitWidth() == I.getBitWidth() &&
            "Invalid complex int (type mismatch).");
     assert(isComplexInt() && "Invalid accessor");
     ((ComplexAPSInt*)(char*)Data)->Real = R;
     ((ComplexAPSInt*)(char*)Data)->Imag = I;
   }
   void setComplexFloat(const APFloat &R, const APFloat &I) {
-    assert(&R.getSemantics() == &I.getSemantics() && 
+    assert(&R.getSemantics() == &I.getSemantics() &&
            "Invalid complex float (type mismatch).");
     assert(isComplexFloat() && "Invalid accessor");
     ((ComplexAPFloat*)(char*)Data)->Real = R;
@@ -207,9 +207,9 @@ public:
     ((LV*)(char*)Data)->Base = B;
     ((LV*)(char*)Data)->Offset = O;
   }
-  
+
   const APValue &operator=(const APValue &RHS);
-  
+
 private:
   void MakeUninit();
   void MakeInt() {
@@ -248,7 +248,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const APValue &V) {
   V.print(OS);
   return OS;
 }
-  
+
 } // end namespace clang.
 
 #endif

+ 6 - 6
include/clang/AST/ASTConsumer.h

@@ -36,27 +36,27 @@ public:
   ASTConsumer() : SemaConsumer(false) { }
 
   virtual ~ASTConsumer() {}
-  
+
   /// Initialize - This is called to initialize the consumer, providing the
   /// ASTContext and the Action.
   virtual void Initialize(ASTContext &Context) {}
-  
+
   /// HandleTopLevelDecl - Handle the specified top-level declaration.  This is
   ///  called by the parser to process every top-level Decl*. Note that D can
   ///  be the head of a chain of Decls (e.g. for `int a, b` the chain will have
   ///  two elements). Use Decl::getNextDeclarator() to walk the chain.
   virtual void HandleTopLevelDecl(DeclGroupRef D);
-  
+
   /// HandleTranslationUnit - This method is called when the ASTs for entire
   ///  translation unit have been parsed.
-  virtual void HandleTranslationUnit(ASTContext &Ctx) {}    
-  
+  virtual void HandleTranslationUnit(ASTContext &Ctx) {}
+
   /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl
   /// (e.g. struct, union, enum, class) is completed.  This allows the client to
   /// hack on the type, which can occur at any point in the file (because these
   /// can be defined in declspecs).
   virtual void HandleTagDeclDefinition(TagDecl *D) {}
-  
+
   /// \brief Callback invoked at the end of a translation unit to
   /// notify the consumer that the given tentative definition should
   /// be completed.

+ 131 - 131
include/clang/AST/ASTContext.h

@@ -56,12 +56,12 @@ namespace clang {
   class TypedefDecl;
   class UnresolvedUsingDecl;
   class UsingDecl;
-  
+
   namespace Builtin { class Context; }
-  
+
 /// ASTContext - This class holds long-lived AST nodes (such as types and
 /// decls) that can be referred to throughout the semantic analysis of a file.
-class ASTContext {  
+class ASTContext {
   std::vector<Type*> Types;
   llvm::FoldingSet<ExtQualType> ExtQualTypes;
   llvm::FoldingSet<ComplexType> ComplexTypes;
@@ -87,7 +87,7 @@ class ASTContext {
   llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes;
   llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
   llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
-  
+
   llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
   llvm::FoldingSet<DependentTemplateName> DependentTemplateNames;
 
@@ -108,7 +108,7 @@ class ASTContext {
 
   llvm::DenseMap<unsigned, FixedWidthIntType*> SignedFixedWidthIntTypes;
   llvm::DenseMap<unsigned, FixedWidthIntType*> UnsignedFixedWidthIntTypes;
-  
+
   /// BuiltinVaListType - built-in va list type.
   /// This is initially null and set by Sema::LazilyCreateBuiltin when
   /// a builtin that takes a valist is encountered.
@@ -116,33 +116,33 @@ class ASTContext {
 
   /// ObjCIdType - a pseudo built-in typedef type (set by Sema).
   QualType ObjCIdTypedefType;
-  
+
   /// ObjCSelType - another pseudo built-in typedef type (set by Sema).
   QualType ObjCSelType;
   const RecordType *SelStructType;
-  
+
   /// ObjCProtoType - another pseudo built-in typedef type (set by Sema).
   QualType ObjCProtoType;
   const RecordType *ProtoStructType;
 
   /// ObjCClassType - another pseudo built-in typedef type (set by Sema).
   QualType ObjCClassTypedefType;
-  
+
   QualType ObjCConstantStringType;
   RecordDecl *CFConstantStringTypeDecl;
 
   RecordDecl *ObjCFastEnumerationStateTypeDecl;
-  
+
   /// \brief The type for the C FILE type.
   TypeDecl *FILEDecl;
-  
+
   /// \brief The type for the C jmp_buf type.
   TypeDecl *jmp_bufDecl;
-  
+
   /// \brief The type for the C sigjmp_buf type.
   TypeDecl *sigjmp_bufDecl;
-  
-  /// \brief Keeps track of all declaration attributes. 
+
+  /// \brief Keeps track of all declaration attributes.
   ///
   /// Since so few decls have attrs, we keep them in a hash map instead of
   /// wasting space in the Decl class.
@@ -153,7 +153,7 @@ class ASTContext {
   ///
   /// This data structure stores the mapping from instantiations of static
   /// data members to the static data member representations within the
-  /// class template from which they were instantiated. 
+  /// class template from which they were instantiated.
   ///
   /// Given the following example:
   ///
@@ -169,11 +169,11 @@ class ASTContext {
   /// int *x = &X<int>::value;
   /// \endcode
   ///
-  /// This mapping will contain an entry that maps from the VarDecl for 
+  /// This mapping will contain an entry that maps from the VarDecl for
   /// X<int>::value to the corresponding VarDecl for X<T>::value (within the
-  /// class template X). 
+  /// class template X).
   llvm::DenseMap<VarDecl *, VarDecl *> InstantiatedFromStaticDataMember;
-  
+
   /// \brief Keeps track of the UnresolvedUsingDecls from which UsingDecls
   /// where created during instantiation.
   ///
@@ -196,14 +196,14 @@ class ASTContext {
   /// B<int> to the UnresolvedUsingDecl in B<T>.
   llvm::DenseMap<UsingDecl *, UnresolvedUsingDecl *>
     InstantiatedFromUnresolvedUsingDecl;
-  
+
   llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl;
-  
+
   TranslationUnitDecl *TUDecl;
 
   /// SourceMgr - The associated SourceManager object.
   SourceManager &SourceMgr;
-  
+
   /// LangOpts - The language options used to create the AST associated with
   ///  this ASTContext object.
   LangOptions LangOpts;
@@ -211,17 +211,17 @@ class ASTContext {
   /// \brief Whether we have already loaded comment source ranges from an
   /// external source.
   bool LoadedExternalComments;
-  
+
   /// MallocAlloc/BumpAlloc - The allocator objects used to create AST objects.
   bool FreeMemory;
   llvm::MallocAllocator MallocAlloc;
   llvm::BumpPtrAllocator BumpAlloc;
-  
+
   /// \brief Mapping from declarations to their comments, once we have
   /// already looked up the comment associated with a given declaration.
   llvm::DenseMap<const Decl *, std::string> DeclComments;
-  
-public:  
+
+public:
   TargetInfo &Target;
   IdentifierTable &Idents;
   SelectorTable &Selectors;
@@ -238,38 +238,38 @@ public:
   /// \brief Source ranges for all of the comments in the source file,
   /// sorted in order of appearance in the translation unit.
   std::vector<SourceRange> Comments;
-  
+
   SourceManager& getSourceManager() { return SourceMgr; }
   const SourceManager& getSourceManager() const { return SourceMgr; }
   void *Allocate(unsigned Size, unsigned Align = 8) {
     return FreeMemory ? MallocAlloc.Allocate(Size, Align) :
                         BumpAlloc.Allocate(Size, Align);
   }
-  void Deallocate(void *Ptr) { 
+  void Deallocate(void *Ptr) {
     if (FreeMemory)
-      MallocAlloc.Deallocate(Ptr); 
+      MallocAlloc.Deallocate(Ptr);
   }
   const LangOptions& getLangOptions() const { return LangOpts; }
-  
-  FullSourceLoc getFullLoc(SourceLocation Loc) const { 
+
+  FullSourceLoc getFullLoc(SourceLocation Loc) const {
     return FullSourceLoc(Loc,SourceMgr);
   }
 
   /// \brief Retrieve the attributes for the given declaration.
   Attr*& getDeclAttrs(const Decl *D) { return DeclAttrs[D]; }
-  
+
   /// \brief Erase the attributes corresponding to the given declaration.
   void eraseDeclAttrs(const Decl *D) { DeclAttrs.erase(D); }
 
   /// \brief If this variable is an instantiated static data member of a
-  /// class template specialization, returns the templated static data member 
+  /// class template specialization, returns the templated static data member
   /// from which it was instantiated.
   VarDecl *getInstantiatedFromStaticDataMember(VarDecl *Var);
-  
+
   /// \brief Note that the static data member \p Inst is an instantiation of
   /// the static data member template \p Tmpl of a class template.
-  void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl);  
-  
+  void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl);
+
   /// \brief If this using decl is instantiated from an unresolved using decl,
   /// return it.
   UnresolvedUsingDecl *getInstantiatedFromUnresolvedUsingDecl(UsingDecl *UUD);
@@ -278,17 +278,17 @@ public:
   /// the unresolved using decl \p Tmpl of a class template.
   void setInstantiatedFromUnresolvedUsingDecl(UsingDecl *Inst,
                                               UnresolvedUsingDecl *Tmpl);
-  
-  
+
+
   FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field);
-  
+
   void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl);
-  
+
   TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
 
-  
+
   const char *getCommentForDecl(const Decl *D);
-  
+
   // Builtin Types.
   QualType VoidTy;
   QualType BoolTy;
@@ -331,27 +331,27 @@ public:
   //===--------------------------------------------------------------------===//
   //                           Type Constructors
   //===--------------------------------------------------------------------===//
-  
-  /// getAddSpaceQualType - Return the uniqued reference to the type for an 
-  /// address space qualified type with the specified type and address space.  
-  /// The resulting type has a union of the qualifiers from T and the address 
-  /// space. If T already has an address space specifier, it is silently 
+
+  /// getAddSpaceQualType - Return the uniqued reference to the type for an
+  /// address space qualified type with the specified type and address space.
+  /// The resulting type has a union of the qualifiers from T and the address
+  /// space. If T already has an address space specifier, it is silently
   /// replaced.
   QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace);
-  
+
   /// getObjCGCQualType - Returns the uniqued reference to the type for an
   /// objc gc qualified type. The retulting type has a union of the qualifiers
   /// from T and the gc attribute.
   QualType getObjCGCQualType(QualType T, QualType::GCAttrTypes gcAttr);
-  
+
   /// getNoReturnType - Add the noreturn attribute to the given type which must
   /// be a FunctionType or a pointer to an allowable type or a BlockPointer.
   QualType getNoReturnType(QualType T);
-  
+
   /// getComplexType - Return the uniqued reference to the type for a complex
   /// number with the specified element type.
   QualType getComplexType(QualType T);
-  
+
   /// getPointerType - Return the uniqued reference to the type for a pointer to
   /// the specified type.
   QualType getPointerType(QualType T);
@@ -379,7 +379,7 @@ public:
                                 ArrayType::ArraySizeModifier ASM,
                                 unsigned EltTypeQuals,
                                 SourceRange Brackets);
-  
+
   /// getDependentSizedArrayType - Returns a non-unique reference to
   /// the type for a dependently-sized array of the specified element
   /// type. FIXME: We will need these to be uniqued, or at least
@@ -430,7 +430,7 @@ public:
   /// the type for a dependently-sized vector of the specified element
   /// type. FIXME: We will need these to be uniqued, or at least
   /// comparable, at some point.
-  QualType getDependentSizedExtVectorType(QualType VectorType, 
+  QualType getDependentSizedExtVectorType(QualType VectorType,
                                           Expr *SizeExpr,
                                           SourceLocation AttrLoc);
 
@@ -455,7 +455,7 @@ public:
   /// specified typename decl.
   QualType getTypedefType(TypedefDecl *Decl);
 
-  QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, 
+  QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
                                    bool ParameterPack,
                                    IdentifierInfo *Name = 0);
 
@@ -466,17 +466,17 @@ public:
 
   QualType getQualifiedNameType(NestedNameSpecifier *NNS,
                                 QualType NamedType);
-  QualType getTypenameType(NestedNameSpecifier *NNS, 
+  QualType getTypenameType(NestedNameSpecifier *NNS,
                            const IdentifierInfo *Name,
                            QualType Canon = QualType());
-  QualType getTypenameType(NestedNameSpecifier *NNS, 
+  QualType getTypenameType(NestedNameSpecifier *NNS,
                            const TemplateSpecializationType *TemplateId,
                            QualType Canon = QualType());
   QualType getElaboratedType(QualType UnderlyingType,
                              ElaboratedType::TagKind Tag);
 
   QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
-                                ObjCProtocolDecl **Protocols = 0, 
+                                ObjCProtocolDecl **Protocols = 0,
                                 unsigned NumProtocols = 0);
 
   /// getObjCObjectPointerType - Return a ObjCObjectPointerType type for the
@@ -484,18 +484,18 @@ public:
   QualType getObjCObjectPointerType(QualType OIT,
                                     ObjCProtocolDecl **ProtocolList = 0,
                                     unsigned NumProtocols = 0);
-  
+
   /// getTypeOfType - GCC extension.
   QualType getTypeOfExprType(Expr *e);
   QualType getTypeOfType(QualType t);
-  
+
   /// getDecltypeType - C++0x decltype.
   QualType getDecltypeType(Expr *e);
-  
+
   /// getTagDeclType - Return the unique reference to the type for the
   /// specified TagDecl (struct/union/class/enum) decl.
   QualType getTagDeclType(const TagDecl *Decl);
-  
+
   /// getSizeType - Return the unique type for "size_t" (C99 7.17), defined
   /// in <stddef.h>. The sizeof operator requires this (C99 6.5.3.4p4).
   QualType getSizeType() const;
@@ -512,15 +512,15 @@ public:
   /// getUnsignedWCharType - Return the type of "unsigned wchar_t".
   /// Used when in C++, as a GCC extension.
   QualType getUnsignedWCharType() const;
-  
+
   /// getPointerDiffType - Return the unique type for "ptrdiff_t" (ref?)
   /// defined in <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
   QualType getPointerDiffType() const;
-  
+
   // getCFConstantStringType - Return the C structure type used to represent
   // constant CFStrings.
-  QualType getCFConstantStringType(); 
-  
+  QualType getCFConstantStringType();
+
   /// Get the structure type used to representation CFStrings, or NULL
   /// if it hasn't yet been built.
   QualType getRawCFConstantStringType() {
@@ -532,13 +532,13 @@ public:
 
   // This setter/getter represents the ObjC type for an NSConstantString.
   void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl);
-  QualType getObjCConstantStringInterface() const { 
-    return ObjCConstantStringType; 
+  QualType getObjCConstantStringInterface() const {
+    return ObjCConstantStringType;
   }
 
   //// This gets the struct used to keep track of fast enumerations.
   QualType getObjCFastEnumerationStateType();
-  
+
   /// Get the ObjCFastEnumerationState type, or NULL if it hasn't yet
   /// been built.
   QualType getRawObjCFastEnumerationStateType() {
@@ -551,10 +551,10 @@ public:
 
   /// \brief Set the type for the C FILE type.
   void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; }
-  
+
   /// \brief Retrieve the C FILE type.
-  QualType getFILEType() { 
-    if (FILEDecl) 
+  QualType getFILEType() {
+    if (FILEDecl)
       return getTypeDeclType(FILEDecl);
     return QualType();
   }
@@ -563,10 +563,10 @@ public:
   void setjmp_bufDecl(TypeDecl *jmp_bufDecl) {
     this->jmp_bufDecl = jmp_bufDecl;
   }
-  
+
   /// \brief Retrieve the C jmp_buf type.
-  QualType getjmp_bufType() { 
-    if (jmp_bufDecl) 
+  QualType getjmp_bufType() {
+    if (jmp_bufDecl)
       return getTypeDeclType(jmp_bufDecl);
     return QualType();
   }
@@ -575,41 +575,41 @@ public:
   void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) {
     this->sigjmp_bufDecl = sigjmp_bufDecl;
   }
-  
+
   /// \brief Retrieve the C sigjmp_buf type.
-  QualType getsigjmp_bufType() { 
-    if (sigjmp_bufDecl) 
+  QualType getsigjmp_bufType() {
+    if (sigjmp_bufDecl)
       return getTypeDeclType(sigjmp_bufDecl);
     return QualType();
   }
-                       
+
   /// getObjCEncodingForType - Emit the ObjC type encoding for the
   /// given type into \arg S. If \arg NameFields is specified then
   /// record field names are also encoded.
-  void getObjCEncodingForType(QualType t, std::string &S, 
+  void getObjCEncodingForType(QualType t, std::string &S,
                               const FieldDecl *Field=0);
 
   void getLegacyIntegralTypeEncoding(QualType &t) const;
-  
+
   // Put the string version of type qualifiers into S.
-  void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, 
+  void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
                                        std::string &S) const;
-  
+
   /// getObjCEncodingForMethodDecl - Return the encoded type for this method
   /// declaration.
   void getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, std::string &S);
-  
+
   /// getObjCEncodingForPropertyDecl - Return the encoded type for
   /// this method declaration. If non-NULL, Container must be either
   /// an ObjCCategoryImplDecl or ObjCImplementationDecl; it should
   /// only be NULL when getting encodings for protocol properties.
-  void getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, 
+  void getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
                                       const Decl *Container,
                                       std::string &S);
-  
+
   bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto,
                                       ObjCProtocolDecl *rProto);
-  
+
   /// getObjCEncodingTypeSize returns size of type for objective-c encoding
   /// purpose.
   int getObjCEncodingTypeSize(QualType t);
@@ -618,32 +618,32 @@ public:
   /// Sema.  id is always a (typedef for a) pointer type, a pointer to a struct.
   QualType getObjCIdType() const { return ObjCIdTypedefType; }
   void setObjCIdType(QualType T);
-  
+
   void setObjCSelType(QualType T);
   QualType getObjCSelType() const { return ObjCSelType; }
-  
+
   void setObjCProtoType(QualType QT);
   QualType getObjCProtoType() const { return ObjCProtoType; }
-  
+
   /// This setter/getter repreents the ObjC 'Class' type. It is setup lazily, by
   /// Sema.  'Class' is always a (typedef for a) pointer type, a pointer to a
   /// struct.
   QualType getObjCClassType() const { return ObjCClassTypedefType; }
   void setObjCClassType(QualType T);
-  
+
   void setBuiltinVaListType(QualType T);
   QualType getBuiltinVaListType() const { return BuiltinVaListType; }
 
   QualType getFixedWidthIntType(unsigned Width, bool Signed);
 
-  TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, 
+  TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS,
                                         bool TemplateKeyword,
                                         TemplateDecl *Template);
-  TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, 
+  TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS,
                                         bool TemplateKeyword,
                                         OverloadedFunctionDecl *Template);
-  
-  TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, 
+
+  TemplateName getDependentTemplateName(NestedNameSpecifier *NNS,
                                         const IdentifierInfo *Name);
 
   enum GetBuiltinTypeError {
@@ -651,42 +651,42 @@ public:
     GE_Missing_stdio,     //< Missing a type from <stdio.h>
     GE_Missing_setjmp     //< Missing a type from <setjmp.h>
   };
-  
+
   /// GetBuiltinType - Return the type for the specified builtin.
   QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error);
-  
+
 private:
   QualType getFromTargetType(unsigned Type) const;
 
   //===--------------------------------------------------------------------===//
   //                         Type Predicates.
   //===--------------------------------------------------------------------===//
- 
+
 public:
   /// getObjCGCAttr - Returns one of GCNone, Weak or Strong objc's
   /// garbage collection attribute.
   ///
   QualType::GCAttrTypes getObjCGCAttrKind(const QualType &Ty) const;
-  
+
   /// isObjCNSObjectType - Return true if this is an NSObject object with
   /// its NSObject attribute set.
   bool isObjCNSObjectType(QualType Ty) const;
-    
+
   //===--------------------------------------------------------------------===//
   //                         Type Sizing and Analysis
   //===--------------------------------------------------------------------===//
-  
+
   /// getFloatTypeSemantics - Return the APFloat 'semantics' for the specified
   /// scalar floating point type.
   const llvm::fltSemantics &getFloatTypeSemantics(QualType T) const;
-  
+
   /// getTypeInfo - Get the size and alignment of the specified complete type in
   /// bits.
   std::pair<uint64_t, unsigned> getTypeInfo(const Type *T);
   std::pair<uint64_t, unsigned> getTypeInfo(QualType T) {
     return getTypeInfo(T.getTypePtr());
   }
-  
+
   /// getTypeSize - Return the size of the specified type, in bits.  This method
   /// does not work on incomplete types.
   uint64_t getTypeSize(QualType T) {
@@ -695,7 +695,7 @@ public:
   uint64_t getTypeSize(const Type *T) {
     return getTypeInfo(T).first;
   }
-  
+
   /// getTypeAlign - Return the ABI-specified alignment of a type, in bits.
   /// This method does not work on incomplete types.
   unsigned getTypeAlign(QualType T) {
@@ -704,23 +704,23 @@ public:
   unsigned getTypeAlign(const Type *T) {
     return getTypeInfo(T).second;
   }
-  
+
   /// getPreferredTypeAlign - Return the "preferred" alignment of the specified
   /// type for the current target in bits.  This can be different than the ABI
   /// alignment in cases where it is beneficial for performance to overalign
   /// a data type.
   unsigned getPreferredTypeAlign(const Type *T);
-  
+
   /// getDeclAlignInBytes - Return the alignment of the specified decl
   /// that should be returned by __alignof().  Note that bitfields do
   /// not have a valid alignment, so this method will assert on them.
   unsigned getDeclAlignInBytes(const Decl *D);
-  
+
   /// getASTRecordLayout - Get or compute information about the layout of the
   /// specified record (struct/union/class), which indicates its size and field
   /// position information.
   const ASTRecordLayout &getASTRecordLayout(const RecordDecl *D);
-  
+
   /// getASTObjCInterfaceLayout - Get or compute information about the
   /// layout of the specified Objective-C interface.
   const ASTRecordLayout &getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D);
@@ -747,7 +747,7 @@ public:
   //===--------------------------------------------------------------------===//
   //                            Type Operators
   //===--------------------------------------------------------------------===//
-  
+
   /// getCanonicalType - Return the canonical (structural) type corresponding to
   /// the specified potentially non-canonical type.  The non-canonical version
   /// of a type may have many "decorated" versions of types.  Decorators can
@@ -763,7 +763,7 @@ public:
   bool hasSameType(QualType T1, QualType T2) {
     return getCanonicalType(T1) == getCanonicalType(T2);
   }
-  
+
   /// \brief Determine whether the given types are equivalent after
   /// cvr-qualifiers have been removed.
   bool hasSameUnqualifiedType(QualType T1, QualType T2) {
@@ -772,7 +772,7 @@ public:
     return T1.getUnqualifiedType() == T2.getUnqualifiedType();
   }
 
-  /// \brief Retrieves the "canonical" declaration of 
+  /// \brief Retrieves the "canonical" declaration of
 
   /// \brief Retrieves the "canonical" nested name specifier for a
   /// given nested name specifier.
@@ -822,11 +822,11 @@ public:
 
   /// \brief Retrieve the "canonical" template argument.
   ///
-  /// The canonical template argument is the simplest template argument 
-  /// (which may be a type, value, expression, or declaration) that 
+  /// The canonical template argument is the simplest template argument
+  /// (which may be a type, value, expression, or declaration) that
   /// expresses the value of the argument.
   TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg);
-  
+
   /// Type Query functions.  If the type is an instance of the specified class,
   /// return the Type pointer for the underlying maximally pretty type.  This
   /// is a member of ASTContext because this may need to do some amount of
@@ -849,10 +849,10 @@ public:
   /// getBaseElementType - Returns the innermost element type of a type
   /// (which needn't actually be an array type).
   QualType getBaseElementType(QualType QT);
-  
+
   /// getConstantArrayElementCount - Returns number of constant array elements.
   uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const;
-  
+
   /// getArrayDecayedType - Return the properly qualified result of decaying the
   /// specified array type to a pointer.  This operation is non-trivial when
   /// handling typedefs etc.  The canonical type of "T" must be an array type,
@@ -860,7 +860,7 @@ public:
   ///
   /// See C99 6.7.5.3p7 and C99 6.3.2.1p3.
   QualType getArrayDecayedType(QualType T);
-  
+
   /// getPromotedIntegerType - Returns the type that Promotable will
   /// promote to: C99 6.3.1.1p2, assuming that Promotable is a promotable
   /// integer type.
@@ -873,22 +873,22 @@ public:
   /// promotion occurs.
   QualType isPromotableBitField(Expr *E);
 
-  /// 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 getIntegerTypeOrder(QualType LHS, QualType RHS);
-  
+
   /// 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 getFloatingTypeOrder(QualType LHS, QualType RHS);
 
-  /// 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 getFloatingTypeOfSizeWithinDomain(QualType typeSize, 
+  QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize,
                                              QualType typeDomain) const;
 
 private:
@@ -900,10 +900,10 @@ public:
   //===--------------------------------------------------------------------===//
   //                    Type Compatibility Predicates
   //===--------------------------------------------------------------------===//
-                                             
+
   /// Compatibility predicates used to check assignment expressions.
   bool typesAreCompatible(QualType, QualType); // C99 6.2.7p1
-  
+
   bool isObjCIdType(QualType T) const {
     return T == ObjCIdTypedefType;
   }
@@ -950,15 +950,15 @@ public:
   //===--------------------------------------------------------------------===//
   //                    Type Iterators.
   //===--------------------------------------------------------------------===//
-  
+
   typedef std::vector<Type*>::iterator       type_iterator;
   typedef std::vector<Type*>::const_iterator const_type_iterator;
-  
+
   type_iterator types_begin() { return Types.begin(); }
   type_iterator types_end() { return Types.end(); }
   const_type_iterator types_begin() const { return Types.begin(); }
-  const_type_iterator types_end() const { return Types.end(); }  
-  
+  const_type_iterator types_end() const { return Types.end(); }
+
   //===--------------------------------------------------------------------===//
   //                    Integer Values
   //===--------------------------------------------------------------------===//
@@ -996,12 +996,12 @@ public:
 private:
   ASTContext(const ASTContext&); // DO NOT IMPLEMENT
   void operator=(const ASTContext&); // DO NOT IMPLEMENT
-  
+
   void InitBuiltinTypes();
   void InitBuiltinType(QualType &R, BuiltinType::Kind K);
-  
+
   // Return the ObjC type encoding for a given type.
-  void getObjCEncodingForTypeImpl(QualType t, std::string &S, 
+  void getObjCEncodingForTypeImpl(QualType t, std::string &S,
                                   bool ExpandPointedToStructures,
                                   bool ExpandStructures,
                                   const FieldDecl *Field,
@@ -1009,7 +1009,7 @@ private:
                                   bool EncodingProperty = false);
 
   const ASTRecordLayout &getObjCLayout(const ObjCInterfaceDecl *D,
-                                       const ObjCImplementationDecl *Impl);    
+                                       const ObjCImplementationDecl *Impl);
 };
 
 }  // end namespace clang

+ 1 - 1
include/clang/AST/ASTDiagnostic.h

@@ -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 ASTSTART

+ 49 - 49
include/clang/AST/Attr.h

@@ -57,7 +57,7 @@ public:
     DLLImport,
     Deprecated,
     Destructor,
-    FastCall,    
+    FastCall,
     Format,
     FormatArg,
     GNUInline,
@@ -83,14 +83,14 @@ public:
     StdCall,
     TransparentUnion,
     Unavailable,
-    Unused,    
+    Unused,
     Used,
     Visibility,
     WarnUnusedResult,
     Weak,
     WeakImport
   };
-    
+
 private:
   Attr *Next;
   Kind AttrKind;
@@ -104,16 +104,16 @@ protected:
   void operator delete(void* data) throw() {
     assert(0 && "Attrs cannot be released with regular 'delete'.");
   }
-  
+
 protected:
   Attr(Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
   virtual ~Attr() {
     assert(Next == 0 && "Destroy didn't work");
   }
 public:
-  
+
   void Destroy(ASTContext &C);
-  
+
   /// \brief Whether this attribute should be merged to new
   /// declarations.
   virtual bool isMerged() const { return true; }
@@ -130,18 +130,18 @@ public:
         return V;
     return 0;
   }
-  
+
   bool isInherited() const { return Inherited; }
   void setInherited(bool value) { Inherited = value; }
 
   void addAttr(Attr *attr) {
     assert((attr != 0) && "addAttr(): attr is null");
-    
+
     // FIXME: This doesn't preserve the order in any way.
     attr->Next = Next;
     Next = attr;
   }
-  
+
   // Clone this attribute.
   virtual Attr* clone(ASTContext &C) const = 0;
 
@@ -169,8 +169,8 @@ public:
   /// getAlignment - The specified alignment in bits.
   unsigned getAlignment() const { return Alignment; }
 
-  virtual Attr* clone(ASTContext &C) const { 
-    return ::new (C) PragmaPackAttr(Alignment); 
+  virtual Attr* clone(ASTContext &C) const {
+    return ::new (C) PragmaPackAttr(Alignment);
   }
 
   // Implement isa/cast/dyncast/etc.
@@ -179,7 +179,7 @@ public:
   }
   static bool classof(const PragmaPackAttr *A) { return true; }
 };
-  
+
 class AlignedAttr : public Attr {
   unsigned Alignment;
 public:
@@ -189,7 +189,7 @@ public:
   unsigned getAlignment() const { return Alignment; }
 
   virtual Attr* clone(ASTContext &C) const { return ::new (C) AlignedAttr(Alignment); }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Attr *A) {
     return A->getKind() == Aligned;
@@ -201,11 +201,11 @@ class AnnotateAttr : public Attr {
   std::string Annotation;
 public:
   AnnotateAttr(const std::string &ann) : Attr(Annotate), Annotation(ann) {}
-  
+
   const std::string& getAnnotation() const { return Annotation; }
 
   virtual Attr* clone(ASTContext &C) const { return ::new (C) AnnotateAttr(Annotation); }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Attr *A) {
     return A->getKind() == Annotate;
@@ -217,11 +217,11 @@ class AsmLabelAttr : public Attr {
   std::string Label;
 public:
   AsmLabelAttr(const std::string &L) : Attr(AsmLabel), Label(L) {}
-  
+
   const std::string& getLabel() const { return Label; }
-  
+
   virtual Attr* clone(ASTContext &C) const { return ::new (C) AsmLabelAttr(Label); }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Attr *A) {
     return A->getKind() == AsmLabel;
@@ -251,28 +251,28 @@ public:
   ConstructorAttr(int p) : Attr(Constructor), priority(p) {}
 
   int getPriority() const { return priority; }
-  
+
   virtual Attr *clone(ASTContext &C) const { return ::new (C) ConstructorAttr(priority); }
 
   // Implement isa/cast/dyncast/etc.
-  static bool classof(const Attr *A) { return A->getKind() == Constructor; }  
+  static bool classof(const Attr *A) { return A->getKind() == Constructor; }
   static bool classof(const ConstructorAttr *A) { return true; }
-};  
-  
+};
+
 class DestructorAttr : public Attr {
   int priority;
 public:
   DestructorAttr(int p) : Attr(Destructor), priority(p) {}
 
   int getPriority() const { return priority; }
-  
+
   virtual Attr *clone(ASTContext &C) const { return ::new (C) DestructorAttr(priority); }
 
   // Implement isa/cast/dyncast/etc.
-  static bool classof(const Attr *A) { return A->getKind() == Destructor; }  
+  static bool classof(const Attr *A) { return A->getKind() == Destructor; }
   static bool classof(const DestructorAttr *A) { return true; }
-};  
-    
+};
+
 class GNUInlineAttr : public Attr {
 public:
   GNUInlineAttr() : Attr(GNUInline) {}
@@ -301,14 +301,14 @@ public:
 
 DEF_SIMPLE_ATTR(Malloc);
 DEF_SIMPLE_ATTR(NoReturn);
-DEF_SIMPLE_ATTR(AnalyzerNoReturn);  
+DEF_SIMPLE_ATTR(AnalyzerNoReturn);
 DEF_SIMPLE_ATTR(Deprecated);
 
 class SectionAttr : public Attr {
   std::string Name;
 public:
   SectionAttr(const std::string &N) : Attr(Section), Name(N) {}
-  
+
   const std::string& getName() const { return Name; }
 
   virtual Attr *clone(ASTContext &C) const { return ::new (C) SectionAttr(Name); }
@@ -322,8 +322,8 @@ public:
 
 DEF_SIMPLE_ATTR(Unavailable);
 DEF_SIMPLE_ATTR(Unused);
-DEF_SIMPLE_ATTR(Used);  
-DEF_SIMPLE_ATTR(Weak);  
+DEF_SIMPLE_ATTR(Used);
+DEF_SIMPLE_ATTR(Weak);
 DEF_SIMPLE_ATTR(WeakImport);
 DEF_SIMPLE_ATTR(NoThrow);
 DEF_SIMPLE_ATTR(Const);
@@ -335,14 +335,14 @@ class NonNullAttr : public Attr {
 public:
   NonNullAttr(unsigned* arg_nums = 0, unsigned size = 0) : Attr(NonNull),
     ArgNums(0), Size(0) {
-  
+
     if (size == 0) return;
     assert(arg_nums);
     ArgNums = new unsigned[size];
     Size = size;
     memcpy(ArgNums, arg_nums, sizeof(*ArgNums)*size);
   }
-  
+
   virtual ~NonNullAttr() {
     delete [] ArgNums;
   }
@@ -354,7 +354,7 @@ public:
 
   bool isNonNull(unsigned arg) const {
     return ArgNums ? std::binary_search(ArgNums, ArgNums+Size, arg) : true;
-  }  
+  }
 
   virtual Attr *clone(ASTContext &C) const { return ::new (C) NonNullAttr(ArgNums, Size); }
 
@@ -374,8 +374,8 @@ public:
   int getFormatIdx() const { return formatIdx; }
   int getFirstArg() const { return firstArg; }
 
-  virtual Attr *clone(ASTContext &C) const { 
-    return ::new (C) FormatAttr(Type, formatIdx, firstArg); 
+  virtual Attr *clone(ASTContext &C) const {
+    return ::new (C) FormatAttr(Type, formatIdx, firstArg);
   }
 
   // Implement isa/cast/dyncast/etc.
@@ -452,8 +452,8 @@ public:
 
   virtual bool isMerged() const { return false; }
 
-  virtual Attr *clone(ASTContext &C) const { 
-    return ::new (C) OverloadableAttr; 
+  virtual Attr *clone(ASTContext &C) const {
+    return ::new (C) OverloadableAttr;
   }
 
   static bool classof(const Attr *A) { return A->getKind() == Overloadable; }
@@ -480,15 +480,15 @@ public:
 };
 
 class FunctionDecl;
-  
+
 class CleanupAttr : public Attr {
   FunctionDecl *FD;
-  
+
 public:
   CleanupAttr(FunctionDecl *fd) : Attr(Cleanup), FD(fd) {}
 
   const FunctionDecl *getFunctionDecl() const { return FD; }
-  
+
   virtual Attr *clone(ASTContext &C) const { return ::new (C) CleanupAttr(FD); }
 
   // Implement isa/cast/dyncast/etc.
@@ -497,7 +497,7 @@ public:
 };
 
 DEF_SIMPLE_ATTR(NoDebug);
-DEF_SIMPLE_ATTR(WarnUnusedResult);  
+DEF_SIMPLE_ATTR(WarnUnusedResult);
 DEF_SIMPLE_ATTR(NoInline);
 
 class RegparmAttr : public Attr {
@@ -508,11 +508,11 @@ public:
 
   unsigned getNumParams() const { return NumParams; }
 
-  virtual Attr *clone(ASTContext &C) const { 
-    return ::new (C) RegparmAttr(NumParams); 
+  virtual Attr *clone(ASTContext &C) const {
+    return ::new (C) RegparmAttr(NumParams);
   }
 
-  // Implement isa/cast/dyncast/etc.    
+  // Implement isa/cast/dyncast/etc.
   static bool classof(const Attr *A) { return A->getKind() == Regparm; }
   static bool classof(const RegparmAttr *A) { return true; }
 };
@@ -527,23 +527,23 @@ public:
   unsigned getYDim() const { return Y; }
   unsigned getZDim() const { return Z; }
 
-  virtual Attr *clone(ASTContext &C) const { 
-    return ::new (C) ReqdWorkGroupSizeAttr(X, Y, Z); 
+  virtual Attr *clone(ASTContext &C) const {
+    return ::new (C) ReqdWorkGroupSizeAttr(X, Y, Z);
   }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Attr *A) {
     return A->getKind() == ReqdWorkGroupSize;
   }
   static bool classof(const ReqdWorkGroupSizeAttr *A) { return true; }
 };
-  
+
 // Checker-specific attributes.
 DEF_SIMPLE_ATTR(CFReturnsRetained);
 DEF_SIMPLE_ATTR(NSReturnsRetained);
 
 #undef DEF_SIMPLE_ATTR
-  
+
 }  // end namespace clang
 
 #endif

+ 148 - 163
include/clang/AST/CanonicalType.h

@@ -21,69 +21,69 @@
 #include <iterator>
 
 namespace clang {
-  
+
 template<typename T> class CanProxy;
 template<typename T> struct CanProxyAdaptor;
 
 //----------------------------------------------------------------------------//
 // Canonical, qualified type template
 //----------------------------------------------------------------------------//
-  
+
 /// \brief Represents a canonical, potentially-qualified type.
 ///
 /// The CanQual template is a lightweight smart pointer that provides access
 /// to the canonical representation of a type, where all typedefs and other
-/// syntactic sugar has been eliminated. A CanQualType may also have various 
+/// syntactic sugar has been eliminated. A CanQualType may also have various
 /// qualifiers (const, volatile, restrict) attached to it.
 ///
-/// The template type parameter @p T is one of the Type classes (PointerType, 
+/// The template type parameter @p T is one of the Type classes (PointerType,
 /// BuiltinType, etc.). The type stored within @c CanQual<T> will be of that
 /// type (or some subclass of that type). The typedef @c CanQualType is just
 /// a shorthand for @c CanQual<Type>.
 ///
-/// An instance of @c CanQual<T> can be implicitly converted to a 
+/// An instance of @c CanQual<T> can be implicitly converted to a
 /// @c CanQual<U> when T is derived from U, which essentially provides an
-/// implicit upcast. For example, @c CanQual<LValueReferenceType> can be 
-/// converted to @c CanQual<ReferenceType>. Note that any @c CanQual type can 
+/// implicit upcast. For example, @c CanQual<LValueReferenceType> can be
+/// converted to @c CanQual<ReferenceType>. Note that any @c CanQual type can
 /// be implicitly converted to a QualType, but the reverse operation requires
 /// a call to ASTContext::getCanonicalType().
-/// 
-/// 
+///
+///
 template<typename T = Type>
 class CanQual {
-  /// \brief The actual, canonical type. 
+  /// \brief The actual, canonical type.
   QualType Stored;
-  
+
 public:
   /// \brief Constructs a NULL canonical type.
   CanQual() : Stored() { }
-  
+
   /// \brief Converting constructor that permits implicit upcasting of
   /// canonical type pointers.
   template<typename U>
-  CanQual(const CanQual<U>& Other, 
+  CanQual(const CanQual<U>& Other,
           typename llvm::enable_if<llvm::is_base_of<T, U>, int>::type = 0);
-  
+
   /// \brief Implicit conversion to the underlying pointer.
   ///
   /// Also provides the ability to use canonical types in a boolean context,
-  /// e.g., 
+  /// e.g.,
   /// @code
   ///   if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { ... }
   /// @endcode
   operator const T*() const { return getTypePtr(); }
-  
-  /// \brief Retrieve the underlying type pointer, which refers to a 
+
+  /// \brief Retrieve the underlying type pointer, which refers to a
   /// canonical type.
   T *getTypePtr() const { return cast_or_null<T>(Stored.getTypePtr()); }
-  
+
   /// \brief Implicit conversion to a qualified type.
   operator QualType() const { return Stored; }
-  
+
   /// \brief Retrieve a canonical type pointer with a different static type,
   /// upcasting or downcasting as needed.
   ///
-  /// The getAs() function is typically used to try to downcast to a 
+  /// The getAs() function is typically used to try to downcast to a
   /// more specific (canonical) type in the type system. For example:
   ///
   /// @code
@@ -98,17 +98,17 @@ public:
   /// static type (@p U). If the dynamic type is not the specified static type
   /// or a derived class thereof, a NULL canonical type.
   template<typename U> CanProxy<U> getAs() const;
-  
+
   /// \brief Overloaded arrow operator that produces a canonical type
   /// proxy.
   CanProxy<T> operator->() const;
-  
+
   /// \brief Retrieve the const/volatile/restrict qualifiers.
   unsigned getCVRQualifiers() const { return Stored.getCVRQualifiers(); }
-  
+
   /// \brief Set the const/volatile/restrict qualifiers
   void setCVRQualifiers(unsigned Quals) { Stored.setCVRQualifiers(Quals); }
-  
+
   bool isConstQualified() const {
     return (getCVRQualifiers() & QualType::Const) ? true : false;
   }
@@ -117,42 +117,42 @@ public:
   }
   bool isRestrictQualified() const {
     return (getCVRQualifiers() & QualType::Restrict) ? true : false;
-  }  
-  
+  }
+
   /// \brief Retrieve the unqualified form of this type.
   CanQual<T> getUnqualifiedType() const;
-  
+
   CanQual<T> getQualifiedType(unsigned TQs) const {
     return CanQual<T>::CreateUnsafe(QualType(getTypePtr(), TQs));
   }
-  
-  /// \brief Determines whether this canonical type is more qualified than 
+
+  /// \brief Determines whether this canonical type is more qualified than
   /// the @p Other canonical type.
   bool isMoreQualifiedThan(CanQual<T> Other) const {
     return Stored.isMoreQualifiedThan(Other.Stored);
   }
-  
+
   /// \brief Determines whether this canonical type is at least as qualified as
   /// the @p Other canonical type.
   bool isAtLeastAsQualifiedAs(CanQual<T> Other) const {
     return Stored.isAtLeastAsQualifiedAs(Other.Stored);
   }
-  
+
   /// \brief If the canonical type is a reference type, returns the type that
   /// it refers to; otherwise, returns the type itself.
   CanQual<Type> getNonReferenceType() const;
-  
+
   /// \brief Retrieve the internal representation of this canonical type.
   void *getAsOpaquePtr() const { return Stored.getAsOpaquePtr(); }
-  
+
   /// \brief Construct a canonical type from its internal representation.
   static CanQual<T> getFromOpaquePtr(void *Ptr);
-  
+
   /// \brief Builds a canonical type from a QualType.
   ///
-  /// This routine is inherently unsafe, because it requires the user to 
-  /// ensure that the given type is a canonical type with the correct 
-  // (dynamic) type. 
+  /// This routine is inherently unsafe, because it requires the user to
+  /// ensure that the given type is a canonical type with the correct
+  // (dynamic) type.
   static CanQual<T> CreateUnsafe(QualType Other);
 };
 
@@ -172,7 +172,7 @@ typedef CanQual<Type> CanQualType;
 //----------------------------------------------------------------------------//
 // Internal proxy classes used by canonical types
 //----------------------------------------------------------------------------//
-  
+
 #define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor)                    \
 CanQualType Accessor() const {                                           \
 return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
@@ -183,32 +183,32 @@ Type Accessor() const { return this->getTypePtr()->Accessor(); }
 
 /// \brief Base class of all canonical proxy types, which is responsible for
 /// storing the underlying canonical type and providing basic conversions.
-template<typename T> 
+template<typename T>
 class CanProxyBase {
 protected:
   CanQual<T> Stored;
-  
+
 public:
   /// \brief Retrieve the pointer to the underlying Type
   T* getTypePtr() const { return Stored.getTypePtr(); }
-  
+
   /// \brief Implicit conversion to the underlying pointer.
   ///
   /// Also provides the ability to use canonical type proxies in a Boolean
-  // context,e.g., 
+  // context,e.g.,
   /// @code
   ///   if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { ... }
   /// @endcode
   operator const T*() const { return this->Stored.getTypePtr(); }
-  
+
   /// \brief Try to convert the given canonical type to a specific structural
   /// type.
-  template<typename U> CanProxy<U> getAs() const { 
-    return this->Stored.template getAs<U>(); 
+  template<typename U> CanProxy<U> getAs() const {
+    return this->Stored.template getAs<U>();
   }
-  
+
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type::TypeClass, getTypeClass)
-  
+
   // Type predicates
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjectType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteType)
@@ -271,44 +271,44 @@ public:
 /// that provide accessors returning canonical types (@c CanQualType) rather
 /// than the more typical @c QualType, to propagate the notion of "canonical"
 /// through the system.
-template<typename T> 
+template<typename T>
 struct CanProxyAdaptor : CanProxyBase<T> { };
 
 /// \brief Canonical proxy type returned when retrieving the members of a
-/// canonical type or as the result of the @c CanQual<T>::getAs member 
+/// canonical type or as the result of the @c CanQual<T>::getAs member
 /// function.
 ///
 /// The CanProxy type mainly exists as a proxy through which operator-> will
-/// look to either map down to a raw T* (e.g., PointerType*) or to a proxy 
+/// look to either map down to a raw T* (e.g., PointerType*) or to a proxy
 /// type that provides canonical-type access to the fields of the type.
 template<typename T>
 class CanProxy : public CanProxyAdaptor<T> {
 public:
   /// \brief Build a NULL proxy.
   CanProxy() { }
-  
+
   /// \brief Build a proxy to the given canonical type.
   CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
-  
+
   /// \brief Implicit conversion to the stored canonical type.
   operator CanQual<T>() const { return this->Stored; }
 };
-  
+
 } // end namespace clang
 
 namespace llvm {
-  
-/// Implement simplify_type for CanQual<T>, so that we can dyn_cast from 
+
+/// Implement simplify_type for CanQual<T>, so that we can dyn_cast from
 /// CanQual<T> to a specific Type class. We're prefer isa/dyn_cast/cast/etc.
 /// to return smart pointer (proxies?).
-template<typename T> 
+template<typename T>
 struct simplify_type<const ::clang::CanQual<T> > {
   typedef T* SimpleType;
   static SimpleType getSimplifiedValue(const ::clang::CanQual<T> &Val) {
     return Val.getTypePtr();
   }
 };
-template<typename T> 
+template<typename T>
 struct simplify_type< ::clang::CanQual<T> >
 : public simplify_type<const ::clang::CanQual<T> > {};
 
@@ -325,21 +325,21 @@ public:
   // CVR qualifiers go in low bits.
   enum { NumLowBitsAvailable = 0 };
 };
-  
+
 } // end namespace llvm
 
 namespace clang {
-  
+
 //----------------------------------------------------------------------------//
 // Canonical proxy adaptors for canonical type nodes.
 //----------------------------------------------------------------------------//
-  
-/// \brief Iterator adaptor that turns an iterator over canonical QualTypes 
+
+/// \brief Iterator adaptor that turns an iterator over canonical QualTypes
 /// into an iterator over CanQualTypes.
 template<typename InputIterator>
 class CanTypeIterator {
   InputIterator Iter;
-  
+
 public:
   typedef CanQualType    value_type;
   typedef value_type     reference;
@@ -348,62 +348,62 @@ public:
     difference_type;
   typedef typename std::iterator_traits<InputIterator>::iterator_category
     iterator_category;
-  
+
   CanTypeIterator() : Iter() { }
   explicit CanTypeIterator(InputIterator Iter) : Iter(Iter) { }
-  
+
   // Input iterator
   reference operator*() const {
     return CanQualType::CreateUnsafe(*Iter);
   }
-  
+
   pointer operator->() const;
-  
+
   CanTypeIterator &operator++() {
     ++Iter;
     return *this;
   }
-  
+
   CanTypeIterator operator++(int) {
     CanTypeIterator Tmp(*this);
     ++Iter;
     return Tmp;
   }
- 
+
   friend bool operator==(const CanTypeIterator& X, const CanTypeIterator &Y) {
     return X.Iter == Y.Iter;
   }
   friend bool operator!=(const CanTypeIterator& X, const CanTypeIterator &Y) {
     return X.Iter != Y.Iter;
   }
-  
+
   // Bidirectional iterator
   CanTypeIterator &operator--() {
     --Iter;
     return *this;
   }
-  
+
   CanTypeIterator operator--(int) {
     CanTypeIterator Tmp(*this);
     --Iter;
     return Tmp;
   }
-  
+
   // Random access iterator
   reference operator[](difference_type n) const {
     return CanQualType::CreateUnsafe(Iter[n]);
   }
-  
+
   CanTypeIterator &operator+=(difference_type n) {
     Iter += n;
     return *this;
   }
-  
+
   CanTypeIterator &operator-=(difference_type n) {
     Iter -= n;
     return *this;
   }
-  
+
   friend CanTypeIterator operator+(CanTypeIterator X, difference_type n) {
     X += n;
     return X;
@@ -413,15 +413,15 @@ public:
     X += n;
     return X;
   }
-  
+
   friend CanTypeIterator operator-(CanTypeIterator X, difference_type n) {
     X -= n;
     return X;
   }
-  
-  friend difference_type operator-(const CanTypeIterator &X, 
+
+  friend difference_type operator-(const CanTypeIterator &X,
                                    const CanTypeIterator &Y) {
-    return X - Y; 
+    return X - Y;
   }
 };
 
@@ -431,7 +431,7 @@ struct CanProxyAdaptor<ExtQualType> : public CanProxyBase<ExtQualType> {
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(QualType::GCAttrTypes, getObjCGCAttr)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getAddressSpace)
 };
-  
+
 template<>
 struct CanProxyAdaptor<ComplexType> : public CanProxyBase<ComplexType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
@@ -441,66 +441,60 @@ template<>
 struct CanProxyAdaptor<PointerType> : public CanProxyBase<PointerType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
 };
-  
+
 template<>
-struct CanProxyAdaptor<BlockPointerType> 
-  : public CanProxyBase<BlockPointerType> 
-{
+struct CanProxyAdaptor<BlockPointerType>
+  : public CanProxyBase<BlockPointerType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
 };
-  
+
 template<>
 struct CanProxyAdaptor<ReferenceType> : public CanProxyBase<ReferenceType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
 };
 
 template<>
-struct CanProxyAdaptor<LValueReferenceType> 
-  : public CanProxyBase<LValueReferenceType> 
-{
+struct CanProxyAdaptor<LValueReferenceType>
+  : public CanProxyBase<LValueReferenceType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
 };
 
 template<>
-struct CanProxyAdaptor<RValueReferenceType> 
-  : public CanProxyBase<RValueReferenceType> 
-{
+struct CanProxyAdaptor<RValueReferenceType>
+  : public CanProxyBase<RValueReferenceType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
 };
 
 template<>
-struct CanProxyAdaptor<MemberPointerType> 
-  : public CanProxyBase<MemberPointerType> 
-{
+struct CanProxyAdaptor<MemberPointerType>
+  : public CanProxyBase<MemberPointerType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Type *, getClass)
 };
-  
+
 template<>
 struct CanProxyAdaptor<ArrayType> : public CanProxyBase<ArrayType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
 };
 
 template<>
-struct CanProxyAdaptor<ConstantArrayType> 
-  : public CanProxyBase<ConstantArrayType> 
-{
+struct CanProxyAdaptor<ConstantArrayType>
+  : public CanProxyBase<ConstantArrayType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
 };
 
 template<>
-struct CanProxyAdaptor<ConstantArrayWithExprType> 
-  : public CanProxyBase<ConstantArrayWithExprType> 
-{
+struct CanProxyAdaptor<ConstantArrayWithExprType>
+  : public CanProxyBase<ConstantArrayWithExprType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
@@ -509,34 +503,31 @@ struct CanProxyAdaptor<ConstantArrayWithExprType>
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getLBracketLoc)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getRBracketLoc)
 };
-  
+
 template<>
-struct CanProxyAdaptor<ConstantArrayWithoutExprType> 
-  : public CanProxyBase<ConstantArrayWithoutExprType> 
-{
+struct CanProxyAdaptor<ConstantArrayWithoutExprType>
+  : public CanProxyBase<ConstantArrayWithoutExprType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
 };
 
 template<>
-struct CanProxyAdaptor<IncompleteArrayType> 
-  : public CanProxyBase<IncompleteArrayType> 
-{
+struct CanProxyAdaptor<IncompleteArrayType>
+  : public CanProxyBase<IncompleteArrayType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
 };
-  
+
 template<>
-struct CanProxyAdaptor<VariableArrayType> 
-  : public CanProxyBase<VariableArrayType> 
-{
+struct CanProxyAdaptor<VariableArrayType>
+  : public CanProxyBase<VariableArrayType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
                                       getSizeModifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndexTypeQualifier)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getSizeExpr)
@@ -546,9 +537,8 @@ struct CanProxyAdaptor<VariableArrayType>
 };
 
 template<>
-struct CanProxyAdaptor<DependentSizedArrayType> 
-  : public CanProxyBase<DependentSizedArrayType> 
-{
+struct CanProxyAdaptor<DependentSizedArrayType>
+  : public CanProxyBase<DependentSizedArrayType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getSizeExpr)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceRange, getBracketsRange)
@@ -557,14 +547,13 @@ struct CanProxyAdaptor<DependentSizedArrayType>
 };
 
 template<>
-struct CanProxyAdaptor<DependentSizedExtVectorType> 
-  : public CanProxyBase<DependentSizedExtVectorType>
-{
+struct CanProxyAdaptor<DependentSizedExtVectorType>
+  : public CanProxyBase<DependentSizedExtVectorType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Expr *, getSizeExpr)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getAttributeLoc)  
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getAttributeLoc)
 };
-  
+
 template<>
 struct CanProxyAdaptor<VectorType> : public CanProxyBase<VectorType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
@@ -583,28 +572,26 @@ struct CanProxyAdaptor<FunctionType> : public CanProxyBase<FunctionType> {
 };
 
 template<>
-struct CanProxyAdaptor<FunctionNoProtoType> 
-  : public CanProxyBase<FunctionNoProtoType> 
-{
+struct CanProxyAdaptor<FunctionNoProtoType>
+  : public CanProxyBase<FunctionNoProtoType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType)
 };
-  
+
 template<>
-struct CanProxyAdaptor<FunctionProtoType> 
-  : public CanProxyBase<FunctionProtoType>
-{
+struct CanProxyAdaptor<FunctionProtoType>
+  : public CanProxyBase<FunctionProtoType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumArgs);  
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumArgs);
   CanQualType getArgType(unsigned i) const {
     return CanQualType::CreateUnsafe(this->getTypePtr()->getArgType(i));
   }
-  
+
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariadic)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getTypeQuals)
-  
-  typedef CanTypeIterator<FunctionProtoType::arg_type_iterator> 
+
+  typedef CanTypeIterator<FunctionProtoType::arg_type_iterator>
     arg_type_iterator;
-  
+
   arg_type_iterator arg_type_begin() const {
     return arg_type_iterator(this->getTypePtr()->arg_type_begin());
   }
@@ -612,10 +599,10 @@ struct CanProxyAdaptor<FunctionProtoType>
   arg_type_iterator arg_type_end() const {
     return arg_type_iterator(this->getTypePtr()->arg_type_end());
   }
-  
+
   // Note: canonical function types never have exception specifications
 };
-  
+
 template<>
 struct CanProxyAdaptor<TypeOfType> : public CanProxyBase<TypeOfType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType)
@@ -638,44 +625,42 @@ struct CanProxyAdaptor<RecordType> : public CanProxyBase<RecordType> {
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(RecordDecl *, getDecl)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasConstFields)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getAddressSpace)  
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getAddressSpace)
 };
-  
+
 template<>
 struct CanProxyAdaptor<EnumType> : public CanProxyBase<EnumType> {
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(EnumDecl *, getDecl)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined)
 };
-  
+
 template<>
-struct CanProxyAdaptor<TemplateTypeParmType> 
-  : public CanProxyBase<TemplateTypeParmType>
-{
+struct CanProxyAdaptor<TemplateTypeParmType>
+  : public CanProxyBase<TemplateTypeParmType> {
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getDepth)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndex)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isParameterPack)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(IdentifierInfo *, getName)    
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(IdentifierInfo *, getName)
 };
-  
+
 template<>
-struct CanProxyAdaptor<ObjCObjectPointerType> 
-  : public CanProxyBase<ObjCObjectPointerType> 
-{
+struct CanProxyAdaptor<ObjCObjectPointerType>
+  : public CanProxyBase<ObjCObjectPointerType> {
   LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceType *, 
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceType *,
                                       getInterfaceType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCIdType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCClassType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedIdType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClassType)
-  
+
   typedef ObjCObjectPointerType::qual_iterator qual_iterator;
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, qual_empty)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols)
 };
-  
+
 //----------------------------------------------------------------------------//
 // Method and function definitions
 //----------------------------------------------------------------------------//
@@ -698,12 +683,12 @@ template<typename T>
 CanQual<T> CanQual<T>::getFromOpaquePtr(void *Ptr) {
   CanQual<T> Result;
   Result.Stored.setFromOpaqueValue(Ptr);
-  assert((!Result || Result.Stored.isCanonical()) 
+  assert((!Result || Result.Stored.isCanonical())
          && "Type is not canonical!");
   return Result;
 }
 
-template<typename T> 
+template<typename T>
 CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
   assert((Other.isNull() || Other->isCanonical()) && "Type is not canonical!");
   assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
@@ -713,19 +698,19 @@ CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
   return Result;
 }
 
-template<typename T> 
-template<typename U> 
+template<typename T>
+template<typename U>
 CanProxy<U> CanQual<T>::getAs() const {
   if (Stored.isNull())
     return CanProxy<U>();
-  
+
   if (isa<U>(Stored.getTypePtr()))
     return CanQual<U>::CreateUnsafe(Stored);
-    
+
   if (const ExtQualType *EQ = Stored->getAs<ExtQualType>())
     return CanQual<T>::CreateUnsafe(QualType(EQ->getBaseType(), 0))
              .template getAs<U>();
-  
+
   return CanProxy<U>();
 }
 
@@ -733,13 +718,13 @@ template<typename T>
 CanProxy<T> CanQual<T>::operator->() const {
   return CanProxy<T>(*this);
 }
-  
+
 template<typename InputIterator>
-typename CanTypeIterator<InputIterator>::pointer 
+typename CanTypeIterator<InputIterator>::pointer
 CanTypeIterator<InputIterator>::operator->() const {
   return CanProxy<Type>(*this);
 }
-  
+
 }
 
 

+ 146 - 146
include/clang/AST/Decl.h

@@ -53,18 +53,18 @@ public:
 /// TranslationUnitDecl - The top declaration context.
 class TranslationUnitDecl : public Decl, public DeclContext {
   ASTContext &Ctx;
-  
+
   explicit TranslationUnitDecl(ASTContext &ctx)
     : Decl(TranslationUnit, 0, SourceLocation()),
       DeclContext(TranslationUnit),
       Ctx(ctx) {}
 public:
   ASTContext &getASTContext() const { return Ctx; }
-  
+
   static TranslationUnitDecl *Create(ASTContext &C);
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == TranslationUnit; }
-  static bool classof(const TranslationUnitDecl *D) { return true; }  
+  static bool classof(const TranslationUnitDecl *D) { return true; }
   static DeclContext *castToDeclContext(const TranslationUnitDecl *D) {
     return static_cast<DeclContext *>(const_cast<TranslationUnitDecl*>(D));
   }
@@ -113,7 +113,7 @@ public:
   /// manipulation, so it should be called only when performance doesn't matter.
   /// For simple declarations, getNameAsCString() should suffice.
   std::string getNameAsString() const { return Name.getAsString(); }
-  
+
   /// getQualifiedNameAsString - Returns human-readable qualified name for
   /// declaration, like A::B::i, for i being member of namespace A::B.
   /// If declaration is not member of context which can be named (record,
@@ -141,7 +141,7 @@ public:
   const NamedDecl *getUnderlyingDecl() const {
     return const_cast<NamedDecl*>(this)->getUnderlyingDecl();
   }
-  
+
   static bool classof(const Decl *D) {
     return D->getKind() >= NamedFirst && D->getKind() <= NamedLast;
   }
@@ -151,7 +151,7 @@ public:
 /// NamespaceDecl - Represent a C++ namespace.
 class NamespaceDecl : public NamedDecl, public DeclContext {
   SourceLocation LBracLoc, RBracLoc;
-  
+
   // For extended namespace definitions:
   //
   // namespace A { int x; }
@@ -162,7 +162,7 @@ class NamespaceDecl : public NamedDecl, public DeclContext {
   // OrigNamespace points to the original namespace declaration.
   // OrigNamespace of the first namespace decl points to itself.
   NamespaceDecl *OrigNamespace, *NextNamespace;
-  
+
   NamespaceDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id)
     : NamedDecl(Namespace, DC, L, Id), DeclContext(Namespace) {
     OrigNamespace = this;
@@ -171,7 +171,7 @@ class NamespaceDecl : public NamedDecl, public DeclContext {
 public:
   static NamespaceDecl *Create(ASTContext &C, DeclContext *DC,
                                SourceLocation L, IdentifierInfo *Id);
-  
+
   virtual void Destroy(ASTContext& C);
 
   NamespaceDecl *getNextNamespace() { return NextNamespace; }
@@ -182,7 +182,7 @@ public:
     return OrigNamespace;
   }
   void setOriginalNamespace(NamespaceDecl *ND) { OrigNamespace = ND; }
-  
+
   virtual SourceRange getSourceRange() const {
     return SourceRange(getLocation(), RBracLoc);
   }
@@ -191,7 +191,7 @@ public:
   SourceLocation getRBracLoc() const { return RBracLoc; }
   void setLBracLoc(SourceLocation LBrace) { LBracLoc = LBrace; }
   void setRBracLoc(SourceLocation RBrace) { RBracLoc = RBrace; }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == Namespace; }
   static bool classof(const NamespaceDecl *D) { return true; }
@@ -203,20 +203,20 @@ public:
   }
 };
 
-/// ValueDecl - Represent the declaration of a variable (in which case it is 
+/// ValueDecl - Represent the declaration of a variable (in which case it is
 /// an lvalue) a function (in which case it is a function designator) or
-/// an enum constant. 
+/// an enum constant.
 class ValueDecl : public NamedDecl {
   QualType DeclType;
 
 protected:
   ValueDecl(Kind DK, DeclContext *DC, SourceLocation L,
-            DeclarationName N, QualType T) 
+            DeclarationName N, QualType T)
     : NamedDecl(DK, DC, L, N), DeclType(T) {}
 public:
   QualType getType() const { return DeclType; }
   void setType(QualType newType) { DeclType = newType; }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
     return D->getKind() >= ValueFirst && D->getKind() <= ValueLast;
@@ -287,23 +287,23 @@ protected:
   /// argument.
   struct UnparsedDefaultArgument;
 
-  /// \brief Placeholder type used in Init to denote an uninstantiated C++ 
+  /// \brief Placeholder type used in Init to denote an uninstantiated C++
   /// default argument.
   struct UninstantiatedDefaultArgument;
 
-  typedef llvm::PointerUnion4<Stmt *, EvaluatedStmt *, 
-                              UnparsedDefaultArgument *, 
+  typedef llvm::PointerUnion4<Stmt *, EvaluatedStmt *,
+                              UnparsedDefaultArgument *,
                               UninstantiatedDefaultArgument *> InitType;
-  
-  /// \brief The initializer for this variable or, for a ParmVarDecl, the 
+
+  /// \brief The initializer for this variable or, for a ParmVarDecl, the
   /// C++ default argument.
   mutable InitType Init;
-  
+
 private:
   // FIXME: This can be packed into the bitfields in Decl.
   unsigned SClass : 3;
   bool ThreadSpecified : 1;
-  bool HasCXXDirectInit : 1; 
+  bool HasCXXDirectInit : 1;
 
   /// DeclaredInCondition - Whether this variable was declared in a
   /// condition, e.g., if (int x = foo()) { ... }.
@@ -315,8 +315,8 @@ protected:
           QualType T, DeclaratorInfo *DInfo, StorageClass SC)
     : DeclaratorDecl(DK, DC, L, Id, T, DInfo), Init(),
       ThreadSpecified(false), HasCXXDirectInit(false),
-      DeclaredInCondition(false) { 
-    SClass = SC; 
+      DeclaredInCondition(false) {
+    SClass = SC;
   }
 
   typedef Redeclarable<VarDecl> redeclarable_base;
@@ -326,7 +326,7 @@ public:
   typedef redeclarable_base::redecl_iterator redecl_iterator;
   redecl_iterator redecls_begin() const {
     return redeclarable_base::redecls_begin();
-  } 
+  }
   redecl_iterator redecls_end() const {
     return redeclarable_base::redecls_end();
   }
@@ -340,10 +340,10 @@ public:
 
   StorageClass getStorageClass() const { return (StorageClass)SClass; }
   void setStorageClass(StorageClass SC) { SClass = SC; }
-  
+
   virtual SourceRange getSourceRange() const;
 
-  const Expr *getInit() const { 
+  const Expr *getInit() const {
     if (Init.isNull())
       return 0;
 
@@ -352,9 +352,9 @@ public:
       if (EvaluatedStmt *ES = Init.dyn_cast<EvaluatedStmt*>())
         S = ES->Value;
     }
-    return (const Expr*) S; 
+    return (const Expr*) S;
   }
-  Expr *getInit() { 
+  Expr *getInit() {
     if (Init.isNull())
       return 0;
 
@@ -364,26 +364,26 @@ public:
         S = ES->Value;
     }
 
-    return (Expr*) S; 
+    return (Expr*) S;
   }
 
   /// \brief Retrieve the address of the initializer expression.
   Stmt **getInitAddress() {
     if (EvaluatedStmt *ES = Init.dyn_cast<EvaluatedStmt*>())
       return &ES->Value;
-    
+
     // This union hack tip-toes around strict-aliasing rules.
     union {
       InitType *InitPtr;
       Stmt **StmtPtr;
     };
-    
+
     InitPtr = &Init;
     return StmtPtr;
   }
 
   void setInit(ASTContext &C, Expr *I);
-   
+
   /// \brief Note that constant evaluation has computed the given
   /// value for this variable's initializer.
   void setEvaluatedValue(ASTContext &C, const APValue &Value) const {
@@ -398,7 +398,7 @@ public:
     Eval->WasEvaluated = true;
     Eval->Evaluated = Value;
   }
-   
+
   /// \brief Return the already-evaluated value of this variable's
   /// initializer, or NULL if the value is not yet known.
   APValue *getEvaluatedValue() const {
@@ -423,7 +423,7 @@ public:
   ///
   /// \pre isInitKnownICE()
   bool isInitICE() const {
-    assert(isInitKnownICE() && 
+    assert(isInitKnownICE() &&
            "Check whether we already know that the initializer is an ICE");
     return Init.get<EvaluatedStmt *>()->IsICE;
   }
@@ -465,7 +465,7 @@ public:
   bool hasCXXDirectInitializer() const {
     return HasCXXDirectInit;
   }
-  
+
   /// isDeclaredInCondition - Whether this variable was declared as
   /// part of a condition in an if/switch/while statement, e.g.,
   /// @code
@@ -474,8 +474,8 @@ public:
   bool isDeclaredInCondition() const {
     return DeclaredInCondition;
   }
-  void setDeclaredInCondition(bool InCondition) { 
-    DeclaredInCondition = InCondition; 
+  void setDeclaredInCondition(bool InCondition) {
+    DeclaredInCondition = InCondition;
   }
 
   virtual VarDecl *getCanonicalDecl();
@@ -485,10 +485,10 @@ public:
   bool hasLocalStorage() const {
     if (getStorageClass() == None)
       return !isFileVarDecl();
-    
+
     // Return true for:  Auto, Register.
     // Return false for: Extern, Static, PrivateExtern.
-    
+
     return getStorageClass() <= Register;
   }
 
@@ -515,7 +515,7 @@ public:
       return DC->getLookupContext()->isFunctionOrMethod();
     return false;
   }
-  
+
   /// \brief Determines whether this is a static data member.
   ///
   /// This will only be true in C++, and applies to, e.g., the
@@ -530,10 +530,10 @@ public:
   }
 
   /// \brief If this variable is an instantiated static data member of a
-  /// class template specialization, returns the templated static data member 
+  /// class template specialization, returns the templated static data member
   /// from which it was instantiated.
-  VarDecl *getInstantiatedFromStaticDataMember(); 
-  
+  VarDecl *getInstantiatedFromStaticDataMember();
+
   /// isFileVarDecl - Returns true for file scoped variable declaration.
   bool isFileVarDecl() const {
     if (getKind() != Decl::Var)
@@ -545,14 +545,14 @@ public:
     }
     if (isStaticDataMember())
       return true;
-    
+
     return false;
   }
 
   /// \brief Determine whether this is a tentative definition of a
   /// variable in C.
   bool isTentativeDefinition(ASTContext &Context) const;
-  
+
   /// \brief Determines whether this variable is a variable with
   /// external, C linkage.
   bool isExternC(ASTContext &Context) const;
@@ -567,7 +567,7 @@ public:
 class ImplicitParamDecl : public VarDecl {
 protected:
   ImplicitParamDecl(Kind DK, DeclContext *DC, SourceLocation L,
-                    IdentifierInfo *Id, QualType Tw) 
+                    IdentifierInfo *Id, QualType Tw)
     : VarDecl(DK, DC, L, Id, Tw, /*DInfo=*/0, VarDecl::None) {}
 public:
   static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
@@ -584,15 +584,15 @@ class ParmVarDecl : public VarDecl {
   /// FIXME: Also can be paced into the bitfields in Decl.
   /// in, inout, etc.
   unsigned objcDeclQualifier : 6;
-  
-  /// \brief Retrieves the fake "value" of an unparsed 
+
+  /// \brief Retrieves the fake "value" of an unparsed
   static Expr *getUnparsedDefaultArgValue() {
     uintptr_t Value = (uintptr_t)-1;
     // Mask off the low bits
     Value &= ~(uintptr_t)0x07;
     return reinterpret_cast<Expr*> (Value);
   }
-  
+
 protected:
   ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L,
               IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
@@ -606,27 +606,27 @@ public:
                              SourceLocation L,IdentifierInfo *Id,
                              QualType T, DeclaratorInfo *DInfo,
                              StorageClass S, Expr *DefArg);
-  
+
   ObjCDeclQualifier getObjCDeclQualifier() const {
     return ObjCDeclQualifier(objcDeclQualifier);
   }
   void setObjCDeclQualifier(ObjCDeclQualifier QTVal) {
     objcDeclQualifier = QTVal;
   }
-    
-  const Expr *getDefaultArg() const { 
+
+  const Expr *getDefaultArg() const {
     assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
-    assert(!hasUninstantiatedDefaultArg() && 
+    assert(!hasUninstantiatedDefaultArg() &&
            "Default argument is not yet instantiated!");
     return getInit();
   }
-  Expr *getDefaultArg() { 
+  Expr *getDefaultArg() {
     assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
-    assert(!hasUninstantiatedDefaultArg() && 
+    assert(!hasUninstantiatedDefaultArg() &&
            "Default argument is not yet instantiated!");
     return getInit();
   }
-  void setDefaultArg(Expr *defarg) { 
+  void setDefaultArg(Expr *defarg) {
     Init = reinterpret_cast<Stmt *>(defarg);
   }
 
@@ -636,14 +636,14 @@ public:
   Expr *getUninstantiatedDefaultArg() {
     return (Expr *)Init.get<UninstantiatedDefaultArgument *>();
   }
-  
+
   /// hasDefaultArg - Determines whether this parameter has a default argument,
   /// either parsed or not.
   bool hasDefaultArg() const {
-    return getInit() || hasUnparsedDefaultArg() || 
+    return getInit() || hasUnparsedDefaultArg() ||
       hasUninstantiatedDefaultArg();
   }
-  
+
   /// hasUnparsedDefaultArg - Determines whether this parameter has a
   /// default argument that has not yet been parsed. This will occur
   /// during the processing of a C++ class whose member functions have
@@ -661,18 +661,18 @@ public:
   bool hasUninstantiatedDefaultArg() const {
     return Init.is<UninstantiatedDefaultArgument*>();
   }
-  
+
   /// setUnparsedDefaultArg - Specify that this parameter has an
   /// unparsed default argument. The argument will be replaced with a
   /// real default argument via setDefaultArg when the class
   /// definition enclosing the function declaration that owns this
   /// default argument is completed.
-  void setUnparsedDefaultArg() { 
+  void setUnparsedDefaultArg() {
     Init = (UnparsedDefaultArgument *)0;
   }
 
   QualType getOriginalType() const;
-  
+
   /// setOwningFunction - Sets the function declaration that owns this
   /// ParmVarDecl. Since ParmVarDecls are often created before the
   /// FunctionDecls that own them, this routine is required to update
@@ -680,9 +680,9 @@ public:
   void setOwningFunction(DeclContext *FD) { setDeclContext(FD); }
 
   // Implement isa/cast/dyncast/etc.
-  static bool classof(const Decl *D) { 
+  static bool classof(const Decl *D) {
     return (D->getKind() == ParmVar ||
-            D->getKind() == OriginalParmVar); 
+            D->getKind() == OriginalParmVar);
   }
   static bool classof(const ParmVarDecl *D) { return true; }
 };
@@ -698,7 +698,7 @@ protected:
 private:
   OriginalParmVarDecl(DeclContext *DC, SourceLocation L,
                               IdentifierInfo *Id, QualType T,
-                              DeclaratorInfo *DInfo, 
+                              DeclaratorInfo *DInfo,
                               QualType OT, StorageClass S,
                               Expr *DefArg)
   : ParmVarDecl(OriginalParmVar, DC, L, Id, T, DInfo, S, DefArg),
@@ -715,7 +715,7 @@ public:
   static bool classof(const Decl *D) { return D->getKind() == OriginalParmVar; }
   static bool classof(const OriginalParmVarDecl *D) { return true; }
 };
-  
+
 // \brief Describes the kind of template specialization that a
 // particular template specialization declaration represents.
 enum TemplateSpecializationKind {
@@ -730,17 +730,17 @@ enum TemplateSpecializationKind {
   /// specialization (C++ [temp.class.spec]).
   TSK_ExplicitSpecialization,
   /// This template specialization was instantiated from a template
-  /// due to an explicit instantiation declaration request 
+  /// due to an explicit instantiation declaration request
   /// (C++0x [temp.explicit]).
   TSK_ExplicitInstantiationDeclaration,
   /// This template specialization was instantiated from a template
-  /// due to an explicit instantiation definition request 
+  /// due to an explicit instantiation definition request
   /// (C++ [temp.explicit]).
-  TSK_ExplicitInstantiationDefinition  
+  TSK_ExplicitInstantiationDefinition
 };
-  
+
 /// FunctionDecl - An instance of this class is created to represent a
-/// function declaration or definition. 
+/// function declaration or definition.
 ///
 /// Since a given function can be declared several times in a program,
 /// there may be several FunctionDecls that correspond to that
@@ -749,20 +749,20 @@ enum TemplateSpecializationKind {
 /// FunctionDecl (e.g., the translation unit); this FunctionDecl
 /// contains all of the information known about the function. Other,
 /// previous declarations of the function are available via the
-/// getPreviousDeclaration() chain. 
+/// getPreviousDeclaration() chain.
 class FunctionDecl : public DeclaratorDecl, public DeclContext,
                      public Redeclarable<FunctionDecl> {
 public:
   enum StorageClass {
     None, Extern, Static, PrivateExtern
   };
-  
-private:  
+
+private:
   /// ParamInfo - new[]'d array of pointers to VarDecls for the formal
   /// parameters of this function.  This is null if a prototype or if there are
   /// no formals.
   ParmVarDecl **ParamInfo;
-  
+
   LazyDeclStmtPtr Body;
 
   // FIXME: This can be packed into the bitfields in Decl.
@@ -778,7 +778,7 @@ private:
   bool IsTrivial : 1; // sunk from CXXMethodDecl
   bool IsCopyAssignment : 1;  // sunk from CXXMethodDecl
   bool HasImplicitReturnZero : 1;
-  
+
   /// \brief End part of this FunctionDecl's source range.
   ///
   /// We could compute the full range in getSourceRange(). However, when we're
@@ -790,15 +790,15 @@ private:
 
   /// \brief The template or declaration that this declaration
   /// describes or was instantiated from, respectively.
-  /// 
+  ///
   /// For non-templates, this value will be NULL. For function
   /// declarations that describe a function template, this will be a
   /// pointer to a FunctionTemplateDecl. For member functions
   /// of class template specializations, this will be the
   /// FunctionDecl from which the member function was instantiated.
-  /// For function template specializations, this will be a 
+  /// For function template specializations, this will be a
   /// FunctionTemplateSpecializationInfo, which contains information about
-  /// the template being specialized and the template arguments involved in 
+  /// the template being specialized and the template arguments involved in
   /// that specialization.
   llvm::PointerUnion3<FunctionTemplateDecl*, FunctionDecl*,
                       FunctionTemplateSpecializationInfo*>
@@ -808,11 +808,11 @@ protected:
   FunctionDecl(Kind DK, DeclContext *DC, SourceLocation L,
                DeclarationName N, QualType T, DeclaratorInfo *DInfo,
                StorageClass S, bool isInline)
-    : DeclaratorDecl(DK, DC, L, N, T, DInfo), 
+    : DeclaratorDecl(DK, DC, L, N, T, DInfo),
       DeclContext(DK),
       ParamInfo(0), Body(),
-      SClass(S), IsInline(isInline), C99InlineDefinition(false), 
-      IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false), 
+      SClass(S), IsInline(isInline), C99InlineDefinition(false),
+      IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
       HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
       IsCopyAssignment(false),
       HasImplicitReturnZero(false),
@@ -828,7 +828,7 @@ public:
   typedef redeclarable_base::redecl_iterator redecl_iterator;
   redecl_iterator redecls_begin() const {
     return redeclarable_base::redecls_begin();
-  } 
+  }
   redecl_iterator redecls_end() const {
     return redeclarable_base::redecls_end();
   }
@@ -888,7 +888,7 @@ public:
   /// the class has been fully built by Sema.
   bool isTrivial() const { return IsTrivial; }
   void setTrivial(bool IT) { IsTrivial = IT; }
-                       
+
   bool isCopyAssignment() const { return IsCopyAssignment; }
   void setCopyAssignment(bool CA) { IsCopyAssignment = CA; }
 
@@ -902,10 +902,10 @@ public:
   /// was explicitly written or because it was "inherited" by merging
   /// a declaration without a prototype with a declaration that has a
   /// prototype.
-  bool hasPrototype() const { 
-    return HasWrittenPrototype || HasInheritedPrototype; 
+  bool hasPrototype() const {
+    return HasWrittenPrototype || HasInheritedPrototype;
   }
-  
+
   bool hasWrittenPrototype() const { return HasWrittenPrototype; }
   void setHasWrittenPrototype(bool P) { HasWrittenPrototype = P; }
 
@@ -953,23 +953,23 @@ public:
   unsigned getBuiltinID(ASTContext &Context) const;
 
   unsigned getNumParmVarDeclsFromType() const;
-  
+
   // Iterator access to formal parameters.
   unsigned param_size() const { return getNumParams(); }
   typedef ParmVarDecl **param_iterator;
   typedef ParmVarDecl * const *param_const_iterator;
-  
+
   param_iterator param_begin() { return ParamInfo; }
   param_iterator param_end()   { return ParamInfo+param_size(); }
-  
+
   param_const_iterator param_begin() const { return ParamInfo; }
   param_const_iterator param_end() const   { return ParamInfo+param_size(); }
-  
+
   /// getNumParams - Return the number of parameters this function must have
   /// based on its functiontype.  This is the length of the PararmInfo array
   /// after it has been created.
   unsigned getNumParams() const;
-  
+
   const ParmVarDecl *getParamDecl(unsigned i) const {
     assert(i < getNumParams() && "Illegal param #");
     return ParamInfo[i];
@@ -986,7 +986,7 @@ public:
   /// arguments (in C++).
   unsigned getMinRequiredArguments() const;
 
-  QualType getResultType() const { 
+  QualType getResultType() const {
     return getType()->getAsFunctionType()->getResultType();
   }
   StorageClass getStorageClass() const { return StorageClass(SClass); }
@@ -1015,7 +1015,7 @@ public:
 
   /// isOverloadedOperator - Whether this function declaration
   /// represents an C++ overloaded operator, e.g., "operator+".
-  bool isOverloadedOperator() const { 
+  bool isOverloadedOperator() const {
     return getOverloadedOperator() != OO_None;
   };
 
@@ -1048,7 +1048,7 @@ public:
 
   /// \brief Specify that this record is an instantiation of the
   /// member function RD.
-  void setInstantiationOfMemberFunction(FunctionDecl *RD) { 
+  void setInstantiationOfMemberFunction(FunctionDecl *RD) {
     TemplateOrSpecialization = RD;
   }
 
@@ -1078,14 +1078,14 @@ public:
   /// If this function declaration is not a function template specialization,
   /// returns NULL.
   FunctionTemplateDecl *getPrimaryTemplate() const;
-  
+
   /// \brief Retrieve the template arguments used to produce this function
   /// template specialization from the primary template.
   ///
   /// If this function declaration is not a function template specialization,
   /// returns NULL.
-  const TemplateArgumentList *getTemplateSpecializationArgs() const;  
-  
+  const TemplateArgumentList *getTemplateSpecializationArgs() const;
+
   /// \brief Specify that this function declaration is actually a function
   /// template specialization.
   ///
@@ -1108,7 +1108,7 @@ public:
   /// \brief Determine what kind of template instantiation this function
   /// represents.
   void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
-                       
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
     return D->getKind() >= FunctionFirst && D->getKind() <= FunctionLast;
@@ -1123,21 +1123,21 @@ public:
 };
 
 
-/// FieldDecl - An instance of this class is created by Sema::ActOnField to 
+/// FieldDecl - An instance of this class is created by Sema::ActOnField to
 /// represent a member of a struct/union/class.
 class FieldDecl : public DeclaratorDecl {
   // FIXME: This can be packed into the bitfields in Decl.
   bool Mutable : 1;
   Expr *BitWidth;
 protected:
-  FieldDecl(Kind DK, DeclContext *DC, SourceLocation L, 
+  FieldDecl(Kind DK, DeclContext *DC, SourceLocation L,
             IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
             Expr *BW, bool Mutable)
-    : DeclaratorDecl(DK, DC, L, Id, T, DInfo), Mutable(Mutable), BitWidth(BW)
-      { }
+    : DeclaratorDecl(DK, DC, L, Id, T, DInfo), Mutable(Mutable), BitWidth(BW) {
+  }
 
 public:
-  static FieldDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, 
+  static FieldDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                            IdentifierInfo *Id, QualType T,
                            DeclaratorInfo *DInfo, Expr *BW, bool Mutable);
 
@@ -1189,7 +1189,7 @@ public:
                                   SourceLocation L, IdentifierInfo *Id,
                                   QualType T, Expr *E,
                                   const llvm::APSInt &V);
-  
+
   virtual void Destroy(ASTContext& C);
 
   const Expr *getInitExpr() const { return (const Expr*) Init; }
@@ -1198,11 +1198,11 @@ public:
 
   void setInitExpr(Expr *E) { Init = (Stmt*) E; }
   void setInitVal(const llvm::APSInt &V) { Val = V; }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == EnumConstant; }
   static bool classof(const EnumConstantDecl *D) { return true; }
-  
+
   friend class StmtIteratorBase;
 };
 
@@ -1244,16 +1244,16 @@ class TypedefDecl : public TypeDecl {
   /// UnderlyingType - This is the type the typedef is set to.
   QualType UnderlyingType;
   TypedefDecl(DeclContext *DC, SourceLocation L,
-              IdentifierInfo *Id, QualType T) 
+              IdentifierInfo *Id, QualType T)
     : TypeDecl(Typedef, DC, L, Id), UnderlyingType(T) {}
 
   virtual ~TypedefDecl() {}
 public:
-  
+
   static TypedefDecl *Create(ASTContext &C, DeclContext *DC,
                              SourceLocation L,IdentifierInfo *Id,
                              QualType T);
-  
+
   QualType getUnderlyingType() const { return UnderlyingType; }
   void setUnderlyingType(QualType newType) { UnderlyingType = newType; }
 
@@ -1263,9 +1263,9 @@ public:
 };
 
 class TypedefDecl;
-  
+
 /// TagDecl - Represents the declaration of a struct/union/class/enum.
-class TagDecl 
+class TagDecl
   : public TypeDecl, public DeclContext, public Redeclarable<TagDecl> {
 public:
   // This is really ugly.
@@ -1283,7 +1283,7 @@ private:
   /// IsDefinition - True if this is a definition ("struct foo {};"), false if
   /// it is a declaration ("struct foo;").
   bool IsDefinition : 1;
-  
+
   /// TypedefForAnonDecl - If a TagDecl is anonymous and part of a typedef,
   /// this points to the TypedefDecl. Used for mangling.
   TypedefDecl *TypedefForAnonDecl;
@@ -1302,19 +1302,19 @@ protected:
     IsDefinition = false;
     setPreviousDeclaration(PrevDecl);
   }
-    
+
   typedef Redeclarable<TagDecl> redeclarable_base;
   virtual TagDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
-    
+
 public:
   typedef redeclarable_base::redecl_iterator redecl_iterator;
   redecl_iterator redecls_begin() const {
     return redeclarable_base::redecls_begin();
-  } 
+  }
   redecl_iterator redecls_end() const {
     return redeclarable_base::redecls_end();
   }
-    
+
   SourceLocation getRBraceLoc() const { return RBraceLoc; }
   void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
 
@@ -1322,7 +1322,7 @@ public:
   void setTagKeywordLoc(SourceLocation TKL) { TagKeywordLoc = TKL; }
 
   virtual SourceRange getSourceRange() const;
-  
+
   virtual TagDecl* getCanonicalDecl();
 
   /// isDefinition - Return true if this decl has its body specified.
@@ -1336,7 +1336,7 @@ public:
   bool isDependentType() const { return isDependentContext(); }
 
   /// @brief Starts the definition of this tag declaration.
-  /// 
+  ///
   /// This method should be invoked at the beginning of the definition
   /// of this tag declaration. It will set the tag type into a state
   /// where it is in the process of being defined.
@@ -1345,7 +1345,7 @@ public:
   /// @brief Completes the definition of this tag declaration.
   void completeDefinition();
 
-  /// getDefinition - Returns the TagDecl that actually defines this 
+  /// getDefinition - Returns the TagDecl that actually defines this
   ///  struct/union/class/enum.  When determining whether or not a
   ///  struct/union/class/enum is completely defined, one should use this method
   ///  as opposed to 'isDefinition'.  'isDefinition' indicates whether or not a
@@ -1353,7 +1353,7 @@ public:
   ///  struct/union/class/enum type is defined.  This method returns NULL if
   ///  there is no TagDecl that defines the struct/union/class/enum.
   TagDecl* getDefinition(ASTContext& C) const;
-  
+
   const char *getKindName() const {
     return ElaboratedType::getNameForTagKind(getTagKind());
   }
@@ -1373,10 +1373,10 @@ public:
   bool isClass()  const { return getTagKind() == TK_class; }
   bool isUnion()  const { return getTagKind() == TK_union; }
   bool isEnum()   const { return getTagKind() == TK_enum; }
-  
+
   TypedefDecl *getTypedefForAnonDecl() const { return TypedefForAnonDecl; }
   void setTypedefForAnonDecl(TypedefDecl *TDD) { TypedefForAnonDecl = TDD; }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
     return D->getKind() >= TagFirst && D->getKind() <= TagLast;
@@ -1419,7 +1419,7 @@ public:
   static EnumDecl *Create(ASTContext &C, DeclContext *DC,
                           SourceLocation L, IdentifierInfo *Id,
                           SourceLocation TKL, EnumDecl *PrevDecl);
-  
+
   virtual void Destroy(ASTContext& C);
 
   /// completeDefinition - When created, the EnumDecl corresponds to a
@@ -1428,16 +1428,16 @@ public:
   /// added (via DeclContext::addDecl). NewType is the new underlying
   /// type of the enumeration type.
   void completeDefinition(ASTContext &C, QualType NewType);
-  
+
   // enumerator_iterator - Iterates through the enumerators of this
   // enumeration.
   typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
 
-  enumerator_iterator enumerator_begin() const { 
+  enumerator_iterator enumerator_begin() const {
     return enumerator_iterator(this->decls_begin());
   }
 
-  enumerator_iterator enumerator_end() const { 
+  enumerator_iterator enumerator_end() const {
     return enumerator_iterator(this->decls_end());
   }
 
@@ -1477,14 +1477,14 @@ class RecordDecl : public TagDecl {
   /// AnonymousStructOrUnion - Whether this is the type of an
   /// anonymous struct or union.
   bool AnonymousStructOrUnion : 1;
-  
+
   /// HasObjectMember - This is true if this struct has at least one
-  /// member containing an object 
+  /// member containing an object
   bool HasObjectMember : 1;
 
 protected:
   RecordDecl(Kind DK, TagKind TK, DeclContext *DC,
-             SourceLocation L, IdentifierInfo *Id, 
+             SourceLocation L, IdentifierInfo *Id,
              RecordDecl *PrevDecl, SourceLocation TKL);
   virtual ~RecordDecl();
 
@@ -1495,7 +1495,7 @@ public:
                             RecordDecl* PrevDecl = 0);
 
   virtual void Destroy(ASTContext& C);
-      
+
   bool hasFlexibleArrayMember() const { return HasFlexibleArrayMember; }
   void setHasFlexibleArrayMember(bool V) { HasFlexibleArrayMember = V; }
 
@@ -1505,7 +1505,7 @@ public:
   /// type declared, e.g.,
   /// @code
   ///   union { int i; float f; };
-  /// @endcode   
+  /// @endcode
   /// is an anonymous union but neither of the following are:
   /// @code
   ///  union X { int i; float f; };
@@ -1518,7 +1518,7 @@ public:
 
   bool hasObjectMember() const { return HasObjectMember; }
   void setHasObjectMember (bool val) { HasObjectMember = val; }
-  
+
   /// \brief Determines whether this declaration represents the
   /// injected class name.
   ///
@@ -1534,7 +1534,7 @@ public:
   /// \endcode
   bool isInjectedClassName() const;
 
-  /// getDefinition - Returns the RecordDecl that actually defines this 
+  /// getDefinition - Returns the RecordDecl that actually defines this
   ///  struct/union/class.  When determining whether or not a struct/union/class
   ///  is completely defined, one should use this method as opposed to
   ///  'isDefinition'.  'isDefinition' indicates whether or not a specific
@@ -1544,7 +1544,7 @@ public:
   RecordDecl* getDefinition(ASTContext& C) const {
     return cast_or_null<RecordDecl>(TagDecl::getDefinition(C));
   }
-  
+
   // Iterator access to field members. The field iterator only visits
   // the non-static data members of this class, ignoring any static
   // data members, functions, constructors, destructors, etc.
@@ -1559,7 +1559,7 @@ public:
 
   // field_empty - Whether there are any fields (non-static data
   // members) in this record.
-  bool field_empty() const { 
+  bool field_empty() const {
     return field_begin() == field_end();
   }
 
@@ -1588,7 +1588,7 @@ public:
   static bool classof(const Decl *D) {
     return D->getKind() == FileScopeAsm;
   }
-  static bool classof(const FileScopeAsmDecl *D) { return true; }  
+  static bool classof(const FileScopeAsmDecl *D) { return true; }
 };
 
 /// BlockDecl - This represents a block literal declaration, which is like an
@@ -1603,12 +1603,12 @@ class BlockDecl : public Decl, public DeclContext {
   /// no formals.
   ParmVarDecl **ParamInfo;
   unsigned NumParams;
-  
+
   Stmt *Body;
-  
+
 protected:
   BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
-    : Decl(Block, DC, CaretLoc), DeclContext(Block), 
+    : Decl(Block, DC, CaretLoc), DeclContext(Block),
       isVariadic(false), ParamInfo(0), NumParams(0), Body(0) {}
 
   virtual ~BlockDecl();
@@ -1621,7 +1621,7 @@ public:
 
   bool IsVariadic() const { return isVariadic; }
   void setIsVariadic(bool value) { isVariadic = value; }
-  
+
   CompoundStmt *getCompoundBody() const { return (CompoundStmt*) Body; }
   Stmt *getBody() const { return (Stmt*) Body; }
   void setBody(CompoundStmt *B) { Body = (Stmt*) B; }
@@ -1630,14 +1630,14 @@ public:
   unsigned param_size() const { return getNumParams(); }
   typedef ParmVarDecl **param_iterator;
   typedef ParmVarDecl * const *param_const_iterator;
-  
+
   bool param_empty() const { return NumParams == 0; }
   param_iterator param_begin()  { return ParamInfo; }
   param_iterator param_end()   { return ParamInfo+param_size(); }
-  
+
   param_const_iterator param_begin() const { return ParamInfo; }
   param_const_iterator param_end() const   { return ParamInfo+param_size(); }
-  
+
   unsigned getNumParams() const;
   const ParmVarDecl *getParamDecl(unsigned i) const {
     assert(i < getNumParams() && "Illegal param #");
@@ -1648,10 +1648,10 @@ public:
     return ParamInfo[i];
   }
   void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams);
-    
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == Block; }
-  static bool classof(const BlockDecl *D) { return true; }  
+  static bool classof(const BlockDecl *D) { return true; }
   static DeclContext *castToDeclContext(const BlockDecl *D) {
     return static_cast<DeclContext *>(const_cast<BlockDecl*>(D));
   }

+ 61 - 61
include/clang/AST/DeclBase.h

@@ -60,8 +60,8 @@ public:
 
 namespace clang {
 
-/// Decl - This represents one declaration (or definition), e.g. a variable, 
-/// typedef, function, struct, etc.  
+/// Decl - This represents one declaration (or definition), e.g. a variable,
+/// typedef, function, struct, etc.
 ///
 class Decl {
 public:
@@ -69,7 +69,7 @@ public:
   enum Kind {
 #define DECL(Derived, Base) Derived,
 #define DECL_RANGE(CommonBase, Start, End) \
-    CommonBase##First = Start, CommonBase##Last = End, 
+    CommonBase##First = Start, CommonBase##Last = End,
 #define LAST_DECL_RANGE(CommonBase, Start, End) \
     CommonBase##First = Start, CommonBase##Last = End
 #include "clang/AST/DeclNodes.def"
@@ -93,7 +93,7 @@ public:
     IDNS_OrdinaryFriend = 0x80,
     IDNS_TagFriend = 0x100
   };
-  
+
   /// ObjCDeclQualifier - Qualifier used on types in method declarations
   /// for remote messaging. They are meant for the arguments though and
   /// applied to the Decls (ObjCMethodDecl and ParmVarDecl).
@@ -106,7 +106,7 @@ public:
     OBJC_TQ_Byref = 0x10,
     OBJC_TQ_Oneway = 0x20
   };
-    
+
 private:
   /// NextDeclInContext - The next declaration within the same lexical
   /// DeclContext. These pointers form the linked list that is
@@ -119,8 +119,8 @@ private:
     DeclContext *SemanticDC;
     DeclContext *LexicalDC;
   };
-  
-  
+
+
   /// DeclCtx - Holds either a DeclContext* or a MultipleDC*.
   /// For declarations that don't contain C++ scope specifiers, it contains
   /// the DeclContext where the Decl was declared.
@@ -144,16 +144,16 @@ private:
   inline DeclContext *getSemanticDC() const {
     return DeclCtx.get<DeclContext*>();
   }
-  
+
   /// Loc - The location that this decl.
   SourceLocation Loc;
-  
+
   /// DeclKind - This indicates which class this is.
   Kind DeclKind   :  8;
-  
+
   /// InvalidDecl - This indicates a semantic error occurred.
   unsigned int InvalidDecl :  1;
-  
+
   /// HasAttrs - This indicates whether the decl has attributes or not.
   unsigned int HasAttrs : 1;
 
@@ -168,22 +168,22 @@ private:
 protected:
   /// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
   unsigned IdentifierNamespace : 16;
-  
+
 private:
 #ifndef NDEBUG
   void CheckAccessDeclContext() const;
 #else
   void CheckAccessDeclContext() const { }
 #endif
-  
+
 protected:
   /// Access - Used by C++ decls for the access specifier.
   // NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
   unsigned Access : 2;
   friend class CXXClassMemberWrapper;
 
-  Decl(Kind DK, DeclContext *DC, SourceLocation L) 
-    : NextDeclInContext(0), DeclCtx(DC), 
+  Decl(Kind DK, DeclContext *DC, SourceLocation L)
+    : NextDeclInContext(0), DeclCtx(DC),
       Loc(L), DeclKind(DK), InvalidDecl(0),
       HasAttrs(false), Implicit(false), Used(false),
       IdentifierNamespace(getIdentifierNamespaceForKind(DK)), Access(AS_none) {
@@ -206,7 +206,7 @@ public:
 
   Kind getKind() const { return DeclKind; }
   const char *getDeclKindName() const;
-  
+
   Decl *getNextDeclInContext() { return NextDeclInContext; }
   const Decl *getNextDeclInContext() const { return NextDeclInContext; }
 
@@ -225,15 +225,15 @@ public:
   }
 
   ASTContext &getASTContext() const;
-  
+
   void setAccess(AccessSpecifier AS) {
-    Access = AS; 
+    Access = AS;
     CheckAccessDeclContext();
   }
-  
-  AccessSpecifier getAccess() const { 
+
+  AccessSpecifier getAccess() const {
     CheckAccessDeclContext();
-    return AccessSpecifier(Access); 
+    return AccessSpecifier(Access);
   }
 
   bool hasAttrs() const { return HasAttrs; }
@@ -251,11 +251,11 @@ public:
         return V;
     return 0;
   }
-    
+
   template<typename T> bool hasAttr() const {
     return getAttr<T>() != 0;
   }
-  
+
   /// setInvalidDecl - Indicates the Decl had a semantic error. This
   /// allows for graceful error recovery.
   void setInvalidDecl(bool Invalid = true) { InvalidDecl = Invalid; }
@@ -266,12 +266,12 @@ public:
   /// was written explicitly in the source code.
   bool isImplicit() const { return Implicit; }
   void setImplicit(bool I = true) { Implicit = I; }
-  
+
   /// \brief Whether this declaration was used, meaning that a definition
   /// is required.
   bool isUsed() const { return Used; }
   void setUsed(bool U = true) { Used = U; }
-  
+
   unsigned getIdentifierNamespace() const {
     return IdentifierNamespace;
   }
@@ -280,7 +280,7 @@ public:
   }
   static unsigned getIdentifierNamespaceForKind(Kind DK);
 
-  
+
   /// getLexicalDeclContext - The declaration context where this Decl was
   /// lexically declared (LexicalDC). May be different from
   /// getDeclContext() (SemanticDC).
@@ -303,7 +303,7 @@ public:
   bool isOutOfLine() const {
     return getLexicalDeclContext() != getDeclContext();
   }
-  
+
   /// setDeclContext - Set both the semantic and lexical DeclContext
   /// to DC.
   void setDeclContext(DeclContext *DC);
@@ -324,7 +324,7 @@ public:
 
   /// \brief Whether this particular Decl is a canonical one.
   bool isCanonicalDecl() const { return getCanonicalDecl() == this; }
-  
+
 protected:
   /// \brief Returns the next redeclaration or itself if this is the only decl.
   ///
@@ -367,10 +367,10 @@ public:
       return tmp;
     }
 
-    friend bool operator==(redecl_iterator x, redecl_iterator y) { 
+    friend bool operator==(redecl_iterator x, redecl_iterator y) {
       return x.Current == y.Current;
     }
-    friend bool operator!=(redecl_iterator x, redecl_iterator y) { 
+    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
       return x.Current != y.Current;
     }
   };
@@ -398,11 +398,11 @@ public:
   static void addDeclKind(Kind k);
   static bool CollectingStats(bool Enable = false);
   static void PrintStats();
-    
+
   /// isTemplateParameter - Determines whether this declaration is a
   /// template parameter.
   bool isTemplateParameter() const;
-  
+
   /// isTemplateParameter - Determines whether this declaration is a
   /// template parameter pack.
   bool isTemplateParameterPack() const;
@@ -445,12 +445,12 @@ public:
     if (!mask) return FOK_None;
     return (mask & (IDNS_Tag | IDNS_Ordinary) ? FOK_Declared : FOK_Undeclared);
   }
-  
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *) { return true; }
   static DeclContext *castToDeclContext(const Decl *);
   static Decl *castFromDeclContext(const DeclContext *);
-  
+
   /// Destroy - Call destructors and release memory.
   virtual void Destroy(ASTContext& C);
 
@@ -478,10 +478,10 @@ public:
   PrettyStackTraceDecl(Decl *theDecl, SourceLocation L,
                        SourceManager &sm, const char *Msg)
   : TheDecl(theDecl), Loc(L), SM(sm), Message(Msg) {}
-  
+
   virtual void print(llvm::raw_ostream &OS) const;
-};  
-  
+};
+
 
 /// DeclContext - This is used only as base class of specific decl types that
 /// can act as declaration contexts. These decls are (only the top classes
@@ -526,9 +526,9 @@ class DeclContext {
   mutable Decl *LastDecl;
 
 protected:
-   DeclContext(Decl::Kind K) 
+   DeclContext(Decl::Kind K)
      : DeclKind(K), ExternalLexicalStorage(false),
-       ExternalVisibleStorage(false), LookupPtr(0), FirstDecl(0), 
+       ExternalVisibleStorage(false), LookupPtr(0), FirstDecl(0),
        LastDecl(0) { }
 
   void DestroyDecls(ASTContext &C);
@@ -548,7 +548,7 @@ public:
   const DeclContext *getParent() const {
     return const_cast<DeclContext*>(this)->getParent();
   }
-  
+
   /// getLexicalParent - Returns the containing lexical DeclContext. May be
   /// different from getParent, e.g.:
   ///
@@ -563,7 +563,7 @@ public:
   }
   const DeclContext *getLexicalParent() const {
     return const_cast<DeclContext*>(this)->getLexicalParent();
-  }    
+  }
 
   ASTContext &getParentASTContext() const {
     return cast<Decl>(this)->getASTContext();
@@ -604,10 +604,10 @@ public:
   /// context are semantically declared in the nearest enclosing
   /// non-transparent (opaque) context but are lexically declared in
   /// this context. For example, consider the enumerators of an
-  /// enumeration type: 
+  /// enumeration type:
   /// @code
   /// enum E {
-  ///   Val1 
+  ///   Val1
   /// };
   /// @endcode
   /// Here, E is a transparent context, so its enumerator (Val1) will
@@ -622,7 +622,7 @@ public:
   bool Equals(DeclContext *DC) {
     return this->getPrimaryContext() == DC->getPrimaryContext();
   }
-  
+
   /// \brief Determine whether this declaration context encloses the
   /// declaration context DC.
   bool Encloses(DeclContext *DC);
@@ -643,7 +643,7 @@ public:
   const DeclContext *getLookupContext() const {
     return const_cast<DeclContext *>(this)->getLookupContext();
   }
-  
+
   /// \brief Retrieve the nearest enclosing namespace context.
   DeclContext *getEnclosingNamespaceContext();
   const DeclContext *getEnclosingNamespaceContext() const {
@@ -699,16 +699,16 @@ public:
       return tmp;
     }
 
-    friend bool operator==(decl_iterator x, decl_iterator y) { 
+    friend bool operator==(decl_iterator x, decl_iterator y) {
       return x.Current == y.Current;
     }
-    friend bool operator!=(decl_iterator x, decl_iterator y) { 
+    friend bool operator!=(decl_iterator x, decl_iterator y) {
       return x.Current != y.Current;
     }
   };
 
   /// decls_begin/decls_end - Iterate over the declarations stored in
-  /// this context. 
+  /// this context.
   decl_iterator decls_begin() const;
   decl_iterator decls_end() const;
   bool decls_empty() const;
@@ -724,7 +724,7 @@ public:
     /// will either be NULL or will point to a declaration of
     /// type SpecificDecl.
     DeclContext::decl_iterator Current;
-    
+
     /// SkipToNextDecl - Advances the current position up to the next
     /// declaration of type SpecificDecl that also meets the criteria
     /// required by Acceptable.
@@ -769,13 +769,13 @@ public:
       ++(*this);
       return tmp;
     }
-  
+
     friend bool
     operator==(const specific_decl_iterator& x, const specific_decl_iterator& y) {
       return x.Current == y.Current;
     }
-  
-    friend bool 
+
+    friend bool
     operator!=(const specific_decl_iterator& x, const specific_decl_iterator& y) {
       return x.Current != y.Current;
     }
@@ -796,7 +796,7 @@ public:
     /// will either be NULL or will point to a declaration of
     /// type SpecificDecl.
     DeclContext::decl_iterator Current;
-    
+
     /// SkipToNextDecl - Advances the current position up to the next
     /// declaration of type SpecificDecl that also meets the criteria
     /// required by Acceptable.
@@ -843,13 +843,13 @@ public:
       ++(*this);
       return tmp;
     }
-  
+
     friend bool
     operator==(const filtered_decl_iterator& x, const filtered_decl_iterator& y) {
       return x.Current == y.Current;
     }
-  
-    friend bool 
+
+    friend bool
     operator!=(const filtered_decl_iterator& x, const filtered_decl_iterator& y) {
       return x.Current != y.Current;
     }
@@ -920,7 +920,7 @@ public:
   /// udir_iterator - Iterates through the using-directives stored
   /// within this context.
   typedef UsingDirectiveDecl * const * udir_iterator;
-  
+
   typedef std::pair<udir_iterator, udir_iterator> udir_iterator_range;
 
   udir_iterator_range getUsingDirectives() const;
@@ -944,8 +944,8 @@ public:
 
   /// \brief State whether this DeclContext has external storage for
   /// declarations lexically in this context.
-  void setHasExternalLexicalStorage(bool ES = true) { 
-    ExternalLexicalStorage = ES; 
+  void setHasExternalLexicalStorage(bool ES = true) {
+    ExternalLexicalStorage = ES;
   }
 
   /// \brief Whether this DeclContext has external storage containing
@@ -954,8 +954,8 @@ public:
 
   /// \brief State whether this DeclContext has external storage for
   /// declarations visible in this context.
-  void setHasExternalVisibleStorage(bool ES = true) { 
-    ExternalVisibleStorage = ES; 
+  void setHasExternalVisibleStorage(bool ES = true) {
+    ExternalVisibleStorage = ES;
   }
 
   static bool classof(const Decl *D);

Файловите разлики са ограничени, защото са твърде много
+ 189 - 189
include/clang/AST/DeclCXX.h


+ 15 - 15
include/clang/AST/DeclContextInternals.h

@@ -57,13 +57,13 @@ public:
       Data = reinterpret_cast<uintptr_t>(New) | (Data & 0x03);
     }
   }
-  
+
   ~StoredDeclsList() {
     // If this is a vector-form, free the vector.
     if (VectorTy *Vector = getAsVector())
       delete Vector;
   }
-  
+
   StoredDeclsList &operator=(const StoredDeclsList &RHS) {
     if (VectorTy *Vector = getAsVector())
       delete Vector;
@@ -74,9 +74,9 @@ public:
     }
     return *this;
   }
-  
+
   bool isNull() const { return (Data & ~0x03) == 0; }
-  
+
   NamedDecl *getAsDecl() const {
     if ((Data & 0x03) != DK_Decl)
       return 0;
@@ -135,27 +135,27 @@ public:
   DeclContext::lookup_result getLookupResult(ASTContext &Context) {
     if (isNull())
       return DeclContext::lookup_result(0, 0);
-   
+
     if (hasDeclarationIDs())
       materializeDecls(Context);
 
     // If we have a single NamedDecl, return it.
     if (getAsDecl()) {
       assert(!isNull() && "Empty list isn't allowed");
-      
+
       // Data is a raw pointer to a NamedDecl*, return it.
       void *Ptr = &Data;
       return DeclContext::lookup_result((NamedDecl**)Ptr, (NamedDecl**)Ptr+1);
     }
-    
+
     assert(getAsVector() && "Must have a vector at this point");
     VectorTy &Vector = *getAsVector();
-    
+
     // Otherwise, we have a range result.
-    return DeclContext::lookup_result((NamedDecl **)&Vector[0], 
+    return DeclContext::lookup_result((NamedDecl **)&Vector[0],
                                       (NamedDecl **)&Vector[0]+Vector.size());
   }
-  
+
   /// HandleRedeclaration - If this is a redeclaration of an existing decl,
   /// replace the old one with D and return true.  Otherwise return false.
   bool HandleRedeclaration(ASTContext &Context, NamedDecl *D) {
@@ -169,7 +169,7 @@ public:
       setOnlyValue(D);
       return true;
     }
-    
+
     // Determine if this declaration is actually a redeclaration.
     VectorTy &Vec = *getAsVector();
     for (VectorTy::iterator OD = Vec.begin(), ODEnd = Vec.end();
@@ -183,10 +183,10 @@ public:
 
     return false;
   }
-  
+
   /// AddSubsequentDecl - This is called on the second and later decl when it is
   /// not a redeclaration to merge it into the appropriate place in our list.
-  /// 
+  ///
   void AddSubsequentDecl(NamedDecl *D) {
     assert(!hasDeclarationIDs() && "Must materialize before adding decls");
 
@@ -197,7 +197,7 @@ public:
       VT->push_back(reinterpret_cast<uintptr_t>(OldD));
       Data = reinterpret_cast<uintptr_t>(VT) | DK_Decl_Vector;
     }
-    
+
     VectorTy &Vec = *getAsVector();
     if (isa<UsingDirectiveDecl>(D) ||
         D->getIdentifierNamespace() == Decl::IDNS_Tag)
@@ -217,4 +217,4 @@ typedef llvm::DenseMap<DeclarationName, StoredDeclsList> StoredDeclsMap;
 
 } // end namespace clang
 
-#endif 
+#endif

+ 19 - 19
include/clang/AST/DeclGroup.h

@@ -18,7 +18,7 @@
 #include <cassert>
 
 namespace clang {
-  
+
 class ASTContext;
 class Decl;
 class DeclGroup;
@@ -27,7 +27,7 @@ class DeclGroupIterator;
 class DeclGroup {
   // FIXME: Include a TypeSpecifier object.
   unsigned NumDecls;
-  
+
 private:
   DeclGroup() : NumDecls(0) {}
   DeclGroup(unsigned numdecls, Decl** decls);
@@ -38,34 +38,34 @@ public:
 
   unsigned size() const { return NumDecls; }
 
-  Decl*& operator[](unsigned i) { 
+  Decl*& operator[](unsigned i) {
     assert (i < NumDecls && "Out-of-bounds access.");
     return *((Decl**) (this+1));
   }
-  
-  Decl* const& operator[](unsigned i) const { 
+
+  Decl* const& operator[](unsigned i) const {
     assert (i < NumDecls && "Out-of-bounds access.");
     return *((Decl* const*) (this+1));
   }
 };
-    
+
 class DeclGroupRef {
   // Note this is not a PointerIntPair because we need the address of the
   // non-group case to be valid as a Decl** for iteration.
-  enum Kind { SingleDeclKind=0x0, DeclGroupKind=0x1, Mask=0x1 };  
+  enum Kind { SingleDeclKind=0x0, DeclGroupKind=0x1, Mask=0x1 };
   Decl* D;
 
   Kind getKind() const {
     return (Kind) (reinterpret_cast<uintptr_t>(D) & Mask);
-  }  
-  
-public:    
+  }
+
+public:
   DeclGroupRef() : D(0) {}
-  
+
   explicit DeclGroupRef(Decl* d) : D(d) {}
   explicit DeclGroupRef(DeclGroup* dg)
     : D((Decl*) (reinterpret_cast<uintptr_t>(dg) | DeclGroupKind)) {}
-  
+
   static DeclGroupRef Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
     if (NumDecls == 0)
       return DeclGroupRef();
@@ -73,10 +73,10 @@ public:
       return DeclGroupRef(Decls[0]);
     return DeclGroupRef(DeclGroup::Create(C, Decls, NumDecls));
   }
-  
+
   typedef Decl** iterator;
   typedef Decl* const * const_iterator;
-  
+
   bool isNull() const { return D == 0; }
   bool isSingleDecl() const { return getKind() == SingleDeclKind; }
   bool isDeclGroup() const { return getKind() == DeclGroupKind; }
@@ -88,7 +88,7 @@ public:
   const Decl *getSingleDecl() const {
     return const_cast<DeclGroupRef*>(this)->getSingleDecl();
   }
-  
+
   DeclGroup &getDeclGroup() {
     assert(isDeclGroup() && "Isn't a declgroup");
     return *((DeclGroup*)(reinterpret_cast<uintptr_t>(D) & ~Mask));
@@ -96,7 +96,7 @@ public:
   const DeclGroup &getDeclGroup() const {
     return const_cast<DeclGroupRef*>(this)->getDeclGroup();
   }
-  
+
   iterator begin() {
     if (isSingleDecl())
       return D ? &D : 0;
@@ -109,13 +109,13 @@ public:
     DeclGroup &G = getDeclGroup();
     return &G[0] + G.size();
   }
-  
+
   const_iterator begin() const {
     if (isSingleDecl())
       return D ? &D : 0;
     return &getDeclGroup()[0];
   }
-  
+
   const_iterator end() const {
     if (isSingleDecl())
       return D ? &D+1 : 0;
@@ -130,7 +130,7 @@ public:
     return X;
   }
 };
-  
+
 } // end clang namespace
 
 namespace llvm {

Файловите разлики са ограничени, защото са твърде много
+ 192 - 192
include/clang/AST/DeclObjC.h


+ 149 - 153
include/clang/AST/DeclTemplate.h

@@ -53,7 +53,7 @@ class TemplateParameterList {
                         SourceLocation RAngleLoc);
 
 public:
-  static TemplateParameterList *Create(ASTContext &C, 
+  static TemplateParameterList *Create(ASTContext &C,
                                        SourceLocation TemplateLoc,
                                        SourceLocation LAngleLoc,
                                        Decl **Params,
@@ -115,10 +115,10 @@ class TemplateArgument {
       bool CopyArgs;
     } Args;
   };
-  
+
   /// \brief Location of the beginning of this template argument.
   SourceLocation StartLoc;
-  
+
 public:
   /// \brief The type of template argument we're storing.
   enum ArgKind {
@@ -133,21 +133,21 @@ public:
     /// The template argument is a value- or type-dependent expression
     /// stored in an Expr*.
     Expression = 4,
-    
+
     /// The template argument is actually a parameter pack. Arguments are stored
     /// in the Args struct.
     Pack = 5
   } Kind;
-  
+
   /// \brief Construct an empty, invalid template argument.
   TemplateArgument() : TypeOrValue(0), StartLoc(), Kind(Null) { }
-  
+
   /// \brief Construct a template type argument.
   TemplateArgument(SourceLocation Loc, QualType T) : Kind(Type) {
     TypeOrValue = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
     StartLoc = Loc;
   }
-  
+
   /// \brief Construct a template argument that refers to a
   /// declaration, which is either an external declaration or a
   /// template declaration.
@@ -156,7 +156,7 @@ public:
     TypeOrValue = reinterpret_cast<uintptr_t>(D);
     StartLoc = Loc;
   }
-  
+
   /// \brief Construct an integral constant template argument.
   TemplateArgument(SourceLocation Loc, const llvm::APSInt &Value,
                    QualType Type)
@@ -165,14 +165,14 @@ public:
     Integer.Type = Type.getAsOpaquePtr();
     StartLoc = Loc;
   }
-  
-  /// \brief Construct a template argument that is an expression. 
+
+  /// \brief Construct a template argument that is an expression.
   ///
   /// This form of template argument only occurs in template argument
   /// lists used for dependent types and for expression; it will not
   /// occur in a non-dependent, canonical template argument list.
   TemplateArgument(Expr *E);
-  
+
   /// \brief Copy constructor for a template argument.
   TemplateArgument(const TemplateArgument &Other) : Kind(Other.Kind) {
     if (Kind == Integral) {
@@ -188,27 +188,27 @@ public:
       TypeOrValue = Other.TypeOrValue;
     StartLoc = Other.StartLoc;
   }
-  
+
   TemplateArgument& operator=(const TemplateArgument& Other) {
     // FIXME: Does not provide the strong guarantee for exception
     // safety.
     using llvm::APSInt;
-    
+
     // FIXME: Handle Packs
     assert(Kind != Pack && "FIXME: Handle packs");
     assert(Other.Kind != Pack && "FIXME: Handle packs");
-    
+
     if (Kind == Other.Kind && Kind == Integral) {
       // Copy integral values.
       *this->getAsIntegral() = *Other.getAsIntegral();
-      Integer.Type = Other.Integer.Type; 
+      Integer.Type = Other.Integer.Type;
     } else {
       // Destroy the current integral value, if that's what we're holding.
       if (Kind == Integral)
         getAsIntegral()->~APSInt();
-      
+
       Kind = Other.Kind;
-      
+
       if (Other.Kind == Integral) {
         new (Integer.Value) llvm::APSInt(*Other.getAsIntegral());
         Integer.Type = Other.Integer.Type;
@@ -216,127 +216,127 @@ public:
         TypeOrValue = Other.TypeOrValue;
     }
     StartLoc = Other.StartLoc;
-    
+
     return *this;
   }
-  
+
   ~TemplateArgument() {
     using llvm::APSInt;
-    
+
     if (Kind == Integral)
       getAsIntegral()->~APSInt();
     else if (Kind == Pack && Args.CopyArgs)
       delete[] Args.Args;
   }
-  
+
   /// \brief Return the kind of stored template argument.
   ArgKind getKind() const { return Kind; }
-  
+
   /// \brief Determine whether this template argument has no value.
   bool isNull() const { return Kind == Null; }
-  
+
   /// \brief Retrieve the template argument as a type.
   QualType getAsType() const {
     if (Kind != Type)
       return QualType();
-    
+
     return QualType::getFromOpaquePtr(reinterpret_cast<void*>(TypeOrValue));
   }
-  
+
   /// \brief Retrieve the template argument as a declaration.
   Decl *getAsDecl() const {
     if (Kind != Declaration)
       return 0;
     return reinterpret_cast<Decl *>(TypeOrValue);
   }
-  
+
   /// \brief Retrieve the template argument as an integral value.
   llvm::APSInt *getAsIntegral() {
     if (Kind != Integral)
       return 0;
     return reinterpret_cast<llvm::APSInt*>(&Integer.Value[0]);
   }
-  
+
   const llvm::APSInt *getAsIntegral() const {
     return const_cast<TemplateArgument*>(this)->getAsIntegral();
   }
-  
+
   /// \brief Retrieve the type of the integral value.
   QualType getIntegralType() const {
     if (Kind != Integral)
       return QualType();
-    
+
     return QualType::getFromOpaquePtr(Integer.Type);
   }
-  
+
   void setIntegralType(QualType T) {
-    assert(Kind == Integral && 
+    assert(Kind == Integral &&
            "Cannot set the integral type of a non-integral template argument");
     Integer.Type = T.getAsOpaquePtr();
   };
-  
+
   /// \brief Retrieve the template argument as an expression.
   Expr *getAsExpr() const {
     if (Kind != Expression)
       return 0;
-    
+
     return reinterpret_cast<Expr *>(TypeOrValue);
   }
-  
+
   /// \brief Iterator that traverses the elements of a template argument pack.
   typedef const TemplateArgument * pack_iterator;
-  
-  /// \brief Iterator referencing the first argument of a template argument 
+
+  /// \brief Iterator referencing the first argument of a template argument
   /// pack.
   pack_iterator pack_begin() const {
     assert(Kind == Pack);
     return Args.Args;
   }
-  
+
   /// \brief Iterator referencing one past the last argument of a template
   /// argument pack.
   pack_iterator pack_end() const {
     assert(Kind == Pack);
     return Args.Args + Args.NumArgs;
   }
-  
+
   /// \brief The number of template arguments in the given template argument
   /// pack.
   unsigned pack_size() const {
     assert(Kind == Pack);
     return Args.NumArgs;
   }
-  
+
   /// \brief Retrieve the location where the template argument starts.
   SourceLocation getLocation() const { return StartLoc; }
-  
+
   /// \brief Construct a template argument pack.
   void setArgumentPack(TemplateArgument *Args, unsigned NumArgs, bool CopyArgs);
-  
+
   /// \brief Used to insert TemplateArguments into FoldingSets.
   void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context) const {
     ID.AddInteger(Kind);
     switch (Kind) {
       case Null:
         break;
-        
+
       case Type:
         getAsType().Profile(ID);
         break;
-        
+
       case Declaration:
         ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : 0);
         break;
-        
+
       case Integral:
         getAsIntegral()->Profile(ID);
         getIntegralType().Profile(ID);
         break;
-        
+
       case Expression:
         getAsExpr()->Profile(ID, Context, true);
         break;
-        
+
       case Pack:
         ID.AddInteger(Args.NumArgs);
         for (unsigned I = 0; I != Args.NumArgs; ++I)
@@ -350,47 +350,47 @@ class TemplateArgumentListBuilder {
   TemplateArgument *StructuredArgs;
   unsigned MaxStructuredArgs;
   unsigned NumStructuredArgs;
-  
+
   TemplateArgument *FlatArgs;
   unsigned MaxFlatArgs;
   unsigned NumFlatArgs;
-  
+
   bool AddingToPack;
   unsigned PackBeginIndex;
-  
+
 public:
   TemplateArgumentListBuilder(const TemplateParameterList *Parameters,
                               unsigned NumTemplateArgs)
-  : StructuredArgs(0), MaxStructuredArgs(Parameters->size()), 
-  NumStructuredArgs(0), FlatArgs(0), 
+  : StructuredArgs(0), MaxStructuredArgs(Parameters->size()),
+  NumStructuredArgs(0), FlatArgs(0),
   MaxFlatArgs(std::max(MaxStructuredArgs, NumTemplateArgs)), NumFlatArgs(0),
   AddingToPack(false), PackBeginIndex(0) { }
-  
+
   void Append(const TemplateArgument& Arg);
   void BeginPack();
   void EndPack();
-  
+
   void ReleaseArgs();
-  
-  unsigned flatSize() const { 
+
+  unsigned flatSize() const {
     return NumFlatArgs;
   }
   const TemplateArgument *getFlatArguments() const {
     return FlatArgs;
   }
-  
+
   unsigned structuredSize() const {
     // If we don't have any structured args, just reuse the flat size.
     if (!StructuredArgs)
       return flatSize();
-    
+
     return NumStructuredArgs;
   }
   const TemplateArgument *getStructuredArguments() const {
     // If we don't have any structured args, just reuse the flat args.
     if (!StructuredArgs)
       return getFlatArguments();
-    
+
     return StructuredArgs;
   }
 };
@@ -406,44 +406,44 @@ class TemplateArgumentList {
   /// The integer value will be non-zero to indicate that this
   /// template argument list does not own the pointer.
   llvm::PointerIntPair<const TemplateArgument *, 1> FlatArguments;
-  
+
   /// \brief The number of template arguments in this template
   /// argument list.
   unsigned NumFlatArguments;
-  
+
   llvm::PointerIntPair<const TemplateArgument *, 1> StructuredArguments;
   unsigned NumStructuredArguments;
-  
+
 public:
   TemplateArgumentList(ASTContext &Context,
                        TemplateArgumentListBuilder &Builder,
                        bool TakeArgs);
-  
+
   ~TemplateArgumentList();
-  
+
   /// \brief Retrieve the template argument at a given index.
-  const TemplateArgument &get(unsigned Idx) const { 
+  const TemplateArgument &get(unsigned Idx) const {
     assert(Idx < NumFlatArguments && "Invalid template argument index");
     return getFlatArgumentList()[Idx];
   }
-  
+
   /// \brief Retrieve the template argument at a given index.
   const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); }
-  
+
   /// \brief Retrieve the number of template arguments in this
   /// template argument list.
   unsigned size() const { return NumFlatArguments; }
-  
+
   /// \brief Retrieve the number of template arguments in the
   /// flattened template argument list.
   unsigned flat_size() const { return NumFlatArguments; }
-  
+
   /// \brief Retrieve the flattened template argument list.
-  const TemplateArgument *getFlatArgumentList() const { 
+  const TemplateArgument *getFlatArgumentList() const {
     return FlatArguments.getPointer();
   }
 };
-  
+
 //===----------------------------------------------------------------------===//
 // Kinds of Templates
 //===----------------------------------------------------------------------===//
@@ -457,15 +457,13 @@ protected:
   // This is probably never used.
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
                DeclarationName Name)
-    : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(0)
-  { }
+    : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(0) { }
 
   // Construct a template decl with the given name and parameters.
   // Used when there is not templated element (tt-params, alias?).
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
                DeclarationName Name, TemplateParameterList *Params)
-    : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(Params)
-  { }
+    : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(Params) { }
 
   // Construct a template decl with name, parameters, and templated element.
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
@@ -497,26 +495,26 @@ protected:
   NamedDecl *TemplatedDecl;
   TemplateParameterList* TemplateParams;
 };
- 
-/// \brief Provides information about a function template specialization, 
+
+/// \brief Provides information about a function template specialization,
 /// which is a FunctionDecl that has been explicitly specialization or
 /// instantiated from a function template.
 class FunctionTemplateSpecializationInfo : public llvm::FoldingSetNode {
 public:
-  /// \brief The function template specialization that this structure 
+  /// \brief The function template specialization that this structure
   /// describes.
   FunctionDecl *Function;
-  
-  /// \brief The function template from which this function template 
+
+  /// \brief The function template from which this function template
   /// specialization was generated.
   ///
   /// The two bits are contain the top 4 values of TemplateSpecializationKind.
   llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
-  
+
   /// \brief The template arguments used to produce the function template
   /// specialization from the function template.
   const TemplateArgumentList *TemplateArguments;
-  
+
   /// \brief Retrieve the template from which this function was specialized.
   FunctionTemplateDecl *getTemplate() const { return Template.getPointer(); }
 
@@ -527,61 +525,61 @@ public:
 
   /// \brief Set the template specialization kind.
   void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
-    assert(TSK != TSK_Undeclared && 
+    assert(TSK != TSK_Undeclared &&
          "Cannot encode TSK_Undeclared for a function template specialization");
     Template.setInt(TSK - 1);
   }
-  
+
   void Profile(llvm::FoldingSetNodeID &ID) {
-    Profile(ID, TemplateArguments->getFlatArgumentList(), 
+    Profile(ID, TemplateArguments->getFlatArgumentList(),
             TemplateArguments->flat_size(),
-            Function->getASTContext());    
+            Function->getASTContext());
   }
-  
-  static void 
-  Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs, 
+
+  static void
+  Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
           unsigned NumTemplateArgs, ASTContext &Context) {
     ID.AddInteger(NumTemplateArgs);
     for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
       TemplateArgs[Arg].Profile(ID, Context);
-  }  
+  }
 };
-  
+
 /// Declaration of a template function.
-class FunctionTemplateDecl : public TemplateDecl {  
+class FunctionTemplateDecl : public TemplateDecl {
 protected:
   /// \brief Data that is common to all of the declarations of a given
   /// function template.
   struct Common {
     Common() : InstantiatedFromMember(0) { }
-    
+
     /// \brief The function template specializations for this function
     /// template, including explicit specializations and instantiations.
     llvm::FoldingSet<FunctionTemplateSpecializationInfo> Specializations;
-    
+
     /// \brief The member function template from which this was most
     /// directly instantiated (or null).
-    FunctionTemplateDecl *InstantiatedFromMember;    
+    FunctionTemplateDecl *InstantiatedFromMember;
   };
-  
+
   /// \brief A pointer to the previous declaration (if this is a redeclaration)
   /// or to the data that is common to all declarations of this function
   /// template.
   llvm::PointerUnion<Common*, FunctionTemplateDecl*> CommonOrPrev;
-  
-  /// \brief Retrieves the "common" pointer shared by all 
+
+  /// \brief Retrieves the "common" pointer shared by all
   /// (re-)declarations of the same function template. Calling this routine
   /// may implicitly allocate memory for the common pointer.
   Common *getCommonPtr();
-  
+
   FunctionTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
                        TemplateParameterList *Params, NamedDecl *Decl)
     : TemplateDecl(FunctionTemplate, DC, L, Name, Params, Decl),
       CommonOrPrev((Common*)0) { }
-  
+
 public:
   void Destroy(ASTContext &C);
-  
+
   /// Get the underlying function declaration of the template.
   FunctionDecl *getTemplatedDecl() const {
     return static_cast<FunctionDecl*>(TemplatedDecl);
@@ -592,7 +590,7 @@ public:
   llvm::FoldingSet<FunctionTemplateSpecializationInfo> &getSpecializations() {
     return getCommonPtr()->Specializations;
   }
-  
+
   /// \brief Retrieve the previous declaration of this function template, or
   /// NULL if no such declaration exists.
   const FunctionTemplateDecl *getPreviousDeclaration() const {
@@ -604,16 +602,16 @@ public:
   FunctionTemplateDecl *getPreviousDeclaration() {
     return CommonOrPrev.dyn_cast<FunctionTemplateDecl*>();
   }
-  
+
   /// \brief Set the previous declaration of this function template.
   void setPreviousDeclaration(FunctionTemplateDecl *Prev) {
     if (Prev)
       CommonOrPrev = Prev;
   }
-  
+
   virtual FunctionTemplateDecl *getCanonicalDecl();
-  
-  /// \brief Retrieve the member function template that this function template 
+
+  /// \brief Retrieve the member function template that this function template
   /// was instantiated from.
   ///
   /// This routine will return non-NULL for member function templates of
@@ -627,23 +625,23 @@ public:
   /// \endcode
   ///
   /// X<int>::A<float> is a CXXMethodDecl (whose parent is X<int>, a
-  /// ClassTemplateSpecializationDecl) for which getPrimaryTemplate() will 
+  /// ClassTemplateSpecializationDecl) for which getPrimaryTemplate() will
   /// return X<int>::f, a FunctionTemplateDecl (whose parent is again
   /// X<int>) for which getInstantiatedFromMemberTemplate() will return
-  /// X<T>::f, a FunctionTemplateDecl (whose parent is X<T>, a 
+  /// X<T>::f, a FunctionTemplateDecl (whose parent is X<T>, a
   /// ClassTemplateDecl).
   ///
-  /// \returns NULL if this is not an instantiation of a member function 
+  /// \returns NULL if this is not an instantiation of a member function
   /// template.
   FunctionTemplateDecl *getInstantiatedFromMemberTemplate() {
     return getCommonPtr()->InstantiatedFromMember;
   }
-  
+
   void setInstantiatedFromMemberTemplate(FunctionTemplateDecl *FTD) {
     assert(!getCommonPtr()->InstantiatedFromMember);
     getCommonPtr()->InstantiatedFromMember = FTD;
   }
-  
+
   /// Create a template function node.
   static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
                                       SourceLocation L,
@@ -669,8 +667,7 @@ public:
 /// the occurrence within the parameter list.
 /// This class is inheritedly privately by different kinds of template
 /// parameters and is not part of the Decl hierarchy. Just a facility.
-class TemplateParmPosition
-{
+class TemplateParmPosition {
 protected:
   // FIXME: This should probably never be called, but it's here as
   TemplateParmPosition()
@@ -692,7 +689,7 @@ public:
 
   /// Get the position of the template parameter within its parameter list.
   unsigned getPosition() const { return Position; }
-  
+
   /// Get the index of the template parameter within its parameter list.
   unsigned getIndex() const { return Position; }
 };
@@ -721,10 +718,10 @@ class TemplateTypeParmDecl : public TypeDecl {
   /// \brief The default template argument, if any.
   QualType DefaultArgument;
 
-  TemplateTypeParmDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, 
+  TemplateTypeParmDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
                        bool Typename, QualType Type, bool ParameterPack)
     : TypeDecl(TemplateTypeParm, DC, L, Id), Typename(Typename),
-      InheritedDefault(false), ParameterPack(ParameterPack), DefaultArgument() { 
+      InheritedDefault(false), ParameterPack(ParameterPack), DefaultArgument() {
     TypeForDecl = Type.getTypePtr();
   }
 
@@ -787,7 +784,7 @@ class NonTypeTemplateParmDecl
                           unsigned P, IdentifierInfo *Id, QualType T,
                           DeclaratorInfo *DInfo)
     : VarDecl(NonTypeTemplateParm, DC, L, Id, T, DInfo, VarDecl::None),
-      TemplateParmPosition(D, P), DefaultArgument(0) 
+      TemplateParmPosition(D, P), DefaultArgument(0)
   { }
 
 public:
@@ -798,7 +795,7 @@ public:
   using TemplateParmPosition::getDepth;
   using TemplateParmPosition::getPosition;
   using TemplateParmPosition::getIndex;
-    
+
   /// \brief Determine whether this template parameter has a default
   /// argument.
   bool hasDefaultArgument() const { return DefaultArgument; }
@@ -850,7 +847,7 @@ public:
   using TemplateParmPosition::getDepth;
   using TemplateParmPosition::getPosition;
   using TemplateParmPosition::getIndex;
-    
+
   /// \brief Determine whether this template parameter has a default
   /// argument.
   bool hasDefaultArgument() const { return DefaultArgument; }
@@ -882,26 +879,26 @@ public:
 ///
 /// \code
 /// template<typename T> class array;
-/// 
-/// template<> 
+///
+/// template<>
 /// class array<bool> { }; // class template specialization array<bool>
 /// \endcode
-class ClassTemplateSpecializationDecl 
+class ClassTemplateSpecializationDecl
   : public CXXRecordDecl, public llvm::FoldingSetNode {
-    
-  /// \brief Structure that stores information about a class template 
+
+  /// \brief Structure that stores information about a class template
   /// specialization that was instantiated from a class template partial
   /// specialization.
   struct SpecializedPartialSpecialization {
     /// \brief The class template partial specialization from which this
     /// class template specialization was instantiated.
     ClassTemplatePartialSpecializationDecl *PartialSpecialization;
-    
+
     /// \brief The template argument list deduced for the class template
     /// partial specialization itself.
     TemplateArgumentList *TemplateArgs;
   };
-    
+
   /// \brief The template that this specialization specializes
   llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
     SpecializedTemplate;
@@ -919,7 +916,7 @@ protected:
                                   ClassTemplateDecl *SpecializedTemplate,
                                   TemplateArgumentListBuilder &Builder,
                                   ClassTemplateSpecializationDecl *PrevDecl);
-                                  
+
 public:
   static ClassTemplateSpecializationDecl *
   Create(ASTContext &Context, DeclContext *DC, SourceLocation L,
@@ -932,9 +929,9 @@ public:
   /// \brief Retrieve the template that this specialization specializes.
   ClassTemplateDecl *getSpecializedTemplate() const;
 
-  /// \brief Retrieve the template arguments of the class template 
+  /// \brief Retrieve the template arguments of the class template
   /// specialization.
-  const TemplateArgumentList &getTemplateArgs() const { 
+  const TemplateArgumentList &getTemplateArgs() const {
     return TemplateArgs;
   }
 
@@ -952,22 +949,22 @@ public:
   /// a template (rather than an explicit specialization), return the
   /// class template or class template partial specialization from which it
   /// was instantiated.
-  llvm::PointerUnion<ClassTemplateDecl *, 
+  llvm::PointerUnion<ClassTemplateDecl *,
                      ClassTemplatePartialSpecializationDecl *>
   getInstantiatedFrom() const {
     if (getSpecializationKind() != TSK_ImplicitInstantiation &&
         getSpecializationKind() != TSK_ExplicitInstantiationDefinition &&
         getSpecializationKind() != TSK_ExplicitInstantiationDeclaration)
       return (ClassTemplateDecl*)0;
-    
-    if (SpecializedPartialSpecialization *PartialSpec 
+
+    if (SpecializedPartialSpecialization *PartialSpec
           = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
       return PartialSpec->PartialSpecialization;
-    
+
     return const_cast<ClassTemplateDecl*>(
                              SpecializedTemplate.get<ClassTemplateDecl*>());
   }
-    
+
   /// \brief Retrieve the set of template arguments that should be used
   /// to instantiate members of the class template or class template partial
   /// specialization from which this class template specialization was
@@ -980,25 +977,25 @@ public:
   /// deduced template arguments for the class template partial specialization
   /// itself.
   const TemplateArgumentList &getTemplateInstantiationArgs() const {
-    if (SpecializedPartialSpecialization *PartialSpec 
+    if (SpecializedPartialSpecialization *PartialSpec
         = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
       return *PartialSpec->TemplateArgs;
-    
+
     return getTemplateArgs();
   }
-    
+
   /// \brief Note that this class template specialization is actually an
   /// instantiation of the given class template partial specialization whose
   /// template arguments have been deduced.
   void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
                           TemplateArgumentList *TemplateArgs) {
-    SpecializedPartialSpecialization *PS 
+    SpecializedPartialSpecialization *PS
       = new (getASTContext()) SpecializedPartialSpecialization();
     PS->PartialSpecialization = PartialSpec;
     PS->TemplateArgs = TemplateArgs;
     SpecializedTemplate = PS;
   }
-    
+
   /// \brief Sets the type of this specialization as it was written by
   /// the user. This will be a class template specialization type.
   void setTypeAsWritten(QualType T) {
@@ -1010,15 +1007,15 @@ public:
             getASTContext());
   }
 
-  static void 
-  Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs, 
+  static void
+  Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
           unsigned NumTemplateArgs, ASTContext &Context) {
     ID.AddInteger(NumTemplateArgs);
     for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
       TemplateArgs[Arg].Profile(ID, Context);
   }
 
-  static bool classof(const Decl *D) { 
+  static bool classof(const Decl *D) {
     return D->getKind() == ClassTemplateSpecialization ||
            D->getKind() == ClassTemplatePartialSpecialization;
   }
@@ -1032,10 +1029,9 @@ public:
   }
 };
 
-class ClassTemplatePartialSpecializationDecl 
-  : public ClassTemplateSpecializationDecl 
-{
-  /// \brief The list of template parameters 
+class ClassTemplatePartialSpecializationDecl
+  : public ClassTemplateSpecializationDecl {
+  /// \brief The list of template parameters
   TemplateParameterList* TemplateParams;
 
   ClassTemplatePartialSpecializationDecl(ASTContext &Context,
@@ -1044,7 +1040,7 @@ class ClassTemplatePartialSpecializationDecl
                                          ClassTemplateDecl *SpecializedTemplate,
                                          TemplateArgumentListBuilder &Builder,
                                ClassTemplatePartialSpecializationDecl *PrevDecl)
-    : ClassTemplateSpecializationDecl(Context, 
+    : ClassTemplateSpecializationDecl(Context,
                                       ClassTemplatePartialSpecialization,
                                       DC, L, SpecializedTemplate, Builder,
                                       PrevDecl),
@@ -1065,7 +1061,7 @@ public:
 
   // FIXME: Add Profile support!
 
-  static bool classof(const Decl *D) { 
+  static bool classof(const Decl *D) {
     return D->getKind() == ClassTemplatePartialSpecialization;
   }
 
@@ -1088,7 +1084,7 @@ protected:
 
     /// \brief The class template partial specializations for this class
     /// template.
-    llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> 
+    llvm::FoldingSet<ClassTemplatePartialSpecializationDecl>
       PartialSpecializations;
 
     /// \brief The injected-class-name type for this class template.
@@ -1104,11 +1100,11 @@ protected:
 
   /// \brief Pointer to the data that is common to all of the
   /// declarations of this class template.
-  /// 
+  ///
   /// The first declaration of a class template (e.g., the declaration
   /// with no "previous declaration") owns this pointer.
   Common *CommonPtr;
-  
+
   ClassTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
                     TemplateParameterList *Params, NamedDecl *Decl,
                     ClassTemplateDecl *PrevDecl, Common *CommonPtr)
@@ -1127,7 +1123,7 @@ public:
   ClassTemplateDecl *getPreviousDeclaration() const {
     return PreviousDeclaration;
   }
-  
+
   virtual ClassTemplateDecl *getCanonicalDecl();
 
   /// Create a class template node.
@@ -1159,7 +1155,7 @@ public:
   /// \returns the class template partial specialization that exactly matches
   /// the type \p T, or NULL if no such partial specialization exists.
   ClassTemplatePartialSpecializationDecl *findPartialSpecialization(QualType T);
-  
+
   /// \brief Retrieve the type of the injected-class-name for this
   /// class template.
   ///
@@ -1215,7 +1211,7 @@ public:
 };
 
 /// Implementation of inline functions that require the template declarations
-inline AnyFunctionDecl::AnyFunctionDecl(FunctionTemplateDecl *FTD) 
+inline AnyFunctionDecl::AnyFunctionDecl(FunctionTemplateDecl *FTD)
   : Function(FTD) { }
 
 } /* end of namespace clang */

+ 18 - 18
include/clang/AST/DeclarationName.h

@@ -101,7 +101,7 @@ private:
   /// CXXSpecialName, returns a pointer to it. Otherwise, returns
   /// a NULL pointer.
   CXXSpecialName *getAsCXXSpecialName() const {
-    if (getNameKind() >= CXXConstructorName && 
+    if (getNameKind() >= CXXConstructorName &&
         getNameKind() <= CXXConversionFunctionName)
       return reinterpret_cast<CXXSpecialName *>(Ptr & ~PtrMask);
     return 0;
@@ -116,16 +116,16 @@ private:
 
   // Construct a declaration name from the name of a C++ constructor,
   // destructor, or conversion function.
-  DeclarationName(CXXSpecialName *Name) 
-    : Ptr(reinterpret_cast<uintptr_t>(Name)) { 
+  DeclarationName(CXXSpecialName *Name)
+    : Ptr(reinterpret_cast<uintptr_t>(Name)) {
     assert((Ptr & PtrMask) == 0 && "Improperly aligned CXXSpecialName");
     Ptr |= StoredDeclarationNameExtra;
   }
 
   // Construct a declaration name from the name of a C++ overloaded
   // operator.
-  DeclarationName(CXXOperatorIdName *Name) 
-    : Ptr(reinterpret_cast<uintptr_t>(Name)) { 
+  DeclarationName(CXXOperatorIdName *Name)
+    : Ptr(reinterpret_cast<uintptr_t>(Name)) {
     assert((Ptr & PtrMask) == 0 && "Improperly aligned CXXOperatorId");
     Ptr |= StoredDeclarationNameExtra;
   }
@@ -145,8 +145,8 @@ public:
   DeclarationName() : Ptr(0) { }
 
   // Construct a declaration name from an IdentifierInfo *.
-  DeclarationName(const IdentifierInfo *II) 
-    : Ptr(reinterpret_cast<uintptr_t>(II)) { 
+  DeclarationName(const IdentifierInfo *II)
+    : Ptr(reinterpret_cast<uintptr_t>(II)) {
     assert((Ptr & PtrMask) == 0 && "Improperly aligned IdentifierInfo");
   }
 
@@ -158,8 +158,8 @@ public:
 
   // operator bool() - Evaluates true when this declaration name is
   // non-empty.
-  operator bool() const { 
-    return ((Ptr & PtrMask) != 0) || 
+  operator bool() const {
+    return ((Ptr & PtrMask) != 0) ||
            (reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
   }
 
@@ -171,10 +171,10 @@ public:
   bool isObjCOneArgSelector() const {
     return getStoredNameKind() == StoredObjCOneArgSelector;
   }
-  
+
   /// getNameKind - Determine what kind of name this is.
   NameKind getNameKind() const;
-  
+
 
   /// getName - Retrieve the human-readable string for this name.
   std::string getAsString() const;
@@ -182,7 +182,7 @@ public:
   /// getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in
   /// this declaration name, or NULL if this declaration name isn't a
   /// simple identifier.
-  IdentifierInfo *getAsIdentifierInfo() const { 
+  IdentifierInfo *getAsIdentifierInfo() const {
     if (isIdentifier())
       return reinterpret_cast<IdentifierInfo *>(Ptr);
     return 0;
@@ -201,7 +201,7 @@ public:
     N.Ptr = P;
     return N;
   }
-  
+
   /// getCXXNameType - If this name is one of the C++ names (of a
   /// constructor, destructor, or conversion function), return the
   /// type associated with that name.
@@ -310,13 +310,13 @@ public:
   /// getCXXSpecialName - Returns a declaration name for special kind
   /// of C++ name, e.g., for a constructor, destructor, or conversion
   /// function.
-  DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind, 
+  DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind,
                                     CanQualType Ty);
 
   /// getCXXOperatorName - Get the name of the overloadable C++
   /// operator corresponding to Op.
   DeclarationName getCXXOperatorName(OverloadedOperatorKind Op);
-};  
+};
 
 /// Insertion operator for diagnostics.  This allows sending DeclarationName's
 /// into a diagnostic with <<.
@@ -326,8 +326,8 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
                   Diagnostic::ak_declarationname);
   return DB;
 }
-  
-  
+
+
 }  // end namespace clang
 
 namespace llvm {
@@ -345,7 +345,7 @@ struct DenseMapInfo<clang::DeclarationName> {
 
   static unsigned getHashValue(clang::DeclarationName);
 
-  static inline bool 
+  static inline bool
   isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS) {
     return LHS == RHS;
   }

Файловите разлики са ограничени, защото са твърде много
+ 200 - 200
include/clang/AST/Expr.h


+ 206 - 206
include/clang/AST/ExprCXX.h

@@ -47,14 +47,14 @@ class CXXOperatorCallExpr : public CallExpr {
   OverloadedOperatorKind Operator;
 
 public:
-  CXXOperatorCallExpr(ASTContext& C, OverloadedOperatorKind Op, Expr *fn, 
-                      Expr **args, unsigned numargs, QualType t, 
+  CXXOperatorCallExpr(ASTContext& C, OverloadedOperatorKind Op, Expr *fn,
+                      Expr **args, unsigned numargs, QualType t,
                       SourceLocation operatorloc)
     : CallExpr(C, CXXOperatorCallExprClass, fn, args, numargs, t, operatorloc),
       Operator(Op) {}
-  explicit CXXOperatorCallExpr(ASTContext& C, EmptyShell Empty) : 
+  explicit CXXOperatorCallExpr(ASTContext& C, EmptyShell Empty) :
     CallExpr(C, CXXOperatorCallExprClass, Empty) { }
-  
+
 
   /// getOperator - Returns the kind of overloaded operator that this
   /// expression refers to.
@@ -69,9 +69,9 @@ public:
   SourceLocation getOperatorLoc() const { return getRParenLoc(); }
 
   virtual SourceRange getSourceRange() const;
-  
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == CXXOperatorCallExprClass; 
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == CXXOperatorCallExprClass;
   }
   static bool classof(const CXXOperatorCallExpr *) { return true; }
 };
@@ -95,7 +95,7 @@ public:
   /// operation would return "x".
   Expr *getImplicitObjectArgument();
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXMemberCallExprClass;
   }
   static bool classof(const CXXMemberCallExpr *) { return true; }
@@ -113,7 +113,7 @@ private:
   SourceLocation Loc; // the location of the casting op
 
 protected:
-  CXXNamedCastExpr(StmtClass SC, QualType ty, const CastInfo &info, Expr *op, 
+  CXXNamedCastExpr(StmtClass SC, QualType ty, const CastInfo &info, Expr *op,
                    QualType writtenTy, SourceLocation l)
     : ExplicitCastExpr(SC, ty, info, op, writtenTy), Loc(l) {}
 
@@ -128,7 +128,7 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd());
   }
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     switch (T->getStmtClass()) {
     case CXXNamedCastExprClass:
     case CXXStaticCastExprClass:
@@ -144,34 +144,34 @@ public:
 };
 
 /// CXXStaticCastExpr - A C++ @c static_cast expression (C++ [expr.static.cast]).
-/// 
+///
 /// This expression node represents a C++ static cast, e.g.,
 /// @c static_cast<int>(1.0).
 class CXXStaticCastExpr : public CXXNamedCastExpr {
 public:
-  CXXStaticCastExpr(QualType ty, const CastInfo &info, Expr *op, 
+  CXXStaticCastExpr(QualType ty, const CastInfo &info, Expr *op,
                     QualType writtenTy, SourceLocation l)
     : CXXNamedCastExpr(CXXStaticCastExprClass, ty, info, op, writtenTy, l) {}
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXStaticCastExprClass;
   }
   static bool classof(const CXXStaticCastExpr *) { return true; }
 };
 
 /// CXXDynamicCastExpr - A C++ @c dynamic_cast expression
-/// (C++ [expr.dynamic.cast]), which may perform a run-time check to 
+/// (C++ [expr.dynamic.cast]), which may perform a run-time check to
 /// determine how to perform the type cast.
-/// 
+///
 /// This expression node represents a dynamic cast, e.g.,
 /// @c dynamic_cast<Derived*>(BasePtr).
 class CXXDynamicCastExpr : public CXXNamedCastExpr {
 public:
-  CXXDynamicCastExpr(QualType ty, CastKind kind, Expr *op, QualType writtenTy, 
+  CXXDynamicCastExpr(QualType ty, CastKind kind, Expr *op, QualType writtenTy,
                      SourceLocation l)
     : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, kind, op, writtenTy, l) {}
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXDynamicCastExprClass;
   }
   static bool classof(const CXXDynamicCastExpr *) { return true; }
@@ -180,17 +180,17 @@ public:
 /// CXXReinterpretCastExpr - A C++ @c reinterpret_cast expression (C++
 /// [expr.reinterpret.cast]), which provides a differently-typed view
 /// of a value but performs no actual work at run time.
-/// 
+///
 /// This expression node represents a reinterpret cast, e.g.,
 /// @c reinterpret_cast<int>(VoidPtr).
 class CXXReinterpretCastExpr : public CXXNamedCastExpr {
 public:
-  CXXReinterpretCastExpr(QualType ty, Expr *op, QualType writtenTy, 
+  CXXReinterpretCastExpr(QualType ty, Expr *op, QualType writtenTy,
                          SourceLocation l)
-    : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, CK_BitCast, op, 
+    : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, CK_BitCast, op,
                        writtenTy, l) {}
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXReinterpretCastExprClass;
   }
   static bool classof(const CXXReinterpretCastExpr *) { return true; }
@@ -198,39 +198,39 @@ public:
 
 /// CXXConstCastExpr - A C++ @c const_cast expression (C++ [expr.const.cast]),
 /// which can remove type qualifiers but does not change the underlying value.
-/// 
+///
 /// This expression node represents a const cast, e.g.,
 /// @c const_cast<char*>(PtrToConstChar).
 class CXXConstCastExpr : public CXXNamedCastExpr {
 public:
-  CXXConstCastExpr(QualType ty, Expr *op, QualType writtenTy, 
+  CXXConstCastExpr(QualType ty, Expr *op, QualType writtenTy,
                    SourceLocation l)
     : CXXNamedCastExpr(CXXConstCastExprClass, ty, CK_NoOp, op, writtenTy, l) {}
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXConstCastExprClass;
   }
   static bool classof(const CXXConstCastExpr *) { return true; }
 };
 
 /// CXXBoolLiteralExpr - [C++ 2.13.5] C++ Boolean Literal.
-/// 
+///
 class CXXBoolLiteralExpr : public Expr {
   bool Value;
   SourceLocation Loc;
 public:
-  CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) : 
+  CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) :
     Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {}
 
   bool getValue() const { return Value; }
 
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
-    
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXBoolLiteralExprClass;
   }
   static bool classof(const CXXBoolLiteralExpr *) { return true; }
-      
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -322,7 +322,7 @@ class CXXThisExpr : public Expr {
   SourceLocation Loc;
 
 public:
-  CXXThisExpr(SourceLocation L, QualType Type) 
+  CXXThisExpr(SourceLocation L, QualType Type)
     : Expr(CXXThisExprClass, Type,
            // 'this' is type-dependent if the class type of the enclosing
            // member function is dependent (C++ [temp.dep.expr]p2)
@@ -331,7 +331,7 @@ public:
 
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXThisExprClass;
   }
   static bool classof(const CXXThisExpr *) { return true; }
@@ -383,14 +383,14 @@ public:
 /// supply arguments for all of the parameters.
 class CXXDefaultArgExpr : public Expr {
   ParmVarDecl *Param;
-    
+
 protected:
-  CXXDefaultArgExpr(StmtClass SC, ParmVarDecl *param) 
-    : Expr(SC, param->hasUnparsedDefaultArg() ? 
+  CXXDefaultArgExpr(StmtClass SC, ParmVarDecl *param)
+    : Expr(SC, param->hasUnparsedDefaultArg() ?
            param->getType().getNonReferenceType()
            : param->getDefaultArg()->getType()),
     Param(param) { }
-    
+
 public:
   // Param is the parameter whose default argument is used by this
   // expression.
@@ -426,39 +426,39 @@ public:
 class CXXTemporary {
   /// Destructor - The destructor that needs to be called.
   const CXXDestructorDecl *Destructor;
-  
+
   CXXTemporary(const CXXDestructorDecl *destructor)
     : Destructor(destructor) { }
   ~CXXTemporary() { }
 
 public:
-  static CXXTemporary *Create(ASTContext &C, 
+  static CXXTemporary *Create(ASTContext &C,
                               const CXXDestructorDecl *Destructor);
-  
+
   void Destroy(ASTContext &Ctx);
-  
+
   const CXXDestructorDecl *getDestructor() const { return Destructor; }
 };
 
-/// CXXBindTemporaryExpr - Represents binding an expression to a temporary, 
+/// CXXBindTemporaryExpr - Represents binding an expression to a temporary,
 /// so its destructor can be called later.
 class CXXBindTemporaryExpr : public Expr {
   CXXTemporary *Temp;
-  
+
   Stmt *SubExpr;
 
-  CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr) 
+  CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr)
    : Expr(CXXBindTemporaryExprClass,
           subexpr->getType()), Temp(temp), SubExpr(subexpr) { }
-  ~CXXBindTemporaryExpr() { } 
+  ~CXXBindTemporaryExpr() { }
 
 protected:
   virtual void DoDestroy(ASTContext &C);
 
 public:
-  static CXXBindTemporaryExpr *Create(ASTContext &C, CXXTemporary *Temp, 
+  static CXXBindTemporaryExpr *Create(ASTContext &C, CXXTemporary *Temp,
                                       Expr* SubExpr);
-  
+
   CXXTemporary *getTemporary() { return Temp; }
   const CXXTemporary *getTemporary() const { return Temp; }
 
@@ -484,24 +484,24 @@ class CXXConstructExpr : public Expr {
   CXXConstructorDecl *Constructor;
 
   bool Elidable;
-  
+
   Stmt **Args;
   unsigned NumArgs;
-  
+
 protected:
-  CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, 
+  CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
                    CXXConstructorDecl *d, bool elidable,
                    Expr **args, unsigned numargs);
-  ~CXXConstructExpr() { } 
+  ~CXXConstructExpr() { }
 
   virtual void DoDestroy(ASTContext &C);
 
 public:
   static CXXConstructExpr *Create(ASTContext &C, QualType T,
-                                  CXXConstructorDecl *D, bool Elidable, 
+                                  CXXConstructorDecl *D, bool Elidable,
                                   Expr **Args, unsigned NumArgs);
-  
-  
+
+
   CXXConstructorDecl* getConstructor() const { return Constructor; }
 
   /// \brief Whether this construction is elidable.
@@ -509,7 +509,7 @@ public:
 
   typedef ExprIterator arg_iterator;
   typedef ConstExprIterator const_arg_iterator;
-  
+
   arg_iterator arg_begin() { return Args; }
   arg_iterator arg_end() { return Args + NumArgs; }
   const_arg_iterator arg_begin() const { return Args; }
@@ -526,7 +526,7 @@ public:
     assert(Arg < NumArgs && "Arg access out of range!");
     return cast<Expr>(Args[Arg]);
   }
-  
+
   /// setArg - Set the specified argument.
   void setArg(unsigned Arg, Expr *ArgExpr) {
     assert(Arg < NumArgs && "Arg access out of range!");
@@ -535,12 +535,12 @@ public:
 
   virtual SourceRange getSourceRange() const { return SourceRange(); }
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXConstructExprClass ||
       T->getStmtClass() == CXXTemporaryObjectExprClass;
   }
   static bool classof(const CXXConstructExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -554,24 +554,24 @@ class CXXFunctionalCastExpr : public ExplicitCastExpr {
   SourceLocation TyBeginLoc;
   SourceLocation RParenLoc;
 public:
-  CXXFunctionalCastExpr(QualType ty, QualType writtenTy, 
-                        SourceLocation tyBeginLoc, CastKind kind, 
+  CXXFunctionalCastExpr(QualType ty, QualType writtenTy,
+                        SourceLocation tyBeginLoc, CastKind kind,
                         Expr *castExpr, CXXMethodDecl *typeConversionMethod,
-                        SourceLocation rParenLoc) : 
+                        SourceLocation rParenLoc) :
     ExplicitCastExpr(CXXFunctionalCastExprClass, ty, kind, castExpr, writtenTy),
     TypeConversionMethod(typeConversionMethod),
     TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
 
-  CXXMethodDecl *getTypeConversionMethod() const 
+  CXXMethodDecl *getTypeConversionMethod() const
   { return TypeConversionMethod; }
   SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
-  
+
   virtual SourceRange getSourceRange() const {
     return SourceRange(TyBeginLoc, RParenLoc);
   }
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == CXXFunctionalCastExprClass; 
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == CXXFunctionalCastExprClass;
   }
   static bool classof(const CXXFunctionalCastExpr *) { return true; }
 };
@@ -579,7 +579,7 @@ public:
 /// @brief Represents a C++ functional cast expression that builds a
 /// temporary object.
 ///
-/// This expression type represents a C++ "functional" cast 
+/// This expression type represents a C++ "functional" cast
 /// (C++[expr.type.conv]) with N != 1 arguments that invokes a
 /// constructor to build a temporary object. If N == 0 but no
 /// constructor will be called (because the functional cast is
@@ -600,12 +600,12 @@ class CXXTemporaryObjectExpr : public CXXConstructExpr {
   SourceLocation RParenLoc;
 
 public:
-  CXXTemporaryObjectExpr(ASTContext &C, CXXConstructorDecl *Cons, 
-                         QualType writtenTy, SourceLocation tyBeginLoc, 
-                         Expr **Args,unsigned NumArgs, 
+  CXXTemporaryObjectExpr(ASTContext &C, CXXConstructorDecl *Cons,
+                         QualType writtenTy, SourceLocation tyBeginLoc,
+                         Expr **Args,unsigned NumArgs,
                          SourceLocation rParenLoc);
 
-  ~CXXTemporaryObjectExpr() { } 
+  ~CXXTemporaryObjectExpr() { }
 
   SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
@@ -613,7 +613,7 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(TyBeginLoc, RParenLoc);
   }
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXTemporaryObjectExprClass;
   }
   static bool classof(const CXXTemporaryObjectExpr *) { return true; }
@@ -630,28 +630,28 @@ class CXXZeroInitValueExpr : public Expr {
 
 public:
   CXXZeroInitValueExpr(QualType ty, SourceLocation tyBeginLoc,
-                       SourceLocation rParenLoc ) : 
+                       SourceLocation rParenLoc ) :
     Expr(CXXZeroInitValueExprClass, ty, false, false),
     TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
-  
+
   SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
 
   /// @brief Whether this initialization expression was
   /// implicitly-generated.
-  bool isImplicit() const { 
-    return TyBeginLoc.isInvalid() && RParenLoc.isInvalid(); 
+  bool isImplicit() const {
+    return TyBeginLoc.isInvalid() && RParenLoc.isInvalid();
   }
 
   virtual SourceRange getSourceRange() const {
     return SourceRange(TyBeginLoc, RParenLoc);
   }
-    
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXZeroInitValueExprClass;
   }
   static bool classof(const CXXZeroInitValueExpr *) { return true; }
-      
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -666,26 +666,26 @@ class CXXConditionDeclExpr : public DeclRefExpr {
 public:
   CXXConditionDeclExpr(SourceLocation startLoc,
                        SourceLocation eqLoc, VarDecl *var)
-    : DeclRefExpr(CXXConditionDeclExprClass, var, 
+    : DeclRefExpr(CXXConditionDeclExprClass, var,
                   var->getType().getNonReferenceType(), startLoc,
                   var->getType()->isDependentType(),
                   /*FIXME:integral constant?*/
                     var->getType()->isDependentType()) {}
 
   SourceLocation getStartLoc() const { return getLocation(); }
-  
+
   VarDecl *getVarDecl() { return cast<VarDecl>(getDecl()); }
   const VarDecl *getVarDecl() const { return cast<VarDecl>(getDecl()); }
 
   virtual SourceRange getSourceRange() const {
     return SourceRange(getStartLoc(), getVarDecl()->getInit()->getLocEnd());
   }
-    
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXConditionDeclExprClass;
   }
   static bool classof(const CXXConditionDeclExpr *) { return true; }
-      
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -866,7 +866,7 @@ public:
 /// Example:
 ///
 /// \code
-/// template<typename T> 
+/// template<typename T>
 /// void destroy(T* ptr) {
 ///   ptr->~T();
 /// }
@@ -874,67 +874,67 @@ public:
 ///
 /// When the template is parsed, the expression \c ptr->~T will be stored as
 /// a member reference expression. If it then instantiated with a scalar type
-/// as a template argument for T, the resulting expression will be a 
+/// as a template argument for T, the resulting expression will be a
 /// pseudo-destructor expression.
 class CXXPseudoDestructorExpr : public Expr {
   /// \brief The base expression (that is being destroyed).
   Stmt *Base;
-  
+
   /// \brief Whether the operator was an arrow ('->'); otherwise, it was a
   /// period ('.').
   bool IsArrow : 1;
-  
+
   /// \brief The location of the '.' or '->' operator.
   SourceLocation OperatorLoc;
-  
+
   /// \brief The nested-name-specifier that follows the operator, if present.
   NestedNameSpecifier *Qualifier;
-  
-  /// \brief The source range that covers the nested-name-specifier, if 
+
+  /// \brief The source range that covers the nested-name-specifier, if
   /// present.
   SourceRange QualifierRange;
-  
+
   /// \brief The type being destroyed.
   QualType DestroyedType;
-  
+
   /// \brief The location of the type after the '~'.
   SourceLocation DestroyedTypeLoc;
-    
+
 public:
   CXXPseudoDestructorExpr(ASTContext &Context,
                           Expr *Base, bool isArrow, SourceLocation OperatorLoc,
                           NestedNameSpecifier *Qualifier,
                           SourceRange QualifierRange,
-                          QualType DestroyedType, 
+                          QualType DestroyedType,
                           SourceLocation DestroyedTypeLoc)
-    : Expr(CXXPseudoDestructorExprClass, 
+    : Expr(CXXPseudoDestructorExprClass,
            Context.getPointerType(Context.getFunctionType(Context.VoidTy, 0, 0,
                                                           false, 0)),
            /*isTypeDependent=*/false,
            /*isValueDependent=*/Base->isValueDependent()),
-      Base(static_cast<Stmt *>(Base)), IsArrow(isArrow), 
+      Base(static_cast<Stmt *>(Base)), IsArrow(isArrow),
       OperatorLoc(OperatorLoc), Qualifier(Qualifier),
       QualifierRange(QualifierRange), DestroyedType(DestroyedType),
       DestroyedTypeLoc(DestroyedTypeLoc) { }
-  
+
   void setBase(Expr *E) { Base = E; }
   Expr *getBase() const { return cast<Expr>(Base); }
-  
-  /// \brief Determines whether this member expression actually had 
+
+  /// \brief Determines whether this member expression actually had
   /// a C++ nested-name-specifier prior to the name of the member, e.g.,
   /// x->Base::foo.
   bool hasQualifier() const { return Qualifier != 0; }
-  
+
   /// \brief If the member name was qualified, retrieves the source range of
   /// the nested-name-specifier that precedes the member name. Otherwise,
   /// returns an empty source range.
   SourceRange getQualifierRange() const { return QualifierRange; }
-  
-  /// \brief If the member name was qualified, retrieves the 
+
+  /// \brief If the member name was qualified, retrieves the
   /// nested-name-specifier that precedes the member name. Otherwise, returns
   /// NULL.
   NestedNameSpecifier *getQualifier() const { return Qualifier; }
-    
+
   /// \brief Determine whether this pseudo-destructor expression was written
   /// using an '->' (otherwise, it used a '.').
   bool isArrow() const { return IsArrow; }
@@ -942,27 +942,27 @@ public:
 
   /// \brief Retrieve the location of the '.' or '->' operator.
   SourceLocation getOperatorLoc() const { return OperatorLoc; }
-  
+
   /// \brief Retrieve the type that is being destroyed.
   QualType getDestroyedType() const { return DestroyedType; }
-  
+
   /// \brief Retrieve the location of the type being destroyed.
   SourceLocation getDestroyedTypeLoc() const { return DestroyedTypeLoc; }
-  
+
   virtual SourceRange getSourceRange() const {
     return SourceRange(Base->getLocStart(), DestroyedTypeLoc);
   }
-  
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXPseudoDestructorExprClass;
   }
   static bool classof(const CXXPseudoDestructorExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
-  virtual child_iterator child_end();  
+  virtual child_iterator child_end();
 };
-  
+
 /// \brief Represents the name of a function that has not been
 /// resolved to any declaration.
 ///
@@ -980,7 +980,7 @@ public:
 /// }
 /// @endcode
 class UnresolvedFunctionNameExpr : public Expr {
-  /// The name that was present in the source 
+  /// The name that was present in the source
   DeclarationName Name;
 
   /// The location of this name in the source code
@@ -999,7 +999,7 @@ public:
 
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == UnresolvedFunctionNameExprClass;
   }
   static bool classof(const UnresolvedFunctionNameExpr *) { return true; }
@@ -1064,9 +1064,9 @@ class QualifiedDeclRefExpr : public DeclRefExpr {
   NestedNameSpecifier *NNS;
 
 public:
-  QualifiedDeclRefExpr(NamedDecl *d, QualType t, SourceLocation l, bool TD, 
+  QualifiedDeclRefExpr(NamedDecl *d, QualType t, SourceLocation l, bool TD,
                        bool VD, SourceRange R, NestedNameSpecifier *NNS)
-    : DeclRefExpr(QualifiedDeclRefExprClass, d, t, l, TD, VD), 
+    : DeclRefExpr(QualifiedDeclRefExprClass, d, t, l, TD, VD),
       QualifierRange(R), NNS(NNS) { }
 
   /// \brief Retrieve the source range of the nested-name-specifier.
@@ -1076,8 +1076,8 @@ public:
   /// declaration.
   NestedNameSpecifier *getQualifier() const { return NNS; }
 
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(QualifierRange.getBegin(), getLocation()); 
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(QualifierRange.getBegin(), getLocation());
   }
 
   static bool classof(const Stmt *T) {
@@ -1117,13 +1117,13 @@ class UnresolvedDeclRefExpr : public Expr {
 
   /// \brief Whether this expr is an address of (&) operand.
   bool IsAddressOfOperand;
-  
+
 public:
   UnresolvedDeclRefExpr(DeclarationName N, QualType T, SourceLocation L,
-                        SourceRange R, NestedNameSpecifier *NNS, 
+                        SourceRange R, NestedNameSpecifier *NNS,
                         bool IsAddressOfOperand)
-    : Expr(UnresolvedDeclRefExprClass, T, true, true), 
-      Name(N), Loc(L), QualifierRange(R), NNS(NNS), 
+    : Expr(UnresolvedDeclRefExprClass, T, true, true),
+      Name(N), Loc(L), QualifierRange(R), NNS(NNS),
       IsAddressOfOperand(IsAddressOfOperand) { }
 
   /// \brief Retrieve the name that this expression refers to.
@@ -1140,10 +1140,10 @@ public:
   NestedNameSpecifier *getQualifier() const { return NNS; }
 
   /// \brief Retrieve whether this is an address of (&) operand.
-  
+
   bool isAddressOfOperand() const { return IsAddressOfOperand; }
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(QualifierRange.getBegin(), getLocation()); 
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(QualifierRange.getBegin(), getLocation());
   }
 
   static bool classof(const Stmt *T) {
@@ -1155,42 +1155,42 @@ public:
   virtual StmtIterator child_end();
 };
 
-/// \brief An expression that refers to a C++ template-id, such as 
-/// @c isa<FunctionDecl>. 
+/// \brief An expression that refers to a C++ template-id, such as
+/// @c isa<FunctionDecl>.
 class TemplateIdRefExpr : public Expr {
   /// \brief If this template-id was qualified-id, e.g., @c std::sort<int>,
   /// this nested name specifier contains the @c std::.
   NestedNameSpecifier *Qualifier;
-  
+
   /// \brief If this template-id was a qualified-id, e.g., @c std::sort<int>,
   /// this covers the source code range of the @c std::.
   SourceRange QualifierRange;
-  
+
   /// \brief The actual template to which this template-id refers.
   TemplateName Template;
-  
+
   /// \brief The source location of the template name.
   SourceLocation TemplateNameLoc;
 
   /// \brief The source location of the left angle bracket ('<');
   SourceLocation LAngleLoc;
-  
+
   /// \brief The source location of the right angle bracket ('>');
   SourceLocation RAngleLoc;
-  
+
   /// \brief The number of template arguments in TemplateArgs.
   unsigned NumTemplateArgs;
-  
+
   TemplateIdRefExpr(QualType T,
                     NestedNameSpecifier *Qualifier, SourceRange QualifierRange,
                     TemplateName Template, SourceLocation TemplateNameLoc,
-                    SourceLocation LAngleLoc, 
+                    SourceLocation LAngleLoc,
                     const TemplateArgument *TemplateArgs,
                     unsigned NumTemplateArgs,
                     SourceLocation RAngleLoc);
-  
+
   virtual void DoDestroy(ASTContext &Context);
-  
+
 public:
   static TemplateIdRefExpr *
   Create(ASTContext &Context, QualType T,
@@ -1198,66 +1198,66 @@ public:
          TemplateName Template, SourceLocation TemplateNameLoc,
          SourceLocation LAngleLoc, const TemplateArgument *TemplateArgs,
          unsigned NumTemplateArgs, SourceLocation RAngleLoc);
-  
+
   /// \brief Retrieve the nested name specifier used to qualify the name of
   /// this template-id, e.g., the "std::sort" in @c std::sort<int>, or NULL
   /// if this template-id was an unqualified-id.
   NestedNameSpecifier *getQualifier() const { return Qualifier; }
-  
+
   /// \brief Retrieve the source range describing the nested name specifier
   /// used to qualified the name of this template-id, if the name was qualified.
   SourceRange getQualifierRange() const { return QualifierRange; }
-  
+
   /// \brief Retrieve the name of the template referenced, e.g., "sort" in
   /// @c std::sort<int>;
   TemplateName getTemplateName() const { return Template; }
-  
+
   /// \brief Retrieve the location of the name of the template referenced, e.g.,
   /// the location of "sort" in @c std::sort<int>.
   SourceLocation getTemplateNameLoc() const { return TemplateNameLoc; }
-  
-  /// \brief Retrieve the location of the left angle bracket following the 
+
+  /// \brief Retrieve the location of the left angle bracket following the
   /// template name ('<').
   SourceLocation getLAngleLoc() const { return LAngleLoc; }
-  
+
   /// \brief Retrieve the template arguments provided as part of this
   /// template-id.
-  const TemplateArgument *getTemplateArgs() const { 
+  const TemplateArgument *getTemplateArgs() const {
     return reinterpret_cast<const TemplateArgument *>(this + 1);
   }
-  
+
   /// \brief Retrieve the number of template arguments provided as part of this
   /// template-id.
   unsigned getNumTemplateArgs() const { return NumTemplateArgs; }
-    
-  /// \brief Retrieve the location of the right angle bracket following the 
+
+  /// \brief Retrieve the location of the right angle bracket following the
   /// template arguments ('>').
   SourceLocation getRAngleLoc() const { return RAngleLoc; }
-  
+
   virtual SourceRange getSourceRange() const {
     return SourceRange(Qualifier? QualifierRange.getBegin() : TemplateNameLoc,
                        RAngleLoc);
   }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
-  
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == TemplateIdRefExprClass;
   }
   static bool classof(const TemplateIdRefExpr *) { return true; }
 };
-  
+
 class CXXExprWithTemporaries : public Expr {
   Stmt *SubExpr;
-    
+
   CXXTemporary **Temps;
   unsigned NumTemps;
 
   bool ShouldDestroyTemps;
-  
-  CXXExprWithTemporaries(Expr *SubExpr, CXXTemporary **Temps, 
+
+  CXXExprWithTemporaries(Expr *SubExpr, CXXTemporary **Temps,
                          unsigned NumTemps, bool ShouldDestroyTemps);
   ~CXXExprWithTemporaries();
 
@@ -1268,7 +1268,7 @@ public:
   static CXXExprWithTemporaries *Create(ASTContext &C, Expr *SubExpr,
                                         CXXTemporary **Temps, unsigned NumTemps,
                                         bool ShouldDestroyTemporaries);
-  
+
   unsigned getNumTemporaries() const { return NumTemps; }
   CXXTemporary *getTemporary(unsigned i) {
     assert(i < NumTemps && "Index out of range");
@@ -1278,11 +1278,11 @@ public:
     assert(i < NumTemps && "Index out of range");
     return Temps[i];
   }
-  
+
   bool shouldDestroyTemporaries() const { return ShouldDestroyTemps; }
-  
+
   void removeLastTemporary() { NumTemps--; }
-  
+
   Expr *getSubExpr() { return cast<Expr>(SubExpr); }
   const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
   void setSubExpr(Expr *E) { SubExpr = E; }
@@ -1336,7 +1336,7 @@ class CXXUnresolvedConstructExpr : public Expr {
 
   /// \brief The number of arguments used to construct the type.
   unsigned NumArgs;
-  
+
   CXXUnresolvedConstructExpr(SourceLocation TyBegin,
                              QualType T,
                              SourceLocation LParenLoc,
@@ -1345,7 +1345,7 @@ class CXXUnresolvedConstructExpr : public Expr {
                              SourceLocation RParenLoc);
 
 public:
-  static CXXUnresolvedConstructExpr *Create(ASTContext &C, 
+  static CXXUnresolvedConstructExpr *Create(ASTContext &C,
                                             SourceLocation TyBegin,
                                             QualType T,
                                             SourceLocation LParenLoc,
@@ -1387,7 +1387,7 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(TyBeginLoc, RParenLoc);
   }
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXUnresolvedConstructExprClass;
   }
   static bool classof(const CXXUnresolvedConstructExpr *) { return true; }
@@ -1404,7 +1404,7 @@ class CXXUnresolvedMemberExpr : public Expr {
   /// \brief The expression for the base pointer or class reference,
   /// e.g., the \c x in x.f.
   Stmt *Base;
-  
+
   /// \brief Whether this member expression used the '->' operator or
   /// the '.' operator.
   bool IsArrow : 1;
@@ -1412,25 +1412,25 @@ class CXXUnresolvedMemberExpr : public Expr {
   /// \brief Whether this member expression has explicitly-specified template
   /// arguments.
   bool HasExplicitTemplateArgumentList : 1;
-  
+
   /// \brief The location of the '->' or '.' operator.
   SourceLocation OperatorLoc;
 
   /// \brief The nested-name-specifier that precedes the member name, if any.
   NestedNameSpecifier *Qualifier;
-  
+
   /// \brief The source range covering the nested name specifier.
   SourceRange QualifierRange;
-  
+
   /// \brief In a qualified member access expression such as t->Base::f, this
-  /// member stores the resolves of name lookup in the context of the member 
+  /// member stores the resolves of name lookup in the context of the member
   /// access expression, to be used at instantiation time.
   ///
   /// FIXME: This member, along with the Qualifier and QualifierRange, could
   /// be stuck into a structure that is optionally allocated at the end of
   /// the CXXUnresolvedMemberExpr, to save space in the common case.
   NamedDecl *FirstQualifierFoundInScope;
-  
+
   /// \brief The member to which this member expression refers, which
   /// can be name, overloaded operator, or destructor.
   /// FIXME: could also be a template-id
@@ -1438,25 +1438,25 @@ class CXXUnresolvedMemberExpr : public Expr {
 
   /// \brief The location of the member name.
   SourceLocation MemberLoc;
-  
+
   /// \brief Retrieve the explicit template argument list that followed the
   /// member template name, if any.
   ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
     if (!HasExplicitTemplateArgumentList)
       return 0;
-    
+
     return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
   }
-  
+
   /// \brief Retrieve the explicit template argument list that followed the
   /// member template name, if any.
   const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
     return const_cast<CXXUnresolvedMemberExpr *>(this)
              ->getExplicitTemplateArgumentList();
   }
-  
-  CXXUnresolvedMemberExpr(ASTContext &C, 
-                          Expr *Base, bool IsArrow, 
+
+  CXXUnresolvedMemberExpr(ASTContext &C,
+                          Expr *Base, bool IsArrow,
                           SourceLocation OperatorLoc,
                           NestedNameSpecifier *Qualifier,
                           SourceRange QualifierRange,
@@ -1468,10 +1468,10 @@ class CXXUnresolvedMemberExpr : public Expr {
                           const TemplateArgument *TemplateArgs,
                           unsigned NumTemplateArgs,
                           SourceLocation RAngleLoc);
-  
+
 public:
-  CXXUnresolvedMemberExpr(ASTContext &C, 
-                          Expr *Base, bool IsArrow, 
+  CXXUnresolvedMemberExpr(ASTContext &C,
+                          Expr *Base, bool IsArrow,
                           SourceLocation OperatorLoc,
                           NestedNameSpecifier *Qualifier,
                           SourceRange QualifierRange,
@@ -1484,10 +1484,10 @@ public:
     Qualifier(Qualifier), QualifierRange(QualifierRange),
     FirstQualifierFoundInScope(FirstQualifierFoundInScope),
     Member(Member), MemberLoc(MemberLoc) { }
-  
+
   static CXXUnresolvedMemberExpr *
-  Create(ASTContext &C, 
-         Expr *Base, bool IsArrow, 
+  Create(ASTContext &C,
+         Expr *Base, bool IsArrow,
          SourceLocation OperatorLoc,
          NestedNameSpecifier *Qualifier,
          SourceRange QualifierRange,
@@ -1499,7 +1499,7 @@ public:
          const TemplateArgument *TemplateArgs,
          unsigned NumTemplateArgs,
          SourceLocation RAngleLoc);
-         
+
   /// \brief Retrieve the base object of this member expressions,
   /// e.g., the \c x in \c x.m.
   Expr *getBase() { return cast<Expr>(Base); }
@@ -1517,26 +1517,26 @@ public:
   /// \brief Retrieve the nested-name-specifier that qualifies the member
   /// name.
   NestedNameSpecifier *getQualifier() const { return Qualifier; }
-  
+
   /// \brief Retrieve the source range covering the nested-name-specifier
   /// that qualifies the member name.
   SourceRange getQualifierRange() const { return QualifierRange; }
-  
+
   /// \brief Retrieve the first part of the nested-name-specifier that was
   /// found in the scope of the member access expression when the member access
   /// was initially parsed.
   ///
   /// This function only returns a useful result when member access expression
-  /// uses a qualified member name, e.g., "x.Base::f". Here, the declaration 
-  /// returned by this function describes what was found by unqualified name 
+  /// uses a qualified member name, e.g., "x.Base::f". Here, the declaration
+  /// returned by this function describes what was found by unqualified name
   /// lookup for the identifier "Base" within the scope of the member access
   /// expression itself. At template instantiation time, this information is
   /// combined with the results of name lookup into the type of the object
   /// expression itself (the class type of x).
-  NamedDecl *getFirstQualifierFoundInScope() const { 
+  NamedDecl *getFirstQualifierFoundInScope() const {
     return FirstQualifierFoundInScope;
   }
-  
+
   /// \brief Retrieve the name of the member that this expression
   /// refers to.
   DeclarationName getMember() const { return Member; }
@@ -1549,56 +1549,56 @@ public:
 
   /// \brief Determines whether this member expression actually had a C++
   /// template argument list explicitly specified, e.g., x.f<int>.
-  bool hasExplicitTemplateArgumentList() { 
-    return HasExplicitTemplateArgumentList; 
+  bool hasExplicitTemplateArgumentList() {
+    return HasExplicitTemplateArgumentList;
   }
-  
-  /// \brief Retrieve the location of the left angle bracket following the 
+
+  /// \brief Retrieve the location of the left angle bracket following the
   /// member name ('<'), if any.
-  SourceLocation getLAngleLoc() const { 
+  SourceLocation getLAngleLoc() const {
     if (!HasExplicitTemplateArgumentList)
       return SourceLocation();
-    
+
     return getExplicitTemplateArgumentList()->LAngleLoc;
   }
-  
+
   /// \brief Retrieve the template arguments provided as part of this
   /// template-id.
-  const TemplateArgument *getTemplateArgs() const { 
+  const TemplateArgument *getTemplateArgs() const {
     if (!HasExplicitTemplateArgumentList)
-      return 0;   
-    
+      return 0;
+
     return getExplicitTemplateArgumentList()->getTemplateArgs();
   }
-  
+
   /// \brief Retrieve the number of template arguments provided as part of this
   /// template-id.
-  unsigned getNumTemplateArgs() const { 
+  unsigned getNumTemplateArgs() const {
     if (!HasExplicitTemplateArgumentList)
-      return 0;   
-    
+      return 0;
+
     return getExplicitTemplateArgumentList()->NumTemplateArgs;
   }
-  
-  /// \brief Retrieve the location of the right angle bracket following the 
+
+  /// \brief Retrieve the location of the right angle bracket following the
   /// template arguments ('>').
-  SourceLocation getRAngleLoc() const { 
+  SourceLocation getRAngleLoc() const {
     if (!HasExplicitTemplateArgumentList)
       return SourceLocation();
-    
+
     return getExplicitTemplateArgumentList()->RAngleLoc;
   }
-  
+
   virtual SourceRange getSourceRange() const {
     if (HasExplicitTemplateArgumentList)
       return SourceRange(Base->getSourceRange().getBegin(),
                          getRAngleLoc());
-    
+
     return SourceRange(Base->getSourceRange().getBegin(),
                        MemberLoc);
   }
-  
-  static bool classof(const Stmt *T) { 
+
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == CXXUnresolvedMemberExprClass;
   }
   static bool classof(const CXXUnresolvedMemberExpr *) { return true; }

+ 102 - 102
include/clang/AST/ExprObjC.h

@@ -22,7 +22,7 @@ namespace clang {
   class ASTContext;
   class ObjCMethodDecl;
   class ObjCPropertyDecl;
-  
+
 /// ObjCStringLiteral, used for Objective-C string literals
 /// i.e. @"foo".
 class ObjCStringLiteral : public Expr {
@@ -41,20 +41,20 @@ public:
   SourceLocation getAtLoc() const { return AtLoc; }
   void setAtLoc(SourceLocation L) { AtLoc = L; }
 
-  virtual SourceRange getSourceRange() const { 
+  virtual SourceRange getSourceRange() const {
     return SourceRange(AtLoc, String->getLocEnd());
   }
-  
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCStringLiteralClass; 
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCStringLiteralClass;
   }
-  static bool classof(const ObjCStringLiteral *) { return true; }  
-  
+  static bool classof(const ObjCStringLiteral *) { return true; }
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
+
 /// ObjCEncodeExpr, used for @encode in Objective-C.  @encode has the same type
 /// and behavior as StringLiteral except that the string initializer is obtained
 /// from ASTContext with the encoding type as an argument.
@@ -62,32 +62,32 @@ class ObjCEncodeExpr : public Expr {
   QualType EncType;
   SourceLocation AtLoc, RParenLoc;
 public:
-  ObjCEncodeExpr(QualType T, QualType ET, 
+  ObjCEncodeExpr(QualType T, QualType ET,
                  SourceLocation at, SourceLocation rp)
-    : Expr(ObjCEncodeExprClass, T, ET->isDependentType(), 
+    : Expr(ObjCEncodeExprClass, T, ET->isDependentType(),
            ET->isDependentType()), EncType(ET), AtLoc(at), RParenLoc(rp) {}
-  
+
   explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){}
 
-  
+
   SourceLocation getAtLoc() const { return AtLoc; }
   void setAtLoc(SourceLocation L) { AtLoc = L; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setRParenLoc(SourceLocation L) { RParenLoc = L; }
-  
+
   QualType getEncodedType() const { return EncType; }
   void setEncodedType(QualType T) { EncType = T; }
 
-  
+
   virtual SourceRange getSourceRange() const {
     return SourceRange(AtLoc, RParenLoc);
   }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCEncodeExprClass;
   }
   static bool classof(const ObjCEncodeExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -106,7 +106,7 @@ public:
 
   Selector getSelector() const { return SelName; }
   void setSelector(Selector S) { SelName = S; }
-  
+
   SourceLocation getAtLoc() const { return AtLoc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setAtLoc(SourceLocation L) { AtLoc = L; }
@@ -115,26 +115,26 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(AtLoc, RParenLoc);
   }
-  
+
   /// getNumArgs - Return the number of actual arguments to this call.
   unsigned getNumArgs() const { return SelName.getNumArgs(); }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCSelectorExprClass;
   }
   static bool classof(const ObjCSelectorExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
+
 /// ObjCProtocolExpr used for protocol expression in Objective-C.  This is used
 /// as: @protocol(foo), as in:
 ///   obj conformsToProtocol:@protocol(foo)]
 /// The return type is "Protocol*".
-class ObjCProtocolExpr : public Expr {    
-  ObjCProtocolDecl *TheProtocol;    
+class ObjCProtocolExpr : public Expr {
+  ObjCProtocolDecl *TheProtocol;
   SourceLocation AtLoc, RParenLoc;
 public:
   ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol,
@@ -146,7 +146,7 @@ public:
 
   ObjCProtocolDecl *getProtocol() const { return TheProtocol; }
   void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; }
-    
+
   SourceLocation getAtLoc() const { return AtLoc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setAtLoc(SourceLocation L) { AtLoc = L; }
@@ -155,12 +155,12 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(AtLoc, RParenLoc);
   }
-        
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCProtocolExprClass;
   }
   static bool classof(const ObjCProtocolExpr *) { return true; }
-    
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -173,44 +173,44 @@ class ObjCIvarRefExpr : public Expr {
   Stmt *Base;
   bool IsArrow:1;      // True if this is "X->F", false if this is "X.F".
   bool IsFreeIvar:1;   // True if ivar reference has no base (self assumed).
-  
+
 public:
   ObjCIvarRefExpr(ObjCIvarDecl *d,
-                  QualType t, SourceLocation l, Expr *base=0, 
-                  bool arrow = false, bool freeIvar = false) : 
+                  QualType t, SourceLocation l, Expr *base=0,
+                  bool arrow = false, bool freeIvar = false) :
     Expr(ObjCIvarRefExprClass, t), D(d),
     Loc(l), Base(base), IsArrow(arrow),
     IsFreeIvar(freeIvar) {}
-  
+
   explicit ObjCIvarRefExpr(EmptyShell Empty)
     : Expr(ObjCIvarRefExprClass, Empty) {}
 
   ObjCIvarDecl *getDecl() { return D; }
   const ObjCIvarDecl *getDecl() const { return D; }
   void setDecl(ObjCIvarDecl *d) { D = d; }
-  
+
   const Expr *getBase() const { return cast<Expr>(Base); }
   Expr *getBase() { return cast<Expr>(Base); }
   void setBase(Expr * base) { Base = base; }
-  
+
   bool isArrow() const { return IsArrow; }
   bool isFreeIvar() const { return IsFreeIvar; }
   void setIsArrow(bool A) { IsArrow = A; }
   void setIsFreeIvar(bool A) { IsFreeIvar = A; }
-  
+
   SourceLocation getLocation() const { return Loc; }
   void setLocation(SourceLocation L) { Loc = L; }
 
-  virtual SourceRange getSourceRange() const { 
+  virtual SourceRange getSourceRange() const {
     return isFreeIvar() ? SourceRange(Loc)
-    : SourceRange(getBase()->getLocStart(), Loc); 
+    : SourceRange(getBase()->getLocStart(), Loc);
   }
-  
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCIvarRefExprClass; 
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCIvarRefExprClass;
   }
   static bool classof(const ObjCIvarRefExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
@@ -225,48 +225,48 @@ private:
   SourceLocation IdLoc;
   Stmt *Base;
 public:
-  ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, 
+  ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
                       SourceLocation l, Expr *base)
     : Expr(ObjCPropertyRefExprClass, t), AsProperty(PD), IdLoc(l), Base(base) {
   }
-  
+
   explicit ObjCPropertyRefExpr(EmptyShell Empty)
     : Expr(ObjCPropertyRefExprClass, Empty) {}
 
   ObjCPropertyDecl *getProperty() const { return AsProperty; }
   void setProperty(ObjCPropertyDecl *D) { AsProperty = D; }
-  
+
   const Expr *getBase() const { return cast<Expr>(Base); }
   Expr *getBase() { return cast<Expr>(Base); }
   void setBase(Expr *base) { Base = base; }
-  
+
   SourceLocation getLocation() const { return IdLoc; }
   void setLocation(SourceLocation L) { IdLoc = L; }
 
   virtual SourceRange getSourceRange() const {
     return SourceRange(getBase()->getLocStart(), IdLoc);
   }
-  
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCPropertyRefExprClass; 
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCPropertyRefExprClass;
   }
   static bool classof(const ObjCPropertyRefExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
 
-/// ObjCImplicitSetterGetterRefExpr - A dot-syntax expression to access two 
-/// methods; one to set a value to an 'ivar' (Setter) and the other to access 
-/// an 'ivar' (Setter). 
+/// ObjCImplicitSetterGetterRefExpr - A dot-syntax expression to access two
+/// methods; one to set a value to an 'ivar' (Setter) and the other to access
+/// an 'ivar' (Setter).
 /// An example for use of this AST is:
 /// @code
 ///  @interface Test { }
 ///  - (Test *)crash;
 ///  - (void)setCrash: (Test*)value;
 /// @end
-/// void  foo(Test *p1, Test *p2) 
+/// void  foo(Test *p1, Test *p2)
 /// {
 ///    p2.crash  = p1.crash; // Uses ObjCImplicitSetterGetterRefExpr AST
 /// }
@@ -285,10 +285,10 @@ class ObjCImplicitSetterGetterRefExpr : public Expr {
   /// Location of the receiver class in the dot syntax notation
   /// used to call a class method setter/getter.
   SourceLocation ClassLoc;
-    
+
 public:
   ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter,
-                 QualType t, 
+                 QualType t,
                  ObjCMethodDecl *setter,
                  SourceLocation l, Expr *base)
     : Expr(ObjCImplicitSetterGetterRefExprClass, t), Setter(setter),
@@ -296,13 +296,13 @@ public:
       ClassLoc(SourceLocation()) {
     }
   ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter,
-                 QualType t, 
+                 QualType t,
                  ObjCMethodDecl *setter,
                  SourceLocation l, ObjCInterfaceDecl *C, SourceLocation CL)
     : Expr(ObjCImplicitSetterGetterRefExprClass, t), Setter(setter),
       Getter(getter), MemberLoc(l), Base(0), InterfaceDecl(C), ClassLoc(CL) {
     }
-  explicit ObjCImplicitSetterGetterRefExpr(EmptyShell Empty) 
+  explicit ObjCImplicitSetterGetterRefExpr(EmptyShell Empty)
            : Expr(ObjCImplicitSetterGetterRefExprClass, Empty){}
 
   ObjCMethodDecl *getGetterMethod() const { return Getter; }
@@ -311,7 +311,7 @@ public:
   void setGetterMethod(ObjCMethodDecl *D) { Getter = D; }
   void setSetterMethod(ObjCMethodDecl *D) { Setter = D; }
   void setInterfaceDecl(ObjCInterfaceDecl *D) { InterfaceDecl = D; }
-  
+
   virtual SourceRange getSourceRange() const {
     if (Base)
       return SourceRange(getBase()->getLocStart(), MemberLoc);
@@ -320,34 +320,34 @@ public:
   const Expr *getBase() const { return cast_or_null<Expr>(Base); }
   Expr *getBase() { return cast_or_null<Expr>(Base); }
   void setBase(Expr *base) { Base = base; }
-    
+
   SourceLocation getLocation() const { return MemberLoc; }
   void setLocation(SourceLocation L) { MemberLoc = L; }
   SourceLocation getClassLoc() const { return ClassLoc; }
   void setClassLoc(SourceLocation L) { ClassLoc = L; }
-    
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCImplicitSetterGetterRefExprClass; 
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCImplicitSetterGetterRefExprClass;
   }
   static bool classof(const ObjCImplicitSetterGetterRefExpr *) { return true; }
-    
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
+
 class ObjCMessageExpr : public Expr {
   // SubExprs - The receiver and arguments of the message expression.
   Stmt **SubExprs;
-  
+
   // NumArgs - The number of arguments (not including the receiver) to the
   //  message expression.
   unsigned NumArgs;
-  
+
   // A unigue name for this message.
   Selector SelName;
-  
-  // A method prototype for this message (optional). 
+
+  // A method prototype for this message (optional).
   // FIXME: Since method decls contain the selector, and most messages have a
   // prototype, consider devising a scheme for unifying SelName/MethodProto.
   ObjCMethodDecl *MethodProto;
@@ -360,7 +360,7 @@ class ObjCMessageExpr : public Expr {
   // Bit-swizzling flags.
   enum { IsInstMeth=0, IsClsMethDeclUnknown, IsClsMethDeclKnown, Flags=0x3 };
   unsigned getFlag() const { return (uintptr_t) SubExprs[RECEIVER] & Flags; }
-  
+
 public:
   /// This constructor is used to represent class messages where the
   /// ObjCInterfaceDecl* of the receiver is not known.
@@ -376,28 +376,28 @@ public:
                   QualType retType, ObjCMethodDecl *methDecl,
                   SourceLocation LBrac, SourceLocation RBrac,
                   Expr **ArgExprs, unsigned NumArgs);
-  
+
   // constructor for instance messages.
   ObjCMessageExpr(Expr *receiver, Selector selInfo,
                   QualType retType, ObjCMethodDecl *methDecl,
                   SourceLocation LBrac, SourceLocation RBrac,
                   Expr **ArgExprs, unsigned NumArgs);
-                  
+
   explicit ObjCMessageExpr(EmptyShell Empty)
     : Expr(ObjCMessageExprClass, Empty), SubExprs(0), NumArgs(0) {}
-  
+
   ~ObjCMessageExpr() {
     delete [] SubExprs;
   }
-  
+
   /// getReceiver - Returns the receiver of the message expression.
   ///  This can be NULL if the message is for class methods.  For
   ///  class methods, use getClassName.
   /// FIXME: need to handle/detect 'super' usage within a class method.
-  Expr *getReceiver() { 
+  Expr *getReceiver() {
     uintptr_t x = (uintptr_t) SubExprs[RECEIVER];
     return (x & Flags) == IsInstMeth ? (Expr*) x : 0;
-  }  
+  }
   const Expr *getReceiver() const {
     return const_cast<ObjCMessageExpr*>(this)->getReceiver();
   }
@@ -405,36 +405,36 @@ public:
   void setReceiver(Expr *rec) { SubExprs[RECEIVER] = rec; }
   Selector getSelector() const { return SelName; }
   void setSelector(Selector S) { SelName = S; }
-  
+
   const ObjCMethodDecl *getMethodDecl() const { return MethodProto; }
   ObjCMethodDecl *getMethodDecl() { return MethodProto; }
   void setMethodDecl(ObjCMethodDecl *MD) { MethodProto = MD; }
-  
+
   typedef std::pair<ObjCInterfaceDecl*, IdentifierInfo*> ClassInfo;
-  
+
   /// getClassInfo - For class methods, this returns both the ObjCInterfaceDecl*
   ///  and IdentifierInfo* of the invoked class.  Both can be NULL if this
   ///  is an instance message, and the ObjCInterfaceDecl* can be NULL if none
-  ///  was available when this ObjCMessageExpr object was constructed.  
-  ClassInfo getClassInfo() const; 
+  ///  was available when this ObjCMessageExpr object was constructed.
+  ClassInfo getClassInfo() const;
   void setClassInfo(const ClassInfo &C);
-  
+
   /// getClassName - For class methods, this returns the invoked class,
-  ///  and returns NULL otherwise.  For instance methods, use getReceiver.  
+  ///  and returns NULL otherwise.  For instance methods, use getReceiver.
   IdentifierInfo *getClassName() const {
     return getClassInfo().second;
   }
-  
+
   /// getNumArgs - Return the number of actual arguments to this call.
   unsigned getNumArgs() const { return NumArgs; }
-  void setNumArgs(unsigned nArgs) { 
-    NumArgs = nArgs; 
+  void setNumArgs(unsigned nArgs) {
+    NumArgs = nArgs;
     // FIXME: should always allocate SubExprs via the ASTContext's
     // allocator.
     if (!SubExprs)
       SubExprs = new Stmt* [NumArgs + 1];
   }
-  
+
   /// getArg - Return the specified argument.
   Expr *getArg(unsigned Arg) {
     assert(Arg < NumArgs && "Arg access out of range!");
@@ -449,13 +449,13 @@ public:
     assert(Arg < NumArgs && "Arg access out of range!");
     SubExprs[Arg+ARGS_START] = ArgExpr;
   }
-  
+
   SourceLocation getLeftLoc() const { return LBracloc; }
   SourceLocation getRightLoc() const { return RBracloc; }
 
   void setLeftLoc(SourceLocation L) { LBracloc = L; }
   void setRightLoc(SourceLocation L) { RBracloc = L; }
-  
+
   void setSourceRange(SourceRange R) {
     LBracloc = R.getBegin();
     RBracloc = R.getEnd();
@@ -468,14 +468,14 @@ public:
     return T->getStmtClass() == ObjCMessageExprClass;
   }
   static bool classof(const ObjCMessageExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
-  
+
   typedef ExprIterator arg_iterator;
   typedef ConstExprIterator const_arg_iterator;
-  
+
   arg_iterator arg_begin() { return &SubExprs[ARGS_START]; }
   arg_iterator arg_end()   { return &SubExprs[ARGS_START] + NumArgs; }
   const_arg_iterator arg_begin() const { return &SubExprs[ARGS_START]; }
@@ -487,16 +487,16 @@ public:
 class ObjCSuperExpr : public Expr {
   SourceLocation Loc;
 public:
-  ObjCSuperExpr(SourceLocation L, QualType Type) 
+  ObjCSuperExpr(SourceLocation L, QualType Type)
     : Expr(ObjCSuperExprClass, Type), Loc(L) { }
   explicit ObjCSuperExpr(EmptyShell Empty) : Expr(ObjCSuperExprClass, Empty) {}
 
   SourceLocation getLoc() const { return Loc; }
   void setLoc(SourceLocation L) { Loc = L; }
-  
+
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
 
-  static bool classof(const Stmt *T) { 
+  static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCSuperExprClass;
   }
   static bool classof(const ObjCSuperExpr *) { return true; }
@@ -511,23 +511,23 @@ public:
 class ObjCIsaExpr : public Expr {
   /// Base - the expression for the base object pointer.
   Stmt *Base;
-  
+
   /// IsaMemberLoc - This is the location of the 'isa'.
   SourceLocation IsaMemberLoc;
-  
+
   /// IsArrow - True if this is "X->F", false if this is "X.F".
   bool IsArrow;
 public:
-  ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, QualType ty) 
+  ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, QualType ty)
     : Expr(ObjCIsaExprClass, ty),
       Base(base), IsaMemberLoc(l), IsArrow(isarrow) {}
-      
+
   /// \brief Build an empty expression.
   explicit ObjCIsaExpr(EmptyShell Empty) : Expr(ObjCIsaExprClass, Empty) { }
-      
+
   void setBase(Expr *E) { Base = E; }
   Expr *getBase() const { return cast<Expr>(Base); }
-  
+
   bool isArrow() const { return IsArrow; }
   void setArrow(bool A) { IsArrow = A; }
 
@@ -539,14 +539,14 @@ public:
   virtual SourceRange getSourceRange() const {
     return SourceRange(getBase()->getLocStart(), IsaMemberLoc);
   }
-  
+
   virtual SourceLocation getExprLoc() const { return IsaMemberLoc; }
 
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCIsaExprClass; 
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCIsaExprClass;
   }
   static bool classof(const ObjCIsaExpr *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();

+ 4 - 4
include/clang/AST/ExternalASTSource.h

@@ -33,7 +33,7 @@ struct VisibleDeclaration {
   /// \brief The name of the declarations.
   DeclarationName Name;
 
-  /// \brief The ID numbers of all of the declarations with this name. 
+  /// \brief The ID numbers of all of the declarations with this name.
   ///
   /// These declarations have not necessarily been de-serialized.
   llvm::SmallVector<unsigned, 4> Declarations;
@@ -65,7 +65,7 @@ public:
   /// replaced with the sorted set of source ranges corresponding to
   /// comments in the source code.
   virtual void ReadComments(std::vector<SourceRange> &Comments) = 0;
-  
+
   /// \brief Resolve a type ID into a type, potentially building a new
   /// type.
   virtual QualType GetType(uint32_t ID) = 0;
@@ -151,7 +151,7 @@ public:
     this->Ptr = reinterpret_cast<uint64_t>(Ptr);
     return *this;
   }
-  
+
   LazyOffsetPtr &operator=(uint64_t Offset) {
     assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
     if (Offset == 0)
@@ -177,7 +177,7 @@ public:
   /// \returns a pointer to the AST node.
   T* get(ExternalASTSource *Source) const {
     if (isOffset()) {
-      assert(Source && 
+      assert(Source &&
              "Cannot deserialize a lazy pointer without an AST source");
       Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1));
     }

+ 16 - 16
include/clang/AST/NestedNameSpecifier.h

@@ -81,8 +81,8 @@ private:
 
   /// \brief Copy constructor used internally to clone nested name
   /// specifiers.
-  NestedNameSpecifier(const NestedNameSpecifier &Other) 
-    : llvm::FoldingSetNode(Other), Prefix(Other.Prefix), 
+  NestedNameSpecifier(const NestedNameSpecifier &Other)
+    : llvm::FoldingSetNode(Other), Prefix(Other.Prefix),
       Specifier(Other.Specifier) {
   }
 
@@ -90,7 +90,7 @@ private:
 
   /// \brief Either find or insert the given nested name specifier
   /// mockup in the given context.
-  static NestedNameSpecifier *FindOrInsert(ASTContext &Context, 
+  static NestedNameSpecifier *FindOrInsert(ASTContext &Context,
                                            const NestedNameSpecifier &Mockup);
 
 public:
@@ -99,18 +99,18 @@ public:
   /// The prefix must be dependent, since nested name specifiers
   /// referencing an identifier are only permitted when the identifier
   /// cannot be resolved.
-  static NestedNameSpecifier *Create(ASTContext &Context, 
-                                     NestedNameSpecifier *Prefix, 
+  static NestedNameSpecifier *Create(ASTContext &Context,
+                                     NestedNameSpecifier *Prefix,
                                      IdentifierInfo *II);
 
   /// \brief Builds a nested name specifier that names a namespace.
-  static NestedNameSpecifier *Create(ASTContext &Context, 
-                                     NestedNameSpecifier *Prefix, 
+  static NestedNameSpecifier *Create(ASTContext &Context,
+                                     NestedNameSpecifier *Prefix,
                                      NamespaceDecl *NS);
 
   /// \brief Builds a nested name specifier that names a type.
-  static NestedNameSpecifier *Create(ASTContext &Context, 
-                                     NestedNameSpecifier *Prefix, 
+  static NestedNameSpecifier *Create(ASTContext &Context,
+                                     NestedNameSpecifier *Prefix,
                                      bool Template, Type *T);
 
   /// \brief Builds a specifier that consists of just an identifier.
@@ -120,7 +120,7 @@ public:
   /// nested name specifier, e.g., in "x->Base::f", the "x" has a dependent
   /// type.
   static NestedNameSpecifier *Create(ASTContext &Context, IdentifierInfo *II);
-  
+
   /// \brief Returns the nested name specifier representing the global
   /// scope.
   static NestedNameSpecifier *GlobalSpecifier(ASTContext &Context);
@@ -135,10 +135,10 @@ public:
   NestedNameSpecifier *getPrefix() const { return Prefix.getPointer(); }
 
   /// \brief Determine what kind of nested name specifier is stored.
-  SpecifierKind getKind() const { 
+  SpecifierKind getKind() const {
     if (Specifier == 0)
       return Global;
-    return (SpecifierKind)Prefix.getInt(); 
+    return (SpecifierKind)Prefix.getInt();
   }
 
   /// \brief Retrieve the identifier stored in this nested name
@@ -149,7 +149,7 @@ public:
 
     return 0;
   }
-  
+
   /// \brief Retrieve the namespace stored in this nested name
   /// specifier.
   NamespaceDecl *getAsNamespace() const {
@@ -161,7 +161,7 @@ public:
 
   /// \brief Retrieve the type stored in this nested name specifier.
   Type *getAsType() const {
-    if (Prefix.getInt() == TypeSpec || 
+    if (Prefix.getInt() == TypeSpec ||
         Prefix.getInt() == TypeSpecWithTemplate)
       return (Type *)Specifier;
 
@@ -192,11 +192,11 @@ public:
 /// into a diagnostic with <<.
 inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
                                            NestedNameSpecifier *NNS) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS), 
+  DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS),
                   Diagnostic::ak_nestednamespec);
   return DB;
 }
-  
+
 }
 
 #endif

+ 5 - 5
include/clang/AST/ParentMap.h

@@ -17,7 +17,7 @@
 namespace clang {
 class Stmt;
 class Expr;
-  
+
 class ParentMap {
   void* Impl;
 public:
@@ -30,7 +30,7 @@ public:
   const Stmt *getParent(const Stmt* S) const {
     return getParent(const_cast<Stmt*>(S));
   }
-  
+
   const Stmt *getParentIgnoreParens(const Stmt *S) const {
     return getParentIgnoreParens(const_cast<Stmt*>(S));
   }
@@ -38,13 +38,13 @@ public:
   bool hasParent(Stmt* S) const {
     return getParent(S) != 0;
   }
-  
+
   bool isConsumedExpr(Expr *E) const;
-  
+
   bool isConsumedExpr(const Expr *E) const {
     return isConsumedExpr(const_cast<Expr*>(E));
   }
 };
-  
+
 } // end clang namespace
 #endif

+ 1 - 1
include/clang/AST/PrettyPrinter.h

@@ -34,7 +34,7 @@ public:
 /// declarations should be printed.
 struct PrintingPolicy {
   /// \brief Create a default printing policy for C.
-  PrintingPolicy(const LangOptions &LO) 
+  PrintingPolicy(const LangOptions &LO)
     : Indentation(2), LangOpts(LO), SuppressSpecifiers(false),
       SuppressTag(false), SuppressTagKind(false), SuppressScope(false),
       Dump(false), ConstantArraySizeAsWritten(false) { }

+ 33 - 33
include/clang/AST/RecordLayout.h

@@ -22,38 +22,38 @@ namespace clang {
   class RecordDecl;
   class CXXRecordDecl;
 
-/// ASTRecordLayout - 
+/// ASTRecordLayout -
 /// This class contains layout information for one RecordDecl,
 /// which is a struct/union/class.  The decl represented must be a definition,
-/// not a forward declaration.  
-/// This class is also used to contain layout information for one 
+/// not a forward declaration.
+/// This class is also used to contain layout information for one
 /// ObjCInterfaceDecl. FIXME - Find appropriate name.
 /// These objects are managed by ASTContext.
 class ASTRecordLayout {
   /// Size - Size of record in bits.
   uint64_t Size;
-  
+
   /// DataSize - Size of record in bits without tail padding.
   uint64_t DataSize;
-  
+
   /// FieldOffsets - Array of field offsets in bits.
   uint64_t *FieldOffsets;
-  
+
   // Alignment - Alignment of record in bits.
-  unsigned Alignment;   
-  
+  unsigned Alignment;
+
   // FieldCount - Number of fields.
   unsigned FieldCount;
 
   struct CXXRecordLayoutInfo {
-    /// NonVirtualSize - The non-virtual size (in bits) of an object, which is 
+    /// NonVirtualSize - The non-virtual size (in bits) of an object, which is
     /// the size of the object without virtual bases.
     uint64_t NonVirtualSize;
-    
+
     /// NonVirtualAlign - The non-virtual alignment (in bits) of an object,
     /// which is the alignment of the object without virtual bases.
     uint64_t NonVirtualAlign;
-    
+
     /// PrimaryBase - The primary base for our vtable.
     const CXXRecordDecl *PrimaryBase;
     /// PrimaryBase - Wether or not the primary base was a virtual base.
@@ -67,16 +67,16 @@ class ASTRecordLayout {
     /// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :)
     llvm::DenseMap<const CXXRecordDecl *, uint64_t> VBaseOffsets;
   };
-  
-  /// CXXInfo - If the record layout is for a C++ record, this will have 
+
+  /// CXXInfo - If the record layout is for a C++ record, this will have
   /// C++ specific information about the record.
   CXXRecordLayoutInfo *CXXInfo;
-  
+
   friend class ASTContext;
   friend class ASTRecordLayoutBuilder;
 
   ASTRecordLayout(uint64_t size, unsigned alignment, unsigned datasize,
-                  const uint64_t *fieldoffsets, unsigned fieldcount) 
+                  const uint64_t *fieldoffsets, unsigned fieldcount)
   : Size(size), DataSize(datasize), FieldOffsets(0), Alignment(alignment),
     FieldCount(fieldcount), CXXInfo(0) {
     if (FieldCount > 0)  {
@@ -85,7 +85,7 @@ class ASTRecordLayout {
         FieldOffsets[i] = fieldoffsets[i];
     }
   }
-  
+
   // Constructor for C++ records.
   ASTRecordLayout(uint64_t size, unsigned alignment, uint64_t datasize,
                   const uint64_t *fieldoffsets, unsigned fieldcount,
@@ -101,7 +101,7 @@ class ASTRecordLayout {
       for (unsigned i = 0; i < FieldCount; ++i)
         FieldOffsets[i] = fieldoffsets[i];
     }
-    
+
     CXXInfo->PrimaryBase = PB;
     CXXInfo->PrimaryBaseWasVirtual = PBVirtual;
     CXXInfo->NonVirtualSize = nonvirtualsize;
@@ -111,7 +111,7 @@ class ASTRecordLayout {
     for (unsigned i = 0; i != vbasecount; ++i)
       CXXInfo->VBaseOffsets[vbases[i]] = vbaseoffsets[i];
   }
-  
+
   ~ASTRecordLayout() {
     delete [] FieldOffsets;
     delete CXXInfo;
@@ -120,55 +120,55 @@ class ASTRecordLayout {
   ASTRecordLayout(const ASTRecordLayout&);   // DO NOT IMPLEMENT
   void operator=(const ASTRecordLayout&); // DO NOT IMPLEMENT
 public:
-  
+
   /// getAlignment - Get the record alignment in bits.
   unsigned getAlignment() const { return Alignment; }
 
   /// getSize - Get the record size in bits.
   uint64_t getSize() const { return Size; }
-  
+
   /// getFieldCount - Get the number of fields in the layout.
   unsigned getFieldCount() const { return FieldCount; }
-  
+
   /// getFieldOffset - Get the offset of the given field index, in
   /// bits.
   uint64_t getFieldOffset(unsigned FieldNo) const {
     assert (FieldNo < FieldCount && "Invalid Field No");
     return FieldOffsets[FieldNo];
   }
-    
+
   /// getDataSize() - Get the record data size, which is the record size
   /// without tail padding, in bits.
   uint64_t getDataSize() const {
     return DataSize;
   }
-  
-  /// getNonVirtualSize - Get the non-virtual size (in bits) of an object, 
+
+  /// getNonVirtualSize - Get the non-virtual size (in bits) of an object,
   /// which is the size of the object without virtual bases.
-  uint64_t getNonVirtualSize() const { 
+  uint64_t getNonVirtualSize() const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
-    
+
     return CXXInfo->NonVirtualSize;
   }
-  
+
   /// getNonVirtualSize - Get the non-virtual alignment (in bits) of an object,
   /// which is the alignment of the object without virtual bases.
   unsigned getNonVirtualAlign() const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
-    
+
     return CXXInfo->NonVirtualAlign;
   }
-  
+
   /// getPrimaryBase - Get the primary base.
   const CXXRecordDecl *getPrimaryBase() const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
-    
+
     return CXXInfo->PrimaryBase;
   }
   /// getPrimaryBaseWasVirtual - Indicates if the primary base was virtual.
   bool getPrimaryBaseWasVirtual() const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
-    
+
     return CXXInfo->PrimaryBaseWasVirtual;
   }
 
@@ -176,7 +176,7 @@ public:
   uint64_t getBaseClassOffset(const CXXRecordDecl *Base) const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
     assert(CXXInfo->BaseOffsets.count(Base) && "Did not find base!");
-    
+
     return CXXInfo->BaseOffsets[Base];
   }
 
@@ -184,7 +184,7 @@ public:
   uint64_t getVBaseClassOffset(const CXXRecordDecl *VBase) const {
     assert(CXXInfo && "Record layout does not have C++ specific info!");
     assert(CXXInfo->VBaseOffsets.count(VBase) && "Did not find base!");
-    
+
     return CXXInfo->VBaseOffsets[VBase];
   }
 };

+ 6 - 6
include/clang/AST/Redeclarable.h

@@ -26,10 +26,10 @@ protected:
   struct DeclLink : public llvm::PointerIntPair<decl_type *, 1, bool> {
     DeclLink(decl_type *D, bool isLatest)
       : llvm::PointerIntPair<decl_type *, 1, bool>(D, isLatest) { }
-    
+
     typedef llvm::PointerIntPair<decl_type *, 1, bool> base_type;
 
-    bool NextIsPrevious() const { return base_type::getInt() == false; }         
+    bool NextIsPrevious() const { return base_type::getInt() == false; }
     bool NextIsLatest() const { return base_type::getInt() == true; }
     decl_type *getNext() const { return base_type::getPointer(); }
   };
@@ -69,7 +69,7 @@ public:
     return const_cast<decl_type *>(
                  static_cast<const decl_type*>(this))->getPreviousDeclaration();
   }
-  
+
   /// \brief Return the first declaration of this declaration or itself if this
   /// is the only declaration.
   decl_type *getFirstDeclaration() {
@@ -91,7 +91,7 @@ public:
       assert(First->RedeclLink.NextIsLatest() && "Expected first");
     } else {
       // Make this first.
-      First = static_cast<decl_type*>(this); 
+      First = static_cast<decl_type*>(this);
     }
 
     // First one will point to this one as latest.
@@ -131,10 +131,10 @@ public:
       return tmp;
     }
 
-    friend bool operator==(redecl_iterator x, redecl_iterator y) { 
+    friend bool operator==(redecl_iterator x, redecl_iterator y) {
       return x.Current == y.Current;
     }
-    friend bool operator!=(redecl_iterator x, redecl_iterator y) { 
+    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
       return x.Current != y.Current;
     }
   };

Файловите разлики са ограничени, защото са твърде много
+ 198 - 198
include/clang/AST/Stmt.h


+ 14 - 14
include/clang/AST/StmtGraphTraits.h

@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines a template specialization of llvm::GraphTraits to 
+//  This file defines a template specialization of llvm::GraphTraits to
 //  treat ASTs (Stmt*) as graphs
 //
 //===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@
 #include "llvm/ADT/DepthFirstIterator.h"
 
 namespace llvm {
-  
+
 //template <typename T> struct GraphTraits;
 
 
@@ -28,23 +28,23 @@ template <> struct GraphTraits<clang::Stmt*> {
   typedef clang::Stmt                       NodeType;
   typedef clang::Stmt::child_iterator       ChildIteratorType;
   typedef llvm::df_iterator<clang::Stmt*>   nodes_iterator;
-    
+
   static NodeType* getEntryNode(clang::Stmt* S) { return S; }
-  
+
   static inline ChildIteratorType child_begin(NodeType* N) {
     if (N) return N->child_begin();
     else return ChildIteratorType();
   }
-  
+
   static inline ChildIteratorType child_end(NodeType* N) {
     if (N) return N->child_end();
     else return ChildIteratorType();
   }
-  
+
   static nodes_iterator nodes_begin(clang::Stmt* S) {
     return df_begin(S);
   }
-  
+
   static nodes_iterator nodes_end(clang::Stmt* S) {
     return df_end(S);
   }
@@ -55,29 +55,29 @@ template <> struct GraphTraits<const clang::Stmt*> {
   typedef const clang::Stmt                       NodeType;
   typedef clang::Stmt::const_child_iterator       ChildIteratorType;
   typedef llvm::df_iterator<const clang::Stmt*>   nodes_iterator;
-  
+
   static NodeType* getEntryNode(const clang::Stmt* S) { return S; }
-  
+
   static inline ChildIteratorType child_begin(NodeType* N) {
     if (N) return N->child_begin();
-    else return ChildIteratorType();    
+    else return ChildIteratorType();
   }
-  
+
   static inline ChildIteratorType child_end(NodeType* N) {
     if (N) return N->child_end();
     else return ChildIteratorType();
   }
-  
+
   static nodes_iterator nodes_begin(const clang::Stmt* S) {
     return df_begin(S);
   }
-  
+
   static nodes_iterator nodes_end(const clang::Stmt* S) {
     return df_end(S);
   }
 };
 
-  
+
 } // end namespace llvm
 
 #endif

+ 31 - 31
include/clang/AST/StmtIterator.h

@@ -23,45 +23,45 @@ namespace clang {
 class Stmt;
 class Decl;
 class VariableArrayType;
-  
+
 class StmtIteratorBase {
 protected:
   enum { DeclMode = 0x1, SizeOfTypeVAMode = 0x2, DeclGroupMode = 0x3,
          Flags = 0x3 };
-  
+
   union { Stmt** stmt; Decl* decl; Decl** DGI; };
-  uintptr_t RawVAPtr;  
+  uintptr_t RawVAPtr;
   Decl** DGE;
 
   bool inDecl() const {
     return (RawVAPtr & Flags) == DeclMode;
   }
-  
+
   bool inDeclGroup() const {
     return (RawVAPtr & Flags) == DeclGroupMode;
   }
-  
-  bool inSizeOfTypeVA() const { 
+
+  bool inSizeOfTypeVA() const {
     return (RawVAPtr & Flags) == SizeOfTypeVAMode;
   }
-  
+
   bool inStmt() const {
     return (RawVAPtr & Flags) == 0;
   }
-    
+
   VariableArrayType* getVAPtr() const {
     return reinterpret_cast<VariableArrayType*>(RawVAPtr & ~Flags);
   }
-  
+
   void setVAPtr(VariableArrayType* P) {
-    assert (inDecl() || inDeclGroup() || inSizeOfTypeVA());    
+    assert (inDecl() || inDeclGroup() || inSizeOfTypeVA());
     RawVAPtr = reinterpret_cast<uintptr_t>(P) | (RawVAPtr & Flags);
   }
-  
+
   void NextDecl(bool ImmediateAdvance = true);
   bool HandleDecl(Decl* D);
   void NextVA();
-  
+
   Stmt*& GetDeclExpr() const;
 
   StmtIteratorBase(Stmt** s) : stmt(s), RawVAPtr(0) {}
@@ -70,22 +70,22 @@ protected:
   StmtIteratorBase(Decl** dgi, Decl** dge);
   StmtIteratorBase() : stmt(NULL), RawVAPtr(0) {}
 };
-  
-  
+
+
 template <typename DERIVED, typename REFERENCE>
-class StmtIteratorImpl : public StmtIteratorBase, 
+class StmtIteratorImpl : public StmtIteratorBase,
                          public std::iterator<std::forward_iterator_tag,
-                                              REFERENCE, ptrdiff_t, 
-                                              REFERENCE, REFERENCE> {  
+                                              REFERENCE, ptrdiff_t,
+                                              REFERENCE, REFERENCE> {
 protected:
   StmtIteratorImpl(const StmtIteratorBase& RHS) : StmtIteratorBase(RHS) {}
 public:
-  StmtIteratorImpl() {}                                                
+  StmtIteratorImpl() {}
   StmtIteratorImpl(Stmt** s) : StmtIteratorBase(s) {}
   StmtIteratorImpl(Decl** dgi, Decl** dge) : StmtIteratorBase(dgi, dge) {}
   StmtIteratorImpl(Decl* d) : StmtIteratorBase(d) {}
   StmtIteratorImpl(VariableArrayType* t) : StmtIteratorBase(t) {}
-  
+
   DERIVED& operator++() {
     if (inDecl() || inDeclGroup()) {
       if (getVAPtr()) NextVA();
@@ -95,36 +95,36 @@ public:
       NextVA();
     else
       ++stmt;
-      
+
     return static_cast<DERIVED&>(*this);
   }
-    
+
   DERIVED operator++(int) {
     DERIVED tmp = static_cast<DERIVED&>(*this);
     operator++();
     return tmp;
   }
-  
+
   bool operator==(const DERIVED& RHS) const {
     return stmt == RHS.stmt && RawVAPtr == RHS.RawVAPtr;
   }
-  
+
   bool operator!=(const DERIVED& RHS) const {
     return stmt != RHS.stmt || RawVAPtr != RHS.RawVAPtr;
   }
-  
-  REFERENCE operator*() const { 
+
+  REFERENCE operator*() const {
     return (REFERENCE) (inStmt() ? *stmt : GetDeclExpr());
   }
-  
-  REFERENCE operator->() const { return operator*(); }   
+
+  REFERENCE operator->() const { return operator*(); }
 };
 
 struct StmtIterator : public StmtIteratorImpl<StmtIterator,Stmt*&> {
   explicit StmtIterator() : StmtIteratorImpl<StmtIterator,Stmt*&>() {}
 
   StmtIterator(Stmt** S) : StmtIteratorImpl<StmtIterator,Stmt*&>(S) {}
-  StmtIterator(Decl** dgi, Decl** dge) 
+  StmtIterator(Decl** dgi, Decl** dge)
    : StmtIteratorImpl<StmtIterator,Stmt*&>(dgi, dge) {}
 
   StmtIterator(VariableArrayType* t):StmtIteratorImpl<StmtIterator,Stmt*&>(t) {}
@@ -133,10 +133,10 @@ struct StmtIterator : public StmtIteratorImpl<StmtIterator,Stmt*&> {
 
 struct ConstStmtIterator : public StmtIteratorImpl<ConstStmtIterator,
                                                    const Stmt*> {
-  explicit ConstStmtIterator() : 
+  explicit ConstStmtIterator() :
     StmtIteratorImpl<ConstStmtIterator,const Stmt*>() {}
-                                                     
-  ConstStmtIterator(const StmtIterator& RHS) : 
+
+  ConstStmtIterator(const StmtIterator& RHS) :
     StmtIteratorImpl<ConstStmtIterator,const Stmt*>(RHS) {}
 };
 

+ 95 - 95
include/clang/AST/StmtObjC.h

@@ -27,47 +27,47 @@ class ObjCForCollectionStmt : public Stmt {
   SourceLocation ForLoc;
   SourceLocation RParenLoc;
 public:
-  ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body, 
+  ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body,
                         SourceLocation FCL, SourceLocation RPL);
-  explicit ObjCForCollectionStmt(EmptyShell Empty) : 
+  explicit ObjCForCollectionStmt(EmptyShell Empty) :
     Stmt(ObjCForCollectionStmtClass, Empty) { }
-  
+
   Stmt *getElement() { return SubExprs[ELEM]; }
-  Expr *getCollection() { 
-    return reinterpret_cast<Expr*>(SubExprs[COLLECTION]); 
+  Expr *getCollection() {
+    return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
   }
   Stmt *getBody() { return SubExprs[BODY]; }
-  
+
   const Stmt *getElement() const { return SubExprs[ELEM]; }
-  const Expr *getCollection() const { 
+  const Expr *getCollection() const {
     return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
   }
   const Stmt *getBody() const { return SubExprs[BODY]; }
-  
+
   void setElement(Stmt *S) { SubExprs[ELEM] = S; }
-  void setCollection(Expr *E) { 
+  void setCollection(Expr *E) {
     SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(E);
   }
   void setBody(Stmt *S) { SubExprs[BODY] = S; }
-  
+
   SourceLocation getForLoc() const { return ForLoc; }
   void setForLoc(SourceLocation Loc) { ForLoc = Loc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
-  
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd()); 
+
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd());
   }
-  static bool classof(const Stmt *T) { 
-    return T->getStmtClass() == ObjCForCollectionStmtClass; 
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == ObjCForCollectionStmtClass;
   }
   static bool classof(const ObjCForCollectionStmt *) { return true; }
-  
+
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
-};  
-  
+};
+
 /// ObjCAtCatchStmt - This represents objective-c's @catch statement.
 class ObjCAtCatchStmt : public Stmt {
 private:
@@ -78,95 +78,95 @@ private:
 
 public:
   ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
-                  ParmVarDecl *catchVarDecl, 
+                  ParmVarDecl *catchVarDecl,
                   Stmt *atCatchStmt, Stmt *atCatchList);
 
-  explicit ObjCAtCatchStmt(EmptyShell Empty) : 
+  explicit ObjCAtCatchStmt(EmptyShell Empty) :
     Stmt(ObjCAtCatchStmtClass, Empty) { }
-  
+
   const Stmt *getCatchBody() const { return SubExprs[BODY]; }
   Stmt *getCatchBody() { return SubExprs[BODY]; }
   void setCatchBody(Stmt *S) { SubExprs[BODY] = S; }
-  
+
   const ObjCAtCatchStmt *getNextCatchStmt() const {
     return static_cast<const ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
   }
-  ObjCAtCatchStmt *getNextCatchStmt() { 
+  ObjCAtCatchStmt *getNextCatchStmt() {
     return static_cast<ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
   }
   void setNextCatchStmt(Stmt *S) { SubExprs[NEXT_CATCH] = S; }
-  
-  const ParmVarDecl *getCatchParamDecl() const { 
-    return ExceptionDecl; 
+
+  const ParmVarDecl *getCatchParamDecl() const {
+    return ExceptionDecl;
   }
-  ParmVarDecl *getCatchParamDecl() { 
-    return ExceptionDecl; 
+  ParmVarDecl *getCatchParamDecl() {
+    return ExceptionDecl;
   }
   void setCatchParamDecl(ParmVarDecl *D) { ExceptionDecl = D; }
-  
+
   SourceLocation getAtCatchLoc() const { return AtCatchLoc; }
   void setAtCatchLoc(SourceLocation Loc) { AtCatchLoc = Loc; }
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
-  
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(AtCatchLoc, SubExprs[BODY]->getLocEnd()); 
+
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(AtCatchLoc, SubExprs[BODY]->getLocEnd());
   }
 
   bool hasEllipsis() const { return getCatchParamDecl() == 0; }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCAtCatchStmtClass;
   }
   static bool classof(const ObjCAtCatchStmt *) { return true; }
-  
+
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
-/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement 
+
+/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement
 class ObjCAtFinallyStmt : public Stmt {
   Stmt *AtFinallyStmt;
-  SourceLocation AtFinallyLoc;    
+  SourceLocation AtFinallyLoc;
 public:
   ObjCAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt)
-  : Stmt(ObjCAtFinallyStmtClass), 
+  : Stmt(ObjCAtFinallyStmtClass),
     AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {}
 
-  explicit ObjCAtFinallyStmt(EmptyShell Empty) : 
+  explicit ObjCAtFinallyStmt(EmptyShell Empty) :
     Stmt(ObjCAtFinallyStmtClass, Empty) { }
-  
+
   const Stmt *getFinallyBody() const { return AtFinallyStmt; }
   Stmt *getFinallyBody() { return AtFinallyStmt; }
   void setFinallyBody(Stmt *S) { AtFinallyStmt = S; }
-  
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd()); 
+
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd());
   }
-  
+
   SourceLocation getAtFinallyLoc() const { return AtFinallyLoc; }
   void setAtFinallyLoc(SourceLocation Loc) { AtFinallyLoc = Loc; }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCAtFinallyStmtClass;
   }
   static bool classof(const ObjCAtFinallyStmt *) { return true; }
-  
+
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
-/// ObjCAtTryStmt - This represent objective-c's over-all 
+
+/// ObjCAtTryStmt - This represent objective-c's over-all
 /// @try ... @catch ... @finally statement.
 class ObjCAtTryStmt : public Stmt {
 private:
   enum { TRY, CATCH, FINALLY, END_EXPR };
-  Stmt* SubStmts[END_EXPR]; 
-  
-  SourceLocation AtTryLoc;      
+  Stmt* SubStmts[END_EXPR];
+
+  SourceLocation AtTryLoc;
 public:
-  ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt, 
-                Stmt *atCatchStmt, 
+  ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
+                Stmt *atCatchStmt,
                 Stmt *atFinallyStmt)
   : Stmt(ObjCAtTryStmtClass) {
       SubStmts[TRY] = atTryStmt;
@@ -174,41 +174,41 @@ public:
       SubStmts[FINALLY] = atFinallyStmt;
       AtTryLoc = atTryLoc;
     }
-  explicit ObjCAtTryStmt(EmptyShell Empty) : 
+  explicit ObjCAtTryStmt(EmptyShell Empty) :
     Stmt(ObjCAtTryStmtClass, Empty) { }
-    
+
   SourceLocation getAtTryLoc() const { return AtTryLoc; }
   void setAtTryLoc(SourceLocation Loc) { AtTryLoc = Loc; }
-  
+
   const Stmt *getTryBody() const { return SubStmts[TRY]; }
   Stmt *getTryBody() { return SubStmts[TRY]; }
   void setTryBody(Stmt *S) { SubStmts[TRY] = S; }
-  
-  const ObjCAtCatchStmt *getCatchStmts() const { 
-    return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]); 
+
+  const ObjCAtCatchStmt *getCatchStmts() const {
+    return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
   }
-  ObjCAtCatchStmt *getCatchStmts() { 
-    return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]); 
+  ObjCAtCatchStmt *getCatchStmts() {
+    return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
   }
   void setCatchStmts(Stmt *S) { SubStmts[CATCH] = S; }
-  
-  const ObjCAtFinallyStmt *getFinallyStmt() const { 
-    return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]); 
+
+  const ObjCAtFinallyStmt *getFinallyStmt() const {
+    return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
   }
-  ObjCAtFinallyStmt *getFinallyStmt() { 
-    return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]); 
+  ObjCAtFinallyStmt *getFinallyStmt() {
+    return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
   }
   void setFinallyStmt(Stmt *S) { SubStmts[FINALLY] = S; }
 
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(AtTryLoc, SubStmts[TRY]->getLocEnd()); 
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(AtTryLoc, SubStmts[TRY]->getLocEnd());
   }
-    
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCAtTryStmtClass;
   }
   static bool classof(const ObjCAtTryStmt *) { return true; }
-    
+
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
@@ -223,7 +223,7 @@ private:
   enum { SYNC_EXPR, SYNC_BODY, END_EXPR };
   Stmt* SubStmts[END_EXPR];
   SourceLocation AtSynchronizedLoc;
-  
+
 public:
   ObjCAtSynchronizedStmt(SourceLocation atSynchronizedLoc, Stmt *synchExpr,
                          Stmt *synchBody)
@@ -232,41 +232,41 @@ public:
     SubStmts[SYNC_BODY] = synchBody;
     AtSynchronizedLoc = atSynchronizedLoc;
   }
-  explicit ObjCAtSynchronizedStmt(EmptyShell Empty) : 
+  explicit ObjCAtSynchronizedStmt(EmptyShell Empty) :
     Stmt(ObjCAtSynchronizedStmtClass, Empty) { }
-  
+
   SourceLocation getAtSynchronizedLoc() const { return AtSynchronizedLoc; }
   void setAtSynchronizedLoc(SourceLocation Loc) { AtSynchronizedLoc = Loc; }
-  
+
   const CompoundStmt *getSynchBody() const {
     return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
   }
-  CompoundStmt *getSynchBody() { 
-    return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]); 
+  CompoundStmt *getSynchBody() {
+    return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
   }
   void setSynchBody(Stmt *S) { SubStmts[SYNC_BODY] = S; }
-  
-  const Expr *getSynchExpr() const { 
-    return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]); 
+
+  const Expr *getSynchExpr() const {
+    return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
   }
-  Expr *getSynchExpr() { 
-    return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]); 
+  Expr *getSynchExpr() {
+    return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
   }
   void setSynchExpr(Stmt *S) { SubStmts[SYNC_EXPR] = S; }
-  
-  virtual SourceRange getSourceRange() const { 
-    return SourceRange(AtSynchronizedLoc, getSynchBody()->getLocEnd()); 
+
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(AtSynchronizedLoc, getSynchBody()->getLocEnd());
   }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCAtSynchronizedStmtClass;
   }
   static bool classof(const ObjCAtSynchronizedStmt *) { return true; }
-  
+
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };
-  
+
 /// ObjCAtThrowStmt - This represents objective-c's @throw statement.
 class ObjCAtThrowStmt : public Stmt {
   Stmt *Throw;
@@ -276,28 +276,28 @@ public:
   : Stmt(ObjCAtThrowStmtClass), Throw(throwExpr) {
     AtThrowLoc = atThrowLoc;
   }
-  explicit ObjCAtThrowStmt(EmptyShell Empty) : 
+  explicit ObjCAtThrowStmt(EmptyShell Empty) :
     Stmt(ObjCAtThrowStmtClass, Empty) { }
-  
+
   const Expr *getThrowExpr() const { return reinterpret_cast<Expr*>(Throw); }
   Expr *getThrowExpr() { return reinterpret_cast<Expr*>(Throw); }
   void setThrowExpr(Stmt *S) { Throw = S; }
-  
+
   SourceLocation getThrowLoc() { return AtThrowLoc; }
   void setThrowLoc(SourceLocation Loc) { AtThrowLoc = Loc; }
-  
+
   virtual SourceRange getSourceRange() const {
     if (Throw)
-      return SourceRange(AtThrowLoc, Throw->getLocEnd()); 
-    else 
+      return SourceRange(AtThrowLoc, Throw->getLocEnd());
+    else
       return SourceRange(AtThrowLoc);
   }
-  
+
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == ObjCAtThrowStmtClass;
   }
   static bool classof(const ObjCAtThrowStmt *) { return true; }
-  
+
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
 };

+ 10 - 10
include/clang/AST/StmtVisitor.h

@@ -20,17 +20,17 @@
 #include "clang/AST/StmtObjC.h"
 
 namespace clang {
-  
+
 #define DISPATCH(NAME, CLASS) \
   return static_cast<ImplClass*>(this)->Visit ## NAME(static_cast<CLASS*>(S))
-  
+
 /// StmtVisitor - This class implements a simple visitor for Stmt subclasses.
 /// Since Expr derives from Stmt, this also includes support for visiting Exprs.
 template<typename ImplClass, typename RetTy=void>
 class StmtVisitor {
 public:
   RetTy Visit(Stmt *S) {
-    
+
     // If we have a binary expr, dispatch to the subcode of the binop.  A smart
     // optimizer (e.g. LLVM) will fold this comparison into the switch stmt
     // below.
@@ -53,7 +53,7 @@ public:
       case BinaryOperator::GE:        DISPATCH(BinGE,        BinaryOperator);
       case BinaryOperator::EQ:        DISPATCH(BinEQ,        BinaryOperator);
       case BinaryOperator::NE:        DISPATCH(BinNE,        BinaryOperator);
-        
+
       case BinaryOperator::And:       DISPATCH(BinAnd,       BinaryOperator);
       case BinaryOperator::Xor:       DISPATCH(BinXor,       BinaryOperator);
       case BinaryOperator::Or :       DISPATCH(BinOr,        BinaryOperator);
@@ -101,7 +101,7 @@ public:
       case UnaryOperator::OffsetOf:     DISPATCH(UnaryOffsetOf,  UnaryOperator);
       }
     }
-    
+
     // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
     switch (S->getStmtClass()) {
     default: assert(0 && "Unknown stmt kind!");
@@ -110,7 +110,7 @@ public:
 #include "clang/AST/StmtNodes.def"
     }
   }
-  
+
   // If the implementation chooses not to implement a certain visit method, fall
   // back on VisitExpr or whatever else is the superclass.
 #define STMT(CLASS, PARENT)                                   \
@@ -127,7 +127,7 @@ public:
   BINOP_FALLBACK(Mul)   BINOP_FALLBACK(Div)  BINOP_FALLBACK(Rem)
   BINOP_FALLBACK(Add)   BINOP_FALLBACK(Sub)  BINOP_FALLBACK(Shl)
   BINOP_FALLBACK(Shr)
-  
+
   BINOP_FALLBACK(LT)    BINOP_FALLBACK(GT)   BINOP_FALLBACK(LE)
   BINOP_FALLBACK(GE)    BINOP_FALLBACK(EQ)   BINOP_FALLBACK(NE)
   BINOP_FALLBACK(And)   BINOP_FALLBACK(Xor)  BINOP_FALLBACK(Or)
@@ -148,7 +148,7 @@ public:
   CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign)
   CAO_FALLBACK(XorAssign)
 #undef CAO_FALLBACK
-  
+
   // If the implementation doesn't implement unary operator methods, fall back
   // on VisitUnaryOperator.
 #define UNARYOP_FALLBACK(NAME) \
@@ -158,13 +158,13 @@ public:
   UNARYOP_FALLBACK(PostInc)   UNARYOP_FALLBACK(PostDec)
   UNARYOP_FALLBACK(PreInc)    UNARYOP_FALLBACK(PreDec)
   UNARYOP_FALLBACK(AddrOf)    UNARYOP_FALLBACK(Deref)
-  
+
   UNARYOP_FALLBACK(Plus)      UNARYOP_FALLBACK(Minus)
   UNARYOP_FALLBACK(Not)       UNARYOP_FALLBACK(LNot)
   UNARYOP_FALLBACK(Real)      UNARYOP_FALLBACK(Imag)
   UNARYOP_FALLBACK(Extension) UNARYOP_FALLBACK(OffsetOf)
 #undef UNARYOP_FALLBACK
-  
+
   // Base case, ignore it. :)
   RetTy VisitStmt(Stmt *Node) { return RetTy(); }
 };

+ 19 - 19
include/clang/AST/TemplateName.h

@@ -61,7 +61,7 @@ class OverloadedFunctionDecl;
 /// only be understood in the context of
 class TemplateName {
   typedef llvm::PointerUnion4<TemplateDecl *, OverloadedFunctionDecl *,
-                              QualifiedTemplateName *, 
+                              QualifiedTemplateName *,
                               DependentTemplateName *> StorageType;
 
   StorageType Storage;
@@ -80,25 +80,25 @@ public:
 
   /// \brief Determine whether this template name is NULL.
   bool isNull() const { return Storage.isNull(); }
-  
+
   /// \brief Retrieve the the underlying template declaration that
   /// this template name refers to, if known.
   ///
   /// \returns The template declaration that this template name refers
   /// to, if any. If the template name does not refer to a specific
-  /// declaration because it is a dependent name, or if it refers to a 
+  /// declaration because it is a dependent name, or if it refers to a
   /// set of function templates, returns NULL.
   TemplateDecl *getAsTemplateDecl() const;
 
-  /// \brief Retrieve the the underlying, overloaded function template 
+  /// \brief Retrieve the the underlying, overloaded function template
   // declarations that this template name refers to, if known.
   ///
-  /// \returns The set of overloaded function templates that this template 
-  /// name refers to, if known. If the template name does not refer to a 
+  /// \returns The set of overloaded function templates that this template
+  /// name refers to, if known. If the template name does not refer to a
   /// specific set of function templates because it is a dependent name or
   /// refers to a single template, returns NULL.
   OverloadedFunctionDecl *getAsOverloadedFunctionDecl() const;
-  
+
   /// \brief Retrieve the underlying qualified template name
   /// structure, if any.
   QualifiedTemplateName *getAsQualifiedTemplateName() const {
@@ -137,8 +137,8 @@ public:
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
 
   /// \brief Build a template name from a void pointer.
-  static TemplateName getFromVoidPointer(void *Ptr) { 
-    return TemplateName(Ptr); 
+  static TemplateName getFromVoidPointer(void *Ptr) {
+    return TemplateName(Ptr);
   }
 };
 
@@ -171,14 +171,14 @@ class QualifiedTemplateName : public llvm::FoldingSetNode {
 
   QualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword,
                         TemplateDecl *Template)
-    : Qualifier(NNS, TemplateKeyword? 1 : 0), 
+    : Qualifier(NNS, TemplateKeyword? 1 : 0),
       Template(reinterpret_cast<NamedDecl *>(Template)) { }
 
   QualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword,
                         OverloadedFunctionDecl *Template)
-  : Qualifier(NNS, TemplateKeyword? 1 : 0), 
+  : Qualifier(NNS, TemplateKeyword? 1 : 0),
     Template(reinterpret_cast<NamedDecl *>(Template)) { }
-  
+
 public:
   /// \brief Return the nested name specifier that qualifies this name.
   NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
@@ -190,22 +190,22 @@ public:
   /// \brief The template declaration or set of overloaded functions that
   /// that qualified name refers to.
   NamedDecl *getDecl() const { return Template; }
-  
+
   /// \brief The template declaration to which this qualified name
   /// refers, or NULL if this qualified name refers to a set of overloaded
   /// function templates.
   TemplateDecl *getTemplateDecl() const;
 
   /// \brief The set of overloaded function tempaltes to which this qualified
-  /// name refers, or NULL if this qualified name refers to a single 
+  /// name refers, or NULL if this qualified name refers to a single
   /// template declaration.
   OverloadedFunctionDecl *getOverloadedFunctionDecl() const;
-  
+
   void Profile(llvm::FoldingSetNodeID &ID) {
     Profile(ID, getQualifier(), hasTemplateKeyword(), getDecl());
   }
 
-  static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, 
+  static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
                       bool TemplateKeyword, NamedDecl *Template) {
     ID.AddPointer(NNS);
     ID.AddBoolean(TemplateKeyword);
@@ -239,11 +239,11 @@ class DependentTemplateName : public llvm::FoldingSetNode {
 
   friend class ASTContext;
 
-  DependentTemplateName(NestedNameSpecifier *Qualifier, 
+  DependentTemplateName(NestedNameSpecifier *Qualifier,
                         const IdentifierInfo *Name)
     : Qualifier(Qualifier), Name(Name), CanonicalTemplateName(this) { }
 
-  DependentTemplateName(NestedNameSpecifier *Qualifier, 
+  DependentTemplateName(NestedNameSpecifier *Qualifier,
                         const IdentifierInfo *Name,
                         TemplateName Canon)
     : Qualifier(Qualifier), Name(Name), CanonicalTemplateName(Canon) { }
@@ -260,7 +260,7 @@ public:
     Profile(ID, getQualifier(), getName());
   }
 
-  static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, 
+  static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
                       const IdentifierInfo *Name) {
     ID.AddPointer(NNS);
     ID.AddPointer(Name);

Файловите разлики са ограничени, защото са твърде много
+ 181 - 181
include/clang/AST/Type.h


+ 5 - 5
include/clang/AST/TypeLoc.h

@@ -30,7 +30,7 @@ class TypeLoc {
 protected:
   QualType Ty;
   void *Data;
-  
+
   TypeLoc(QualType ty, void *data) : Ty(ty), Data(data) { }
   static TypeLoc Create(QualType ty, void *data) { return TypeLoc(ty,data); }
   friend class DeclaratorInfo;
@@ -86,7 +86,7 @@ public:
 class DeclaratorLoc : public TypeLoc  {
 public:
   /// \brief Find the TypeSpecLoc that is part of this DeclaratorLoc.
-  TypeSpecLoc getTypeSpecLoc() const;  
+  TypeSpecLoc getTypeSpecLoc() const;
 
   static bool classof(const TypeLoc *TL);
   static bool classof(const DeclaratorLoc *TL) { return true; }
@@ -98,7 +98,7 @@ class DefaultTypeSpecLoc : public TypeSpecLoc {
   struct Info {
     SourceLocation StartLoc;
   };
-  
+
 public:
   SourceLocation getStartLoc() const {
     return static_cast<Info*>(Data)->StartLoc;
@@ -137,7 +137,7 @@ public:
   SourceRange getSourceRange() const {
     return SourceRange(getNameLoc(), getNameLoc());
   }
-  
+
   /// \brief Returns the size of the type source info data block that is
   /// specific to this type.
   unsigned getLocalDataSize() const { return sizeof(Info); }
@@ -445,7 +445,7 @@ class TypeLocVisitor {
 #define TYPELOC(CLASS, PARENT, TYPE)                              \
     RetTy Visit##TYPE(TYPE *) {                                   \
       return Impl->Visit##CLASS(reinterpret_cast<CLASS&>(TyLoc)); \
-    } 
+    }
 #include "clang/AST/TypeLocNodes.def"
   };
 

+ 3 - 3
include/clang/AST/TypeOrdering.h

@@ -37,7 +37,7 @@ namespace llvm {
   template<> struct DenseMapInfo<clang::QualType> {
     static inline clang::QualType getEmptyKey() { return clang::QualType(); }
 
-    static inline clang::QualType getTombstoneKey() { 
+    static inline clang::QualType getTombstoneKey() {
       using clang::QualType;
       return QualType::getFromOpaquePtr(reinterpret_cast<clang::Type *>(-1));
     }
@@ -51,11 +51,11 @@ namespace llvm {
       return LHS == RHS;
     }
 
-    static bool isPod() { 
+    static bool isPod() {
       // QualType isn't *technically* a POD type. However, we can get
       // away with calling it a POD type since its copy constructor,
       // copy assignment operator, and destructor are all trivial.
-      return true; 
+      return true;
     }
   };
 }

+ 4 - 4
include/clang/AST/TypeVisitor.h

@@ -17,10 +17,10 @@
 #include "clang/AST/Type.h"
 
 namespace clang {
-  
+
 #define DISPATCH(CLASS) \
   return static_cast<ImplClass*>(this)->Visit ## CLASS(static_cast<CLASS*>(T))
-  
+
 template<typename ImplClass, typename RetTy=void>
 class TypeVisitor {
 public:
@@ -28,12 +28,12 @@ public:
     // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
     switch (T->getTypeClass()) {
     default: assert(0 && "Unknown type class!");
-#define ABSTRACT_TYPE(CLASS, PARENT) 
+#define ABSTRACT_TYPE(CLASS, PARENT)
 #define TYPE(CLASS, PARENT) case Type::CLASS: DISPATCH(CLASS##Type);
 #include "clang/AST/TypeNodes.def"
     }
   }
-    
+
   // If the implementation chooses not to implement a certain visit method, fall
   // back on superclass.
 #define TYPE(CLASS, PARENT) RetTy Visit##CLASS##Type(CLASS##Type *T) {       \

+ 21 - 21
include/clang/Analysis/Analyses/LiveVariables.h

@@ -23,7 +23,7 @@ namespace clang {
 class Stmt;
 class DeclRefExpr;
 class SourceManager;
-  
+
 struct LiveVariables_ValueTypes {
 
   struct ObserverTy;
@@ -35,77 +35,77 @@ struct LiveVariables_ValueTypes {
   // (so that we don't explore such expressions twice).  We also want
   // to compute liveness information for block-level expressions, since these
   // act as "temporary" values.
-  
+
   struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {
     ObserverTy* Observer;
     ValTy AlwaysLive;
-    
+
     AnalysisDataTy() : Observer(NULL) {}
   };
-  
+
   //===-----------------------------------------------------===//
   // ObserverTy - Observer for uninitialized values queries.
   //===-----------------------------------------------------===//
 
   struct ObserverTy {
     virtual ~ObserverTy() {}
-    
+
     /// ObserveStmt - A callback invoked right before invoking the
     ///  liveness transfer function on the given statement.
-    virtual void ObserveStmt(Stmt* S, const AnalysisDataTy& AD, 
+    virtual void ObserveStmt(Stmt* S, const AnalysisDataTy& AD,
                              const ValTy& V) {}
-    
+
     virtual void ObserverKill(DeclRefExpr* DR) {}
   };
 };
 
 class LiveVariables : public DataflowValues<LiveVariables_ValueTypes,
                                             dataflow::backward_analysis_tag> {
-                                              
-                                              
+
+
 public:
   typedef LiveVariables_ValueTypes::ObserverTy ObserverTy;
-    
+
   LiveVariables(ASTContext& Ctx, CFG& cfg);
-  
+
   /// IsLive - Return true if a variable is live at beginning of a
   /// specified block.
   bool isLive(const CFGBlock* B, const VarDecl* D) const;
-                                              
+
   /// IsLive - Returns true if a variable is live at the beginning of the
   ///  the statement.  This query only works if liveness information
   ///  has been recorded at the statement level (see runOnAllBlocks), and
   ///  only returns liveness information for block-level expressions.
   bool isLive(const Stmt* S, const VarDecl* D) const;
-                                              
+
   /// IsLive - Returns true the block-level expression "value" is live
   ///  before the given block-level expression (see runOnAllBlocks).
   bool isLive(const Stmt* Loc, const Stmt* StmtVal) const;
-  
+
   /// IsLive - Return true if a variable is live according to the
   ///  provided livness bitvector.
   bool isLive(const ValTy& V, const VarDecl* D) const;
-  
+
   /// dumpLiveness - Print to stderr the liveness information encoded
   ///  by a specified bitvector.
   void dumpLiveness(const ValTy& V, SourceManager& M) const;
-  
+
   /// dumpBlockLiveness - Print to stderr the liveness information
   ///  associated with each basic block.
   void dumpBlockLiveness(SourceManager& M) const;
-  
+
   /// getNumDecls - Return the number of variables (declarations) that
   ///  whose liveness status is being tracked by the dataflow
   ///  analysis.
   unsigned getNumDecls() const { return getAnalysisData().getNumDecls(); }
-    
+
   /// IntializeValues - This routine can perform extra initialization, but
   ///  for LiveVariables this does nothing since all that logic is in
-  ///  the constructor.                                              
+  ///  the constructor.
   void InitializeValues(const CFG& cfg) {}
-  
+
   void runOnCFG(CFG& cfg);
-                                              
+
   /// runOnAllBlocks - Propagate the dataflow values once for each block,
   ///  starting from the current dataflow values.  'recordStmtValues' indicates
   ///  whether the method should store dataflow values per each individual

+ 12 - 12
include/clang/Analysis/Analyses/UninitializedValues.h

@@ -24,7 +24,7 @@ namespace clang {
   class Expr;
   class DeclRefExpr;
   class VarDecl;
-  
+
 /// UninitializedValues_ValueTypes - Utility class to wrap type declarations
 ///   for dataflow values and dataflow analysis state for the
 ///   Unitialized Values analysis.
@@ -32,39 +32,39 @@ class UninitializedValues_ValueTypes {
 public:
 
   struct ObserverTy;
-  
-  struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {    
+
+  struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {
     AnalysisDataTy() : Observer(NULL), FullUninitTaint(true) {}
     virtual ~AnalysisDataTy() {};
-    
+
     ObserverTy* Observer;
     bool FullUninitTaint;
   };
-  
+
   typedef StmtDeclBitVector_Types::ValTy ValTy;
-  
+
   //===--------------------------------------------------------------------===//
   // ObserverTy - Observer for querying DeclRefExprs that use an uninitalized
   //   value.
   //===--------------------------------------------------------------------===//
-  
+
   struct ObserverTy {
     virtual ~ObserverTy();
-    virtual void ObserveDeclRefExpr(ValTy& Val, AnalysisDataTy& AD, 
+    virtual void ObserveDeclRefExpr(ValTy& Val, AnalysisDataTy& AD,
                                     DeclRefExpr* DR, VarDecl* VD) = 0;
-  };  
+  };
 };
 
 /// UninitializedValues - Objects of this class encapsulate dataflow analysis
 ///  information regarding what variable declarations in a function are
 ///  potentially unintialized.
-class UninitializedValues : 
-  public DataflowValues<UninitializedValues_ValueTypes> {  
+class UninitializedValues :
+  public DataflowValues<UninitializedValues_ValueTypes> {
 public:
   typedef UninitializedValues_ValueTypes::ObserverTy ObserverTy;
 
   UninitializedValues(CFG &cfg) { getAnalysisData().setCFG(cfg); }
-  
+
   /// IntializeValues - Create initial dataflow values and meta data for
   ///  a given CFG.  This is intended to be called by the dataflow solver.
   void InitializeValues(const CFG& cfg);

+ 1 - 1
include/clang/Analysis/AnalysisDiagnostic.h

@@ -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 ANALYSISSTART

+ 66 - 66
include/clang/Analysis/CFG.h

@@ -65,27 +65,27 @@ class CFGBlock {
   ///  statements in the block.  When this variable is non-NULL, it is
   ///  either an instance of LabelStmt or SwitchCase.
   Stmt *Label;
-  
+
   /// Terminator - The terminator for a basic block that
   ///  indicates the type of control-flow that occurs between a block
   ///  and its successors.
   Stmt *Terminator;
-  
+
   /// LoopTarget - Some blocks are used to represent the "loop edge" to
   ///  the start of a loop from within the loop body.  This Stmt* will be
   ///  refer to the loop statement for such blocks (and be null otherwise).
-  const Stmt *LoopTarget; 
-  
+  const Stmt *LoopTarget;
+
   /// BlockID - A numerical ID assigned to a CFGBlock during construction
   ///   of the CFG.
   unsigned BlockID;
-  
+
   /// Predecessors/Successors - Keep track of the predecessor / successor
   /// CFG blocks.
   typedef std::vector<CFGBlock*> AdjacentBlocks;
   AdjacentBlocks Preds;
   AdjacentBlocks Succs;
-  
+
 public:
   explicit CFGBlock(unsigned blockid) : Label(NULL), Terminator(NULL),
                                         LoopTarget(NULL), BlockID(blockid) {}
@@ -96,25 +96,25 @@ public:
   typedef StatementListTy::const_iterator                      const_iterator;
   typedef std::reverse_iterator<const_iterator>        const_reverse_iterator;
   typedef std::reverse_iterator<iterator>                    reverse_iterator;
-  
+
   Stmt*                        front()       const { return Stmts.front();   }
   Stmt*                        back()        const { return Stmts.back();    }
-  
+
   iterator                     begin()             { return Stmts.begin();   }
   iterator                     end()               { return Stmts.end();     }
   const_iterator               begin()       const { return Stmts.begin();   }
-  const_iterator               end()         const { return Stmts.end();     } 
+  const_iterator               end()         const { return Stmts.end();     }
 
   reverse_iterator             rbegin()            { return Stmts.rbegin();  }
   reverse_iterator             rend()              { return Stmts.rend();    }
   const_reverse_iterator       rbegin()      const { return Stmts.rbegin();  }
   const_reverse_iterator       rend()        const { return Stmts.rend();    }
-  
+
   unsigned                     size()        const { return Stmts.size();    }
   bool                         empty()       const { return Stmts.empty();   }
 
   Stmt*  operator[](size_t i) const  { assert (i < size()); return Stmts[i]; }
-  
+
   // CFG iterators
   typedef AdjacentBlocks::iterator                              pred_iterator;
   typedef AdjacentBlocks::const_iterator                  const_pred_iterator;
@@ -125,22 +125,22 @@ public:
   typedef AdjacentBlocks::const_iterator                  const_succ_iterator;
   typedef AdjacentBlocks::reverse_iterator              succ_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_succ_reverse_iterator;
-  
+
   pred_iterator                pred_begin()        { return Preds.begin();   }
   pred_iterator                pred_end()          { return Preds.end();     }
   const_pred_iterator          pred_begin()  const { return Preds.begin();   }
   const_pred_iterator          pred_end()    const { return Preds.end();     }
-  
+
   pred_reverse_iterator        pred_rbegin()       { return Preds.rbegin();  }
-  pred_reverse_iterator        pred_rend()         { return Preds.rend();    }  
+  pred_reverse_iterator        pred_rend()         { return Preds.rend();    }
   const_pred_reverse_iterator  pred_rbegin() const { return Preds.rbegin();  }
   const_pred_reverse_iterator  pred_rend()   const { return Preds.rend();    }
 
-  succ_iterator                succ_begin()        { return Succs.begin();   }    
+  succ_iterator                succ_begin()        { return Succs.begin();   }
   succ_iterator                succ_end()          { return Succs.end();     }
   const_succ_iterator          succ_begin()  const { return Succs.begin();   }
-  const_succ_iterator          succ_end()    const { return Succs.end();     }  
-    
+  const_succ_iterator          succ_end()    const { return Succs.end();     }
+
   succ_reverse_iterator        succ_rbegin()       { return Succs.rbegin();  }
   succ_reverse_iterator        succ_rend()         { return Succs.rend();    }
   const_succ_reverse_iterator  succ_rbegin() const { return Succs.rbegin();  }
@@ -151,9 +151,9 @@ public:
 
   unsigned                     pred_size()   const { return Preds.size();    }
   bool                         pred_empty()  const { return Preds.empty();   }
-  
+
   // Manipulation of block contents
-  
+
   void appendStmt(Stmt* Statement) { Stmts.push_back(Statement); }
   void setTerminator(Stmt* Statement) { Terminator = Statement; }
   void setLabel(Stmt* Statement) { Label = Statement; }
@@ -161,35 +161,35 @@ public:
 
   Stmt* getTerminator() { return Terminator; }
   const Stmt* getTerminator() const { return Terminator; }
-  
+
   Stmt* getTerminatorCondition();
-  
+
   const Stmt* getTerminatorCondition() const {
     return const_cast<CFGBlock*>(this)->getTerminatorCondition();
   }
-  
+
   const Stmt *getLoopTarget() const { return LoopTarget; }
-  
+
   bool hasBinaryBranchTerminator() const;
-  
+
   Stmt* getLabel() { return Label; }
   const Stmt* getLabel() const { return Label; }
-  
+
   void reverseStmts();
-  
+
   void addSuccessor(CFGBlock* Block) {
     if (Block)
       Block->Preds.push_back(this);
     Succs.push_back(Block);
   }
-  
+
   unsigned getBlockID() const { return BlockID; }
-  
+
   void dump(const CFG *cfg, const LangOptions &LO) const;
   void print(llvm::raw_ostream &OS, const CFG* cfg, const LangOptions &LO) const;
   void printTerminator(llvm::raw_ostream &OS, const LangOptions &LO) const;
 };
-  
+
 
 /// CFG - Represents a source-level, intra-procedural CFG that represents the
 ///  control-flow of a Stmt.  The Stmt can represent an entire function body,
@@ -205,28 +205,28 @@ public:
   //===--------------------------------------------------------------------===//
 
   /// buildCFG - Builds a CFG from an AST.  The responsibility to free the
-  ///   constructed CFG belongs to the caller.  
-  static CFG* buildCFG(Stmt* AST, ASTContext *C);  
-  
+  ///   constructed CFG belongs to the caller.
+  static CFG* buildCFG(Stmt* AST, ASTContext *C);
+
   /// createBlock - Create a new block in the CFG.  The CFG owns the block;
   ///  the caller should not directly free it.
   CFGBlock* createBlock();
-  
+
   /// setEntry - Set the entry block of the CFG.  This is typically used
   ///  only during CFG construction.  Most CFG clients expect that the
   ///  entry block has no predecessors and contains no statements.
   void setEntry(CFGBlock *B) { Entry = B; }
-  
+
   /// setIndirectGotoBlock - Set the block used for indirect goto jumps.
   ///  This is typically used only during CFG construction.
   void setIndirectGotoBlock(CFGBlock* B) { IndirectGotoBlock = B; }
-  
+
   //===--------------------------------------------------------------------===//
   // Block Iterators
   //===--------------------------------------------------------------------===//
 
   typedef std::list<CFGBlock>                      CFGBlockListTy;
-  
+
   typedef CFGBlockListTy::iterator                 iterator;
   typedef CFGBlockListTy::const_iterator           const_iterator;
   typedef std::reverse_iterator<iterator>          reverse_iterator;
@@ -234,17 +234,17 @@ public:
 
   CFGBlock&                 front()                { return Blocks.front(); }
   CFGBlock&                 back()                 { return Blocks.back(); }
-  
+
   iterator                  begin()                { return Blocks.begin(); }
   iterator                  end()                  { return Blocks.end(); }
   const_iterator            begin()       const    { return Blocks.begin(); }
-  const_iterator            end()         const    { return Blocks.end(); } 
-  
+  const_iterator            end()         const    { return Blocks.end(); }
+
   reverse_iterator          rbegin()               { return Blocks.rbegin(); }
   reverse_iterator          rend()                 { return Blocks.rend(); }
   const_reverse_iterator    rbegin()      const    { return Blocks.rbegin(); }
   const_reverse_iterator    rend()        const    { return Blocks.rend(); }
-  
+
   CFGBlock&                 getEntry()             { return *Entry; }
   const CFGBlock&           getEntry()    const    { return *Entry; }
   CFGBlock&                 getExit()              { return *Exit; }
@@ -252,18 +252,18 @@ public:
 
   CFGBlock*        getIndirectGotoBlock() { return IndirectGotoBlock; }
   const CFGBlock*  getIndirectGotoBlock() const { return IndirectGotoBlock; }
-  
+
   //===--------------------------------------------------------------------===//
   // Member templates useful for various batch operations over CFGs.
   //===--------------------------------------------------------------------===//
-  
+
   template <typename CALLBACK>
   void VisitBlockStmts(CALLBACK& O) const {
     for (const_iterator I=begin(), E=end(); I != E; ++I)
       for (CFGBlock::const_iterator BI=I->begin(), BE=I->end(); BI != BE; ++BI)
         O(*BI);
-  }  
-  
+  }
+
   //===--------------------------------------------------------------------===//
   // CFG Introspection.
   //===--------------------------------------------------------------------===//
@@ -275,11 +275,11 @@ public:
     operator bool() const { return Idx >= 0; }
     operator unsigned() const { assert(Idx >=0); return (unsigned) Idx; }
   };
-    
+
   bool          isBlkExpr(const Stmt* S) { return getBlkExprNum(S); }
   BlkExprNumTy  getBlkExprNum(const Stmt* S);
   unsigned      getNumBlkExprs();
-  
+
   /// getNumBlockIDs - Returns the total number of BlockIDs allocated (which
   /// start at 0).
   unsigned getNumBlockIDs() const { return NumBlockIDs; }
@@ -296,15 +296,15 @@ public:
   // Internal: constructors and data.
   //===--------------------------------------------------------------------===//
 
-  CFG() : Entry(NULL), Exit(NULL), IndirectGotoBlock(NULL), NumBlockIDs(0), 
+  CFG() : Entry(NULL), Exit(NULL), IndirectGotoBlock(NULL), NumBlockIDs(0),
           BlkExprMap(NULL) {};
-  
+
   ~CFG();
-  
+
   llvm::BumpPtrAllocator& getAllocator() {
     return Alloc;
   }
-    
+
 private:
   CFGBlock* Entry;
   CFGBlock* Exit;
@@ -312,14 +312,14 @@ private:
   // for indirect gotos
   CFGBlockListTy Blocks;
   unsigned  NumBlockIDs;
-  
+
   // BlkExprMap - An opaque pointer to prevent inclusion of DenseMap.h.
-  //  It represents a map from Expr* to integers to record the set of 
+  //  It represents a map from Expr* to integers to record the set of
   //  block-level expressions and their "statement number" in the CFG.
   void*     BlkExprMap;
-    
+
   /// Alloc - An internal allocator.
-  llvm::BumpPtrAllocator Alloc;  
+  llvm::BumpPtrAllocator Alloc;
 };
 } // end namespace clang
 
@@ -334,13 +334,13 @@ namespace llvm {
 template <> struct GraphTraits<clang::CFGBlock* > {
   typedef clang::CFGBlock NodeType;
   typedef clang::CFGBlock::succ_iterator ChildIteratorType;
-  
+
   static NodeType* getEntryNode(clang::CFGBlock* BB)
   { return BB; }
 
   static inline ChildIteratorType child_begin(NodeType* N)
   { return N->succ_begin(); }
-    
+
   static inline ChildIteratorType child_end(NodeType* N)
   { return N->succ_end(); }
 };
@@ -348,13 +348,13 @@ template <> struct GraphTraits<clang::CFGBlock* > {
 template <> struct GraphTraits<const clang::CFGBlock* > {
   typedef const clang::CFGBlock NodeType;
   typedef clang::CFGBlock::const_succ_iterator ChildIteratorType;
-  
+
   static NodeType* getEntryNode(const clang::CFGBlock* BB)
   { return BB; }
-  
+
   static inline ChildIteratorType child_begin(NodeType* N)
   { return N->succ_begin(); }
-  
+
   static inline ChildIteratorType child_end(NodeType* N)
   { return N->succ_end(); }
 };
@@ -368,27 +368,27 @@ template <> struct GraphTraits<Inverse<const clang::CFGBlock*> > {
 
   static inline ChildIteratorType child_begin(NodeType* N)
   { return N->pred_begin(); }
-  
+
   static inline ChildIteratorType child_end(NodeType* N)
   { return N->pred_end(); }
 };
 
 // Traits for: CFG
 
-template <> struct GraphTraits<clang::CFG* > 
+template <> struct GraphTraits<clang::CFG* >
             : public GraphTraits<clang::CFGBlock* >  {
 
   typedef clang::CFG::iterator nodes_iterator;
-  
-  static NodeType *getEntryNode(clang::CFG* F) { return &F->getEntry(); }  
+
+  static NodeType *getEntryNode(clang::CFG* F) { return &F->getEntry(); }
   static nodes_iterator nodes_begin(clang::CFG* F) { return F->begin(); }
   static nodes_iterator nodes_end(clang::CFG* F) { return F->end(); }
 };
 
-template <> struct GraphTraits< const clang::CFG* > 
+template <> struct GraphTraits< const clang::CFG* >
             : public GraphTraits< const clang::CFGBlock* >  {
 
-  typedef clang::CFG::const_iterator nodes_iterator;            
+  typedef clang::CFG::const_iterator nodes_iterator;
 
   static NodeType *getEntryNode( const clang::CFG* F) { return &F->getEntry(); }
   static nodes_iterator nodes_begin( const clang::CFG* F) { return F->begin(); }
@@ -404,7 +404,7 @@ template <> struct GraphTraits<Inverse<const clang::CFG*> >
   static nodes_iterator nodes_begin(const clang::CFG* F) { return F->begin();}
   static nodes_iterator nodes_end(const clang::CFG* F) { return F->end(); }
 };
-  
+
 } // end llvm namespace
 
 #endif

+ 50 - 50
include/clang/Analysis/FlowSensitive/DataflowSolver.h

@@ -33,15 +33,15 @@ public:
   /// enqueue - Add a block to the worklist.  Blocks already on the
   ///  worklist are not added a second time.
   void enqueue(const CFGBlock* B) { wlist.insert(B); }
-  
+
   /// dequeue - Remove a block from the worklist.
   const CFGBlock* dequeue() {
     assert (!wlist.empty());
     const CFGBlock* B = *wlist.begin();
     wlist.erase(B);
-    return B;          
+    return B;
   }
-  
+
   /// isEmpty - Return true if the worklist is empty.
   bool isEmpty() const { return wlist.empty(); }
 };
@@ -59,20 +59,20 @@ template <> struct ItrTraits<forward_analysis_tag> {
   typedef CFGBlock::const_pred_iterator PrevBItr;
   typedef CFGBlock::const_succ_iterator NextBItr;
   typedef CFGBlock::const_iterator      StmtItr;
-  
+
   static PrevBItr PrevBegin(const CFGBlock* B) { return B->pred_begin(); }
   static PrevBItr PrevEnd(const CFGBlock* B) { return B->pred_end(); }
-  
-  static NextBItr NextBegin(const CFGBlock* B) { return B->succ_begin(); }    
+
+  static NextBItr NextBegin(const CFGBlock* B) { return B->succ_begin(); }
   static NextBItr NextEnd(const CFGBlock* B) { return B->succ_end(); }
-  
+
   static StmtItr StmtBegin(const CFGBlock* B) { return B->begin(); }
   static StmtItr StmtEnd(const CFGBlock* B) { return B->end(); }
-  
+
   static BlockEdge PrevEdge(const CFGBlock* B, const CFGBlock* Prev) {
     return BlockEdge(Prev, B, 0);
   }
-  
+
   static BlockEdge NextEdge(const CFGBlock* B, const CFGBlock* Next) {
     return BlockEdge(B, Next, 0);
   }
@@ -82,20 +82,20 @@ template <> struct ItrTraits<backward_analysis_tag> {
   typedef CFGBlock::const_succ_iterator    PrevBItr;
   typedef CFGBlock::const_pred_iterator    NextBItr;
   typedef CFGBlock::const_reverse_iterator StmtItr;
-  
-  static PrevBItr PrevBegin(const CFGBlock* B) { return B->succ_begin(); }    
+
+  static PrevBItr PrevBegin(const CFGBlock* B) { return B->succ_begin(); }
   static PrevBItr PrevEnd(const CFGBlock* B) { return B->succ_end(); }
-  
-  static NextBItr NextBegin(const CFGBlock* B) { return B->pred_begin(); }    
+
+  static NextBItr NextBegin(const CFGBlock* B) { return B->pred_begin(); }
   static NextBItr NextEnd(const CFGBlock* B) { return B->pred_end(); }
-  
+
   static StmtItr StmtBegin(const CFGBlock* B) { return B->rbegin(); }
-  static StmtItr StmtEnd(const CFGBlock* B) { return B->rend(); }    
-  
+  static StmtItr StmtEnd(const CFGBlock* B) { return B->rend(); }
+
   static BlockEdge PrevEdge(const CFGBlock* B, const CFGBlock* Prev) {
     return BlockEdge(B, Prev, 0);
   }
-  
+
   static BlockEdge NextEdge(const CFGBlock* B, const CFGBlock* Next) {
     return BlockEdge(Next, B, 0);
   }
@@ -105,7 +105,7 @@ template <> struct ItrTraits<backward_analysis_tag> {
 //===----------------------------------------------------------------------===//
 /// DataflowSolverTy - Generic dataflow solver.
 //===----------------------------------------------------------------------===//
-  
+
 template <typename _DFValuesTy,      // Usually a subclass of DataflowValues
           typename _TransferFuncsTy,
           typename _MergeOperatorTy,
@@ -120,7 +120,7 @@ public:
   typedef _DFValuesTy                              DFValuesTy;
   typedef _TransferFuncsTy                         TransferFuncsTy;
   typedef _MergeOperatorTy                         MergeOperatorTy;
-  
+
   typedef typename _DFValuesTy::AnalysisDirTag     AnalysisDirTag;
   typedef typename _DFValuesTy::ValTy              ValTy;
   typedef typename _DFValuesTy::EdgeDataMapTy      EdgeDataMapTy;
@@ -130,24 +130,24 @@ public:
   typedef typename ItrTraits::NextBItr             NextBItr;
   typedef typename ItrTraits::PrevBItr             PrevBItr;
   typedef typename ItrTraits::StmtItr              StmtItr;
-  
+
   //===----------------------------------------------------===//
   // External interface: constructing and running the solver.
   //===----------------------------------------------------===//
-  
+
 public:
   DataflowSolver(DFValuesTy& d) : D(d), TF(d.getAnalysisData()) {}
-  ~DataflowSolver() {}  
-  
+  ~DataflowSolver() {}
+
   /// runOnCFG - Computes dataflow values for all blocks in a CFG.
   void runOnCFG(CFG& cfg, bool recordStmtValues = false) {
     // Set initial dataflow values and boundary conditions.
-    D.InitializeValues(cfg);     
+    D.InitializeValues(cfg);
     // Solve the dataflow equations.  This will populate D.EdgeDataMap
     // with dataflow values.
     SolveDataflowEquations(cfg, recordStmtValues);
   }
-  
+
   /// runOnBlock - Computes dataflow values for a given block.  This
   ///  should usually be invoked only after previously computing
   ///  dataflow values using runOnCFG, as runOnBlock is intended to
@@ -162,10 +162,10 @@ public:
       ProcessBlock(B, recordStmtValues, AnalysisDirTag());
     }
   }
-  
+
   void runOnBlock(const CFGBlock& B, bool recordStmtValues) {
     runOnBlock(&B, recordStmtValues);
-  }  
+  }
   void runOnBlock(CFG::iterator& I, bool recordStmtValues) {
     runOnBlock(*I, recordStmtValues);
   }
@@ -177,13 +177,13 @@ public:
     for (CFG::const_iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I)
       runOnBlock(I, recordStmtValues);
   }
-  
+
   //===----------------------------------------------------===//
   // Internal solver logic.
   //===----------------------------------------------------===//
-  
+
 private:
- 
+
   /// SolveDataflowEquations - Perform the actual worklist algorithm
   ///  to compute dataflow values.
   void SolveDataflowEquations(CFG& cfg, bool recordStmtValues) {
@@ -191,27 +191,27 @@ private:
     // for every block.  Not all blocks are guaranteed to reach the exit block.
     for (CFG::iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I)
       WorkList.enqueue(&*I);
-    
+
     while (!WorkList.isEmpty()) {
       const CFGBlock* B = WorkList.dequeue();
       ProcessMerge(cfg, B);
       ProcessBlock(B, recordStmtValues, AnalysisDirTag());
       UpdateEdges(cfg, B, TF.getVal());
     }
-  }  
-  
+  }
+
   void ProcessMerge(CFG& cfg, const CFGBlock* B) {
-    ValTy& V = TF.getVal();  
+    ValTy& V = TF.getVal();
     TF.SetTopValue(V);
 
     // Merge dataflow values from all predecessors of this block.
     MergeOperatorTy Merge;
-    
+
     EdgeDataMapTy& M = D.getEdgeDataMap();
     bool firstMerge = true;
-    
+
     for (PrevBItr I=ItrTraits::PrevBegin(B),E=ItrTraits::PrevEnd(B); I!=E; ++I){
-      
+
       CFGBlock *PrevBlk = *I;
 
       if (!PrevBlk)
@@ -229,35 +229,35 @@ private:
           Merge(V, EI->second);
       }
     }
-    
+
     // Set the data for the block.
     D.getBlockDataMap()[B].copyValues(V);
-  }  
+  }
 
   /// ProcessBlock - Process the transfer functions for a given block.
   void ProcessBlock(const CFGBlock* B, bool recordStmtValues,
                     dataflow::forward_analysis_tag) {
-    
+
     for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I)
       ProcessStmt(*I, recordStmtValues, AnalysisDirTag());
-    
-    TF.VisitTerminator(const_cast<CFGBlock*>(B));  
+
+    TF.VisitTerminator(const_cast<CFGBlock*>(B));
   }
-  
+
   void ProcessBlock(const CFGBlock* B, bool recordStmtValues,
                     dataflow::backward_analysis_tag) {
-    
+
     TF.VisitTerminator(const_cast<CFGBlock*>(B));
 
     for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I)
       ProcessStmt(*I, recordStmtValues, AnalysisDirTag());
   }
-  
+
   void ProcessStmt(const Stmt* S, bool record, dataflow::forward_analysis_tag) {
     if (record) D.getStmtDataMap()[S] = TF.getVal();
-    TF.BlockStmt_Visit(const_cast<Stmt*>(S));  
+    TF.BlockStmt_Visit(const_cast<Stmt*>(S));
   }
-  
+
   void ProcessStmt(const Stmt* S, bool record, dataflow::backward_analysis_tag){
     TF.BlockStmt_Visit(const_cast<Stmt*>(S));
     if (record) D.getStmtDataMap()[S] = TF.getVal();
@@ -272,12 +272,12 @@ private:
       if (CFGBlock *NextBlk = *I)
         UpdateEdgeValue(ItrTraits::NextEdge(B, NextBlk),V, NextBlk);
   }
-    
+
   /// UpdateEdgeValue - Update the value associated with a given edge.
   void UpdateEdgeValue(BlockEdge E, ValTy& V, const CFGBlock* TargetBlock) {
     EdgeDataMapTy& M = D.getEdgeDataMap();
     typename EdgeDataMapTy::iterator I = M.find(E);
-      
+
     if (I == M.end()) {  // First computed value for this edge?
       M[E].copyValues(V);
       WorkList.enqueue(TargetBlock);
@@ -287,7 +287,7 @@ private:
       WorkList.enqueue(TargetBlock);
     }
   }
-    
+
 private:
   DFValuesTy& D;
   DataflowWorkListTy WorkList;

+ 28 - 28
include/clang/Analysis/FlowSensitive/DataflowValues.h

@@ -24,7 +24,7 @@
 /// Dataflow Directional Tag Classes.  These are used for tag dispatching
 ///  within the dataflow solver/transfer functions to determine what direction
 ///  a dataflow analysis flows.
-//===----------------------------------------------------------------------===//   
+//===----------------------------------------------------------------------===//
 
 namespace clang {
 namespace dataflow {
@@ -34,19 +34,19 @@ namespace dataflow {
 
 //===----------------------------------------------------------------------===//
 /// DataflowValues.  Container class to store dataflow values for a CFG.
-//===----------------------------------------------------------------------===//   
-  
+//===----------------------------------------------------------------------===//
+
 template <typename ValueTypes,
           typename _AnalysisDirTag = dataflow::forward_analysis_tag >
 class DataflowValues {
 
   //===--------------------------------------------------------------------===//
   // Type declarations.
-  //===--------------------------------------------------------------------===//    
+  //===--------------------------------------------------------------------===//
 
 public:
   typedef typename ValueTypes::ValTy               ValTy;
-  typedef typename ValueTypes::AnalysisDataTy      AnalysisDataTy;  
+  typedef typename ValueTypes::AnalysisDataTy      AnalysisDataTy;
   typedef _AnalysisDirTag                          AnalysisDirTag;
   typedef llvm::DenseMap<ProgramPoint, ValTy>      EdgeDataMapTy;
   typedef llvm::DenseMap<const CFGBlock*, ValTy>   BlockDataMapTy;
@@ -60,15 +60,15 @@ public:
   /// isForwardAnalysis - Returns true if the dataflow values are computed
   ///  from a forward analysis.
   bool isForwardAnalysis() { return isForwardAnalysis(AnalysisDirTag()); }
-  
+
   /// isBackwardAnalysis - Returns true if the dataflow values are computed
   ///  from a backward analysis.
   bool isBackwardAnalysis() { return !isForwardAnalysis(); }
-  
+
 private:
   bool isForwardAnalysis(dataflow::forward_analysis_tag)  { return true; }
-  bool isForwardAnalysis(dataflow::backward_analysis_tag) { return false; }  
-  
+  bool isForwardAnalysis(dataflow::backward_analysis_tag) { return false; }
+
   //===--------------------------------------------------------------------===//
   // Initialization and accessors methods.
   //===--------------------------------------------------------------------===//
@@ -76,10 +76,10 @@ private:
 public:
   DataflowValues() : StmtDataMap(NULL) {}
   ~DataflowValues() { delete StmtDataMap; }
-  
+
   /// InitializeValues - Invoked by the solver to initialize state needed for
   ///  dataflow analysis.  This method is usually specialized by subclasses.
-  void InitializeValues(const CFG& cfg) {};  
+  void InitializeValues(const CFG& cfg) {};
 
 
   /// getEdgeData - Retrieves the dataflow values associated with a
@@ -89,28 +89,28 @@ public:
     assert (I != EdgeDataMap.end() && "No data associated with Edge.");
     return I->second;
   }
-  
+
   const ValTy& getEdgeData(const BlockEdge& E) const {
     return reinterpret_cast<DataflowValues*>(this)->getEdgeData(E);
-  }  
+  }
 
-  /// getBlockData - Retrieves the dataflow values associated with a 
+  /// getBlockData - Retrieves the dataflow values associated with a
   ///  specified CFGBlock.  If the dataflow analysis is a forward analysis,
   ///  this data is associated with the END of the block.  If the analysis
-  ///  is a backwards analysis, it is associated with the ENTRY of the block.  
+  ///  is a backwards analysis, it is associated with the ENTRY of the block.
   ValTy& getBlockData(const CFGBlock* B) {
     typename BlockDataMapTy::iterator I = BlockDataMap.find(B);
     assert (I != BlockDataMap.end() && "No data associated with block.");
     return I->second;
   }
-  
+
   const ValTy& getBlockData(const CFGBlock* B) const {
     return const_cast<DataflowValues*>(this)->getBlockData(B);
   }
-  
-  /// getStmtData - Retrieves the dataflow values associated with a 
+
+  /// getStmtData - Retrieves the dataflow values associated with a
   ///  specified Stmt.  If the dataflow analysis is a forward analysis,
-  ///  this data corresponds to the point immediately before a Stmt. 
+  ///  this data corresponds to the point immediately before a Stmt.
   ///  If the analysis is a backwards analysis, it is associated with
   ///  the point after a Stmt.  This data is only computed for block-level
   ///  expressions, and only when requested when the analysis is executed.
@@ -120,11 +120,11 @@ public:
     assert (I != StmtDataMap->end() && "No data associated with statement.");
     return I->second;
   }
-  
+
   const ValTy& getStmtData(const Stmt* S) const {
     return const_cast<DataflowValues*>(this)->getStmtData(S);
   }
-  
+
   /// getEdgeDataMap - Retrieves the internal map between CFG edges and
   ///  dataflow values.  Usually used by a dataflow solver to compute
   ///  values for blocks.
@@ -138,35 +138,35 @@ public:
   /// to the dataflow values at the end of the block.
   BlockDataMapTy& getBlockDataMap() { return BlockDataMap; }
   const BlockDataMapTy& getBlockDataMap() const { return BlockDataMap; }
-  
+
   /// getStmtDataMap - Retrieves the internal map between Stmts and
   /// dataflow values.
   StmtDataMapTy& getStmtDataMap() {
     if (!StmtDataMap) StmtDataMap = new StmtDataMapTy();
     return *StmtDataMap;
   }
-    
+
   const StmtDataMapTy& getStmtDataMap() const {
     return const_cast<DataflowValues*>(this)->getStmtDataMap();
   }
 
-  /// getAnalysisData - Retrieves the meta data associated with a 
-  ///  dataflow analysis for analyzing a particular CFG.  
+  /// getAnalysisData - Retrieves the meta data associated with a
+  ///  dataflow analysis for analyzing a particular CFG.
   ///  This is typically consumed by transfer function code (via the solver).
   ///  This can also be used by subclasses to interpret the dataflow values.
   AnalysisDataTy& getAnalysisData() { return AnalysisData; }
   const AnalysisDataTy& getAnalysisData() const { return AnalysisData; }
-  
+
   //===--------------------------------------------------------------------===//
   // Internal data.
   //===--------------------------------------------------------------------===//
-  
+
 protected:
   EdgeDataMapTy      EdgeDataMap;
   BlockDataMapTy     BlockDataMap;
   StmtDataMapTy*     StmtDataMap;
   AnalysisDataTy     AnalysisData;
-};          
+};
 
 } // end namespace clang
 #endif

+ 10 - 10
include/clang/Analysis/LocalCheckers.h

@@ -31,28 +31,28 @@ class BugReporter;
 class ObjCImplementationDecl;
 class LangOptions;
 class GRExprEngine;
-  
-void CheckDeadStores(LiveVariables& L, BugReporter& BR); 
-  
+
+void CheckDeadStores(LiveVariables& L, BugReporter& BR);
+
 void CheckUninitializedValues(CFG& cfg, ASTContext& Ctx, Diagnostic& Diags,
                               bool FullUninitTaint=false);
-  
+
 GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
-                                  const LangOptions& lopts); 
-  
+                                  const LangOptions& lopts);
+
 void CheckObjCDealloc(const ObjCImplementationDecl* D, const LangOptions& L,
                       BugReporter& BR);
-  
+
 void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
                                 BugReporter& BR);
 
 void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR);
-  
+
 void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D);
-  
+
 void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);
 
-  
+
 } // end namespace clang
 
 #endif

+ 104 - 104
include/clang/Analysis/PathDiagnostic.h

@@ -38,21 +38,21 @@ class PathDiagnosticClient : public DiagnosticClient  {
 public:
   PathDiagnosticClient() {}
   virtual ~PathDiagnosticClient() {}
-  
+
   virtual void SetPreprocessor(Preprocessor *PP) {}
-  
+
   virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
                                 const DiagnosticInfo &Info);
-  
+
   virtual void HandlePathDiagnostic(const PathDiagnostic* D) = 0;
-  
-  enum PathGenerationScheme { Minimal, Extensive };  
-  virtual PathGenerationScheme getGenerationScheme() const { return Minimal; }   
+
+  enum PathGenerationScheme { Minimal, Extensive };
+  virtual PathGenerationScheme getGenerationScheme() const { return Minimal; }
   virtual bool supportsLogicalOpControlFlow() const { return false; }
   virtual bool supportsAllBlockEdges() const { return false; }
   virtual bool useVerboseDescription() const { return true; }
-};  
-  
+};
+
 //===----------------------------------------------------------------------===//
 // Path-sensitive diagnostics.
 //===----------------------------------------------------------------------===//
@@ -60,11 +60,11 @@ public:
 class PathDiagnosticRange : public SourceRange {
 public:
   const bool isPoint;
-  
+
   PathDiagnosticRange(const SourceRange &R, bool isP = false)
     : SourceRange(R), isPoint(isP) {}
 };
-  
+
 class PathDiagnosticLocation {
 private:
   enum Kind { RangeK, SingleLocK, StmtK, DeclK } K;
@@ -75,27 +75,27 @@ private:
 public:
   PathDiagnosticLocation()
     : K(SingleLocK), S(0), D(0), SM(0) {}
-  
+
   PathDiagnosticLocation(FullSourceLoc L)
     : K(SingleLocK), R(L, L), S(0), D(0), SM(&L.getManager()) {}
-  
+
   PathDiagnosticLocation(const Stmt *s, const SourceManager &sm)
     : K(StmtK), S(s), D(0), SM(&sm) {}
-  
+
   PathDiagnosticLocation(SourceRange r, const SourceManager &sm)
     : K(RangeK), R(r), S(0), D(0), SM(&sm) {}
-  
+
   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
     : K(DeclK), S(0), D(d), SM(&sm) {}
-  
+
   bool operator==(const PathDiagnosticLocation &X) const {
     return K == X.K && R == X.R && S == X.S && D == X.D;
   }
-  
+
   bool operator!=(const PathDiagnosticLocation &X) const {
     return K != X.K || R != X.R || S != X.S || D != X.D;;
   }
-  
+
   PathDiagnosticLocation& operator=(const PathDiagnosticLocation &X) {
     K = X.K;
     R = X.R;
@@ -104,26 +104,26 @@ public:
     SM = X.SM;
     return *this;
   }
-  
+
   bool isValid() const {
     return SM != 0;
   }
-  
+
   const SourceManager& getSourceManager() const { assert(isValid());return *SM;}
-    
+
   FullSourceLoc asLocation() const;
   PathDiagnosticRange asRange() const;
   const Stmt *asStmt() const { assert(isValid()); return S; }
   const Decl *asDecl() const { assert(isValid()); return D; }
-  
+
   bool hasRange() const { return K == StmtK || K == RangeK || K == DeclK; }
-  
+
   void invalidate() {
     *this = PathDiagnosticLocation();
   }
-  
+
   void flatten();
-  
+
   const SourceManager& getManager() const { assert(isValid()); return *SM; }
 };
 
@@ -134,10 +134,10 @@ public:
   PathDiagnosticLocationPair(const PathDiagnosticLocation &start,
                              const PathDiagnosticLocation &end)
     : Start(start), End(end) {}
-  
+
   const PathDiagnosticLocation &getStart() const { return Start; }
   const PathDiagnosticLocation &getEnd() const { return End; }
-  
+
   void flatten() {
     Start.flatten();
     End.flatten();
@@ -146,7 +146,7 @@ public:
 
 //===----------------------------------------------------------------------===//
 // Path "pieces" for path-sensitive diagnostics.
-//===----------------------------------------------------------------------===//  
+//===----------------------------------------------------------------------===//
 
 class PathDiagnosticPiece {
 public:
@@ -159,7 +159,7 @@ private:
   const Kind kind;
   const DisplayHint Hint;
   std::vector<SourceRange> ranges;
-  
+
   // Do not implement:
   PathDiagnosticPiece();
   PathDiagnosticPiece(const PathDiagnosticPiece &P);
@@ -167,42 +167,42 @@ private:
 
 protected:
   PathDiagnosticPiece(const std::string& s, Kind k, DisplayHint hint = Below);
-  
+
   PathDiagnosticPiece(const char* s, Kind k, DisplayHint hint = Below);
 
   PathDiagnosticPiece(Kind k, DisplayHint hint = Below);
-  
+
 public:
   virtual ~PathDiagnosticPiece();
-  
+
   const std::string& getString() const { return str; }
-  
+
   /// getDisplayHint - Return a hint indicating where the diagnostic should
   ///  be displayed by the PathDiagnosticClient.
   DisplayHint getDisplayHint() const { return Hint; }
-  
+
   virtual PathDiagnosticLocation getLocation() const = 0;
   virtual void flattenLocations() = 0;
-  
+
   Kind getKind() const { return kind; }
-  
+
   void addRange(SourceRange R) { ranges.push_back(R); }
-  
+
   void addRange(SourceLocation B, SourceLocation E) {
     ranges.push_back(SourceRange(B,E));
   }
-  
+
   void addCodeModificationHint(const CodeModificationHint& Hint) {
     CodeModificationHints.push_back(Hint);
   }
-  
+
   typedef const SourceRange* range_iterator;
-  
+
   range_iterator ranges_begin() const {
     return ranges.empty() ? NULL : &ranges[0];
   }
-  
-  range_iterator ranges_end() const { 
+
+  range_iterator ranges_end() const {
     return ranges_begin() + ranges.size();
   }
 
@@ -213,7 +213,7 @@ public:
   }
 
   code_modifications_iterator code_modifications_end() const {
-    return CodeModificationHints.empty()? 0 
+    return CodeModificationHints.empty()? 0
                    : &CodeModificationHints[0] + CodeModificationHints.size();
   }
 
@@ -221,7 +221,7 @@ public:
     return true;
   }
 };
-  
+
 class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
 private:
   PathDiagnosticLocation Pos;
@@ -234,30 +234,30 @@ public:
     assert(Pos.asLocation().isValid() &&
            "PathDiagnosticSpotPiece's must have a valid location.");
     if (addPosRange && Pos.hasRange()) addRange(Pos.asRange());
-  }  
+  }
 
   PathDiagnosticLocation getLocation() const { return Pos; }
   virtual void flattenLocations() { Pos.flatten(); }
 };
-  
+
 class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
 
 public:
   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
                            const std::string& s, bool addPosRange = true)
     : PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
-  
+
   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, const char* s,
                            bool addPosRange = true)
     : PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
-  
+
   ~PathDiagnosticEventPiece();
 
   static inline bool classof(const PathDiagnosticPiece* P) {
     return P->getKind() == Event;
   }
 };
-  
+
 class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
   std::vector<PathDiagnosticLocationPair> LPairs;
 public:
@@ -267,40 +267,40 @@ public:
     : PathDiagnosticPiece(s, ControlFlow) {
       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
     }
-  
+
   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
                                  const PathDiagnosticLocation &endPos,
                                  const char* s)
     : PathDiagnosticPiece(s, ControlFlow) {
       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
     }
-  
+
   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
                                  const PathDiagnosticLocation &endPos)
     : PathDiagnosticPiece(ControlFlow) {
       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
     }
-  
+
   ~PathDiagnosticControlFlowPiece();
-  
+
   PathDiagnosticLocation getStartLocation() const {
     assert(!LPairs.empty() &&
            "PathDiagnosticControlFlowPiece needs at least one location.");
     return LPairs[0].getStart();
   }
-    
+
   PathDiagnosticLocation getEndLocation() const {
     assert(!LPairs.empty() &&
            "PathDiagnosticControlFlowPiece needs at least one location.");
     return LPairs[0].getEnd();
   }
-  
+
   void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); }
-  
+
   virtual PathDiagnosticLocation getLocation() const {
     return getStartLocation();
   }
-  
+
   typedef std::vector<PathDiagnosticLocationPair>::iterator iterator;
   iterator begin() { return LPairs.begin(); }
   iterator end()   { return LPairs.end(); }
@@ -308,7 +308,7 @@ public:
   virtual void flattenLocations() {
     for (iterator I=begin(), E=end(); I!=E; ++I) I->flatten();
   }
-  
+
   typedef std::vector<PathDiagnosticLocationPair>::const_iterator
           const_iterator;
   const_iterator begin() const { return LPairs.begin(); }
@@ -318,32 +318,32 @@ public:
     return P->getKind() == ControlFlow;
   }
 };
-  
+
 class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
   std::vector<PathDiagnosticPiece*> SubPieces;
 public:
   PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos)
     : PathDiagnosticSpotPiece(pos, "", Macro) {}
-  
+
   ~PathDiagnosticMacroPiece();
-  
+
   bool containsEvent() const;
 
   void push_back(PathDiagnosticPiece* P) { SubPieces.push_back(P); }
-  
+
   typedef std::vector<PathDiagnosticPiece*>::iterator iterator;
   iterator begin() { return SubPieces.begin(); }
   iterator end() { return SubPieces.end(); }
-  
+
   virtual void flattenLocations() {
     PathDiagnosticSpotPiece::flattenLocations();
     for (iterator I=begin(), E=end(); I!=E; ++I) (*I)->flattenLocations();
   }
-  
+
   typedef std::vector<PathDiagnosticPiece*>::const_iterator const_iterator;
   const_iterator begin() const { return SubPieces.begin(); }
   const_iterator end() const { return SubPieces.end(); }
-  
+
   static inline bool classof(const PathDiagnosticPiece* P) {
     return P->getKind() == Macro;
   }
@@ -359,129 +359,129 @@ class PathDiagnostic {
   std::string Desc;
   std::string Category;
   std::deque<std::string> OtherDesc;
-  
-public:  
+
+public:
   PathDiagnostic();
-  
+
   PathDiagnostic(const char* bugtype, const char* desc, const char* category);
-  
-  PathDiagnostic(const std::string& bugtype, const std::string& desc, 
+
+  PathDiagnostic(const std::string& bugtype, const std::string& desc,
                  const std::string& category);
-  
+
   ~PathDiagnostic();
-  
+
   const std::string& getDescription() const { return Desc; }
   const std::string& getBugType() const { return BugType; }
-  const std::string& getCategory() const { return Category; }  
-  
+  const std::string& getCategory() const { return Category; }
+
   typedef std::deque<std::string>::const_iterator meta_iterator;
   meta_iterator meta_begin() const { return OtherDesc.begin(); }
   meta_iterator meta_end() const { return OtherDesc.end(); }
   void addMeta(const std::string& s) { OtherDesc.push_back(s); }
   void addMeta(const char* s) { OtherDesc.push_back(s); }
-  
+
   PathDiagnosticLocation getLocation() const {
     assert(Size > 0 && "getLocation() requires a non-empty PathDiagnostic.");
     return rbegin()->getLocation();
   }
-  
+
   void push_front(PathDiagnosticPiece* piece) {
     path.push_front(piece);
     ++Size;
   }
-  
+
   void push_back(PathDiagnosticPiece* piece) {
     path.push_back(piece);
     ++Size;
   }
-  
+
   PathDiagnosticPiece* back() {
     return path.back();
   }
-  
+
   const PathDiagnosticPiece* back() const {
     return path.back();
   }
-  
+
   unsigned size() const { return Size; }
   bool empty() const { return Size == 0; }
-  
+
   void resetPath(bool deletePieces = true);
-  
+
   class iterator {
-  public:  
+  public:
     typedef std::deque<PathDiagnosticPiece*>::iterator ImplTy;
-    
+
     typedef PathDiagnosticPiece              value_type;
     typedef value_type&                      reference;
     typedef value_type*                      pointer;
     typedef ptrdiff_t                        difference_type;
     typedef std::bidirectional_iterator_tag  iterator_category;
-    
+
   private:
     ImplTy I;
-    
+
   public:
     iterator(const ImplTy& i) : I(i) {}
-    
+
     bool operator==(const iterator& X) const { return I == X.I; }
     bool operator!=(const iterator& X) const { return I != X.I; }
-    
+
     PathDiagnosticPiece& operator*() const { return **I; }
     PathDiagnosticPiece* operator->() const { return *I; }
-    
+
     iterator& operator++() { ++I; return *this; }
     iterator& operator--() { --I; return *this; }
   };
-  
+
   class const_iterator {
-  public:  
+  public:
     typedef std::deque<PathDiagnosticPiece*>::const_iterator ImplTy;
-    
+
     typedef const PathDiagnosticPiece        value_type;
     typedef value_type&                      reference;
     typedef value_type*                      pointer;
     typedef ptrdiff_t                        difference_type;
     typedef std::bidirectional_iterator_tag  iterator_category;
-    
+
   private:
     ImplTy I;
-    
+
   public:
     const_iterator(const ImplTy& i) : I(i) {}
-    
+
     bool operator==(const const_iterator& X) const { return I == X.I; }
     bool operator!=(const const_iterator& X) const { return I != X.I; }
-    
+
     reference operator*() const { return **I; }
     pointer operator->() const { return *I; }
-    
+
     const_iterator& operator++() { ++I; return *this; }
     const_iterator& operator--() { --I; return *this; }
   };
-  
+
   typedef std::reverse_iterator<iterator>       reverse_iterator;
   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-  
+
   // forward iterator creation methods.
-  
+
   iterator begin() { return path.begin(); }
   iterator end() { return path.end(); }
-  
+
   const_iterator begin() const { return path.begin(); }
   const_iterator end() const { return path.end(); }
-  
+
   // reverse iterator creation methods.
   reverse_iterator rbegin()            { return reverse_iterator(end()); }
   const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
   reverse_iterator rend()              { return reverse_iterator(begin()); }
   const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
-  
+
   void flattenLocations() {
     for (iterator I = begin(), E = end(); I != E; ++I) I->flattenLocations();
   }
 };
-  
-  
+
+
 } //end clang namespace
 #endif

+ 10 - 10
include/clang/Analysis/PathSensitive/AnalysisContext.h

@@ -27,7 +27,7 @@ class CFG;
 class LiveVariables;
 class ParentMap;
 class ImplicitParamDecl;
-  
+
 /// AnalysisContext contains the context data for the function or method under
 /// analysis.
 class AnalysisContext {
@@ -47,7 +47,7 @@ public:
   CFG *getCFG();
   ParentMap &getParentMap();
   LiveVariables *getLiveVariables();
-  
+
   /// Return the ImplicitParamDecl* associated with 'self' if this
   /// AnalysisContext wraps an ObjCMethodDecl.  Returns NULL otherwise.
   const ImplicitParamDecl *getSelfDecl() const;
@@ -58,7 +58,7 @@ class AnalysisContextManager {
   ContextMap Contexts;
 public:
   ~AnalysisContextManager();
-  
+
   AnalysisContext *getContext(const Decl *D);
 };
 
@@ -87,10 +87,10 @@ public:
 
   CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
 
-  LiveVariables *getLiveVariables() const { 
+  LiveVariables *getLiveVariables() const {
     return getAnalysisContext()->getLiveVariables();
   }
-  
+
   const ImplicitParamDecl *getSelfDecl() const {
     return Ctx->getSelfDecl();
   }
@@ -120,8 +120,8 @@ public:
   static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
                       const LocationContext *parent, const Stmt *s);
 
-  static bool classof(const LocationContext* Ctx) { 
-    return Ctx->getKind() == StackFrame; 
+  static bool classof(const LocationContext* Ctx) {
+    return Ctx->getKind() == StackFrame;
   }
 };
 
@@ -140,8 +140,8 @@ public:
   static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
                       const LocationContext *parent, const Stmt *s);
 
-  static bool classof(const LocationContext* Ctx) { 
-    return Ctx->getKind() == Scope; 
+  static bool classof(const LocationContext* Ctx) {
+    return Ctx->getKind() == Scope;
   }
 };
 
@@ -156,6 +156,6 @@ public:
   ScopeContext *getScope(AnalysisContext *ctx, const LocationContext *parent,
                          const Stmt *s);
 };
-  
+
 } // end clang namespace
 #endif

+ 21 - 21
include/clang/Analysis/PathSensitive/AnalysisManager.h

@@ -38,7 +38,7 @@ class AnalysisManager : public BugReporterData {
   ConstraintManagerCreator CreateConstraintMgr;
 
   enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
-      
+
   bool DisplayedFunction;
   bool VisualizeEGDot;
   bool VisualizeEGUbi;
@@ -55,13 +55,13 @@ class AnalysisManager : public BugReporterData {
   bool TrimGraph;
 
 public:
-  AnalysisManager(Decl *d, ASTContext &ctx, Diagnostic &diags, 
+  AnalysisManager(Decl *d, ASTContext &ctx, Diagnostic &diags,
                   const LangOptions &lang, PathDiagnosticClient *pd,
                   StoreManagerCreator storemgr,
                   ConstraintManagerCreator constraintmgr,
-                  bool displayProgress, bool vizdot, bool vizubi, 
+                  bool displayProgress, bool vizdot, bool vizubi,
                   bool purge, bool eager, bool trim)
-    : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd), 
+    : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
       CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
       AScope(ScopeDecl), DisplayedFunction(!displayProgress),
       VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
@@ -69,15 +69,15 @@ public:
 
     EntryContext = ContextMgr.getContext(d);
   }
-    
-  AnalysisManager(ASTContext &ctx, Diagnostic &diags, 
+
+  AnalysisManager(ASTContext &ctx, Diagnostic &diags,
                   const LangOptions &lang, PathDiagnosticClient *pd,
                   StoreManagerCreator storemgr,
                   ConstraintManagerCreator constraintmgr,
-                  bool displayProgress, bool vizdot, bool vizubi, 
+                  bool displayProgress, bool vizdot, bool vizubi,
                   bool purge, bool eager, bool trim)
 
-    : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd), 
+    : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
       CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
       AScope(ScopeDecl), DisplayedFunction(!displayProgress),
       VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
@@ -90,17 +90,17 @@ public:
     EntryContext = ContextMgr.getContext(D);
     DisplayedFunction = false;
   }
-    
-  const Decl *getCodeDecl() const { 
+
+  const Decl *getCodeDecl() const {
     assert (AScope == ScopeDecl);
     return EntryContext->getDecl();
   }
-    
+
   Stmt *getBody() const {
     assert (AScope == ScopeDecl);
     return EntryContext->getBody();
   }
-    
+
   StoreManagerCreator getStoreManagerCreator() {
     return CreateStoreMgr;
   };
@@ -108,11 +108,11 @@ public:
   ConstraintManagerCreator getConstraintManagerCreator() {
     return CreateConstraintMgr;
   }
-    
+
   virtual CFG *getCFG() {
     return EntryContext->getCFG();
   }
-    
+
   virtual ParentMap &getParentMap() {
     return EntryContext->getParentMap();
   }
@@ -120,31 +120,31 @@ public:
   virtual LiveVariables *getLiveVariables() {
     return EntryContext->getLiveVariables();
   }
-    
+
   virtual ASTContext &getASTContext() {
     return Ctx;
   }
-    
+
   virtual SourceManager &getSourceManager() {
     return getASTContext().getSourceManager();
   }
-    
+
   virtual Diagnostic &getDiagnostic() {
     return Diags;
   }
-    
+
   const LangOptions &getLangOptions() const {
     return LangInfo;
   }
-    
+
   virtual PathDiagnosticClient *getPathDiagnosticClient() {
-    return PD.get();      
+    return PD.get();
   }
 
   StackFrameContext *getEntryStackFrame() {
     return LocCtxMgr.getStackFrame(EntryContext, 0, 0);
   }
-    
+
   bool shouldVisualizeGraphviz() const { return VisualizeEGDot; }
 
   bool shouldVisualizeUbigraph() const { return VisualizeEGUbi; }

+ 30 - 30
include/clang/Analysis/PathSensitive/BasicValueFactory.h

@@ -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.
 //
 //===----------------------------------------------------------------------===//
@@ -24,7 +24,7 @@
 #include "llvm/ADT/ImmutableList.h"
 
 namespace clang {
-  
+
   class GRState;
 
 class CompoundValData : public llvm::FoldingSetNode {
@@ -32,13 +32,13 @@ class CompoundValData : public llvm::FoldingSetNode {
   llvm::ImmutableList<SVal> L;
 
 public:
-  CompoundValData(QualType t, llvm::ImmutableList<SVal> l) 
+  CompoundValData(QualType t, llvm::ImmutableList<SVal> l)
     : T(t), L(l) {}
 
   typedef llvm::ImmutableList<SVal>::iterator iterator;
   iterator begin() const { return L.begin(); }
-  iterator end() const { return L.end(); }  
-  
+  iterator end() const { return L.end(); }
+
   static void Profile(llvm::FoldingSetNodeID& ID, QualType T,
                       llvm::ImmutableList<SVal> L);
 
@@ -51,16 +51,16 @@ class LazyCompoundValData : public llvm::FoldingSetNode {
 public:
   LazyCompoundValData(const GRState *st, const TypedRegion *r)
     : state(st), region(r) {}
-  
+
   const GRState *getState() const { return state; }
   const TypedRegion *getRegion() const { return region; }
-    
+
   static void Profile(llvm::FoldingSetNodeID& ID, const GRState *state,
                       const TypedRegion *region);
-  
+
   void Profile(llvm::FoldingSetNodeID& ID) { Profile(ID, state, region); }
 };
-  
+
 class BasicValueFactory {
   typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
           APSIntSetTy;
@@ -77,28 +77,28 @@ class BasicValueFactory {
   llvm::FoldingSet<LazyCompoundValData> LazyCompoundValDataSet;
 
 public:
-  BasicValueFactory(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc) 
+  BasicValueFactory(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc)
   : Ctx(ctx), BPAlloc(Alloc), PersistentSVals(0), PersistentSValPairs(0),
     SValListFactory(Alloc) {}
 
   ~BasicValueFactory();
 
-  ASTContext& getContext() const { return Ctx; }  
+  ASTContext& getContext() const { return Ctx; }
 
   const llvm::APSInt& getValue(const llvm::APSInt& X);
   const llvm::APSInt& getValue(const llvm::APInt& X, bool isUnsigned);
   const llvm::APSInt& getValue(uint64_t X, unsigned BitWidth, bool isUnsigned);
   const llvm::APSInt& getValue(uint64_t X, QualType T);
-  
+
   /// Convert - Create a new persistent APSInt with the same value as 'From'
   ///  but with the bitwidth and signedness of 'To'.
   const llvm::APSInt& Convert(const llvm::APSInt& To,
                               const llvm::APSInt& From) {
-    
+
     if (To.isUnsigned() == From.isUnsigned() &&
         To.getBitWidth() == From.getBitWidth())
       return From;
-    
+
     return getValue(From.getSExtValue(),
                     To.getBitWidth(),
                     To.isUnsigned());
@@ -108,11 +108,11 @@ public:
     QualType T = isUnsigned ? Ctx.UnsignedIntTy : Ctx.IntTy;
     return getValue(X, T);
   }
-  
+
   inline const llvm::APSInt& getMaxValue(const llvm::APSInt &v) {
     return getValue(llvm::APSInt::getMaxValue(v.getBitWidth(), v.isUnsigned()));
   }
-  
+
   inline const llvm::APSInt& getMinValue(const llvm::APSInt &v) {
     return getValue(llvm::APSInt::getMinValue(v.getBitWidth(), v.isUnsigned()));
   }
@@ -122,25 +122,25 @@ public:
     bool isUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
     return getValue(llvm::APSInt::getMaxValue(Ctx.getTypeSize(T), isUnsigned));
   }
-  
+
   inline const llvm::APSInt& getMinValue(QualType T) {
     assert(T->isIntegerType() || Loc::IsLocType(T));
     bool isUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
     return getValue(llvm::APSInt::getMinValue(Ctx.getTypeSize(T), isUnsigned));
   }
-  
+
   inline const llvm::APSInt& Add1(const llvm::APSInt& V) {
     llvm::APSInt X = V;
     ++X;
     return getValue(X);
   }
-  
+
   inline const llvm::APSInt& Sub1(const llvm::APSInt& V) {
     llvm::APSInt X = V;
     --X;
     return getValue(X);
   }
-  
+
   inline const llvm::APSInt& getZeroWithPtrWidth(bool isUnsigned = true) {
     return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned);
   }
@@ -152,21 +152,21 @@ public:
   inline const llvm::APSInt& getTruthValue(bool b, QualType T) {
     return getValue(b ? 1 : 0, Ctx.getTypeSize(T), false);
   }
-  
+
   inline const llvm::APSInt& getTruthValue(bool b) {
     return getTruthValue(b, Ctx.IntTy);
   }
-  
-  const CompoundValData *getCompoundValData(QualType T, 
+
+  const CompoundValData *getCompoundValData(QualType T,
                                             llvm::ImmutableList<SVal> Vals);
-  
+
   const LazyCompoundValData *getLazyCompoundValData(const GRState *state,
                                                     const TypedRegion *region);
-  
+
   llvm::ImmutableList<SVal> getEmptySValList() {
     return SValListFactory.GetEmptyList();
   }
-  
+
   llvm::ImmutableList<SVal> consVals(SVal X, llvm::ImmutableList<SVal> L) {
     return SValListFactory.Add(X, L);
   }
@@ -174,13 +174,13 @@ public:
   const llvm::APSInt* EvaluateAPSInt(BinaryOperator::Opcode Op,
                                      const llvm::APSInt& V1,
                                      const llvm::APSInt& V2);
-  
+
   const std::pair<SVal, uintptr_t>&
   getPersistentSValWithData(const SVal& V, uintptr_t Data);
-  
+
   const std::pair<SVal, SVal>&
-  getPersistentSValPair(const SVal& V1, const SVal& V2);  
-  
+  getPersistentSValPair(const SVal& V1, const SVal& V2);
+
   const SVal* getPersistentSVal(SVal X);
 };
 

+ 96 - 96
include/clang/Analysis/PathSensitive/BugReporter.h

@@ -27,7 +27,7 @@
 #include <list>
 
 namespace clang {
-  
+
 class PathDiagnostic;
 class PathDiagnosticPiece;
 class PathDiagnosticClient;
@@ -40,7 +40,7 @@ class GRState;
 class Stmt;
 class BugType;
 class ParentMap;
-  
+
 //===----------------------------------------------------------------------===//
 // Interface for individual bug reports.
 //===----------------------------------------------------------------------===//
@@ -51,10 +51,10 @@ public:
   virtual PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
                                          const ExplodedNode* PrevN,
                                          BugReporterContext& BRC) = 0;
-  
+
   virtual bool isOwnedByReporterContext() { return true; }
 };
-  
+
 // FIXME: Combine this with RangedBugReport and remove RangedBugReport.
 class BugReport : public BugReporterVisitor {
 protected:
@@ -63,7 +63,7 @@ protected:
   std::string Description;
   const ExplodedNode *EndNode;
   SourceRange R;
-  
+
 protected:
   friend class BugReporter;
   friend class BugReportEquivClass;
@@ -71,7 +71,7 @@ protected:
   virtual void Profile(llvm::FoldingSetNodeID& hash) const {
     hash.AddInteger(getLocation().getRawEncoding());
   }
-  
+
 public:
   class NodeResolver {
   public:
@@ -79,58 +79,58 @@ public:
     virtual const ExplodedNode*
             getOriginalNode(const ExplodedNode* N) = 0;
   };
-  
+
   BugReport(BugType& bt, const char* desc, const ExplodedNode *n)
     : BT(bt), Description(desc), EndNode(n) {}
-  
+
   BugReport(BugType& bt, const char* shortDesc, const char* desc,
             const ExplodedNode *n)
   : BT(bt), ShortDescription(shortDesc), Description(desc), EndNode(n) {}
 
   virtual ~BugReport();
-  
+
   virtual bool isOwnedByReporterContext() { return false; }
 
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
-  
+
   // FIXME: Perhaps this should be moved into a subclass?
   const ExplodedNode* getEndNode() const { return EndNode; }
-  
+
   // FIXME: Do we need this?  Maybe getLocation() should return a ProgramPoint
   // object.
   // FIXME: If we do need it, we can probably just make it private to
   // BugReporter.
   const Stmt* getStmt() const;
-  
+
   const std::string& getDescription() const { return Description; }
 
   const std::string& getShortDescription() const {
     return ShortDescription.empty() ? Description : ShortDescription;
   }
-  
+
   // FIXME: Is this needed?
   virtual std::pair<const char**,const char**> getExtraDescriptiveText() {
     return std::make_pair((const char**)0,(const char**)0);
   }
-  
+
   // FIXME: Perhaps move this into a subclass.
   virtual PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
                                           const ExplodedNode* N);
-  
+
   /// getLocation - Return the "definitive" location of the reported bug.
   ///  While a bug can span an entire path, usually there is a specific
   ///  location that can be used to identify where the key issue occured.
   ///  This location is used by clients rendering diagnostics.
   virtual SourceLocation getLocation() const;
-  
+
   /// getRanges - Returns the source ranges associated with this bug.
   virtual void getRanges(const SourceRange*& beg, const SourceRange*& end);
 
   virtual PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
                                          const ExplodedNode* PrevN,
                                          BugReporterContext& BR);
-  
+
   virtual void registerInitialVisitors(BugReporterContext& BRC,
                                        const ExplodedNode* N) {}
 };
@@ -138,11 +138,11 @@ public:
 //===----------------------------------------------------------------------===//
 // BugTypes (collections of related reports).
 //===----------------------------------------------------------------------===//
-  
+
 class BugReportEquivClass : public llvm::FoldingSetNode {
   // List of *owned* BugReport objects.
   std::list<BugReport*> Reports;
-  
+
   friend class BugReporter;
   void AddReport(BugReport* R) { Reports.push_back(R); }
 public:
@@ -164,7 +164,7 @@ public:
     BugReport* operator*() const { return *impl; }
     BugReport* operator->() const { return *impl; }
   };
-  
+
   class const_iterator {
     std::list<BugReport*>::const_iterator impl;
   public:
@@ -175,14 +175,14 @@ public:
     const BugReport* operator*() const { return *impl; }
     const BugReport* operator->() const { return *impl; }
   };
-    
+
   iterator begin() { return iterator(Reports.begin()); }
   iterator end() { return iterator(Reports.end()); }
-  
+
   const_iterator begin() const { return const_iterator(Reports.begin()); }
   const_iterator end() const { return const_iterator(Reports.end()); }
 };
-  
+
 class BugType {
 private:
   const std::string Name;
@@ -192,45 +192,45 @@ private:
 public:
   BugType(const char *name, const char* cat) : Name(name), Category(cat) {}
   virtual ~BugType();
-  
+
   // FIXME: Should these be made strings as well?
   const std::string& getName() const { return Name; }
   const std::string& getCategory() const { return Category; }
 
-  virtual void FlushReports(BugReporter& BR);  
+  virtual void FlushReports(BugReporter& BR);
 
   typedef llvm::FoldingSet<BugReportEquivClass>::iterator iterator;
   iterator begin() { return EQClasses.begin(); }
   iterator end() { return EQClasses.end(); }
-  
+
   typedef llvm::FoldingSet<BugReportEquivClass>::const_iterator const_iterator;
   const_iterator begin() const { return EQClasses.begin(); }
   const_iterator end() const { return EQClasses.end(); }
 };
-  
+
 //===----------------------------------------------------------------------===//
 // Specialized subclasses of BugReport.
 //===----------------------------------------------------------------------===//
-  
+
 // FIXME: Collapse this with the default BugReport class.
 class RangedBugReport : public BugReport {
   std::vector<SourceRange> Ranges;
 public:
   RangedBugReport(BugType& D, const char* description, ExplodedNode *n)
     : BugReport(D, description, n) {}
-  
+
   RangedBugReport(BugType& D, const char *shortDescription,
                   const char *description, ExplodedNode *n)
   : BugReport(D, shortDescription, description, n) {}
-  
+
   ~RangedBugReport();
 
   // FIXME: Move this out of line.
   void addRange(SourceRange R) { Ranges.push_back(R); }
-  
+
   // FIXME: Move this out of line.
   void getRanges(const SourceRange*& beg, const SourceRange*& end) {
-    
+
     if (Ranges.empty()) {
       beg = NULL;
       end = NULL;
@@ -241,36 +241,36 @@ public:
     }
   }
 };
-  
+
 class EnhancedBugReport : public RangedBugReport {
 public:
   typedef void (*VisitorCreator)(BugReporterContext &BRcC, const void *data,
                                  const ExplodedNode *N);
-  
+
 private:
   typedef std::vector<std::pair<VisitorCreator, const void*> > Creators;
   Creators creators;
-  
+
 public:
   EnhancedBugReport(BugType& D, const char* description, ExplodedNode *n)
    : RangedBugReport(D, description, n) {}
-  
+
   EnhancedBugReport(BugType& D, const char *shortDescription,
                   const char *description, ExplodedNode *n)
     : RangedBugReport(D, shortDescription, description, n) {}
-  
+
   ~EnhancedBugReport() {}
-  
-  void registerInitialVisitors(BugReporterContext& BRC, const ExplodedNode* N) {    
+
+  void registerInitialVisitors(BugReporterContext& BRC, const ExplodedNode* N) {
     for (Creators::iterator I = creators.begin(), E = creators.end(); I!=E; ++I)
       I->first(BRC, I->second, N);
   }
-  
+
   void addVisitorCreator(VisitorCreator creator, const void *data) {
     creators.push_back(std::make_pair(creator, data));
   }
 };
-  
+
 //===----------------------------------------------------------------------===//
 // BugReporter and friends.
 //===----------------------------------------------------------------------===//
@@ -278,15 +278,15 @@ public:
 class BugReporterData {
 public:
   virtual ~BugReporterData();
-  virtual Diagnostic& getDiagnostic() = 0;  
-  virtual PathDiagnosticClient* getPathDiagnosticClient() = 0;  
+  virtual Diagnostic& getDiagnostic() = 0;
+  virtual PathDiagnosticClient* getPathDiagnosticClient() = 0;
   virtual ASTContext& getASTContext() = 0;
   virtual SourceManager& getSourceManager() = 0;
   virtual CFG* getCFG() = 0;
   virtual ParentMap& getParentMap() = 0;
   virtual LiveVariables* getLiveVariables() = 0;
 };
-  
+
 class BugReporter {
 public:
   enum Kind { BaseBRKind, GRBugReporterKind };
@@ -296,9 +296,9 @@ private:
   BugTypesTy::Factory F;
   BugTypesTy BugTypes;
 
-  const Kind kind;  
+  const Kind kind;
   BugReporterData& D;
-  
+
   void FlushReport(BugReportEquivClass& EQ);
 
 protected:
@@ -307,40 +307,40 @@ protected:
 public:
   BugReporter(BugReporterData& d) : BugTypes(F.GetEmptySet()), kind(BaseBRKind), D(d) {}
   virtual ~BugReporter();
-  
+
   void FlushReports();
-  
+
   Kind getKind() const { return kind; }
-  
+
   Diagnostic& getDiagnostic() {
     return D.getDiagnostic();
   }
-  
+
   PathDiagnosticClient* getPathDiagnosticClient() {
     return D.getPathDiagnosticClient();
   }
-  
+
   typedef BugTypesTy::iterator iterator;
   iterator begin() { return BugTypes.begin(); }
   iterator end() { return BugTypes.end(); }
-  
+
   ASTContext& getContext() { return D.getASTContext(); }
-  
+
   SourceManager& getSourceManager() { return D.getSourceManager(); }
-  
+
   CFG* getCFG() { return D.getCFG(); }
-  
+
   ParentMap& getParentMap() { return D.getParentMap(); }
-  
+
   LiveVariables* getLiveVariables() { return D.getLiveVariables(); }
-  
+
   virtual void GeneratePathDiagnostic(PathDiagnostic& PD,
                                       BugReportEquivClass& EQ) {}
 
   void Register(BugType *BT);
-  
+
   void EmitReport(BugReport *R);
-  
+
   void EmitBasicReport(const char* BugName, const char* BugStr,
                        SourceLocation Loc,
                        SourceRange* RangeBeg, unsigned NumRanges);
@@ -348,28 +348,28 @@ public:
   void EmitBasicReport(const char* BugName, const char* BugCategory,
                        const char* BugStr, SourceLocation Loc,
                        SourceRange* RangeBeg, unsigned NumRanges);
-  
-  
+
+
   void EmitBasicReport(const char* BugName, const char* BugStr,
                        SourceLocation Loc) {
     EmitBasicReport(BugName, BugStr, Loc, 0, 0);
   }
-  
+
   void EmitBasicReport(const char* BugName, const char* BugCategory,
                        const char* BugStr, SourceLocation Loc) {
     EmitBasicReport(BugName, BugCategory, BugStr, Loc, 0, 0);
   }
-  
+
   void EmitBasicReport(const char* BugName, const char* BugStr,
                        SourceLocation Loc, SourceRange R) {
     EmitBasicReport(BugName, BugStr, Loc, &R, 1);
   }
-  
+
   void EmitBasicReport(const char* BugName, const char* Category,
                        const char* BugStr, SourceLocation Loc, SourceRange R) {
     EmitBasicReport(BugName, Category, BugStr, Loc, &R, 1);
   }
-  
+
   static bool classof(const BugReporter* R) { return true; }
 };
 
@@ -377,12 +377,12 @@ public:
 class GRBugReporter : public BugReporter {
   GRExprEngine& Eng;
   llvm::SmallSet<SymbolRef, 10> NotableSymbols;
-public:  
+public:
   GRBugReporter(BugReporterData& d, GRExprEngine& eng)
     : BugReporter(d, GRBugReporterKind), Eng(eng) {}
-  
+
   virtual ~GRBugReporter();
-  
+
   /// getEngine - Return the analysis engine used to analyze a given
   ///  function or method.
   GRExprEngine &getEngine() { return Eng; }
@@ -390,76 +390,76 @@ public:
   /// getGraph - Get the exploded graph created by the analysis engine
   ///  for the analyzed method or function.
   ExplodedGraph &getGraph();
-  
+
   /// getStateManager - Return the state manager used by the analysis
   ///  engine.
   GRStateManager &getStateManager();
-  
+
   virtual void GeneratePathDiagnostic(PathDiagnostic& PD,
                                       BugReportEquivClass& R);
 
   void addNotableSymbol(SymbolRef Sym) {
     NotableSymbols.insert(Sym);
   }
-  
+
   bool isNotable(SymbolRef Sym) const {
     return (bool) NotableSymbols.count(Sym);
   }
-    
+
   /// classof - Used by isa<>, cast<>, and dyn_cast<>.
   static bool classof(const BugReporter* R) {
     return R->getKind() == GRBugReporterKind;
   }
 };
-  
+
 class BugReporterContext {
   GRBugReporter &BR;
   std::vector<BugReporterVisitor*> Callbacks;
 public:
   BugReporterContext(GRBugReporter& br) : BR(br) {}
   virtual ~BugReporterContext();
-  
+
   void addVisitor(BugReporterVisitor* visitor) {
     if (visitor) Callbacks.push_back(visitor);
   }
-  
+
   typedef std::vector<BugReporterVisitor*>::iterator visitor_iterator;
   visitor_iterator visitor_begin() { return Callbacks.begin(); }
-  visitor_iterator visitor_end() { return Callbacks.end(); }  
-  
-  GRBugReporter& getBugReporter() { return BR; }  
-  
+  visitor_iterator visitor_end() { return Callbacks.end(); }
+
+  GRBugReporter& getBugReporter() { return BR; }
+
   ExplodedGraph &getGraph() { return BR.getGraph(); }
-  
+
   void addNotableSymbol(SymbolRef Sym) {
     // FIXME: For now forward to GRBugReporter.
     BR.addNotableSymbol(Sym);
   }
-  
+
   bool isNotable(SymbolRef Sym) const {
     // FIXME: For now forward to GRBugReporter.
     return BR.isNotable(Sym);
   }
-  
+
   GRStateManager& getStateManager() {
     return BR.getStateManager();
   }
-  
+
   ValueManager& getValueManager() {
     return getStateManager().getValueManager();
   }
-  
+
   ASTContext& getASTContext() {
     return BR.getContext();
   }
-  
+
   SourceManager& getSourceManager() {
     return BR.getSourceManager();
   }
-  
+
   const Decl &getCodeDecl();
   const CFG &getCFG();
-  virtual BugReport::NodeResolver& getNodeResolver() = 0;  
+  virtual BugReport::NodeResolver& getNodeResolver() = 0;
 };
 
 class DiagBugReport : public RangedBugReport {
@@ -468,24 +468,24 @@ class DiagBugReport : public RangedBugReport {
 public:
   DiagBugReport(BugType& D, const char* desc, FullSourceLoc l) :
   RangedBugReport(D, desc, 0), L(l) {}
-  
+
   virtual ~DiagBugReport() {}
-  
+
   // FIXME: Move out-of-line (virtual function).
   SourceLocation getLocation() const { return L; }
-  
-  void addString(const std::string& s) { Strs.push_back(s); }  
-  
+
+  void addString(const std::string& s) { Strs.push_back(s); }
+
   typedef std::list<std::string>::const_iterator str_iterator;
   str_iterator str_begin() const { return Strs.begin(); }
   str_iterator str_end() const { return Strs.end(); }
 };
-  
+
 //===----------------------------------------------------------------------===//
 //===----------------------------------------------------------------------===//
-  
+
 namespace bugreporter {
-  
+
 const Stmt *GetDerefExpr(const ExplodedNode *N);
 const Stmt *GetReceiverExpr(const ExplodedNode *N);
 const Stmt *GetDenomExpr(const ExplodedNode *N);
@@ -496,7 +496,7 @@ void registerTrackNullOrUndefValue(BugReporterContext& BRC, const void *stmt,
                                    const ExplodedNode* N);
 
 } // end namespace clang::bugreporter
-  
+
 //===----------------------------------------------------------------------===//
 
 } // end clang namespace

+ 16 - 16
include/clang/Analysis/PathSensitive/Checker.h

@@ -46,21 +46,21 @@ public:
                  GRExprEngine &eng,
                  ExplodedNode *pred,
                  const void *tag, bool preVisit)
-    : Dst(dst), B(builder), Eng(eng), Pred(pred), 
+    : Dst(dst), B(builder), Eng(eng), Pred(pred),
       OldSink(B.BuildSinks), OldTag(B.Tag),
       OldPointKind(B.PointKind), OldHasGen(B.HasGeneratedNode) {
-        //assert(Dst.empty()); // This is a fake assertion. 
+        //assert(Dst.empty()); // This is a fake assertion.
               // See GRExprEngine::CheckerVisit(), CurrSet is repeatedly used.
         B.Tag = tag;
         if (preVisit)
-          B.PointKind = ProgramPoint::PreStmtKind;        
+          B.PointKind = ProgramPoint::PreStmtKind;
       }
-  
+
   ~CheckerContext() {
     if (!B.BuildSinks && !B.HasGeneratedNode)
       Dst.Add(Pred);
   }
-  
+
   ConstraintManager &getConstraintManager() {
       return Eng.getConstraintManager();
   }
@@ -68,7 +68,7 @@ public:
   GRStmtNodeBuilder &getNodeBuilder() { return B; }
   ExplodedNode *&getPredecessor() { return Pred; }
   const GRState *getState() { return B.GetState(Pred); }
-  
+
   ASTContext &getASTContext() {
     return Eng.getContext();
   }
@@ -76,26 +76,26 @@ public:
   ExplodedNode *GenerateNode(const Stmt *S, bool markAsSink = false) {
     return GenerateNode(S, getState(), markAsSink);
   }
-  
+
   ExplodedNode *GenerateNode(const Stmt* S, const GRState *state,
-                             bool markAsSink = false) {    
+                             bool markAsSink = false) {
     ExplodedNode *node = B.generateNode(S, state, Pred);
-    
+
     if (markAsSink && node)
       node->markAsSink();
-    
+
     return node;
   }
-  
+
   void addTransition(ExplodedNode *node) {
     Dst.Add(node);
   }
-  
+
   void EmitReport(BugReport *R) {
     Eng.getBugReporter().EmitReport(R);
   }
 };
-  
+
 class Checker {
 private:
   friend class GRExprEngine;
@@ -105,11 +105,11 @@ private:
                 GRExprEngine &Eng,
                 const Stmt *stmt,
                 ExplodedNode *Pred, bool isPrevisit) {
-    CheckerContext C(Dst, Builder, Eng, Pred, getTag(), isPrevisit);    
+    CheckerContext C(Dst, Builder, Eng, Pred, getTag(), isPrevisit);
     assert(isPrevisit && "Only previsit supported for now.");
     _PreVisit(C, stmt);
   }
-  
+
 public:
   virtual ~Checker() {}
   virtual void _PreVisit(CheckerContext &C, const Stmt *stmt) = 0;
@@ -119,4 +119,4 @@ public:
 } // end clang namespace
 
 #endif
-  
+

+ 5 - 5
include/clang/Analysis/PathSensitive/CheckerVisitor.h

@@ -14,14 +14,14 @@
 #ifndef LLVM_CLANG_ANALYSIS_CHECKERVISITOR
 #define LLVM_CLANG_ANALYSIS_CHECKERVISITOR
 #include "clang/Analysis/PathSensitive/Checker.h"
-  
+
 namespace clang {
 
 //===----------------------------------------------------------------------===//
 // Checker visitor interface.  Used by subclasses of Checker to specify their
 // own checker visitor logic.
 //===----------------------------------------------------------------------===//
-  
+
 /// CheckerVisitor - This class implements a simple visitor for Stmt subclasses.
 /// Since Expr derives from Stmt, this also includes support for visiting Exprs.
 template<typename ImplClass>
@@ -47,13 +47,13 @@ break;
 #include "clang/Analysis/PathSensitive/CheckerVisitor.def"
     }
   }
-  
+
 #define PREVISIT(NAME) \
 void PreVisit ## NAME(CheckerContext &C, const NAME* S) {}
 #include "clang/Analysis/PathSensitive/CheckerVisitor.def"
 };
-  
+
 } // end clang namespace
 
 #endif
-  
+

+ 7 - 7
include/clang/Analysis/PathSensitive/ConstraintManager.h

@@ -30,32 +30,32 @@ class SVal;
 class ConstraintManager {
 public:
   virtual ~ConstraintManager();
-  virtual const GRState *Assume(const GRState *state, SVal Cond, 
+  virtual const GRState *Assume(const GRState *state, SVal Cond,
                                 bool Assumption) = 0;
 
-  virtual const GRState *AssumeInBound(const GRState *state, SVal Idx, 
+  virtual const GRState *AssumeInBound(const GRState *state, SVal Idx,
                                        SVal UpperBound, bool Assumption) = 0;
-  
+
   std::pair<const GRState*, const GRState*> AssumeDual(const GRState *state,
                                                        DefinedSVal Cond) {
     return std::make_pair(Assume(state, Cond, true),
-                          Assume(state, Cond, false));    
+                          Assume(state, Cond, false));
   }
 
   virtual const llvm::APSInt* getSymVal(const GRState *state,
                                         SymbolRef sym) const = 0;
 
-  virtual bool isEqual(const GRState *state, SymbolRef sym, 
+  virtual bool isEqual(const GRState *state, SymbolRef sym,
                        const llvm::APSInt& V) const = 0;
 
   virtual const GRState *RemoveDeadBindings(const GRState *state,
                                             SymbolReaper& SymReaper) = 0;
 
-  virtual void print(const GRState *state, llvm::raw_ostream& Out, 
+  virtual void print(const GRState *state, llvm::raw_ostream& Out,
                      const char* nl, const char *sep) = 0;
 
   virtual void EndPath(const GRState *state) {}
-  
+
   /// canReasonAbout - Not all ConstraintManagers can accurately reason about
   ///  all SVal values.  This method returns true if the ConstraintManager can
   ///  reasonably handle a given SVal value.  This is typically queried by

+ 16 - 16
include/clang/Analysis/PathSensitive/Environment.h

@@ -35,61 +35,61 @@ class LiveVariables;
 class Environment {
 private:
   friend class EnvironmentManager;
-  
+
   // Type definitions.
   typedef llvm::ImmutableMap<const Stmt*,SVal> BindingsTy;
 
   // Data.
   BindingsTy ExprBindings;
   AnalysisContext *ACtx;
-  
+
   Environment(BindingsTy eb, AnalysisContext *aCtx)
     : ExprBindings(eb), ACtx(aCtx) {}
-  
-public:    
+
+public:
   typedef BindingsTy::iterator iterator;
   iterator begin() const { return ExprBindings.begin(); }
   iterator end() const { return ExprBindings.end(); }
-    
+
   SVal LookupExpr(const Stmt* E) const {
     const SVal* X = ExprBindings.lookup(E);
     return X ? *X : UnknownVal();
   }
-  
+
   SVal GetSVal(const Stmt* Ex, ValueManager& ValMgr) const;
-  
+
   AnalysisContext &getAnalysisContext() const { return *ACtx; }
-  
+
   /// Profile - Profile the contents of an Environment object for use
   ///  in a FoldingSet.
   static void Profile(llvm::FoldingSetNodeID& ID, const Environment* E) {
     E->ExprBindings.Profile(ID);
   }
-  
+
   /// Profile - Used to profile the contents of this object for inclusion
   ///  in a FoldingSet.
   void Profile(llvm::FoldingSetNodeID& ID) const {
     Profile(ID, this);
   }
-  
+
   bool operator==(const Environment& RHS) const {
     return ExprBindings == RHS.ExprBindings;
   }
 };
-  
+
 class EnvironmentManager {
 private:
   typedef Environment::BindingsTy::Factory FactoryTy;
   FactoryTy F;
-  
-public:  
+
+public:
   EnvironmentManager(llvm::BumpPtrAllocator& Allocator) : F(Allocator) {}
   ~EnvironmentManager() {}
-  
+
   Environment getInitialEnvironment(AnalysisContext *ACtx) {
     return Environment(F.GetEmptyMap(), ACtx);
   }
-  
+
   Environment BindExpr(Environment Env, const Stmt *S, SVal V,
                        bool Invalidate);
 
@@ -97,7 +97,7 @@ public:
                                  SymbolReaper &SymReaper, const GRState *ST,
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 };
-  
+
 } // end clang namespace
 
 #endif

+ 71 - 71
include/clang/Analysis/PathSensitive/ExplodedGraph.h

@@ -38,7 +38,7 @@ class ASTContext;
 // contain a specific kind of state.  Typed-specialized versions are defined
 // on top of these classes.
 //===----------------------------------------------------------------------===//
-  
+
 class ExplodedNode : public llvm::FoldingSetNode {
   friend class ExplodedGraph;
   friend class GRCoreEngine;
@@ -46,16 +46,16 @@ class ExplodedNode : public llvm::FoldingSetNode {
   friend class GRBranchNodeBuilder;
   friend class GRIndirectGotoNodeBuilder;
   friend class GRSwitchNodeBuilder;
-  friend class GREndPathNodeBuilder;  
-  
+  friend class GREndPathNodeBuilder;
+
   class NodeGroup {
     enum { Size1 = 0x0, SizeOther = 0x1, AuxFlag = 0x2, Mask = 0x3 };
     uintptr_t P;
-    
+
     unsigned getKind() const {
       return P & 0x1;
     }
-    
+
     void* getPtr() const {
       assert (!getFlag());
       return reinterpret_cast<void*>(P & ~Mask);
@@ -64,55 +64,55 @@ class ExplodedNode : public llvm::FoldingSetNode {
     ExplodedNode *getNode() const {
       return reinterpret_cast<ExplodedNode*>(getPtr());
     }
-    
+
   public:
     NodeGroup() : P(0) {}
-    
+
     ~NodeGroup();
-    
+
     ExplodedNode** begin() const;
-    
+
     ExplodedNode** end() const;
-    
+
     unsigned size() const;
-    
+
     bool empty() const { return size() == 0; }
-    
+
     void addNode(ExplodedNode* N);
-    
+
     void setFlag() {
       assert (P == 0);
       P = AuxFlag;
     }
-    
+
     bool getFlag() const {
       return P & AuxFlag ? true : false;
     }
-  };  
-  
+  };
+
   /// Location - The program location (within a function body) associated
   ///  with this node.
   const ProgramPoint Location;
-  
+
   /// State - The state associated with this node.
   const GRState* State;
-  
+
   /// Preds - The predecessors of this node.
   NodeGroup Preds;
-  
+
   /// Succs - The successors of this node.
   NodeGroup Succs;
 
 public:
 
-  explicit ExplodedNode(const ProgramPoint& loc, const GRState* state) 
+  explicit ExplodedNode(const ProgramPoint& loc, const GRState* state)
     : Location(loc), State(state) {}
 
   /// getLocation - Returns the edge associated with the given node.
   ProgramPoint getLocation() const { return Location; }
 
-  const LocationContext *getLocationContext() const { 
-    return getLocation().getLocationContext(); 
+  const LocationContext *getLocationContext() const {
+    return getLocation().getLocationContext();
   }
 
   const Decl &getCodeDecl() const { return *getLocationContext()->getDecl(); }
@@ -126,14 +126,14 @@ public:
   template <typename T>
   const T* getLocationAs() const { return llvm::dyn_cast<T>(&Location); }
 
-  static void Profile(llvm::FoldingSetNodeID &ID, 
+  static void Profile(llvm::FoldingSetNodeID &ID,
                       const ProgramPoint& Loc, const GRState* state);
 
   void Profile(llvm::FoldingSetNodeID& ID) const {
     Profile(ID, getLocation(), getState());
   }
 
-  /// addPredeccessor - Adds a predecessor to the current node, and 
+  /// addPredeccessor - Adds a predecessor to the current node, and
   ///  in tandem add this node as a successor of the other node.
   void addPredecessor(ExplodedNode* V);
 
@@ -141,18 +141,18 @@ public:
   unsigned pred_size() const { return Preds.size(); }
   bool succ_empty() const { return Succs.empty(); }
   bool pred_empty() const { return Preds.empty(); }
-  
+
   bool isSink() const { return Succs.getFlag(); }
-  void markAsSink() { Succs.setFlag(); } 
+  void markAsSink() { Succs.setFlag(); }
 
   ExplodedNode* getFirstPred() {
     return pred_empty() ? NULL : *(pred_begin());
   }
-  
+
   const ExplodedNode* getFirstPred() const {
     return const_cast<ExplodedNode*>(this)->getFirstPred();
   }
-  
+
   // Iterators over successor and predecessor vertices.
   typedef ExplodedNode**       succ_iterator;
   typedef const ExplodedNode* const * const_succ_iterator;
@@ -164,7 +164,7 @@ public:
 
   const_pred_iterator pred_begin() const {
     return const_cast<ExplodedNode*>(this)->pred_begin();
-  }  
+  }
   const_pred_iterator pred_end() const {
     return const_cast<ExplodedNode*>(this)->pred_end();
   }
@@ -180,26 +180,26 @@ public:
   }
 
   // For debugging.
-  
+
 public:
-  
+
   class Auditor {
   public:
     virtual ~Auditor();
     virtual void AddEdge(ExplodedNode* Src, ExplodedNode* Dst) = 0;
   };
-  
+
   static void SetAuditor(Auditor* A);
 };
 
 // FIXME: Is this class necessary?
 class InterExplodedGraphMap {
   llvm::DenseMap<const ExplodedNode*, ExplodedNode*> M;
-  friend class ExplodedGraph;  
+  friend class ExplodedGraph;
 
 public:
   ExplodedNode* getMappedNode(const ExplodedNode* N) const;
-  
+
   InterExplodedGraphMap() {};
   virtual ~InterExplodedGraphMap() {}
 };
@@ -211,7 +211,7 @@ protected:
   // Type definitions.
   typedef llvm::SmallVector<ExplodedNode*,2>    RootsTy;
   typedef llvm::SmallVector<ExplodedNode*,10>   EndNodesTy;
-    
+
   /// Roots - The roots of the simulation graph. Usually there will be only
   /// one, but clients are free to establish multiple subgraphs within a single
   /// SimulGraph. Moreover, these subgraphs can often merge when paths from
@@ -227,10 +227,10 @@ protected:
 
   /// Allocator - BumpPtrAllocator to create nodes.
   llvm::BumpPtrAllocator Allocator;
-  
+
   /// Ctx - The ASTContext used to "interpret" CodeDecl.
   ASTContext& Ctx;
-  
+
   /// NumNodes - The number of nodes in the graph.
   unsigned NumNodes;
 
@@ -242,7 +242,7 @@ public:
 
   ExplodedNode* getNode(const ProgramPoint& L, const GRState *State,
                         bool* IsNew = 0);
-  
+
   ExplodedGraph* MakeEmptyGraph() const {
     return new ExplodedGraph(Ctx);
   }
@@ -265,7 +265,7 @@ public:
 
   unsigned num_roots() const { return Roots.size(); }
   unsigned num_eops() const { return EndNodes.size(); }
-  
+
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
@@ -278,29 +278,29 @@ public:
   typedef NodeTy* const *                     const_eop_iterator;
   typedef AllNodesTy::iterator                node_iterator;
   typedef AllNodesTy::const_iterator          const_node_iterator;
-  
+
   node_iterator nodes_begin() { return Nodes.begin(); }
 
   node_iterator nodes_end() { return Nodes.end(); }
-  
+
   const_node_iterator nodes_begin() const { return Nodes.begin(); }
-  
+
   const_node_iterator nodes_end() const { return Nodes.end(); }
-  
+
   roots_iterator roots_begin() { return Roots.begin(); }
-  
+
   roots_iterator roots_end() { return Roots.end(); }
-  
+
   const_roots_iterator roots_begin() const { return Roots.begin(); }
-  
-  const_roots_iterator roots_end() const { return Roots.end(); }  
+
+  const_roots_iterator roots_end() const { return Roots.end(); }
 
   eop_iterator eop_begin() { return EndNodes.begin(); }
-    
+
   eop_iterator eop_end() { return EndNodes.end(); }
-  
+
   const_eop_iterator eop_begin() const { return EndNodes.begin(); }
-  
+
   const_eop_iterator eop_end() const { return EndNodes.end(); }
 
   llvm::BumpPtrAllocator& getAllocator() { return Allocator; }
@@ -322,24 +322,24 @@ public:
 class ExplodedNodeSet {
   typedef llvm::SmallPtrSet<ExplodedNode*,5> ImplTy;
   ImplTy Impl;
-  
+
 public:
   ExplodedNodeSet(ExplodedNode* N) {
     assert (N && !static_cast<ExplodedNode*>(N)->isSink());
     Impl.insert(N);
   }
-  
+
   ExplodedNodeSet() {}
-  
+
   inline void Add(ExplodedNode* N) {
     if (N && !static_cast<ExplodedNode*>(N)->isSink()) Impl.insert(N);
   }
-  
+
   ExplodedNodeSet& operator=(const ExplodedNodeSet &X) {
     Impl = X.Impl;
     return *this;
   }
-  
+
   typedef ImplTy::iterator       iterator;
   typedef ImplTy::const_iterator const_iterator;
 
@@ -347,14 +347,14 @@ public:
   inline bool empty()    const { return Impl.empty(); }
 
   inline void clear() { Impl.clear(); }
-  
+
   inline iterator begin() { return Impl.begin(); }
   inline iterator end()   { return Impl.end();   }
-  
+
   inline const_iterator begin() const { return Impl.begin(); }
   inline const_iterator end()   const { return Impl.end();   }
-};  
-  
+};
+
 } // end clang namespace
 
 // GraphTraits
@@ -364,54 +364,54 @@ namespace llvm {
     typedef clang::ExplodedNode NodeType;
     typedef NodeType::succ_iterator  ChildIteratorType;
     typedef llvm::df_iterator<NodeType*>      nodes_iterator;
-    
+
     static inline NodeType* getEntryNode(NodeType* N) {
       return N;
     }
-    
+
     static inline ChildIteratorType child_begin(NodeType* N) {
       return N->succ_begin();
     }
-    
+
     static inline ChildIteratorType child_end(NodeType* N) {
       return N->succ_end();
     }
-    
+
     static inline nodes_iterator nodes_begin(NodeType* N) {
       return df_begin(N);
     }
-    
+
     static inline nodes_iterator nodes_end(NodeType* N) {
       return df_end(N);
     }
   };
-  
+
   template<> struct GraphTraits<const clang::ExplodedNode*> {
     typedef const clang::ExplodedNode NodeType;
     typedef NodeType::const_succ_iterator   ChildIteratorType;
     typedef llvm::df_iterator<NodeType*>       nodes_iterator;
-    
+
     static inline NodeType* getEntryNode(NodeType* N) {
       return N;
     }
-    
+
     static inline ChildIteratorType child_begin(NodeType* N) {
       return N->succ_begin();
     }
-    
+
     static inline ChildIteratorType child_end(NodeType* N) {
       return N->succ_end();
     }
-    
+
     static inline nodes_iterator nodes_begin(NodeType* N) {
       return df_begin(N);
     }
-    
+
     static inline nodes_iterator nodes_end(NodeType* N) {
       return df_end(N);
     }
   };
-  
+
 } // end llvm namespace
 
 #endif

+ 4 - 4
include/clang/Analysis/PathSensitive/GRAuditor.h

@@ -1,5 +1,5 @@
 //==- GRAuditor.h - Observers of the creation of ExplodedNodes------*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
@@ -22,14 +22,14 @@ namespace clang {
 
 class ExplodedNode;
 class GRStateManager;
-  
+
 class GRAuditor {
 public:
   virtual ~GRAuditor() {}
   virtual bool Audit(ExplodedNode* N, GRStateManager& M) = 0;
 };
-  
-  
+
+
 } // end clang namespace
 
 #endif

+ 8 - 8
include/clang/Analysis/PathSensitive/GRBlockCounter.h

@@ -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
@@ -24,27 +24,27 @@ namespace clang {
 
 class GRBlockCounter {
   void* Data;
-  
-  GRBlockCounter(void* D) : Data(D) {}  
+
+  GRBlockCounter(void* D) : Data(D) {}
 
 public:
   GRBlockCounter() : Data(0) {}
-  
+
   unsigned getNumVisited(unsigned BlockID) const;
-  
+
   class Factory {
     void* F;
   public:
     Factory(llvm::BumpPtrAllocator& Alloc);
     ~Factory();
-    
+
     GRBlockCounter GetEmptyCounter();
     GRBlockCounter IncrementCount(GRBlockCounter BC, unsigned BlockID);
   };
-  
+
   friend class Factory;
 };
 
 } // end clang namespace
-  
+
 #endif

+ 95 - 95
include/clang/Analysis/PathSensitive/GRCoreEngine.h

@@ -1,5 +1,5 @@
 //==- GRCoreEngine.h - Path-Sensitive Dataflow Engine --------------*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
@@ -26,7 +26,7 @@
 namespace clang {
 
 //===----------------------------------------------------------------------===//
-/// GRCoreEngine - Implements the core logic of the graph-reachability 
+/// GRCoreEngine - Implements the core logic of the graph-reachability
 ///   analysis. It traverses the CFG and generates the ExplodedGraph.
 ///   Program "states" are treated as opaque void pointers.
 ///   The template class GRCoreEngine (which subclasses GRCoreEngine)
@@ -45,61 +45,61 @@ class GRCoreEngine {
 
   /// G - The simulation graph.  Each node is a (location,state) pair.
   llvm::OwningPtr<ExplodedGraph> G;
-      
+
   /// WList - A set of queued nodes that need to be processed by the
   ///  worklist algorithm.  It is up to the implementation of WList to decide
   ///  the order that nodes are processed.
   GRWorkList* WList;
-  
+
   /// BCounterFactory - A factory object for created GRBlockCounter objects.
   ///   These are used to record for key nodes in the ExplodedGraph the
   ///   number of times different CFGBlocks have been visited along a path.
   GRBlockCounter::Factory BCounterFactory;
-  
+
   void GenerateNode(const ProgramPoint& Loc, const GRState* State,
                     ExplodedNode* Pred);
-  
+
   void HandleBlockEdge(const BlockEdge& E, ExplodedNode* Pred);
   void HandleBlockEntrance(const BlockEntrance& E, ExplodedNode* Pred);
   void HandleBlockExit(CFGBlock* B, ExplodedNode* Pred);
   void HandlePostStmt(const PostStmt& S, CFGBlock* B,
                       unsigned StmtIdx, ExplodedNode *Pred);
-  
+
   void HandleBranch(Stmt* Cond, Stmt* Term, CFGBlock* B,
-                    ExplodedNode* Pred);  
+                    ExplodedNode* Pred);
 
   /// Get the initial state from the subengine.
-  const GRState* getInitialState(const LocationContext *InitLoc) { 
+  const GRState* getInitialState(const LocationContext *InitLoc) {
     return SubEngine.getInitialState(InitLoc);
   }
 
   void ProcessEndPath(GREndPathNodeBuilder& Builder);
-  
+
   void ProcessStmt(Stmt* S, GRStmtNodeBuilder& Builder);
 
-  
+
   bool ProcessBlockEntrance(CFGBlock* Blk, const GRState* State,
                             GRBlockCounter BC);
 
-  
+
   void ProcessBranch(Stmt* Condition, Stmt* Terminator,
                      GRBranchNodeBuilder& Builder);
 
 
   void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& Builder);
 
-  
+
   void ProcessSwitch(GRSwitchNodeBuilder& Builder);
 
 private:
   GRCoreEngine(const GRCoreEngine&); // Do not implement.
   GRCoreEngine& operator=(const GRCoreEngine&);
-  
+
 public:
   /// Construct a GRCoreEngine object to analyze the provided CFG using
   ///  a DFS exploration of the exploded graph.
   GRCoreEngine(ASTContext& ctx, GRSubEngine& subengine)
-    : SubEngine(subengine), G(new ExplodedGraph(ctx)), 
+    : SubEngine(subengine), G(new ExplodedGraph(ctx)),
       WList(GRWorkList::MakeBFS()),
       BCounterFactory(G->getAllocator()) {}
 
@@ -116,7 +116,7 @@ public:
 
   /// getGraph - Returns the exploded graph.
   ExplodedGraph& getGraph() { return *G.get(); }
-  
+
   /// takeGraph - Returns the exploded graph.  Ownership of the graph is
   ///  transfered to the caller.
   ExplodedGraph* takeGraph() { return G.take(); }
@@ -125,13 +125,13 @@ public:
   ///  steps.  Returns true if there is still simulation state on the worklist.
   bool ExecuteWorkList(const LocationContext *L, unsigned Steps);
 };
-  
+
 class GRStmtNodeBuilder {
   GRCoreEngine& Eng;
   CFGBlock& B;
   const unsigned Idx;
   ExplodedNode* Pred;
-  ExplodedNode* LastNode;  
+  ExplodedNode* LastNode;
   GRStateManager& Mgr;
   GRAuditor* Auditor;
 
@@ -141,23 +141,23 @@ public:
   bool HasGeneratedNode;
   ProgramPoint::Kind PointKind;
   const void *Tag;
-  
-  const GRState* CleanedState;  
-  
+
+  const GRState* CleanedState;
+
 
   typedef llvm::SmallPtrSet<ExplodedNode*,5> DeferredTy;
   DeferredTy Deferred;
-  
+
   void GenerateAutoTransition(ExplodedNode* N);
-  
+
 public:
-  GRStmtNodeBuilder(CFGBlock* b, unsigned idx, ExplodedNode* N, 
-                    GRCoreEngine* e, GRStateManager &mgr);      
-  
+  GRStmtNodeBuilder(CFGBlock* b, unsigned idx, ExplodedNode* N,
+                    GRCoreEngine* e, GRStateManager &mgr);
+
   ~GRStmtNodeBuilder();
-  
+
   ExplodedNode* getBasePredecessor() const { return Pred; }
-  
+
   ExplodedNode* getLastNode() const {
     return LastNode ? (LastNode->isSink() ? NULL : LastNode) : NULL;
   }
@@ -167,26 +167,26 @@ public:
   }
 
   GRBlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
-  
+
   unsigned getCurrentBlockCount() const {
     return getBlockCounter().getNumVisited(B.getBlockID());
-  }  
+  }
 
   ExplodedNode* generateNode(PostStmt PP,const GRState* St,ExplodedNode* Pred) {
     HasGeneratedNode = true;
     return generateNodeInternal(PP, St, Pred);
   }
-  
+
   ExplodedNode* generateNode(const Stmt *S, const GRState *St,
                              ExplodedNode *Pred, ProgramPoint::Kind K) {
     HasGeneratedNode = true;
 
-    if (PurgingDeadSymbols) 
-      K = ProgramPoint::PostPurgeDeadSymbolsKind;      
+    if (PurgingDeadSymbols)
+      K = ProgramPoint::PostPurgeDeadSymbolsKind;
 
     return generateNodeInternal(S, St, Pred, K, Tag);
   }
-  
+
   ExplodedNode* generateNode(const Stmt *S, const GRState *St,
                              ExplodedNode *Pred) {
     return generateNode(S, St, Pred, PointKind);
@@ -195,16 +195,16 @@ public:
   ExplodedNode*
   generateNodeInternal(const ProgramPoint &PP, const GRState* State,
                        ExplodedNode* Pred);
-  
+
   ExplodedNode*
   generateNodeInternal(const Stmt* S, const GRState* State, ExplodedNode* Pred,
                    ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
                    const void *tag = 0);
-  
+
   /// getStmt - Return the current block-level expression associated with
   ///  this builder.
   Stmt* getStmt() const { return B[Idx]; }
-  
+
   /// getBlock - Return the CFGBlock associated with the block-level expression
   ///  of this builder.
   CFGBlock* getBlock() const { return &B; }
@@ -218,40 +218,40 @@ public:
       return Pred->getState();
   }
 
-  ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred, 
+  ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred,
                    const GRState* St) {
     return MakeNode(Dst, S, Pred, St, PointKind);
   }
-  
+
   ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred,
-                         const GRState* St, ProgramPoint::Kind K) {    
-    
+                         const GRState* St, ProgramPoint::Kind K) {
+
     const GRState* PredState = GetState(Pred);
-        
+
     // If the state hasn't changed, don't generate a new node.
     if (!BuildSinks && St == PredState && Auditor == 0) {
       Dst.Add(Pred);
       return NULL;
     }
-    
+
     ExplodedNode* N = generateNode(S, St, Pred, K);
-    
-    if (N) {      
+
+    if (N) {
       if (BuildSinks)
         N->markAsSink();
       else {
         if (Auditor && Auditor->Audit(N, Mgr))
           N->markAsSink();
-        
+
         Dst.Add(N);
       }
     }
-    
+
     return N;
   }
-  
+
   ExplodedNode* MakeSinkNode(ExplodedNodeSet& Dst, Stmt* S,
-                       ExplodedNode* Pred, const GRState* St) { 
+                       ExplodedNode* Pred, const GRState* St) {
     bool Tmp = BuildSinks;
     BuildSinks = true;
     ExplodedNode* N = MakeNode(Dst, S, Pred, St);
@@ -260,7 +260,7 @@ public:
   }
 
 };
-  
+
 class GRBranchNodeBuilder {
   GRCoreEngine& Eng;
   CFGBlock* Src;
@@ -270,44 +270,44 @@ class GRBranchNodeBuilder {
 
   typedef llvm::SmallVector<ExplodedNode*,3> DeferredTy;
   DeferredTy Deferred;
-  
+
   bool GeneratedTrue;
   bool GeneratedFalse;
   bool InFeasibleTrue;
   bool InFeasibleFalse;
-  
+
 public:
   GRBranchNodeBuilder(CFGBlock* src, CFGBlock* dstT, CFGBlock* dstF,
-                          ExplodedNode* pred, GRCoreEngine* e) 
+                          ExplodedNode* pred, GRCoreEngine* e)
   : Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred),
     GeneratedTrue(false), GeneratedFalse(false),
     InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {}
-  
+
   ~GRBranchNodeBuilder();
-  
+
   ExplodedNode* getPredecessor() const { return Pred; }
 
   const ExplodedGraph& getGraph() const { return *Eng.G; }
 
   GRBlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
-    
+
   ExplodedNode* generateNode(const GRState* State, bool branch);
-  
+
   CFGBlock* getTargetBlock(bool branch) const {
     return branch ? DstT : DstF;
-  }    
-  
+  }
+
   void markInfeasible(bool branch) {
     if (branch)
       InFeasibleTrue = GeneratedTrue = true;
     else
       InFeasibleFalse = GeneratedFalse = true;
   }
-  
+
   bool isFeasible(bool branch) {
     return branch ? !InFeasibleTrue : !InFeasibleFalse;
   }
-  
+
   const GRState* getState() const {
     return getPredecessor()->getState();
   }
@@ -318,81 +318,81 @@ class GRIndirectGotoNodeBuilder {
   CFGBlock* Src;
   CFGBlock& DispatchBlock;
   Expr* E;
-  ExplodedNode* Pred;  
+  ExplodedNode* Pred;
 
 public:
-  GRIndirectGotoNodeBuilder(ExplodedNode* pred, CFGBlock* src, Expr* e, 
+  GRIndirectGotoNodeBuilder(ExplodedNode* pred, CFGBlock* src, Expr* e,
                             CFGBlock* dispatch, GRCoreEngine* eng)
   : Eng(*eng), Src(src), DispatchBlock(*dispatch), E(e), Pred(pred) {}
 
   class iterator {
     CFGBlock::succ_iterator I;
-    
-    friend class GRIndirectGotoNodeBuilder;    
-    iterator(CFGBlock::succ_iterator i) : I(i) {}    
+
+    friend class GRIndirectGotoNodeBuilder;
+    iterator(CFGBlock::succ_iterator i) : I(i) {}
   public:
-    
+
     iterator& operator++() { ++I; return *this; }
     bool operator!=(const iterator& X) const { return I != X.I; }
-    
+
     LabelStmt* getLabel() const {
       return llvm::cast<LabelStmt>((*I)->getLabel());
     }
-    
+
     CFGBlock*  getBlock() const {
       return *I;
     }
   };
-  
+
   iterator begin() { return iterator(DispatchBlock.succ_begin()); }
   iterator end() { return iterator(DispatchBlock.succ_end()); }
-  
+
   ExplodedNode* generateNode(const iterator& I, const GRState* State,
                              bool isSink = false);
-  
+
   Expr* getTarget() const { return E; }
 
   const GRState* getState() const { return Pred->State; }
 };
-  
+
 class GRSwitchNodeBuilder {
   GRCoreEngine& Eng;
   CFGBlock* Src;
   Expr* Condition;
-  ExplodedNode* Pred;  
+  ExplodedNode* Pred;
 
 public:
   GRSwitchNodeBuilder(ExplodedNode* pred, CFGBlock* src,
                       Expr* condition, GRCoreEngine* eng)
   : Eng(*eng), Src(src), Condition(condition), Pred(pred) {}
-  
+
   class iterator {
     CFGBlock::succ_reverse_iterator I;
-    
-    friend class GRSwitchNodeBuilder;    
-    iterator(CFGBlock::succ_reverse_iterator i) : I(i) {}    
+
+    friend class GRSwitchNodeBuilder;
+    iterator(CFGBlock::succ_reverse_iterator i) : I(i) {}
 
   public:
     iterator& operator++() { ++I; return *this; }
     bool operator!=(const iterator& X) const { return I != X.I; }
-    
+
     CaseStmt* getCase() const {
       return llvm::cast<CaseStmt>((*I)->getLabel());
     }
-    
+
     CFGBlock* getBlock() const {
       return *I;
     }
   };
-  
+
   iterator begin() { return iterator(Src->succ_rbegin()+1); }
   iterator end() { return iterator(Src->succ_rend()); }
-  
+
   ExplodedNode* generateCaseStmtNode(const iterator& I, const GRState* State);
-  
+
   ExplodedNode* generateDefaultCaseNode(const GRState* State,
                                         bool isSink = false);
-  
+
   Expr* getCondition() const { return Condition; }
 
   const GRState* getState() const { return Pred->State; }
@@ -401,28 +401,28 @@ public:
 class GREndPathNodeBuilder {
   GRCoreEngine& Eng;
   CFGBlock& B;
-  ExplodedNode* Pred;  
+  ExplodedNode* Pred;
   bool HasGeneratedNode;
-  
+
 public:
   GREndPathNodeBuilder(CFGBlock* b, ExplodedNode* N, GRCoreEngine* e)
-    : Eng(*e), B(*b), Pred(N), HasGeneratedNode(false) {}      
-  
+    : Eng(*e), B(*b), Pred(N), HasGeneratedNode(false) {}
+
   ~GREndPathNodeBuilder();
-  
+
   ExplodedNode* getPredecessor() const { return Pred; }
-    
-  GRBlockCounter getBlockCounter() const { 
+
+  GRBlockCounter getBlockCounter() const {
     return Eng.WList->getBlockCounter();
   }
-  
+
   unsigned getCurrentBlockCount() const {
     return getBlockCounter().getNumVisited(B.getBlockID());
-  }  
-  
+  }
+
   ExplodedNode* generateNode(const GRState* State, const void *tag = 0,
                              ExplodedNode *P = 0);
-    
+
   CFGBlock* getBlock() const { return &B; }
 
   const GRState* getState() const {

+ 148 - 148
include/clang/Analysis/PathSensitive/GRExprEngine.h

@@ -26,54 +26,54 @@
 #include "clang/AST/Type.h"
 #include "clang/AST/ExprObjC.h"
 
-namespace clang {  
-  
+namespace clang {
+
   class PathDiagnosticClient;
   class Diagnostic;
   class ObjCForCollectionStmt;
   class Checker;
 
-class GRExprEngine : public GRSubEngine {  
+class GRExprEngine : public GRSubEngine {
   AnalysisManager &AMgr;
 
   GRCoreEngine CoreEngine;
-  
+
   /// G - the simulation graph.
   ExplodedGraph& G;
-  
+
   /// Builder - The current GRStmtNodeBuilder which is used when building the
   ///  nodes for a given statement.
   GRStmtNodeBuilder* Builder;
-  
+
   /// StateMgr - Object that manages the data for all created states.
   GRStateManager StateMgr;
 
   /// SymMgr - Object that manages the symbol information.
   SymbolManager& SymMgr;
-  
+
   /// ValMgr - Object that manages/creates SVals.
   ValueManager &ValMgr;
-  
+
   /// SVator - SValuator object that creates SVals from expressions.
   SValuator &SVator;
-  
+
   /// EntryNode - The immediate predecessor node.
   ExplodedNode* EntryNode;
 
   /// CleanedState - The state for EntryNode "cleaned" of all dead
   ///  variables and symbols (as determined by a liveness analysis).
-  const GRState* CleanedState;  
-  
+  const GRState* CleanedState;
+
   /// CurrentStmt - The current block-level statement.
   Stmt* CurrentStmt;
-  
+
   // Obj-C Class Identifiers.
   IdentifierInfo* NSExceptionII;
-  
+
   // Obj-C Selectors.
   Selector* NSExceptionInstanceRaiseSelectors;
   Selector RaiseSel;
-  
+
   llvm::OwningPtr<GRSimpleAPICheck> BatchAuditor;
   std::vector<Checker*> Checkers;
 
@@ -81,21 +81,21 @@ class GRExprEngine : public GRSubEngine {
   //   this object be placed at the very end of member variables so that its
   //   destructor is called before the rest of the GRExprEngine is destroyed.
   GRBugReporter BR;
-  
+
 public:
-  typedef llvm::SmallPtrSet<ExplodedNode*,2> ErrorNodes;  
+  typedef llvm::SmallPtrSet<ExplodedNode*,2> ErrorNodes;
   typedef llvm::DenseMap<ExplodedNode*, Expr*> UndefArgsTy;
-  
+
   /// NilReceiverStructRetExplicit - Nodes in the ExplodedGraph that resulted
   ///  from [x ...] with 'x' definitely being nil and the result was a 'struct'
   //  (an undefined value).
   ErrorNodes NilReceiverStructRetExplicit;
-  
+
   /// NilReceiverStructRetImplicit - Nodes in the ExplodedGraph that resulted
   ///  from [x ...] with 'x' possibly being nil and the result was a 'struct'
   //  (an undefined value).
   ErrorNodes NilReceiverStructRetImplicit;
-  
+
   /// NilReceiverLargerThanVoidPtrRetExplicit - Nodes in the ExplodedGraph that
   /// resulted from [x ...] with 'x' definitely being nil and the result's size
   // was larger than sizeof(void *) (an undefined value).
@@ -105,7 +105,7 @@ public:
   /// resulted from [x ...] with 'x' possibly being nil and the result's size
   // was larger than sizeof(void *) (an undefined value).
   ErrorNodes NilReceiverLargerThanVoidPtrRetImplicit;
-  
+
   /// RetsStackAddr - Nodes in the ExplodedGraph that result from returning
   ///  the address of a stack variable.
   ErrorNodes RetsStackAddr;
@@ -113,65 +113,65 @@ public:
   /// RetsUndef - Nodes in the ExplodedGraph that result from returning
   ///  an undefined value.
   ErrorNodes RetsUndef;
-  
+
   /// UndefBranches - Nodes in the ExplodedGraph that result from
   ///  taking a branch based on an undefined value.
   ErrorNodes UndefBranches;
-  
+
   /// UndefStores - Sinks in the ExplodedGraph that result from
   ///  making a store to an undefined lvalue.
   ErrorNodes UndefStores;
-  
+
   /// NoReturnCalls - Sinks in the ExplodedGraph that result from
   //  calling a function with the attribute "noreturn".
   ErrorNodes NoReturnCalls;
-  
+
   /// ImplicitNullDeref - Nodes in the ExplodedGraph that result from
   ///  taking a dereference on a symbolic pointer that MAY be NULL.
   ErrorNodes ImplicitNullDeref;
-    
+
   /// ExplicitNullDeref - Nodes in the ExplodedGraph that result from
   ///  taking a dereference on a symbolic pointer that MUST be NULL.
   ErrorNodes ExplicitNullDeref;
-  
+
   /// UnitDeref - Nodes in the ExplodedGraph that result from
   ///  taking a dereference on an undefined value.
   ErrorNodes UndefDeref;
 
-  /// ImplicitBadDivides - Nodes in the ExplodedGraph that result from 
+  /// ImplicitBadDivides - Nodes in the ExplodedGraph that result from
   ///  evaluating a divide or modulo operation where the denominator
   ///  MAY be zero.
   ErrorNodes ImplicitBadDivides;
-  
-  /// ExplicitBadDivides - Nodes in the ExplodedGraph that result from 
+
+  /// ExplicitBadDivides - Nodes in the ExplodedGraph that result from
   ///  evaluating a divide or modulo operation where the denominator
   ///  MUST be zero or undefined.
   ErrorNodes ExplicitBadDivides;
-  
-  /// ImplicitBadSizedVLA - Nodes in the ExplodedGraph that result from 
+
+  /// ImplicitBadSizedVLA - Nodes in the ExplodedGraph that result from
   ///  constructing a zero-sized VLA where the size may be zero.
   ErrorNodes ImplicitBadSizedVLA;
-  
-  /// ExplicitBadSizedVLA - Nodes in the ExplodedGraph that result from 
+
+  /// ExplicitBadSizedVLA - Nodes in the ExplodedGraph that result from
   ///  constructing a zero-sized VLA where the size must be zero.
   ErrorNodes ExplicitBadSizedVLA;
-  
+
   /// UndefResults - Nodes in the ExplodedGraph where the operands are defined
   ///  by the result is not.  Excludes divide-by-zero errors.
   ErrorNodes UndefResults;
-  
+
   /// BadCalls - Nodes in the ExplodedGraph resulting from calls to function
   ///  pointers that are NULL (or other constants) or Undefined.
   ErrorNodes BadCalls;
-  
+
   /// UndefReceiver - Nodes in the ExplodedGraph resulting from message
   ///  ObjC message expressions where the receiver is undefined (uninitialized).
   ErrorNodes UndefReceivers;
-  
+
   /// UndefArg - Nodes in the ExplodedGraph resulting from calls to functions
   ///   where a pass-by-value argument has an undefined value.
   UndefArgsTy UndefArgs;
-  
+
   /// MsgExprUndefArgs - Nodes in the ExplodedGraph resulting from
   ///   message expressions where a pass-by-value argument has an undefined
   ///  value.
@@ -184,132 +184,132 @@ public:
   /// OutOfBoundMemAccesses - Nodes in the ExplodedGraph resulting from
   /// out-of-bound memory accesses where the index MUST be out-of-bound.
   ErrorNodes ExplicitOOBMemAccesses;
-  
+
 public:
   GRExprEngine(AnalysisManager &mgr);
 
   ~GRExprEngine();
-  
+
   void ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) {
     CoreEngine.ExecuteWorkList(L, Steps);
   }
-  
+
   /// getContext - Return the ASTContext associated with this analysis.
   ASTContext& getContext() const { return G.getContext(); }
 
   AnalysisManager &getAnalysisManager() const { return AMgr; }
-  
+
   SValuator &getSValuator() { return SVator; }
-  
+
   GRTransferFuncs& getTF() { return *StateMgr.TF; }
-  
+
   BugReporter& getBugReporter() { return BR; }
-  
+
   /// setTransferFunctions
   void setTransferFunctions(GRTransferFuncs* tf);
 
   void setTransferFunctions(GRTransferFuncs& tf) {
     setTransferFunctions(&tf);
   }
-  
+
   /// ViewGraph - Visualize the ExplodedGraph created by executing the
   ///  simulation.
   void ViewGraph(bool trim = false);
-  
+
   void ViewGraph(ExplodedNode** Beg, ExplodedNode** End);
-  
+
   /// getInitialState - Return the initial state used for the root vertex
   ///  in the ExplodedGraph.
   const GRState* getInitialState(const LocationContext *InitLoc);
-  
+
   ExplodedGraph& getGraph() { return G; }
   const ExplodedGraph& getGraph() const { return G; }
 
   void RegisterInternalChecks();
-  
+
   void registerCheck(Checker *check) {
     Checkers.push_back(check);
   }
-  
+
   bool isRetStackAddr(const ExplodedNode* N) const {
     return N->isSink() && RetsStackAddr.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isUndefControlFlow(const ExplodedNode* N) const {
     return N->isSink() && UndefBranches.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isUndefStore(const ExplodedNode* N) const {
     return N->isSink() && UndefStores.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isImplicitNullDeref(const ExplodedNode* N) const {
     return N->isSink() && ImplicitNullDeref.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isExplicitNullDeref(const ExplodedNode* N) const {
     return N->isSink() && ExplicitNullDeref.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isUndefDeref(const ExplodedNode* N) const {
     return N->isSink() && UndefDeref.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isImplicitBadDivide(const ExplodedNode* N) const {
     return N->isSink() && ImplicitBadDivides.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isExplicitBadDivide(const ExplodedNode* N) const {
     return N->isSink() && ExplicitBadDivides.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isNoReturnCall(const ExplodedNode* N) const {
     return N->isSink() && NoReturnCalls.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isUndefResult(const ExplodedNode* N) const {
     return N->isSink() && UndefResults.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isBadCall(const ExplodedNode* N) const {
     return N->isSink() && BadCalls.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   bool isUndefArg(const ExplodedNode* N) const {
     return N->isSink() &&
       (UndefArgs.find(const_cast<ExplodedNode*>(N)) != UndefArgs.end() ||
        MsgExprUndefArgs.find(const_cast<ExplodedNode*>(N)) != MsgExprUndefArgs.end());
   }
-  
+
   bool isUndefReceiver(const ExplodedNode* N) const {
     return N->isSink() && UndefReceivers.count(const_cast<ExplodedNode*>(N)) != 0;
   }
-  
+
   typedef ErrorNodes::iterator ret_stackaddr_iterator;
   ret_stackaddr_iterator ret_stackaddr_begin() { return RetsStackAddr.begin(); }
-  ret_stackaddr_iterator ret_stackaddr_end() { return RetsStackAddr.end(); }  
-  
+  ret_stackaddr_iterator ret_stackaddr_end() { return RetsStackAddr.end(); }
+
   typedef ErrorNodes::iterator ret_undef_iterator;
   ret_undef_iterator ret_undef_begin() { return RetsUndef.begin(); }
   ret_undef_iterator ret_undef_end() { return RetsUndef.end(); }
-  
+
   typedef ErrorNodes::iterator undef_branch_iterator;
   undef_branch_iterator undef_branches_begin() { return UndefBranches.begin(); }
-  undef_branch_iterator undef_branches_end() { return UndefBranches.end(); }  
-  
+  undef_branch_iterator undef_branches_end() { return UndefBranches.end(); }
+
   typedef ErrorNodes::iterator null_deref_iterator;
   null_deref_iterator null_derefs_begin() { return ExplicitNullDeref.begin(); }
   null_deref_iterator null_derefs_end() { return ExplicitNullDeref.end(); }
-  
+
   null_deref_iterator implicit_null_derefs_begin() {
     return ImplicitNullDeref.begin();
   }
   null_deref_iterator implicit_null_derefs_end() {
     return ImplicitNullDeref.end();
   }
-  
+
   typedef ErrorNodes::iterator nil_receiver_struct_ret_iterator;
-  
+
   nil_receiver_struct_ret_iterator nil_receiver_struct_ret_begin() {
     return NilReceiverStructRetExplicit.begin();
   }
@@ -317,9 +317,9 @@ public:
   nil_receiver_struct_ret_iterator nil_receiver_struct_ret_end() {
     return NilReceiverStructRetExplicit.end();
   }
-  
+
   typedef ErrorNodes::iterator nil_receiver_larger_than_voidptr_ret_iterator;
-  
+
   nil_receiver_larger_than_voidptr_ret_iterator
   nil_receiver_larger_than_voidptr_ret_begin() {
     return NilReceiverLargerThanVoidPtrRetExplicit.begin();
@@ -329,60 +329,60 @@ public:
   nil_receiver_larger_than_voidptr_ret_end() {
     return NilReceiverLargerThanVoidPtrRetExplicit.end();
   }
-  
+
   typedef ErrorNodes::iterator undef_deref_iterator;
   undef_deref_iterator undef_derefs_begin() { return UndefDeref.begin(); }
   undef_deref_iterator undef_derefs_end() { return UndefDeref.end(); }
-  
+
   typedef ErrorNodes::iterator bad_divide_iterator;
 
   bad_divide_iterator explicit_bad_divides_begin() {
     return ExplicitBadDivides.begin();
   }
-  
+
   bad_divide_iterator explicit_bad_divides_end() {
     return ExplicitBadDivides.end();
   }
-  
+
   bad_divide_iterator implicit_bad_divides_begin() {
     return ImplicitBadDivides.begin();
   }
-  
+
   bad_divide_iterator implicit_bad_divides_end() {
     return ImplicitBadDivides.end();
   }
-  
+
   typedef ErrorNodes::iterator undef_result_iterator;
   undef_result_iterator undef_results_begin() { return UndefResults.begin(); }
   undef_result_iterator undef_results_end() { return UndefResults.end(); }
 
   typedef ErrorNodes::iterator bad_calls_iterator;
   bad_calls_iterator bad_calls_begin() { return BadCalls.begin(); }
-  bad_calls_iterator bad_calls_end() { return BadCalls.end(); }  
-  
+  bad_calls_iterator bad_calls_end() { return BadCalls.end(); }
+
   typedef UndefArgsTy::iterator undef_arg_iterator;
   undef_arg_iterator undef_arg_begin() { return UndefArgs.begin(); }
-  undef_arg_iterator undef_arg_end() { return UndefArgs.end(); }  
-  
+  undef_arg_iterator undef_arg_end() { return UndefArgs.end(); }
+
   undef_arg_iterator msg_expr_undef_arg_begin() {
     return MsgExprUndefArgs.begin();
   }
   undef_arg_iterator msg_expr_undef_arg_end() {
     return MsgExprUndefArgs.end();
-  }  
-  
+  }
+
   typedef ErrorNodes::iterator undef_receivers_iterator;
 
   undef_receivers_iterator undef_receivers_begin() {
     return UndefReceivers.begin();
   }
-  
+
   undef_receivers_iterator undef_receivers_end() {
     return UndefReceivers.end();
   }
 
   typedef ErrorNodes::iterator oob_memacc_iterator;
-  oob_memacc_iterator implicit_oob_memacc_begin() { 
+  oob_memacc_iterator implicit_oob_memacc_begin() {
     return ImplicitOOBMemAccesses.begin();
   }
   oob_memacc_iterator implicit_oob_memacc_end() {
@@ -397,45 +397,45 @@ public:
 
   void AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C);
   void AddCheck(GRSimpleAPICheck* A);
-  
+
   /// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
-  ///  nodes by processing the 'effects' of a block-level statement.  
-  void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder);    
-  
+  ///  nodes by processing the 'effects' of a block-level statement.
+  void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder);
+
   /// ProcessBlockEntrance - Called by GRCoreEngine when start processing
   ///  a CFGBlock.  This method returns true if the analysis should continue
   ///  exploring the given path, and false otherwise.
   bool ProcessBlockEntrance(CFGBlock* B, const GRState* St,
                             GRBlockCounter BC);
-  
+
   /// ProcessBranch - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a branch condition.
   void ProcessBranch(Stmt* Condition, Stmt* Term, GRBranchNodeBuilder& builder);
-  
+
   /// ProcessIndirectGoto - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a computed goto jump.
   void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder);
-  
+
   /// ProcessSwitch - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a switch statement.
   void ProcessSwitch(GRSwitchNodeBuilder& builder);
-  
+
   /// ProcessEndPath - Called by GRCoreEngine.  Used to generate end-of-path
   ///  nodes when the control reaches the end of a function.
   void ProcessEndPath(GREndPathNodeBuilder& builder) {
     getTF().EvalEndPath(*this, builder);
     StateMgr.EndPath(builder.getState());
   }
-  
+
   GRStateManager& getStateManager() { return StateMgr; }
   const GRStateManager& getStateManager() const { return StateMgr; }
 
   StoreManager& getStoreManager() { return StateMgr.getStoreManager(); }
-  
+
   ConstraintManager& getConstraintManager() {
     return StateMgr.getConstraintManager();
   }
-  
+
   // FIXME: Remove when we migrate over to just using ValueManager.
   BasicValueFactory& getBasicVals() {
     return StateMgr.getBasicVals();
@@ -443,19 +443,19 @@ public:
   const BasicValueFactory& getBasicVals() const {
     return StateMgr.getBasicVals();
   }
-  
-  ValueManager &getValueManager() { return ValMgr; }  
+
+  ValueManager &getValueManager() { return ValMgr; }
   const ValueManager &getValueManager() const { return ValMgr; }
-  
+
   // FIXME: Remove when we migrate over to just using ValueManager.
   SymbolManager& getSymbolManager() { return SymMgr; }
   const SymbolManager& getSymbolManager() const { return SymMgr; }
-  
+
 protected:
   const GRState* GetState(ExplodedNode* N) {
     return N == EntryNode ? CleanedState : N->getState();
   }
-  
+
 public:
   ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred, const GRState* St,
                    ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
@@ -464,60 +464,60 @@ protected:
   /// CheckerVisit - Dispatcher for performing checker-specific logic
   ///  at specific statements.
   void CheckerVisit(Stmt *S, ExplodedNodeSet &Dst, ExplodedNodeSet &Src, bool isPrevisit);
-  
+
   /// Visit - Transfer function logic for all statements.  Dispatches to
   ///  other functions that handle specific kinds of statements.
   void Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   /// VisitLValue - Evaluate the lvalue of the expression. For example, if Ex is
   /// a DeclRefExpr, it evaluates to the MemRegionVal which represents its
   /// storage location. Note that not all kinds of expressions has lvalue.
   void VisitLValue(Expr* Ex, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   /// VisitArraySubscriptExpr - Transfer function for array accesses.
   void VisitArraySubscriptExpr(ArraySubscriptExpr* Ex, ExplodedNode* Pred,
                                ExplodedNodeSet& Dst, bool asLValue);
-  
+
   /// VisitAsmStmt - Transfer function logic for inline asm.
   void VisitAsmStmt(AsmStmt* A, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   void VisitAsmStmtHelperOutputs(AsmStmt* A,
                                  AsmStmt::outputs_iterator I,
                                  AsmStmt::outputs_iterator E,
                                  ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   void VisitAsmStmtHelperInputs(AsmStmt* A,
                                 AsmStmt::inputs_iterator I,
                                 AsmStmt::inputs_iterator E,
                                 ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   /// VisitBinaryOperator - Transfer function logic for binary operators.
   void VisitBinaryOperator(BinaryOperator* B, ExplodedNode* Pred, ExplodedNodeSet& Dst);
 
-  
+
   /// VisitCall - Transfer function for function calls.
   void VisitCall(CallExpr* CE, ExplodedNode* Pred,
                  CallExpr::arg_iterator AI, CallExpr::arg_iterator AE,
                  ExplodedNodeSet& Dst);
   void VisitCallRec(CallExpr* CE, ExplodedNode* Pred,
                     CallExpr::arg_iterator AI, CallExpr::arg_iterator AE,
-                    ExplodedNodeSet& Dst, const FunctionProtoType *, 
+                    ExplodedNodeSet& Dst, const FunctionProtoType *,
                     unsigned ParamIdx = 0);
-  
+
   /// VisitCast - Transfer function logic for all casts (implicit and explicit).
   void VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred, ExplodedNodeSet& Dst);
 
   /// VisitCompoundLiteralExpr - Transfer function logic for compound literals.
   void VisitCompoundLiteralExpr(CompoundLiteralExpr* CL, ExplodedNode* Pred,
                                 ExplodedNodeSet& Dst, bool asLValue);
-  
+
   /// VisitDeclRefExpr - Transfer function logic for DeclRefExprs.
   void VisitDeclRefExpr(DeclRefExpr* DR, ExplodedNode* Pred, ExplodedNodeSet& Dst,
-                        bool asLValue); 
-  
+                        bool asLValue);
+
   /// VisitDeclStmt - Transfer function logic for DeclStmts.
-  void VisitDeclStmt(DeclStmt* DS, ExplodedNode* Pred, ExplodedNodeSet& Dst); 
-  
+  void VisitDeclStmt(DeclStmt* DS, ExplodedNode* Pred, ExplodedNodeSet& Dst);
+
   /// VisitGuardedExpr - Transfer function logic for ?, __builtin_choose
   void VisitGuardedExpr(Expr* Ex, Expr* L, Expr* R, ExplodedNode* Pred, ExplodedNodeSet& Dst);
 
@@ -525,65 +525,65 @@ protected:
 
   /// VisitLogicalExpr - Transfer function logic for '&&', '||'
   void VisitLogicalExpr(BinaryOperator* B, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   /// VisitMemberExpr - Transfer function for member expressions.
   void VisitMemberExpr(MemberExpr* M, ExplodedNode* Pred, ExplodedNodeSet& Dst,bool asLValue);
-  
+
   /// VisitObjCIvarRefExpr - Transfer function logic for ObjCIvarRefExprs.
   void VisitObjCIvarRefExpr(ObjCIvarRefExpr* DR, ExplodedNode* Pred, ExplodedNodeSet& Dst,
-                            bool asLValue); 
+                            bool asLValue);
 
   /// VisitObjCForCollectionStmt - Transfer function logic for
   ///  ObjCForCollectionStmt.
   void VisitObjCForCollectionStmt(ObjCForCollectionStmt* S, ExplodedNode* Pred,
                                   ExplodedNodeSet& Dst);
-  
+
   void VisitObjCForCollectionStmtAux(ObjCForCollectionStmt* S, ExplodedNode* Pred,
                                      ExplodedNodeSet& Dst, SVal ElementV);
-  
+
   /// VisitObjCMessageExpr - Transfer function for ObjC message expressions.
   void VisitObjCMessageExpr(ObjCMessageExpr* ME, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   void VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
                                      ObjCMessageExpr::arg_iterator I,
                                      ObjCMessageExpr::arg_iterator E,
                                      ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   void VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME, ExplodedNode* Pred,
                                           ExplodedNodeSet& Dst);
-  
+
   /// VisitReturnStmt - Transfer function logic for return statements.
   void VisitReturnStmt(ReturnStmt* R, ExplodedNode* Pred, ExplodedNodeSet& Dst);
-  
+
   /// VisitSizeOfAlignOfExpr - Transfer function for sizeof.
   void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr* Ex, ExplodedNode* Pred,
                               ExplodedNodeSet& Dst);
-    
+
   /// VisitUnaryOperator - Transfer function logic for unary operators.
   void VisitUnaryOperator(UnaryOperator* B, ExplodedNode* Pred, ExplodedNodeSet& Dst,
                           bool asLValue);
- 
+
   const GRState* CheckDivideZero(Expr* Ex, const GRState* St, ExplodedNode* Pred,
-                                 SVal Denom);  
-  
+                                 SVal Denom);
+
   /// EvalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic
   ///  expressions of the form 'x != 0' and generate new nodes (stored in Dst)
   ///  with those assumptions.
   void EvalEagerlyAssume(ExplodedNodeSet& Dst, ExplodedNodeSet& Src, Expr *Ex);
-    
+
   SVal EvalMinus(SVal X) {
     return X.isValid() ? SVator.EvalMinus(cast<NonLoc>(X)) : X;
   }
-  
+
   SVal EvalComplement(SVal X) {
     return X.isValid() ? SVator.EvalComplement(cast<NonLoc>(X)) : X;
   }
 
   bool EvalBuiltinFunction(const FunctionDecl *FD, CallExpr *CE,
                            ExplodedNode *Pred, ExplodedNodeSet &Dst);
-  
+
 public:
-  
+
   SVal EvalBinOp(BinaryOperator::Opcode op, NonLoc L, NonLoc R, QualType T) {
     return SVator.EvalBinOpNN(op, L, R, T);
   }
@@ -591,49 +591,49 @@ public:
   SVal EvalBinOp(BinaryOperator::Opcode op, NonLoc L, SVal R, QualType T) {
     return R.isValid() ? SVator.EvalBinOpNN(op, L, cast<NonLoc>(R), T) : R;
   }
-  
+
   SVal EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
                  SVal LHS, SVal RHS, QualType T) {
     return SVator.EvalBinOp(ST, Op, LHS, RHS, T);
   }
 
 protected:
-  
+
   void EvalCall(ExplodedNodeSet& Dst, CallExpr* CE, SVal L, ExplodedNode* Pred);
-  
+
   void EvalObjCMessageExpr(ExplodedNodeSet& Dst, ObjCMessageExpr* ME, ExplodedNode* Pred) {
     assert (Builder && "GRStmtNodeBuilder must be defined.");
     getTF().EvalObjCMessageExpr(Dst, *this, *Builder, ME, Pred);
   }
 
   void EvalReturn(ExplodedNodeSet& Dst, ReturnStmt* s, ExplodedNode* Pred);
-  
-  const GRState* MarkBranch(const GRState* St, Stmt* Terminator, 
+
+  const GRState* MarkBranch(const GRState* St, Stmt* Terminator,
                             bool branchTaken);
-  
+
   /// EvalBind - Handle the semantics of binding a value to a specific location.
   ///  This method is used by EvalStore, VisitDeclStmt, and others.
   void EvalBind(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred,
                 const GRState* St, SVal location, SVal Val);
-  
+
 public:
   void EvalLoad(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred,
                 const GRState* St, SVal location, const void *tag = 0);
-  
+
   ExplodedNode* EvalLocation(Stmt* Ex, ExplodedNode* Pred,
                        const GRState* St, SVal location,
                        const void *tag = 0);
 
-  
+
   void EvalStore(ExplodedNodeSet& Dst, Expr* E, ExplodedNode* Pred, const GRState* St,
                  SVal TargetLV, SVal Val, const void *tag = 0);
-  
+
   void EvalStore(ExplodedNodeSet& Dst, Expr* E, Expr* StoreE, ExplodedNode* Pred,
                  const GRState* St, SVal TargetLV, SVal Val,
                  const void *tag = 0);
-  
+
 };
-  
+
 } // end clang namespace
 
 #endif

+ 8 - 8
include/clang/Analysis/PathSensitive/GRExprEngineBuilders.h

@@ -34,10 +34,10 @@ class GRStmtNodeBuilderRef {
 
 private:
   friend class GRExprEngine;
-  
+
   GRStmtNodeBuilderRef(); // do not implement
   void operator=(const GRStmtNodeBuilderRef&); // do not implement
-  
+
   GRStmtNodeBuilderRef(ExplodedNodeSet &dst,
                        GRStmtNodeBuilder &builder,
                        GRExprEngine& eng,
@@ -47,12 +47,12 @@ private:
   : Dst(dst), B(builder), Eng(eng), Pred(pred),
     state(st), stmt(s), OldSize(Dst.size()), AutoCreateNode(auto_create_node),
     OldSink(B.BuildSinks), OldTag(B.Tag), OldHasGen(B.HasGeneratedNode) {}
-  
+
 public:
 
   ~GRStmtNodeBuilderRef() {
     // Handle the case where no nodes where generated.  Auto-generate that
-    // contains the updated state if we aren't generating sinks.  
+    // contains the updated state if we aren't generating sinks.
     if (!B.BuildSinks && Dst.size() == OldSize && !B.HasGeneratedNode) {
       if (AutoCreateNode)
         B.MakeNode(Dst, const_cast<Stmt*>(stmt), Pred, state);
@@ -62,14 +62,14 @@ public:
   }
 
   const GRState *getState() { return state; }
-  
+
   GRStateManager& getStateManager() {
     return Eng.getStateManager();
   }
-  
+
   ExplodedNode* MakeNode(const GRState* state) {
-    return B.MakeNode(Dst, const_cast<Stmt*>(stmt), Pred, state);    
-  }    
+    return B.MakeNode(Dst, const_cast<Stmt*>(stmt), Pred, state);
+  }
 };
 
 } // end clang namespace

+ 3 - 3
include/clang/Analysis/PathSensitive/GRSimpleAPICheck.h

@@ -20,15 +20,15 @@
 #include "clang/Analysis/PathSensitive/GRState.h"
 
 namespace clang {
-  
+
 class Diagnostic;
 class BugReporter;
 class ASTContext;
 class GRExprEngine;
 class PathDiagnosticClient;
 class ExplodedGraph;
-  
-  
+
+
 class GRSimpleAPICheck : public GRAuditor {
 public:
   GRSimpleAPICheck() {}

+ 122 - 122
include/clang/Analysis/PathSensitive/GRState.h

@@ -49,12 +49,12 @@ typedef StoreManager* (*StoreManagerCreator)(GRStateManager&);
 //===----------------------------------------------------------------------===//
 // GRStateTrait - Traits used by the Generic Data Map of a GRState.
 //===----------------------------------------------------------------------===//
-  
+
 template <typename T> struct GRStatePartialTrait;
 
 template <typename T> struct GRStateTrait {
   typedef typename T::data_type data_type;
-  static inline void* GDMIndex() { return &T::TagInt; }   
+  static inline void* GDMIndex() { return &T::TagInt; }
   static inline void* MakeVoidPtr(data_type D) { return (void*) D; }
   static inline data_type MakeData(void* const* P) {
     return P ? (data_type) *P : (data_type) 0;
@@ -66,19 +66,19 @@ template <typename T> struct GRStateTrait {
 //===----------------------------------------------------------------------===//
 
 class GRStateManager;
-  
+
 /// GRState - This class encapsulates the actual data values for
 ///  for a "state" in our symbolic value tracking.  It is intended to be
 ///  used as a functional object; that is once it is created and made
 ///  "persistent" in a FoldingSet its values will never change.
 class GRState : public llvm::FoldingSetNode {
-public: 
+public:
   typedef llvm::ImmutableSet<llvm::APSInt*>                IntSetTy;
-  typedef llvm::ImmutableMap<void*, void*>                 GenericDataMap;  
-  
+  typedef llvm::ImmutableMap<void*, void*>                 GenericDataMap;
+
 private:
   void operator=(const GRState& R) const;
-  
+
   friend class GRStateManager;
 
   GRStateManager *StateMgr;
@@ -88,9 +88,9 @@ private:
   // FIXME: Make these private.
 public:
   GenericDataMap   GDM;
-  
+
 public:
-  
+
   /// This ctor is used when creating the first GRState object.
   GRState(GRStateManager *mgr, const Environment& env,
           Store st, GenericDataMap gdm)
@@ -98,7 +98,7 @@ public:
       Env(env),
       St(st),
       GDM(gdm) {}
-  
+
   /// Copy ctor - We must explicitly define this or else the "Next" ptr
   ///  in FoldingSetNode will also get copied.
   GRState(const GRState& RHS)
@@ -107,33 +107,33 @@ public:
       Env(RHS.Env),
       St(RHS.St),
       GDM(RHS.GDM) {}
-  
+
   /// getStateManager - Return the GRStateManager associated with this state.
   GRStateManager &getStateManager() const {
     return *StateMgr;
   }
-  
+
   /// getAnalysisContext - Return the AnalysisContext associated with this
   /// state.
   AnalysisContext &getAnalysisContext() const {
     return Env.getAnalysisContext();
   }
-  
+
   /// getEnvironment - Return the environment associated with this state.
   ///  The environment is the mapping from expressions to values.
   const Environment& getEnvironment() const { return Env; }
-  
+
   /// getStore - Return the store associated with this state.  The store
   ///  is a mapping from locations to values.
   Store getStore() const { return St; }
-  
+
   void setStore(Store s) { St = s; }
-  
+
   /// getGDM - Return the generic data map associated with this state.
   GenericDataMap getGDM() const { return GDM; }
-  
+
   void setGDM(GenericDataMap gdm) { GDM = gdm; }
-  
+
   /// Profile - Profile the contents of a GRState object for use
   ///  in a FoldingSet.
   static void Profile(llvm::FoldingSetNodeID& ID, const GRState* V) {
@@ -148,19 +148,19 @@ public:
   void Profile(llvm::FoldingSetNodeID& ID) const {
     Profile(ID, this);
   }
-  
+
   SVal LookupExpr(Expr* E) const {
     return Env.LookupExpr(E);
   }
-  
+
   /// makeWithStore - Return a GRState with the same values as the current
   /// state with the exception of using the specified Store.
   const GRState *makeWithStore(Store store) const;
-    
+
   BasicValueFactory &getBasicVals() const;
   SymbolManager &getSymbolManager() const;
   GRTransferFuncs &getTransferFuncs() const;
-    
+
   //==---------------------------------------------------------------------==//
   // Constraints on values.
   //==---------------------------------------------------------------------==//
@@ -193,12 +193,12 @@ public:
   // FIXME: (a) should probably disappear since it is redundant with (b).
   //  (i.e., (b) could just be set to NULL).
   //
-  
+
   const GRState *assume(SVal condition, bool assumption) const;
-  
-  const GRState *assumeInBound(SVal idx, SVal upperBound, 
+
+  const GRState *assumeInBound(SVal idx, SVal upperBound,
                                bool assumption) const;
-  
+
   //==---------------------------------------------------------------------==//
   // Utility methods for getting regions.
   //==---------------------------------------------------------------------==//
@@ -208,67 +208,67 @@ public:
   //==---------------------------------------------------------------------==//
   // Binding and retrieving values to/from the environment and symbolic store.
   //==---------------------------------------------------------------------==//
-  
+
   /// BindCompoundLiteral - Return the state that has the bindings currently
   ///  in 'state' plus the bindings for the CompoundLiteral.  'R' is the region
   ///  for the compound literal and 'BegInit' and 'EndInit' represent an
   ///  array of initializer values.
   const GRState* bindCompoundLiteral(const CompoundLiteralExpr* CL,
                                      SVal V) const;
-  
+
   const GRState *BindExpr(const Stmt *S, SVal V, bool Invalidate = true) const;
-    
+
   const GRState *bindDecl(const VarDecl *VD, const LocationContext *LC,
                           SVal V) const;
-  
+
   const GRState *bindDeclWithNoInit(const VarDecl *VD,
-                                    const LocationContext *LC) const;  
-  
+                                    const LocationContext *LC) const;
+
   const GRState *bindLoc(Loc location, SVal V) const;
-  
+
   const GRState *bindLoc(SVal location, SVal V) const;
-  
+
   const GRState *unbindLoc(Loc LV) const;
 
   /// Get the lvalue for a variable reference.
   SVal getLValue(const VarDecl *D, const LocationContext *LC) const;
-  
+
   /// Get the lvalue for a StringLiteral.
   SVal getLValue(const StringLiteral *literal) const;
-  
+
   SVal getLValue(const CompoundLiteralExpr *literal) const;
-  
+
   /// Get the lvalue for an ivar reference.
   SVal getLValue(const ObjCIvarDecl *decl, SVal base) const;
-  
+
   /// Get the lvalue for a field reference.
   SVal getLValue(SVal Base, const FieldDecl *decl) const;
-  
+
   /// Get the lvalue for an array index.
   SVal getLValue(QualType ElementType, SVal Base, SVal Idx) const;
-  
+
   const llvm::APSInt *getSymVal(SymbolRef sym) const;
 
   SVal getSVal(const Stmt* Ex) const;
-  
+
   SVal getSValAsScalarOrLoc(const Stmt *Ex) const;
-  
+
   SVal getSVal(Loc LV, QualType T = QualType()) const;
-  
+
   SVal getSVal(const MemRegion* R) const;
-  
+
   SVal getSValAsScalarOrLoc(const MemRegion *R) const;
-  
+
   bool scanReachableSymbols(SVal val, SymbolVisitor& visitor) const;
 
   template <typename CB> CB scanReachableSymbols(SVal val) const;
-  
+
   //==---------------------------------------------------------------------==//
   // Accessing the Generic Data Map (GDM).
   //==---------------------------------------------------------------------==//
 
   void* const* FindGDM(void* K) const;
-  
+
   template<typename T>
   const GRState *add(typename GRStateTrait<T>::key_type K) const;
 
@@ -277,31 +277,31 @@ public:
   get() const {
     return GRStateTrait<T>::MakeData(FindGDM(GRStateTrait<T>::GDMIndex()));
   }
-  
+
   template<typename T>
   typename GRStateTrait<T>::lookup_type
   get(typename GRStateTrait<T>::key_type key) const {
     void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
     return GRStateTrait<T>::Lookup(GRStateTrait<T>::MakeData(d), key);
   }
-  
+
   template <typename T>
   typename GRStateTrait<T>::context_type get_context() const;
-    
-  
+
+
   template<typename T>
   const GRState *remove(typename GRStateTrait<T>::key_type K) const;
 
   template<typename T>
   const GRState *remove(typename GRStateTrait<T>::key_type K,
                         typename GRStateTrait<T>::context_type C) const;
-  
+
   template<typename T>
   const GRState *set(typename GRStateTrait<T>::data_type D) const;
-  
+
   template<typename T>
   const GRState *set(typename GRStateTrait<T>::key_type K,
-                     typename GRStateTrait<T>::value_type E) const;  
+                     typename GRStateTrait<T>::value_type E) const;
 
   template<typename T>
   const GRState *set(typename GRStateTrait<T>::key_type K,
@@ -313,7 +313,7 @@ public:
     void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
     return GRStateTrait<T>::Contains(GRStateTrait<T>::MakeData(d), key);
   }
-  
+
   // State pretty-printing.
   class Printer {
   public:
@@ -321,55 +321,55 @@ public:
     virtual void Print(llvm::raw_ostream& Out, const GRState* state,
                        const char* nl, const char* sep) = 0;
   };
-  
+
   // Pretty-printing.
   void print(llvm::raw_ostream& Out, const char *nl = "\n",
-             const char *sep = "") const;  
+             const char *sep = "") const;
+
+  void printStdErr() const;
+
+  void printDOT(llvm::raw_ostream& Out) const;
 
-  void printStdErr() const; 
-  
-  void printDOT(llvm::raw_ostream& Out) const;  
-  
   // Tags used for the Generic Data Map.
   struct NullDerefTag {
     static int TagInt;
     typedef const SVal* data_type;
   };
 };
-  
+
 class GRStateSet {
   typedef llvm::SmallPtrSet<const GRState*,5> ImplTy;
-  ImplTy Impl;  
+  ImplTy Impl;
 public:
   GRStateSet() {}
 
   inline void Add(const GRState* St) {
     Impl.insert(St);
   }
-  
+
   typedef ImplTy::const_iterator iterator;
-  
+
   inline unsigned size() const { return Impl.size();  }
   inline bool empty()    const { return Impl.empty(); }
-  
+
   inline iterator begin() const { return Impl.begin(); }
   inline iterator end() const { return Impl.end();   }
-  
+
   class AutoPopulate {
     GRStateSet& S;
     unsigned StartSize;
     const GRState* St;
   public:
-    AutoPopulate(GRStateSet& s, const GRState* st) 
+    AutoPopulate(GRStateSet& s, const GRState* st)
       : S(s), StartSize(S.size()), St(st) {}
-    
+
     ~AutoPopulate() {
       if (StartSize == S.size())
         S.Add(St);
     }
   };
-};  
-  
+};
+
 //===----------------------------------------------------------------------===//
 // GRStateManager - Factory object for GRStates.
 //===----------------------------------------------------------------------===//
@@ -377,21 +377,21 @@ public:
 class GRStateManager {
   friend class GRExprEngine;
   friend class GRState;
-  
+
 private:
   EnvironmentManager                   EnvMgr;
   llvm::OwningPtr<StoreManager>        StoreMgr;
   llvm::OwningPtr<ConstraintManager>   ConstraintMgr;
-  
+
   GRState::GenericDataMap::Factory     GDMFactory;
-  
+
   typedef llvm::DenseMap<void*,std::pair<void*,void (*)(void*)> > GDMContextsTy;
   GDMContextsTy GDMContexts;
-    
+
   /// Printers - A set of printer objects used for pretty-printing a GRState.
   ///  GRStateManager owns these objects.
   std::vector<GRState::Printer*> Printers;
-  
+
   /// StateSet - FoldingSet containing all the states created for analyzing
   ///  a particular function.  This is used to unique states.
   llvm::FoldingSet<GRState> StateSet;
@@ -401,36 +401,36 @@ private:
 
   /// Alloc - A BumpPtrAllocator to allocate states.
   llvm::BumpPtrAllocator& Alloc;
-  
+
   /// CurrentStmt - The block-level statement currently being visited.  This
   ///  is set by GRExprEngine.
   Stmt* CurrentStmt;
-  
+
   /// TF - Object that represents a bundle of transfer functions
   ///  for manipulating and creating SVals.
   GRTransferFuncs* TF;
 
 public:
-  
+
   GRStateManager(ASTContext& Ctx,
                  StoreManagerCreator CreateStoreManager,
                  ConstraintManagerCreator CreateConstraintManager,
                  llvm::BumpPtrAllocator& alloc)
-    : EnvMgr(alloc), 
-      GDMFactory(alloc), 
-      ValueMgr(alloc, Ctx, *this), 
+    : EnvMgr(alloc),
+      GDMFactory(alloc),
+      ValueMgr(alloc, Ctx, *this),
       Alloc(alloc) {
     StoreMgr.reset((*CreateStoreManager)(*this));
     ConstraintMgr.reset((*CreateConstraintManager)(*this));
   }
-  
+
   ~GRStateManager();
 
   const GRState *getInitialState(const LocationContext *InitLoc);
-        
+
   ASTContext &getContext() { return ValueMgr.getContext(); }
   const ASTContext &getContext() const { return ValueMgr.getContext(); }
-                 
+
   GRTransferFuncs& getTransferFuncs() { return *TF; }
 
   BasicValueFactory &getBasicVals() {
@@ -439,17 +439,17 @@ public:
   const BasicValueFactory& getBasicVals() const {
     return ValueMgr.getBasicValueFactory();
   }
-                 
+
   SymbolManager &getSymbolManager() {
     return ValueMgr.getSymbolManager();
   }
   const SymbolManager &getSymbolManager() const {
     return ValueMgr.getSymbolManager();
   }
-  
+
   ValueManager &getValueManager() { return ValueMgr; }
   const ValueManager &getValueManager() const { return ValueMgr; }
-  
+
   llvm::BumpPtrAllocator& getAllocator() { return Alloc; }
 
   MemRegionManager& getRegionManager() {
@@ -458,11 +458,11 @@ public:
   const MemRegionManager& getRegionManager() const {
     return ValueMgr.getRegionManager();
   }
-  
+
   StoreManager& getStoreManager() { return *StoreMgr; }
   ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
 
-  const GRState* RemoveDeadBindings(const GRState* St, Stmt* Loc, 
+  const GRState* RemoveDeadBindings(const GRState* St, Stmt* Loc,
                                     SymbolReaper& SymReaper);
 
 public:
@@ -470,10 +470,10 @@ public:
   SVal ArrayToPointer(Loc Array) {
     return StoreMgr->ArrayToPointer(Array);
   }
-  
+
   // Methods that manipulate the GDM.
   const GRState* addGDM(const GRState* St, void* Key, void* Data);
-  
+
   // Methods that query & manipulate the Store.
 
   void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) {
@@ -484,7 +484,7 @@ public:
 
   bool isEqual(const GRState* state, const Expr* Ex, const llvm::APSInt& V);
   bool isEqual(const GRState* state, const Expr* Ex, uint64_t);
-  
+
   //==---------------------------------------------------------------------==//
   // Generic Data Map methods.
   //==---------------------------------------------------------------------==//
@@ -502,21 +502,21 @@ public:
   // The templated methods below use the GRStateTrait<T> class
   // to resolve keys into the GDM and to return data values to clients.
   //
-  
-  // Trait based GDM dispatch.  
+
+  // Trait based GDM dispatch.
   template <typename T>
   const GRState* set(const GRState* st, typename GRStateTrait<T>::data_type D) {
     return addGDM(st, GRStateTrait<T>::GDMIndex(),
                   GRStateTrait<T>::MakeVoidPtr(D));
   }
-  
+
   template<typename T>
   const GRState* set(const GRState* st,
                      typename GRStateTrait<T>::key_type K,
                      typename GRStateTrait<T>::value_type V,
                      typename GRStateTrait<T>::context_type C) {
-    
-    return addGDM(st, GRStateTrait<T>::GDMIndex(), 
+
+    return addGDM(st, GRStateTrait<T>::GDMIndex(),
      GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Set(st->get<T>(), K, V, C)));
   }
 
@@ -532,22 +532,22 @@ public:
   const GRState* remove(const GRState* st,
                         typename GRStateTrait<T>::key_type K,
                         typename GRStateTrait<T>::context_type C) {
-    
-    return addGDM(st, GRStateTrait<T>::GDMIndex(), 
+
+    return addGDM(st, GRStateTrait<T>::GDMIndex(),
      GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Remove(st->get<T>(), K, C)));
   }
-  
+
 
   void* FindGDMContext(void* index,
                        void* (*CreateContext)(llvm::BumpPtrAllocator&),
                        void  (*DeleteContext)(void*));
-  
+
   template <typename T>
   typename GRStateTrait<T>::context_type get_context() {
     void* p = FindGDMContext(GRStateTrait<T>::GDMIndex(),
                              GRStateTrait<T>::CreateContext,
                              GRStateTrait<T>::DeleteContext);
-    
+
     return GRStateTrait<T>::MakeContext(p);
   }
 
@@ -559,7 +559,7 @@ public:
     ConstraintMgr->EndPath(St);
   }
 };
-  
+
 
 //===----------------------------------------------------------------------===//
 // Out-of-line method definitions for GRState.
@@ -577,13 +577,13 @@ inline const GRState *GRState::assume(SVal Cond, bool Assumption) const {
 inline const GRState *GRState::assumeInBound(SVal Idx, SVal UpperBound,
                                              bool Assumption) const {
   return getStateManager().ConstraintMgr->AssumeInBound(this, Idx, UpperBound, Assumption);
-} 
+}
 
 inline const GRState *GRState::bindCompoundLiteral(const CompoundLiteralExpr* CL,
                                             SVal V) const {
   return getStateManager().StoreMgr->BindCompoundLiteral(this, CL, V);
 }
-  
+
 inline const GRState *GRState::bindDecl(const VarDecl* VD,
                                         const LocationContext *LC,
                                         SVal IVal) const {
@@ -594,7 +594,7 @@ inline const GRState *GRState::bindDeclWithNoInit(const VarDecl* VD,
                                                   const LocationContext *LC) const {
   return getStateManager().StoreMgr->BindDeclWithNoInit(this, VD, LC);
 }
-  
+
 inline const GRState *GRState::bindLoc(Loc LV, SVal V) const {
   return getStateManager().StoreMgr->Bind(this, LV, V);
 }
@@ -602,7 +602,7 @@ inline const GRState *GRState::bindLoc(Loc LV, SVal V) const {
 inline const GRState *GRState::bindLoc(SVal LV, SVal V) const {
   return !isa<Loc>(LV) ? this : bindLoc(cast<Loc>(LV), V);
 }
-  
+
 inline SVal GRState::getLValue(const VarDecl* VD,
                                const LocationContext *LC) const {
   return getStateManager().StoreMgr->getLValueVar(this, VD, LC);
@@ -611,7 +611,7 @@ inline SVal GRState::getLValue(const VarDecl* VD,
 inline SVal GRState::getLValue(const StringLiteral *literal) const {
   return getStateManager().StoreMgr->getLValueString(this, literal);
 }
-  
+
 inline SVal GRState::getLValue(const CompoundLiteralExpr *literal) const {
   return getStateManager().StoreMgr->getLValueCompoundLiteral(this, literal);
 }
@@ -619,19 +619,19 @@ inline SVal GRState::getLValue(const CompoundLiteralExpr *literal) const {
 inline SVal GRState::getLValue(const ObjCIvarDecl *D, SVal Base) const {
   return getStateManager().StoreMgr->getLValueIvar(this, D, Base);
 }
-  
+
 inline SVal GRState::getLValue(SVal Base, const FieldDecl* D) const {
   return getStateManager().StoreMgr->getLValueField(this, Base, D);
 }
-  
+
 inline SVal GRState::getLValue(QualType ElementType, SVal Base, SVal Idx) const{
   return getStateManager().StoreMgr->getLValueElement(this, ElementType, Base, Idx);
 }
-  
+
 inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
   return getStateManager().getSymVal(this, sym);
 }
-  
+
 inline SVal GRState::getSVal(const Stmt* Ex) const {
   return Env.GetSVal(Ex, getStateManager().ValueMgr);
 }
@@ -642,7 +642,7 @@ inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
     if (Loc::IsLocType(T) || T->isIntegerType())
       return getSVal(S);
   }
-    
+
   return UnknownVal();
 }
 
@@ -653,7 +653,7 @@ inline SVal GRState::getSVal(Loc LV, QualType T) const {
 inline SVal GRState::getSVal(const MemRegion* R) const {
   return getStateManager().StoreMgr->Retrieve(this, loc::MemRegionVal(R)).getSVal();
 }
-  
+
 inline BasicValueFactory &GRState::getBasicVals() const {
   return getStateManager().getBasicVals();
 }
@@ -661,7 +661,7 @@ inline BasicValueFactory &GRState::getBasicVals() const {
 inline SymbolManager &GRState::getSymbolManager() const {
   return getStateManager().getSymbolManager();
 }
-  
+
 inline GRTransferFuncs &GRState::getTransferFuncs() const {
   return getStateManager().getTransferFuncs();
 }
@@ -670,12 +670,12 @@ template<typename T>
 const GRState *GRState::add(typename GRStateTrait<T>::key_type K) const {
   return getStateManager().add<T>(this, K, get_context<T>());
 }
-  
+
 template <typename T>
 typename GRStateTrait<T>::context_type GRState::get_context() const {
   return getStateManager().get_context<T>();
 }
-  
+
 template<typename T>
 const GRState *GRState::remove(typename GRStateTrait<T>::key_type K) const {
   return getStateManager().remove<T>(this, K, get_context<T>());
@@ -686,25 +686,25 @@ const GRState *GRState::remove(typename GRStateTrait<T>::key_type K,
                                typename GRStateTrait<T>::context_type C) const {
   return getStateManager().remove<T>(this, K, C);
 }
-  
+
 template<typename T>
 const GRState *GRState::set(typename GRStateTrait<T>::data_type D) const {
   return getStateManager().set<T>(this, D);
 }
-  
+
 template<typename T>
 const GRState *GRState::set(typename GRStateTrait<T>::key_type K,
                             typename GRStateTrait<T>::value_type E) const {
   return getStateManager().set<T>(this, K, E, get_context<T>());
 }
-  
+
 template<typename T>
 const GRState *GRState::set(typename GRStateTrait<T>::key_type K,
                             typename GRStateTrait<T>::value_type E,
                             typename GRStateTrait<T>::context_type C) const {
   return getStateManager().set<T>(this, K, E, C);
 }
-  
+
 template <typename CB>
 CB GRState::scanReachableSymbols(SVal val) const {
   CB cb(this);

+ 41 - 41
include/clang/Analysis/PathSensitive/GRStateTrait.h

@@ -1,5 +1,5 @@
 //==- GRStateTrait.h - Partial implementations of GRStateTrait -----*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
@@ -27,59 +27,59 @@ namespace llvm {
 
 namespace clang {
   template <typename T> struct GRStatePartialTrait;
-  
+
   // Partial-specialization for ImmutableMap.
-  
+
   template <typename Key, typename Data, typename Info>
   struct GRStatePartialTrait< llvm::ImmutableMap<Key,Data,Info> > {
     typedef llvm::ImmutableMap<Key,Data,Info> data_type;
-    typedef typename data_type::Factory&      context_type;  
+    typedef typename data_type::Factory&      context_type;
     typedef Key                               key_type;
     typedef Data                              value_type;
     typedef const value_type*                 lookup_type;
-    
+
     static inline data_type MakeData(void* const* p) {
       return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
-    }  
+    }
     static inline void* MakeVoidPtr(data_type B) {
       return B.getRoot();
-    }  
+    }
     static lookup_type Lookup(data_type B, key_type K) {
       return B.lookup(K);
-    }  
+    }
     static data_type Set(data_type B, key_type K, value_type E,context_type F){
       return F.Add(B, K, E);
     }
-    
+
     static data_type Remove(data_type B, key_type K, context_type F) {
       return F.Remove(B, K);
     }
-    
+
     static inline context_type MakeContext(void* p) {
       return *((typename data_type::Factory*) p);
     }
-    
+
     static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
-      return new typename data_type::Factory(Alloc);      
+      return new typename data_type::Factory(Alloc);
     }
-    
+
     static void DeleteContext(void* Ctx) {
       delete (typename data_type::Factory*) Ctx;
-    }      
+    }
   };
-  
-  
+
+
   // Partial-specialization for ImmutableSet.
-  
+
   template <typename Key, typename Info>
   struct GRStatePartialTrait< llvm::ImmutableSet<Key,Info> > {
     typedef llvm::ImmutableSet<Key,Info>      data_type;
-    typedef typename data_type::Factory&      context_type;  
+    typedef typename data_type::Factory&      context_type;
     typedef Key                               key_type;
-    
+
     static inline data_type MakeData(void* const* p) {
       return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
-    }  
+    }
 
     static inline void* MakeVoidPtr(data_type B) {
       return B.getRoot();
@@ -88,60 +88,60 @@ namespace clang {
     static data_type Add(data_type B, key_type K, context_type F) {
       return F.Add(B, K);
     }
-    
+
     static data_type Remove(data_type B, key_type K, context_type F) {
       return F.Remove(B, K);
     }
-    
+
     static bool Contains(data_type B, key_type K) {
       return B.contains(K);
     }
-    
+
     static inline context_type MakeContext(void* p) {
       return *((typename data_type::Factory*) p);
     }
-    
+
     static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
-      return new typename data_type::Factory(Alloc);      
+      return new typename data_type::Factory(Alloc);
     }
-    
+
     static void DeleteContext(void* Ctx) {
       delete (typename data_type::Factory*) Ctx;
-    }      
+    }
   };
-    
+
   // Partial-specialization for ImmutableList.
-  
+
   template <typename T>
   struct GRStatePartialTrait< llvm::ImmutableList<T> > {
     typedef llvm::ImmutableList<T>            data_type;
     typedef T                                 key_type;
-    typedef typename data_type::Factory&      context_type;  
-    
+    typedef typename data_type::Factory&      context_type;
+
     static data_type Add(data_type L, key_type K, context_type F) {
       return F.Add(K, L);
     }
-    
+
     static inline data_type MakeData(void* const* p) {
-      return p ? data_type((const llvm::ImmutableListImpl<T>*) *p) 
+      return p ? data_type((const llvm::ImmutableListImpl<T>*) *p)
                : data_type(0);
-    }  
-    
+    }
+
     static inline void* MakeVoidPtr(data_type D) {
       return  (void*) D.getInternalPointer();
-    }  
-    
+    }
+
     static inline context_type MakeContext(void* p) {
       return *((typename data_type::Factory*) p);
     }
-    
+
     static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
-      return new typename data_type::Factory(Alloc);      
+      return new typename data_type::Factory(Alloc);
     }
-    
+
     static void DeleteContext(void* Ctx) {
       delete (typename data_type::Factory*) Ctx;
-    }      
+    }
   };
 } // end clang namespace
 

+ 9 - 9
include/clang/Analysis/PathSensitive/GRSubEngine.h

@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file defines the interface of a subengine of the GRCoreEngine. 
+// This file defines the interface of a subengine of the GRCoreEngine.
 //
 //===----------------------------------------------------------------------===//
 #ifndef LLVM_CLANG_ANALYSIS_GRSUBENGINE_H
@@ -36,28 +36,28 @@ public:
   virtual GRStateManager& getStateManager() = 0;
 
   /// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
-  ///  nodes by processing the 'effects' of a block-level statement.  
-  virtual void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) = 0; 
-  
+  ///  nodes by processing the 'effects' of a block-level statement.
+  virtual void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) = 0;
+
   /// ProcessBlockEntrance - Called by GRCoreEngine when start processing
   ///  a CFGBlock.  This method returns true if the analysis should continue
   ///  exploring the given path, and false otherwise.
   virtual bool ProcessBlockEntrance(CFGBlock* B, const GRState* St,
                                     GRBlockCounter BC) = 0;
-  
+
   /// ProcessBranch - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a branch condition.
-  virtual void ProcessBranch(Stmt* Condition, Stmt* Term, 
+  virtual void ProcessBranch(Stmt* Condition, Stmt* Term,
                              GRBranchNodeBuilder& builder) = 0;
-  
+
   /// ProcessIndirectGoto - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a computed goto jump.
   virtual void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) = 0;
-  
+
   /// ProcessSwitch - Called by GRCoreEngine.  Used to generate successor
   ///  nodes by processing the 'effects' of a switch statement.
   virtual void ProcessSwitch(GRSwitchNodeBuilder& builder) = 0;
-  
+
   /// ProcessEndPath - Called by GRCoreEngine.  Used to generate end-of-path
   ///  nodes when the control reaches the end of a function.
   virtual void ProcessEndPath(GREndPathNodeBuilder& builder) = 0;

+ 16 - 16
include/clang/Analysis/PathSensitive/GRTransferFuncs.h

@@ -21,66 +21,66 @@
 #include <vector>
 
 namespace clang {
-  
+
 class GRExprEngine;
 class BugReporter;
 class ObjCMessageExpr;
 class GRStmtNodeBuilderRef;
-  
+
 class GRTransferFuncs {
 public:
   GRTransferFuncs() {}
   virtual ~GRTransferFuncs() {}
-  
+
   virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {}
   virtual void RegisterChecks(BugReporter& BR) {}
-  
+
 
   // Calls.
-  
+
   virtual void EvalCall(ExplodedNodeSet& Dst,
                         GRExprEngine& Engine,
                         GRStmtNodeBuilder& Builder,
                         CallExpr* CE, SVal L,
                         ExplodedNode* Pred) {}
-  
+
   virtual void EvalObjCMessageExpr(ExplodedNodeSet& Dst,
                                    GRExprEngine& Engine,
                                    GRStmtNodeBuilder& Builder,
                                    ObjCMessageExpr* ME,
                                    ExplodedNode* Pred) {}
-  
+
   // Stores.
-  
+
   virtual void EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {}
-  
+
   // End-of-path and dead symbol notification.
-  
+
   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) {}
-  
-  // Return statements.  
+
+  // Return statements.
   virtual void EvalReturn(ExplodedNodeSet& Dst,
                           GRExprEngine& Engine,
                           GRStmtNodeBuilder& Builder,
                           ReturnStmt* S,
                           ExplodedNode* Pred) {}
 
-  // Assumptions.  
+  // Assumptions.
   virtual const GRState* EvalAssume(const GRState *state,
                                     SVal Cond, bool Assumption) {
     return state;
   }
 };
-  
+
 } // end clang namespace
 
 #endif

+ 13 - 13
include/clang/Analysis/PathSensitive/GRWorkList.h

@@ -1,5 +1,5 @@
 //==- GRWorkList.h - Worklist class used by GRCoreEngine -----------*- C++ -*-//
-//             
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
@@ -17,16 +17,16 @@
 
 #include "clang/Analysis/PathSensitive/GRBlockCounter.h"
 
-namespace clang {  
+namespace clang {
 
 class ExplodedNodeImpl;
-  
+
 class GRWorkListUnit {
   ExplodedNode* Node;
   GRBlockCounter Counter;
   CFGBlock* Block;
   unsigned BlockIdx;
-  
+
 public:
   GRWorkListUnit(ExplodedNode* N, GRBlockCounter C,
                  CFGBlock* B, unsigned idx)
@@ -34,13 +34,13 @@ public:
     Counter(C),
     Block(B),
     BlockIdx(idx) {}
-  
+
   explicit GRWorkListUnit(ExplodedNode* N, GRBlockCounter C)
   : Node(N),
     Counter(C),
     Block(NULL),
     BlockIdx(0) {}
-  
+
   ExplodedNode* getNode()         const { return Node; }
   GRBlockCounter    getBlockCounter() const { return Counter; }
   CFGBlock*         getBlock()        const { return Block; }
@@ -52,25 +52,25 @@ class GRWorkList {
 public:
   virtual ~GRWorkList();
   virtual bool hasWork() const = 0;
-    
+
   virtual void Enqueue(const GRWorkListUnit& U) = 0;
 
-  void Enqueue(ExplodedNode* N, CFGBlock& B, unsigned idx) {    
+  void Enqueue(ExplodedNode* N, CFGBlock& B, unsigned idx) {
     Enqueue(GRWorkListUnit(N, CurrentCounter, &B, idx));
   }
-  
+
   void Enqueue(ExplodedNode* N) {
     Enqueue(GRWorkListUnit(N, CurrentCounter));
   }
-  
+
   virtual GRWorkListUnit Dequeue() = 0;
-  
+
   void setBlockCounter(GRBlockCounter C) { CurrentCounter = C; }
   GRBlockCounter getBlockCounter() const { return CurrentCounter; }
-  
+
   static GRWorkList *MakeDFS();
   static GRWorkList *MakeBFS();
   static GRWorkList *MakeBFSBlockDFSContents();
 };
-} // end clang namespace  
+} // end clang namespace
 #endif

+ 141 - 141
include/clang/Analysis/PathSensitive/MemRegion.h

@@ -31,15 +31,15 @@
 namespace llvm { class raw_ostream; }
 
 namespace clang {
- 
+
 class MemRegionManager;
 class MemSpaceRegion;
 class LocationContext;
-      
+
 //===----------------------------------------------------------------------===//
 // Base region classes.
 //===----------------------------------------------------------------------===//
-  
+
 /// MemRegion - The root abstract class for all memory regions.
 class MemRegion : public llvm::FoldingSetNode {
 public:
@@ -56,52 +56,52 @@ public:
                   VarRegionKind, FieldRegionKind,
                   ObjCIvarRegionKind, ObjCObjectRegionKind,
                  END_DECL_REGIONS,
-              END_TYPED_REGIONS };  
+              END_TYPED_REGIONS };
 private:
   const Kind kind;
-  
+
 protected:
   MemRegion(Kind k) : kind(k) {}
   virtual ~MemRegion();
 
 public:
   ASTContext &getContext() const;
-  
+
   virtual void Profile(llvm::FoldingSetNodeID& ID) const = 0;
 
   virtual MemRegionManager* getMemRegionManager() const = 0;
 
   std::string getString() const;
-  
+
   const MemSpaceRegion *getMemorySpace() const;
-  
+
   const MemRegion *getBaseRegion() const;
-    
+
   bool hasStackStorage() const;
-  
+
   bool hasParametersStorage() const;
-  
+
   bool hasGlobalsStorage() const;
-  
+
   bool hasGlobalsOrParametersStorage() const;
-  
+
   bool hasHeapStorage() const;
-  
+
   bool hasHeapOrStackStorage() const;
 
   virtual void dumpToStream(llvm::raw_ostream& os) const;
 
   void dump() const;
-  
-  Kind getKind() const { return kind; }  
-  
+
+  Kind getKind() const { return kind; }
+
   template<typename RegionTy> const RegionTy* getAs() const;
-  
+
   virtual bool isBoundable() const { return false; }
 
   static bool classof(const MemRegion*) { return true; }
 };
-  
+
 /// MemSpaceRegion - A memory region that represents and "memory space";
 ///  for example, the set of global variables, the stack frame, etc.
 class MemSpaceRegion : public MemRegion {
@@ -112,7 +112,7 @@ protected:
 
   MemSpaceRegion(MemRegionManager *mgr) : MemRegion(MemSpaceRegionKind),
                                           Mgr(mgr) {}
-  
+
   MemRegionManager* getMemRegionManager() const {
     return Mgr;
   }
@@ -131,28 +131,28 @@ public:
 ///  are subclasses of SubRegion.
 class SubRegion : public MemRegion {
 protected:
-  const MemRegion* superRegion;  
+  const MemRegion* superRegion;
   SubRegion(const MemRegion* sReg, Kind k) : MemRegion(k), superRegion(sReg) {}
 public:
   const MemRegion* getSuperRegion() const {
     return superRegion;
   }
-  
+
   MemRegionManager* getMemRegionManager() const;
-  
+
   bool isSubRegionOf(const MemRegion* R) const;
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() > MemSpaceRegionKind;
   }
 };
- 
+
 //===----------------------------------------------------------------------===//
 // Auxillary data classes for use with MemRegions.
 //===----------------------------------------------------------------------===//
 
 class ElementRegion;
-  
+
 class RegionRawOffset : public std::pair<const MemRegion*, int64_t> {
 private:
   friend class ElementRegion;
@@ -160,7 +160,7 @@ private:
   RegionRawOffset(const MemRegion* reg, int64_t offset = 0)
     : std::pair<const MemRegion*, int64_t>(reg, offset) {}
 
-public: 
+public:
   // FIXME: Eventually support symbolic offsets.
   int64_t getByteOffset() const { return second; }
   const MemRegion *getRegion() const { return first; }
@@ -171,7 +171,7 @@ public:
 
 //===----------------------------------------------------------------------===//
 // MemRegion subclasses.
-//===----------------------------------------------------------------------===//  
+//===----------------------------------------------------------------------===//
 
 /// AllocaRegion - A region that represents an untyped blob of bytes created
 ///  by a call to 'alloca'.
@@ -184,9 +184,9 @@ protected:
 
   AllocaRegion(const Expr* ex, unsigned cnt, const MemRegion *superRegion)
     : SubRegion(superRegion, AllocaRegionKind), Cnt(cnt), Ex(ex) {}
-  
+
 public:
-  
+
   const Expr* getExpr() const { return Ex; }
 
   bool isBoundable() const { return true; }
@@ -195,32 +195,32 @@ public:
 
   static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr* Ex,
                             unsigned Cnt, const MemRegion *superRegion);
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == AllocaRegionKind;
   }
-};    
-  
+};
+
 /// TypedRegion - An abstract class representing regions that are typed.
 class TypedRegion : public SubRegion {
 protected:
   TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {}
-  
+
 public:
   virtual QualType getValueType(ASTContext &C) const = 0;
-  
+
   virtual QualType getLocationType(ASTContext& C) const {
     // FIXME: We can possibly optimize this later to cache this value.
     return C.getPointerType(getValueType(C));
   }
-  
+
   QualType getDesugaredValueType(ASTContext& C) const {
     QualType T = getValueType(C);
     return T.getTypePtr() ? T->getDesugaredType() : T;
   }
-  
+
   QualType getDesugaredLocationType(ASTContext& C) const {
     return getLocationType(C)->getDesugaredType();
   }
@@ -260,9 +260,9 @@ public:
   const FunctionDecl *getDecl() const {
     return FD;
   }
-    
+
   bool isBoundable() const { return false; }
-  
+
   virtual void dumpToStream(llvm::raw_ostream& os) const;
 
   void Profile(llvm::FoldingSetNodeID& ID) const;
@@ -285,9 +285,9 @@ protected:
   const SymbolRef sym;
 
 public:
-  SymbolicRegion(const SymbolRef s, const MemRegion* sreg) 
+  SymbolicRegion(const SymbolRef s, const MemRegion* sreg)
     : SubRegion(sreg, SymbolicRegionKind), sym(s) {}
-    
+
   SymbolRef getSymbol() const {
     return sym;
   }
@@ -299,13 +299,13 @@ public:
   static void ProfileRegion(llvm::FoldingSetNodeID& ID,
                             SymbolRef sym,
                             const MemRegion* superRegion);
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == SymbolicRegionKind;
   }
-};  
+};
 
 /// StringRegion - Region associated with a StringLiteral.
 class StringRegion : public TypedRegion {
@@ -323,7 +323,7 @@ protected:
 public:
 
   const StringLiteral* getStringLiteral() const { return Str; }
-    
+
   QualType getValueType(ASTContext& C) const {
     return Str->getType();
   }
@@ -351,7 +351,7 @@ private:
 
   CompoundLiteralRegion(const CompoundLiteralExpr* cl, const MemRegion* sReg)
     : TypedRegion(sReg, CompoundLiteralRegionKind), CL(cl) {}
-  
+
   static void ProfileRegion(llvm::FoldingSetNodeID& ID,
                             const CompoundLiteralExpr* CL,
                             const MemRegion* superRegion);
@@ -363,11 +363,11 @@ public:
   bool isBoundable() const { return !CL->isFileScope(); }
 
   void Profile(llvm::FoldingSetNodeID& ID) const;
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
 
   const CompoundLiteralExpr* getLiteralExpr() const { return CL; }
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == CompoundLiteralRegionKind;
   }
@@ -382,23 +382,23 @@ protected:
 
   static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl* D,
                       const MemRegion* superRegion, Kind k);
-  
+
 public:
   const Decl* getDecl() const { return D; }
   void Profile(llvm::FoldingSetNodeID& ID) const;
-      
+
   static bool classof(const MemRegion* R) {
     unsigned k = R->getKind();
     return k > BEG_DECL_REGIONS && k < END_DECL_REGIONS;
   }
 };
-  
+
 class VarRegion : public DeclRegion {
   friend class MemRegionManager;
 
   // Data.
   const LocationContext *LC;
-  
+
   // Constructors and private methods.
   VarRegion(const VarDecl* vd, const LocationContext *lC, const MemRegion* sReg)
     : DeclRegion(vd, sReg, VarRegionKind), LC(lC) {}
@@ -409,24 +409,24 @@ class VarRegion : public DeclRegion {
     DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind);
     ID.AddPointer(LC);
   }
-  
+
   void Profile(llvm::FoldingSetNodeID& ID) const;
-  
-public:  
+
+public:
   const VarDecl *getDecl() const { return cast<VarDecl>(D); }
-  
+
   const LocationContext *getLocationContext() const { return LC; }
-  
-  QualType getValueType(ASTContext& C) const { 
+
+  QualType getValueType(ASTContext& C) const {
     // FIXME: We can cache this if needed.
     return C.getCanonicalType(getDecl()->getType());
-  }    
-    
+  }
+
   void dumpToStream(llvm::raw_ostream& os) const;
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == VarRegionKind;
-  }  
+  }
 };
 
 class FieldRegion : public DeclRegion {
@@ -436,57 +436,57 @@ class FieldRegion : public DeclRegion {
     : DeclRegion(fd, sReg, FieldRegionKind) {}
 
 public:
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
-  
+
   const FieldDecl* getDecl() const { return cast<FieldDecl>(D); }
-    
-  QualType getValueType(ASTContext& C) const { 
+
+  QualType getValueType(ASTContext& C) const {
     // FIXME: We can cache this if needed.
     return C.getCanonicalType(getDecl()->getType());
-  }    
+  }
 
   static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl* FD,
                             const MemRegion* superRegion) {
     DeclRegion::ProfileRegion(ID, FD, superRegion, FieldRegionKind);
   }
-    
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == FieldRegionKind;
   }
 };
-  
+
 class ObjCObjectRegion : public DeclRegion {
-  
+
   friend class MemRegionManager;
-  
+
   ObjCObjectRegion(const ObjCInterfaceDecl* ivd, const MemRegion* sReg)
   : DeclRegion(ivd, sReg, ObjCObjectRegionKind) {}
-  
+
   static void ProfileRegion(llvm::FoldingSetNodeID& ID,
                             const ObjCInterfaceDecl* ivd,
                             const MemRegion* superRegion) {
     DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCObjectRegionKind);
   }
-  
+
 public:
   const ObjCInterfaceDecl* getInterface() const {
     return cast<ObjCInterfaceDecl>(D);
   }
-  
+
   QualType getValueType(ASTContext& C) const {
     return C.getObjCInterfaceType(getInterface());
   }
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == ObjCObjectRegionKind;
   }
-};  
-  
+};
+
 class ObjCIvarRegion : public DeclRegion {
-  
+
   friend class MemRegionManager;
-  
+
   ObjCIvarRegion(const ObjCIvarDecl* ivd, const MemRegion* sReg)
     : DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
 
@@ -494,13 +494,13 @@ class ObjCIvarRegion : public DeclRegion {
                             const MemRegion* superRegion) {
     DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCIvarRegionKind);
   }
-  
+
 public:
   const ObjCIvarDecl* getDecl() const { return cast<ObjCIvarDecl>(D); }
   QualType getValueType(ASTContext&) const { return getDecl()->getType(); }
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
-  
+
   static bool classof(const MemRegion* R) {
     return R->getKind() == ObjCIvarRegionKind;
   }
@@ -519,7 +519,7 @@ class ElementRegion : public TypedRegion {
            cast<nonloc::ConcreteInt>(&Idx)->getValue().isSigned()) &&
            "The index must be signed");
   }
-  
+
   static void ProfileRegion(llvm::FoldingSetNodeID& ID, QualType elementType,
                             SVal Idx, const MemRegion* superRegion);
 
@@ -530,13 +530,13 @@ public:
   QualType getValueType(ASTContext&) const {
     return ElementType;
   }
-  
+
   QualType getElementType() const {
     return ElementType;
   }
-  
+
   RegionRawOffset getAsRawOffset() const;
-  
+
   void dumpToStream(llvm::raw_ostream& os) const;
 
   void Profile(llvm::FoldingSetNodeID& ID) const;
@@ -550,7 +550,7 @@ template<typename RegionTy>
 const RegionTy* MemRegion::getAs() const {
   if (const RegionTy* RT = dyn_cast<RegionTy>(this))
     return RT;
-  
+
   return NULL;
 }
 
@@ -562,7 +562,7 @@ class MemRegionManager {
   ASTContext &C;
   llvm::BumpPtrAllocator& A;
   llvm::FoldingSet<MemRegion> Regions;
-  
+
   MemSpaceRegion *globals;
   MemSpaceRegion *stack;
   MemSpaceRegion *stackArguments;
@@ -574,11 +574,11 @@ public:
   MemRegionManager(ASTContext &c, llvm::BumpPtrAllocator& a)
     : C(c), A(a), globals(0), stack(0), stackArguments(0), heap(0),
       unknown(0), code(0) {}
-  
+
   ~MemRegionManager() {}
-  
+
   ASTContext &getContext() { return C; }
-  
+
   /// getStackRegion - Retrieve the memory region associated with the
   ///  current stack frame.
   MemSpaceRegion *getStackRegion();
@@ -586,11 +586,11 @@ public:
   /// getStackArgumentsRegion - Retrieve the memory region associated with
   ///  function/method arguments of the current stack frame.
   MemSpaceRegion *getStackArgumentsRegion();
-  
+
   /// getGlobalsRegion - Retrieve the memory region associated with
   ///  all global variables.
   MemSpaceRegion *getGlobalsRegion();
-  
+
   /// getHeapRegion - Retrieve the memory region associated with the
   ///  generic "heap".
   MemSpaceRegion *getHeapRegion();
@@ -603,12 +603,12 @@ public:
 
   /// getAllocaRegion - Retrieve a region associated with a call to alloca().
   AllocaRegion *getAllocaRegion(const Expr* Ex, unsigned Cnt);
-  
+
   /// getCompoundLiteralRegion - Retrieve the region associated with a
   ///  given CompoundLiteral.
   CompoundLiteralRegion*
-  getCompoundLiteralRegion(const CompoundLiteralExpr* CL);  
-  
+  getCompoundLiteralRegion(const CompoundLiteralExpr* CL);
+
   /// getSymbolicRegion - Retrieve or create a "symbolic" memory region.
   SymbolicRegion* getSymbolicRegion(SymbolRef sym);
 
@@ -617,13 +617,13 @@ public:
   /// getVarRegion - Retrieve or create the memory region associated with
   ///  a specified VarDecl and LocationContext.
   VarRegion* getVarRegion(const VarDecl *D, const LocationContext *LC);
-  
+
   /// getElementRegion - Retrieve the memory region associated with the
   ///  associated element type, index, and super region.
   ElementRegion *getElementRegion(QualType elementType, SVal Idx,
                                   const MemRegion *superRegion,
                                   ASTContext &Ctx);
-  
+
   ElementRegion *getElementRegionWithSuper(const ElementRegion *ER,
                                            const MemRegion *superRegion) {
     return getElementRegion(ER->getElementType(), ER->getIndex(),
@@ -636,44 +636,44 @@ public:
   ///  a structure or class).
   FieldRegion *getFieldRegion(const FieldDecl* fd,
                               const MemRegion* superRegion);
-  
+
   FieldRegion *getFieldRegionWithSuper(const FieldRegion *FR,
                                        const MemRegion *superRegion) {
     return getFieldRegion(FR->getDecl(), superRegion);
   }
-  
+
   /// getObjCObjectRegion - Retrieve or create the memory region associated with
   ///  the instance of a specified Objective-C class.
   ObjCObjectRegion* getObjCObjectRegion(const ObjCInterfaceDecl* ID,
                                   const MemRegion* superRegion);
-  
+
   /// getObjCIvarRegion - Retrieve or create the memory region associated with
   ///   a specified Objective-c instance variable.  'superRegion' corresponds
   ///   to the containing region (which typically represents the Objective-C
   ///   object).
   ObjCIvarRegion *getObjCIvarRegion(const ObjCIvarDecl* ivd,
                                     const MemRegion* superRegion);
-  
+
   CodeTextRegion *getCodeTextRegion(const FunctionDecl *FD);
-  
+
   template <typename RegionTy, typename A1>
   RegionTy* getRegion(const A1 a1);
-  
+
   template <typename RegionTy, typename A1>
   RegionTy* getSubRegion(const A1 a1, const MemRegion* superRegion);
-  
+
   template <typename RegionTy, typename A1, typename A2>
   RegionTy* getRegion(const A1 a1, const A2 a2);
 
-  bool isGlobalsRegion(const MemRegion* R) { 
+  bool isGlobalsRegion(const MemRegion* R) {
     assert(R);
-    return R == globals; 
+    return R == globals;
   }
-  
+
 private:
   MemSpaceRegion* LazyAllocate(MemSpaceRegion*& region);
 };
-  
+
 //===----------------------------------------------------------------------===//
 // Out-of-line member definitions.
 //===----------------------------------------------------------------------===//
@@ -681,69 +681,69 @@ private:
 inline ASTContext& MemRegion::getContext() const {
   return getMemRegionManager()->getContext();
 }
-  
+
 template<typename RegionTy> struct MemRegionManagerTrait;
-  
+
 template <typename RegionTy, typename A1>
 RegionTy* MemRegionManager::getRegion(const A1 a1) {
 
   const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
     MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1);
-  
-  llvm::FoldingSetNodeID ID;  
-  RegionTy::ProfileRegion(ID, a1, superRegion);  
+
+  llvm::FoldingSetNodeID ID;
+  RegionTy::ProfileRegion(ID, a1, superRegion);
   void* InsertPos;
   RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
                                                                    InsertPos));
-  
+
   if (!R) {
     R = (RegionTy*) A.Allocate<RegionTy>();
     new (R) RegionTy(a1, superRegion);
     Regions.InsertNode(R, InsertPos);
   }
-  
+
   return R;
 }
 
 template <typename RegionTy, typename A1>
 RegionTy* MemRegionManager::getSubRegion(const A1 a1,
                                          const MemRegion *superRegion) {
-  llvm::FoldingSetNodeID ID;  
-  RegionTy::ProfileRegion(ID, a1, superRegion);  
+  llvm::FoldingSetNodeID ID;
+  RegionTy::ProfileRegion(ID, a1, superRegion);
   void* InsertPos;
   RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
                                                                    InsertPos));
-  
+
   if (!R) {
     R = (RegionTy*) A.Allocate<RegionTy>();
     new (R) RegionTy(a1, superRegion);
     Regions.InsertNode(R, InsertPos);
   }
-  
+
   return R;
 }
-  
+
 template <typename RegionTy, typename A1, typename A2>
 RegionTy* MemRegionManager::getRegion(const A1 a1, const A2 a2) {
-  
+
   const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
     MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1, a2);
-  
-  llvm::FoldingSetNodeID ID;  
-  RegionTy::ProfileRegion(ID, a1, a2, superRegion);  
+
+  llvm::FoldingSetNodeID ID;
+  RegionTy::ProfileRegion(ID, a1, a2, superRegion);
   void* InsertPos;
   RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
                                                                    InsertPos));
-  
+
   if (!R) {
     R = (RegionTy*) A.Allocate<RegionTy>();
     new (R) RegionTy(a1, a2, superRegion);
     Regions.InsertNode(R, InsertPos);
   }
-  
+
   return R;
 }
-  
+
 //===----------------------------------------------------------------------===//
 // Traits for constructing regions.
 //===----------------------------------------------------------------------===//
@@ -754,18 +754,18 @@ template <> struct MemRegionManagerTrait<AllocaRegion> {
                                              const Expr *, unsigned) {
     return MRMgr.getStackRegion();
   }
-};  
-  
+};
+
 template <> struct MemRegionManagerTrait<CompoundLiteralRegion> {
   typedef MemRegion SuperRegionTy;
   static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
                                              const CompoundLiteralExpr *CL) {
-    
-    return CL->isFileScope() ? MRMgr.getGlobalsRegion() 
+
+    return CL->isFileScope() ? MRMgr.getGlobalsRegion()
                              : MRMgr.getStackRegion();
   }
 };
-  
+
 template <> struct MemRegionManagerTrait<StringRegion> {
   typedef MemSpaceRegion SuperRegionTy;
   static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
@@ -773,24 +773,24 @@ template <> struct MemRegionManagerTrait<StringRegion> {
     return MRMgr.getGlobalsRegion();
   }
 };
-  
+
 template <> struct MemRegionManagerTrait<VarRegion> {
   typedef MemRegion SuperRegionTy;
   static const SuperRegionTy* getSuperRegion(MemRegionManager &MRMgr,
                                              const VarDecl *D,
                                              const LocationContext *LC) {
-    
+
     // FIXME: Make stack regions have a location context?
-    
+
     if (D->hasLocalStorage()) {
       return isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
              ? MRMgr.getStackArgumentsRegion() : MRMgr.getStackRegion();
     }
-    
+
     return MRMgr.getGlobalsRegion();
   }
 };
-  
+
 template <> struct MemRegionManagerTrait<SymbolicRegion> {
   typedef MemRegion SuperRegionTy;
   static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
@@ -810,7 +810,7 @@ template<> struct MemRegionManagerTrait<CodeTextRegion> {
     return MRMgr.getCodeRegion();
   }
 };
-  
+
 } // end clang namespace
 
 //===----------------------------------------------------------------------===//
@@ -819,7 +819,7 @@ template<> struct MemRegionManagerTrait<CodeTextRegion> {
 
 namespace llvm {
 static inline raw_ostream& operator<<(raw_ostream& os,
-                                      const clang::MemRegion* R) { 
+                                      const clang::MemRegion* R) {
   R->dumpToStream(os);
   return os;
 }

+ 80 - 80
include/clang/Analysis/PathSensitive/SVals.h

@@ -38,35 +38,35 @@ class TypedRegion;
 class MemRegionManager;
 class GRStateManager;
 class ValueManager;
-  
+
 class SVal {
 public:
   enum BaseKind { UndefinedKind, UnknownKind, LocKind, NonLocKind };
   enum { BaseBits = 2, BaseMask = 0x3 };
-  
+
 protected:
   void* Data;
   unsigned Kind;
-  
+
 protected:
   SVal(const void* d, bool isLoc, unsigned ValKind)
   : Data(const_cast<void*>(d)),
     Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {}
-  
+
   explicit SVal(BaseKind k, void* D = NULL)
     : Data(D), Kind(k) {}
-  
+
 public:
   SVal() : Data(0), Kind(0) {}
   ~SVal() {};
-  
+
   /// BufferTy - A temporary buffer to hold a set of SVals.
   typedef llvm::SmallVector<SVal,5> BufferTy;
-  
+
   inline unsigned getRawKind() const { return Kind; }
   inline BaseKind getBaseKind() const { return (BaseKind) (Kind & BaseMask); }
   inline unsigned getSubKind() const { return (Kind & ~BaseMask) >> BaseBits; }
-  
+
   inline void Profile(llvm::FoldingSetNodeID& ID) const {
     ID.AddInteger((unsigned) getRawKind());
     ID.AddPointer(reinterpret_cast<void*>(Data));
@@ -75,7 +75,7 @@ public:
   inline bool operator==(const SVal& R) const {
     return getRawKind() == R.getRawKind() && Data == R.Data;
   }
-    
+
   inline bool operator!=(const SVal& R) const {
     return !(*this == R);
   }
@@ -91,25 +91,25 @@ public:
   inline bool isUnknownOrUndef() const {
     return getRawKind() <= UnknownKind;
   }
-  
+
   inline bool isValid() const {
     return getRawKind() > UnknownKind;
   }
-  
+
   bool isZeroConstant() const;
 
   /// hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
   bool hasConjuredSymbol() const;
 
   /// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a
-  /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl. 
+  /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl.
   /// Otherwise return 0.
   const FunctionDecl* getAsFunctionDecl() const;
-  
-  /// getAsLocSymbol - If this SVal is a location (subclasses Loc) and 
+
+  /// getAsLocSymbol - If this SVal is a location (subclasses Loc) and
   ///  wraps a symbol, return that SymbolRef.  Otherwise return a SymbolData*
   SymbolRef getAsLocSymbol() const;
-  
+
   /// getAsSymbol - If this Sval wraps a symbol return that SymbolRef.
   ///  Otherwise return a SymbolRef where 'isValid()' returns false.
   SymbolRef getAsSymbol() const;
@@ -119,7 +119,7 @@ public:
   const SymExpr *getAsSymbolicExpression() const;
 
   const MemRegion *getAsRegion() const;
-  
+
   void dumpToStream(llvm::raw_ostream& OS) const;
   void dump() const;
 
@@ -130,14 +130,14 @@ public:
   public:
     symbol_iterator() {}
     symbol_iterator(const SymExpr* SE);
-    
+
     symbol_iterator& operator++();
     SymbolRef operator*();
-      
+
     bool operator==(const symbol_iterator& X) const;
     bool operator!=(const symbol_iterator& X) const;
   };
-  
+
   symbol_iterator symbol_begin() const {
     const SymExpr *SE = getAsSymbolicExpression();
     if (SE)
@@ -145,9 +145,9 @@ public:
     else
       return symbol_iterator();
   }
-  
+
   symbol_iterator symbol_end() const { return symbol_iterator(); }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SVal*) { return true; }
 };
@@ -155,24 +155,24 @@ public:
 class UnknownVal : public SVal {
 public:
   UnknownVal() : SVal(UnknownKind) {}
-  
+
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == UnknownKind;
-  }  
+  }
 };
 
 class UndefinedVal : public SVal {
 public:
   UndefinedVal() : SVal(UndefinedKind) {}
   UndefinedVal(void* D) : SVal(UndefinedKind, D) {}
-  
+
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == UndefinedKind;
   }
-  
-  void* getData() const { return Data; }  
+
+  void* getData() const { return Data; }
 };
-  
+
 class DefinedSVal : public SVal {
 protected:
   DefinedSVal(const void* d, bool isLoc, unsigned ValKind)
@@ -181,16 +181,16 @@ public:
   // Implement isa<T> support.
   static inline bool classof(const SVal *V) {
     return !V->isUnknownOrUndef();
-  }    
+  }
 };
 
 class NonLoc : public DefinedSVal {
 protected:
   NonLoc(unsigned SubKind, const void* d) : DefinedSVal(d, false, SubKind) {}
-  
+
 public:
   void dumpToStream(llvm::raw_ostream& Out) const;
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == NonLocKind;
@@ -207,45 +207,45 @@ public:
 
   Loc(const Loc& X) : DefinedSVal(X.Data, true, X.getSubKind()) {}
   Loc& operator=(const Loc& X) { memcpy(this, &X, sizeof(Loc)); return *this; }
-    
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == LocKind;
   }
-  
+
   static inline bool IsLocType(QualType T) {
     return T->isAnyPointerType() || T->isBlockPointerType();
   }
 };
-  
+
 //==------------------------------------------------------------------------==//
 //  Subclasses of NonLoc.
 //==------------------------------------------------------------------------==//
 
 namespace nonloc {
-  
+
 enum Kind { ConcreteIntKind, SymbolValKind, SymExprValKind,
             LocAsIntegerKind, CompoundValKind, LazyCompoundValKind };
 
 class SymbolVal : public NonLoc {
 public:
   SymbolVal(SymbolRef sym) : NonLoc(SymbolValKind, sym) {}
-  
+
   SymbolRef getSymbol() const {
     return (const SymbolData*) Data;
   }
-  
+
   static inline bool classof(const SVal* V) {
-    return V->getBaseKind() == NonLocKind && 
+    return V->getBaseKind() == NonLocKind &&
            V->getSubKind() == SymbolValKind;
   }
-  
+
   static inline bool classof(const NonLoc* V) {
     return V->getSubKind() == SymbolValKind;
   }
 };
 
-class SymExprVal : public NonLoc {    
+class SymExprVal : public NonLoc {
 public:
   SymExprVal(const SymExpr *SE)
     : NonLoc(SymExprValKind, reinterpret_cast<const void*>(SE)) {}
@@ -253,12 +253,12 @@ public:
   const SymExpr *getSymbolicExpression() const {
     return reinterpret_cast<SymExpr*>(Data);
   }
-  
+
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == NonLocKind &&
            V->getSubKind() == SymExprValKind;
   }
-  
+
   static inline bool classof(const NonLoc* V) {
     return V->getSubKind() == SymExprValKind;
   }
@@ -267,30 +267,30 @@ public:
 class ConcreteInt : public NonLoc {
 public:
   ConcreteInt(const llvm::APSInt& V) : NonLoc(ConcreteIntKind, &V) {}
-  
+
   const llvm::APSInt& getValue() const {
     return *static_cast<llvm::APSInt*>(Data);
   }
-  
+
   // Transfer functions for binary/unary operations on ConcreteInts.
   SVal evalBinOp(ValueManager &ValMgr, BinaryOperator::Opcode Op,
                  const ConcreteInt& R) const;
-  
+
   ConcreteInt evalComplement(ValueManager &ValMgr) const;
-  
+
   ConcreteInt evalMinus(ValueManager &ValMgr) const;
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == NonLocKind &&
            V->getSubKind() == ConcreteIntKind;
   }
-  
+
   static inline bool classof(const NonLoc* V) {
     return V->getSubKind() == ConcreteIntKind;
   }
 };
-  
+
 class LocAsInteger : public NonLoc {
   friend class clang::ValueManager;
 
@@ -298,28 +298,28 @@ class LocAsInteger : public NonLoc {
     NonLoc(LocAsIntegerKind, &data) {
       assert (isa<Loc>(data.first));
     }
-  
+
 public:
-    
+
   Loc getLoc() const {
     return cast<Loc>(((std::pair<SVal, uintptr_t>*) Data)->first);
   }
-  
+
   const Loc& getPersistentLoc() const {
     const SVal& V = ((std::pair<SVal, uintptr_t>*) Data)->first;
     return cast<Loc>(V);
-  }    
-  
+  }
+
   unsigned getNumBits() const {
     return ((std::pair<SVal, unsigned>*) Data)->second;
   }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == NonLocKind &&
            V->getSubKind() == LocAsIntegerKind;
   }
-  
+
   static inline bool classof(const NonLoc* V) {
     return V->getSubKind() == LocAsIntegerKind;
   }
@@ -334,10 +334,10 @@ public:
   const CompoundValData* getValue() const {
     return static_cast<CompoundValData*>(Data);
   }
-  
+
   typedef llvm::ImmutableList<SVal>::iterator iterator;
   iterator begin() const;
-  iterator end() const;  
+  iterator end() const;
 
   static bool classof(const SVal* V) {
     return V->getBaseKind() == NonLocKind && V->getSubKind() == CompoundValKind;
@@ -347,7 +347,7 @@ public:
     return V->getSubKind() == CompoundValKind;
   }
 };
-  
+
 class LazyCompoundVal : public NonLoc {
   friend class clang::ValueManager;
 
@@ -359,16 +359,16 @@ public:
   }
   const GRState *getState() const;
   const TypedRegion *getRegion() const;
-  
+
   static bool classof(const SVal *V) {
-    return V->getBaseKind() == NonLocKind && 
+    return V->getBaseKind() == NonLocKind &&
            V->getSubKind() == LazyCompoundValKind;
   }
   static bool classof(const NonLoc *V) {
     return V->getSubKind() == LazyCompoundValKind;
   }
 };
-  
+
 } // end namespace clang::nonloc
 
 //==------------------------------------------------------------------------==//
@@ -376,27 +376,27 @@ public:
 //==------------------------------------------------------------------------==//
 
 namespace loc {
-  
+
 enum Kind { GotoLabelKind, MemRegionKind, ConcreteIntKind };
 
 class GotoLabel : public Loc {
 public:
   GotoLabel(LabelStmt* Label) : Loc(GotoLabelKind, Label) {}
-  
+
   LabelStmt* getLabel() const {
     return static_cast<LabelStmt*>(Data);
   }
-  
+
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == LocKind &&
            V->getSubKind() == GotoLabelKind;
   }
-  
+
   static inline bool classof(const Loc* V) {
     return V->getSubKind() == GotoLabelKind;
-  } 
+  }
 };
-  
+
 
 class MemRegionVal : public Loc {
 public:
@@ -405,37 +405,37 @@ public:
   const MemRegion* getRegion() const {
     return static_cast<MemRegion*>(Data);
   }
-  
+
   const MemRegion* getBaseRegion() const;
-  
+
   template <typename REGION>
   const REGION* getRegionAs() const {
     return llvm::dyn_cast<REGION>(getRegion());
-  }  
-  
+  }
+
   inline bool operator==(const MemRegionVal& R) const {
     return getRegion() == R.getRegion();
   }
-  
+
   inline bool operator!=(const MemRegionVal& R) const {
     return getRegion() != R.getRegion();
   }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == LocKind &&
            V->getSubKind() == MemRegionKind;
   }
-  
+
   static inline bool classof(const Loc* V) {
     return V->getSubKind() == MemRegionKind;
-  }    
+  }
 };
 
 class ConcreteInt : public Loc {
 public:
   ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
-  
+
   const llvm::APSInt& getValue() const {
     return *static_cast<llvm::APSInt*>(Data);
   }
@@ -443,20 +443,20 @@ public:
   // Transfer functions for binary/unary operations on ConcreteInts.
   SVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                  const ConcreteInt& R) const;
-      
+
   // Implement isa<T> support.
   static inline bool classof(const SVal* V) {
     return V->getBaseKind() == LocKind &&
            V->getSubKind() == ConcreteIntKind;
   }
-  
+
   static inline bool classof(const Loc* V) {
     return V->getSubKind() == ConcreteIntKind;
   }
 };
-  
+
 } // end clang::loc namespace
-} // end clang namespace  
+} // end clang namespace
 
 namespace llvm {
 static inline llvm::raw_ostream& operator<<(llvm::raw_ostream& os,

+ 11 - 11
include/clang/Analysis/PathSensitive/SValuator.h

@@ -9,7 +9,7 @@
 //
 //  This file defines SValuator, a class that defines the interface for
 //  "symbolical evaluators" which construct an SVal from an expression.
-//  
+//
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_CLANG_ANALYSIS_SVALUATOR
@@ -28,14 +28,14 @@ class SValuator {
 protected:
   ValueManager &ValMgr;
 
-  virtual SVal EvalCastNL(NonLoc val, QualType castTy) = 0;  
-  
+  virtual SVal EvalCastNL(NonLoc val, QualType castTy) = 0;
+
   virtual SVal EvalCastL(Loc val, QualType castTy) = 0;
 
 public:
   SValuator(ValueManager &valMgr) : ValMgr(valMgr) {}
   virtual ~SValuator() {}
-  
+
   class CastResult : public std::pair<const GRState *, SVal> {
   public:
     const GRState *getState() const { return first; }
@@ -43,12 +43,12 @@ public:
     CastResult(const GRState *s, SVal v)
       : std::pair<const GRState*, SVal>(s, v) {}
   };
-  
+
   CastResult EvalCast(SVal val, const GRState *state,
                       QualType castTy, QualType originalType);
-  
+
   virtual SVal EvalMinus(NonLoc val) = 0;
-  
+
   virtual SVal EvalComplement(NonLoc val) = 0;
 
   virtual SVal EvalBinOpNN(BinaryOperator::Opcode Op, NonLoc lhs,
@@ -58,13 +58,13 @@ public:
                            QualType resultTy) = 0;
 
   virtual SVal EvalBinOpLN(const GRState *state, BinaryOperator::Opcode Op,
-                           Loc lhs, NonLoc rhs, QualType resultTy) = 0;  
-  
+                           Loc lhs, NonLoc rhs, QualType resultTy) = 0;
+
   SVal EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
                  SVal L, SVal R, QualType T);
 };
-  
+
 SValuator* CreateSimpleSValuator(ValueManager &valMgr);
-  
+
 } // end clang namespace
 #endif

+ 26 - 26
include/clang/Analysis/PathSensitive/Store.h

@@ -23,16 +23,16 @@
 #include "llvm/ADT/SmallVector.h"
 
 namespace clang {
-  
+
 typedef const void* Store;
 
-class GRState;  
+class GRState;
 class GRStateManager;
 class Stmt;
 class Expr;
 class ObjCIvarDecl;
 class SubRegionMap;
-  
+
 class StoreManager {
 protected:
   ValueManager &ValMgr;
@@ -43,13 +43,13 @@ protected:
 
   StoreManager(GRStateManager &stateMgr);
 
-public:  
+public:
   virtual ~StoreManager() {}
-  
+
   /// Return the value bound to specified location in a given state.
   /// \param[in] state The analysis state.
   /// \param[in] loc The symbolic memory location.
-  /// \param[in] T An optional type that provides a hint indicating the 
+  /// \param[in] T An optional type that provides a hint indicating the
   ///   expected type of the returned value.  This is used if the value is
   ///   lazily computed.
   /// \return The value bound to the location \c loc.
@@ -60,13 +60,13 @@ public:
   /// \param[in] state The analysis state.
   /// \param[in] loc The symbolic memory location.
   /// \param[in] val The value to bind to location \c loc.
-  /// \return A pointer to a GRState object that contains the same bindings as 
+  /// \return A pointer to a GRState object that contains the same bindings as
   ///   \c state with the addition of having the value specified by \c val bound
   ///   to the location given for \c loc.
   virtual const GRState *Bind(const GRState *state, Loc loc, SVal val) = 0;
 
   virtual Store Remove(Store St, Loc L) = 0;
-  
+
   /// BindCompoundLiteral - Return the store that has the bindings currently
   ///  in 'store' plus the bindings for the CompoundLiteral.  'R' is the region
   ///  for the compound literal and 'BegInit' and 'EndInit' represent an
@@ -74,15 +74,15 @@ public:
   virtual const GRState *BindCompoundLiteral(const GRState *state,
                                               const CompoundLiteralExpr* cl,
                                               SVal v) = 0;
-  
+
   /// getInitialStore - Returns the initial "empty" store representing the
   ///  value bindings upon entry to an analyzed function.
   virtual Store getInitialStore(const LocationContext *InitLoc) = 0;
-  
+
   /// getRegionManager - Returns the internal RegionManager object that is
   ///  used to query and manipulate MemRegion objects.
   MemRegionManager& getRegionManager() { return MRMgr; }
-  
+
   /// getSubRegionMap - Returns an opaque map object that clients can query
   ///  to get the subregions of a given MemRegion object.  It is the
   //   caller's responsibility to 'delete' the returned map.
@@ -96,13 +96,13 @@ public:
 
   virtual SVal getLValueCompoundLiteral(const GRState *state,
                                         const CompoundLiteralExpr* cl) = 0;
-  
+
   virtual SVal getLValueIvar(const GRState *state, const ObjCIvarDecl* decl,
                              SVal base) = 0;
-  
+
   virtual SVal getLValueField(const GRState *state, SVal base,
                               const FieldDecl* D) = 0;
-  
+
   virtual SVal getLValueElement(const GRState *state, QualType elementType,
                                 SVal base, SVal offset) = 0;
 
@@ -114,7 +114,7 @@ public:
   /// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
   ///  conversions between arrays and pointers.
   virtual SVal ArrayToPointer(Loc Array) = 0;
-  
+
   class CastResult {
     const GRState *state;
     const MemRegion *region;
@@ -123,19 +123,19 @@ public:
     const MemRegion* getRegion() const { return region; }
     CastResult(const GRState *s, const MemRegion* r = 0) : state(s), region(r){}
   };
-  
+
   /// CastRegion - Used by GRExprEngine::VisitCast to handle casts from
   ///  a MemRegion* to a specific location type.  'R' is the region being
   ///  casted and 'CastToTy' the result type of the cast.
   CastResult CastRegion(const GRState *state, const MemRegion *region,
-                        QualType CastToTy);  
+                        QualType CastToTy);
 
   /// EvalBinOp - Perform pointer arithmetic.
   virtual SVal EvalBinOp(const GRState *state, BinaryOperator::Opcode Op,
                          Loc lhs, NonLoc rhs, QualType resultTy) {
     return UnknownVal();
   }
-  
+
   virtual void RemoveDeadBindings(GRState &state, Stmt* Loc,
                                   SymbolReaper& SymReaper,
                       llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) = 0;
@@ -166,14 +166,14 @@ public:
 
   virtual void print(Store store, llvm::raw_ostream& Out,
                      const char* nl, const char *sep) = 0;
-      
+
   class BindingsHandler {
-  public:    
+  public:
     virtual ~BindingsHandler();
     virtual bool HandleBinding(StoreManager& SMgr, Store store,
                                const MemRegion *region, SVal val) = 0;
   };
-  
+
   /// iterBindings - Iterate over the bindings in the Store.
   virtual void iterBindings(Store store, BindingsHandler& f) = 0;
 
@@ -181,12 +181,12 @@ protected:
   CastResult MakeElementRegion(const GRState *state, const MemRegion *region,
                                QualType pointeeTy, QualType castToTy,
                                uint64_t index = 0);
-  
+
   /// CastRetrievedVal - Used by subclasses of StoreManager to implement
   ///  implicit casts that arise from loads from regions that are reinterpreted
   ///  as another region.
   SValuator::CastResult CastRetrievedVal(SVal val, const GRState *state,
-                                         const TypedRegion *R, QualType castTy);    
+                                         const TypedRegion *R, QualType castTy);
 };
 
 // FIXME: Do we still need this?
@@ -195,14 +195,14 @@ protected:
 class SubRegionMap {
 public:
   virtual ~SubRegionMap() {}
-  
+
   class Visitor {
   public:
     virtual ~Visitor() {};
     virtual bool Visit(const MemRegion* Parent, const MemRegion* SubRegion) = 0;
   };
-  
-  virtual bool iterSubRegions(const MemRegion *region, Visitor& V) const = 0;  
+
+  virtual bool iterSubRegions(const MemRegion *region, Visitor& V) const = 0;
 };
 
 // FIXME: Do we need to pass GRStateManager anymore?

+ 69 - 69
include/clang/Analysis/PathSensitive/SymbolManager.h

@@ -27,7 +27,7 @@ namespace llvm {
   class raw_ostream;
 }
 
-namespace clang {  
+namespace clang {
   class MemRegion;
   class TypedRegion;
   class ASTContext;
@@ -35,7 +35,7 @@ namespace clang {
 }
 
 namespace clang {
-  
+
 class SymExpr : public llvm::FoldingSetNode {
 public:
   enum Kind { BEGIN_SYMBOLS,
@@ -46,47 +46,47 @@ private:
   Kind K;
 
 protected:
-  SymExpr(Kind k) : K(k) {}  
-  
+  SymExpr(Kind k) : K(k) {}
+
 public:
   virtual ~SymExpr() {}
-  
-  Kind getKind() const { return K; }  
-    
+
+  Kind getKind() const { return K; }
+
   void dump() const;
-  
+
   virtual void dumpToStream(llvm::raw_ostream &os) const = 0;
-  
-  virtual QualType getType(ASTContext&) const = 0;  
+
+  virtual QualType getType(ASTContext&) const = 0;
   virtual void Profile(llvm::FoldingSetNodeID& profile) = 0;
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SymExpr*) { return true; }
 };
-  
+
 typedef unsigned SymbolID;
-  
+
 class SymbolData : public SymExpr {
 private:
   const SymbolID Sym;
-  
+
 protected:
-  SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {}  
+  SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {}
 
 public:
   virtual ~SymbolData() {}
-  
+
   SymbolID getSymbolID() const { return Sym; }
 
   // Implement isa<T> support.
-  static inline bool classof(const SymExpr* SE) { 
+  static inline bool classof(const SymExpr* SE) {
     Kind k = SE->getKind();
     return k > BEGIN_SYMBOLS && k < END_SYMBOLS;
   }
 };
 
 typedef const SymbolData* SymbolRef;
-  
+
 class SymbolRegionValue : public SymbolData {
   const MemRegion *R;
   // We may cast the region to another type, so the expected type of the symbol
@@ -96,7 +96,7 @@ class SymbolRegionValue : public SymbolData {
 public:
   SymbolRegionValue(SymbolID sym, const MemRegion *r, QualType t = QualType())
     : SymbolData(RegionValueKind, sym), R(r), T(t) {}
-  
+
   const MemRegion* getRegion() const { return R; }
 
   static void Profile(llvm::FoldingSetNodeID& profile, const MemRegion* R,
@@ -105,13 +105,13 @@ public:
     profile.AddPointer(R);
     T.Profile(profile);
   }
-  
+
   virtual void Profile(llvm::FoldingSetNodeID& profile) {
     Profile(profile, R, T);
   }
-  
+
   void dumpToStream(llvm::raw_ostream &os) const;
-  
+
   QualType getType(ASTContext&) const;
 
   // Implement isa<T> support.
@@ -131,17 +131,17 @@ public:
                  const void* symbolTag)
     : SymbolData(ConjuredKind, sym), S(s), T(t), Count(count),
       SymbolTag(symbolTag) {}
-  
+
   const Stmt* getStmt() const { return S; }
   unsigned getCount() const { return Count; }
   const void* getTag() const { return SymbolTag; }
-  
+
   QualType getType(ASTContext&) const;
-  
+
   void dumpToStream(llvm::raw_ostream &os) const;
-  
+
   static void Profile(llvm::FoldingSetNodeID& profile, const Stmt* S,
-                      QualType T, unsigned Count, const void* SymbolTag) {    
+                      QualType T, unsigned Count, const void* SymbolTag) {
     profile.AddInteger((unsigned) ConjuredKind);
     profile.AddPointer(S);
     profile.Add(T);
@@ -156,39 +156,39 @@ public:
   // Implement isa<T> support.
   static inline bool classof(const SymExpr* SE) {
     return SE->getKind() == ConjuredKind;
-  }  
+  }
 };
-  
+
 class SymbolDerived : public SymbolData {
   SymbolRef parentSymbol;
   const TypedRegion *R;
-  
+
 public:
   SymbolDerived(SymbolID sym, SymbolRef parent, const TypedRegion *r)
     : SymbolData(DerivedKind, sym), parentSymbol(parent), R(r) {}
 
   SymbolRef getParentSymbol() const { return parentSymbol; }
   const TypedRegion *getRegion() const { return R; }
-  
+
   QualType getType(ASTContext&) const;
-  
+
   void dumpToStream(llvm::raw_ostream &os) const;
-  
+
   static void Profile(llvm::FoldingSetNodeID& profile, SymbolRef parent,
                       const TypedRegion *r) {
     profile.AddInteger((unsigned) DerivedKind);
     profile.AddPointer(r);
     profile.AddPointer(parent);
   }
- 
+
   virtual void Profile(llvm::FoldingSetNodeID& profile) {
     Profile(profile, parentSymbol, R);
   }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SymExpr* SE) {
     return SE->getKind() == DerivedKind;
-  }  
+  }
 };
 
 // SymIntExpr - Represents symbolic expression like 'x' + 3.
@@ -205,16 +205,16 @@ public:
 
   // FIXME: We probably need to make this out-of-line to avoid redundant
   // generation of virtual functions.
-  QualType getType(ASTContext& C) const { return T; }  
-  
+  QualType getType(ASTContext& C) const { return T; }
+
   BinaryOperator::Opcode getOpcode() const { return Op; }
-    
-  void dumpToStream(llvm::raw_ostream &os) const;  
-  
+
+  void dumpToStream(llvm::raw_ostream &os) const;
+
   const SymExpr *getLHS() const { return LHS; }
   const llvm::APSInt &getRHS() const { return RHS; }
 
-  static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *lhs, 
+  static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *lhs,
                       BinaryOperator::Opcode op, const llvm::APSInt& rhs,
                       QualType t) {
     ID.AddInteger((unsigned) SymIntKind);
@@ -227,11 +227,11 @@ public:
   void Profile(llvm::FoldingSetNodeID& ID) {
     Profile(ID, LHS, Op, RHS, T);
   }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SymExpr* SE) {
     return SE->getKind() == SymIntKind;
-  }  
+  }
 };
 
 // SymSymExpr - Represents symbolic expression like 'x' + 'y'.
@@ -248,13 +248,13 @@ public:
 
   const SymExpr *getLHS() const { return LHS; }
   const SymExpr *getRHS() const { return RHS; }
-  
+
   // FIXME: We probably need to make this out-of-line to avoid redundant
   // generation of virtual functions.
   QualType getType(ASTContext& C) const { return T; }
-  
+
   void dumpToStream(llvm::raw_ostream &os) const;
-  
+
   static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *lhs,
                     BinaryOperator::Opcode op, const SymExpr *rhs, QualType t) {
     ID.AddInteger((unsigned) SymSymKind);
@@ -267,48 +267,48 @@ public:
   void Profile(llvm::FoldingSetNodeID& ID) {
     Profile(ID, LHS, Op, RHS, T);
   }
-  
+
   // Implement isa<T> support.
   static inline bool classof(const SymExpr* SE) {
     return SE->getKind() == SymSymKind;
-  }  
+  }
 };
 
 class SymbolManager {
   typedef llvm::FoldingSet<SymExpr> DataSetTy;
-  DataSetTy DataSet;  
+  DataSetTy DataSet;
   unsigned SymbolCounter;
   llvm::BumpPtrAllocator& BPAlloc;
   BasicValueFactory &BV;
   ASTContext& Ctx;
-  
+
 public:
-  SymbolManager(ASTContext& ctx, BasicValueFactory &bv, 
+  SymbolManager(ASTContext& ctx, BasicValueFactory &bv,
                 llvm::BumpPtrAllocator& bpalloc)
     : SymbolCounter(0), BPAlloc(bpalloc), BV(bv), Ctx(ctx) {}
-  
+
   ~SymbolManager();
-  
+
   static bool canSymbolicate(QualType T);
 
   /// Make a unique symbol for MemRegion R according to its kind.
-  const SymbolRegionValue* getRegionValueSymbol(const MemRegion* R, 
+  const SymbolRegionValue* getRegionValueSymbol(const MemRegion* R,
 						QualType T = QualType());
   const SymbolConjured* getConjuredSymbol(const Stmt* E, QualType T,
                                           unsigned VisitCount,
                                           const void* SymbolTag = 0);
 
   const SymbolConjured* getConjuredSymbol(const Expr* E, unsigned VisitCount,
-                                          const void* SymbolTag = 0) {    
+                                          const void* SymbolTag = 0) {
     return getConjuredSymbol(E, E->getType(), VisitCount, SymbolTag);
   }
-  
+
   const SymbolDerived *getDerivedSymbol(SymbolRef parentSymbol,
                                         const TypedRegion *R);
 
   const SymIntExpr *getSymIntExpr(const SymExpr *lhs, BinaryOperator::Opcode op,
                                   const llvm::APSInt& rhs, QualType t);
-  
+
   const SymIntExpr *getSymIntExpr(const SymExpr &lhs, BinaryOperator::Opcode op,
                                   const llvm::APSInt& rhs, QualType t) {
     return getSymIntExpr(&lhs, op, rhs, t);
@@ -316,27 +316,27 @@ public:
 
   const SymSymExpr *getSymSymExpr(const SymExpr *lhs, BinaryOperator::Opcode op,
                                   const SymExpr *rhs, QualType t);
-  
+
   QualType getType(const SymExpr *SE) const {
     return SE->getType(Ctx);
   }
-  
+
   ASTContext &getContext() { return Ctx; }
   BasicValueFactory &getBasicVals() { return BV; }
 };
-  
+
 class SymbolReaper {
   typedef llvm::DenseSet<SymbolRef> SetTy;
-  
+
   SetTy TheLiving;
   SetTy TheDead;
   LiveVariables& Liveness;
   SymbolManager& SymMgr;
-  
+
 public:
   SymbolReaper(LiveVariables& liveness, SymbolManager& symmgr)
     : Liveness(liveness), SymMgr(symmgr) {}
-  
+
   ~SymbolReaper() {}
 
   bool isLive(SymbolRef sym);
@@ -348,19 +348,19 @@ public:
   bool isLive(const Stmt* Loc, const VarDecl* VD) const {
     return Liveness.isLive(Loc, VD);
   }
-  
+
   void markLive(SymbolRef sym);
   bool maybeDead(SymbolRef sym);
-  
+
   typedef SetTy::const_iterator dead_iterator;
   dead_iterator dead_begin() const { return TheDead.begin(); }
   dead_iterator dead_end() const { return TheDead.end(); }
-  
+
   bool hasDeadSymbols() const {
     return !TheDead.empty();
   }
 };
-  
+
 class SymbolVisitor {
 public:
   // VisitSymbol - A visitor method invoked by
@@ -369,7 +369,7 @@ public:
   virtual bool VisitSymbol(SymbolRef sym) = 0;
   virtual ~SymbolVisitor();
 };
-  
+
 } // end clang namespace
 
 namespace llvm {

+ 29 - 30
include/clang/Analysis/PathSensitive/ValueManager.h

@@ -25,15 +25,15 @@
 
 namespace llvm { class BumpPtrAllocator; }
 
-namespace clang {  
+namespace clang {
 
 class GRStateManager;
-  
+
 class ValueManager {
 
-  ASTContext &Context;  
+  ASTContext &Context;
   BasicValueFactory BasicVals;
-  
+
   /// SymMgr - Object that manages the symbol information.
   SymbolManager SymMgr;
 
@@ -41,12 +41,12 @@ class ValueManager {
   llvm::OwningPtr<SValuator> SVator;
 
   MemRegionManager MemMgr;
-  
+
   GRStateManager &StateMgr;
-  
+
   const QualType ArrayIndexTy;
   const unsigned ArrayIndexWidth;
-  
+
 public:
   ValueManager(llvm::BumpPtrAllocator &alloc, ASTContext &context,
                GRStateManager &stateMgr)
@@ -54,40 +54,39 @@ public:
                  SymMgr(context, BasicVals, alloc),
                  MemMgr(context, alloc), StateMgr(stateMgr),
                  ArrayIndexTy(context.IntTy),
-                 ArrayIndexWidth(context.getTypeSize(ArrayIndexTy))  
-  {
+                 ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {
     // FIXME: Generalize later.
     SVator.reset(clang::CreateSimpleSValuator(*this));
   }
 
   // Accessors to submanagers.
-  
+
   ASTContext &getContext() { return Context; }
   const ASTContext &getContext() const { return Context; }
-  
+
   GRStateManager &getStateManager() { return StateMgr; }
-  
+
   BasicValueFactory &getBasicValueFactory() { return BasicVals; }
   const BasicValueFactory &getBasicValueFactory() const { return BasicVals; }
-  
+
   SymbolManager &getSymbolManager() { return SymMgr; }
   const SymbolManager &getSymbolManager() const { return SymMgr; }
-                 
+
   SValuator &getSValuator() { return *SVator.get(); }
 
   MemRegionManager &getRegionManager() { return MemMgr; }
   const MemRegionManager &getRegionManager() const { return MemMgr; }
-  
+
   // Forwarding methods to SymbolManager.
-  
+
   const SymbolConjured* getConjuredSymbol(const Stmt* E, QualType T,
                                           unsigned VisitCount,
                                           const void* SymbolTag = 0) {
     return SymMgr.getConjuredSymbol(E, T, VisitCount, SymbolTag);
   }
-  
+
   const SymbolConjured* getConjuredSymbol(const Expr* E, unsigned VisitCount,
-                                          const void* SymbolTag = 0) {    
+                                          const void* SymbolTag = 0) {
     return SymMgr.getConjuredSymbol(E, VisitCount, SymbolTag);
   }
 
@@ -96,24 +95,24 @@ public:
 
   /// getRegionValueSymbolVal - make a unique symbol for value of R.
   SVal getRegionValueSymbolVal(const MemRegion *R, QualType T = QualType());
-  
+
   SVal getRegionValueSymbolValOrUnknown(const MemRegion *R, QualType T) {
-    return SymMgr.canSymbolicate(T) ? getRegionValueSymbolVal(R, T) 
-                                    : UnknownVal();    
+    return SymMgr.canSymbolicate(T) ? getRegionValueSymbolVal(R, T)
+                                    : UnknownVal();
   }
-  
-  SVal getConjuredSymbolVal(const Expr *E, unsigned Count);  
+
+  SVal getConjuredSymbolVal(const Expr *E, unsigned Count);
   SVal getConjuredSymbolVal(const Expr* E, QualType T, unsigned Count);
 
   SVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
                                       const TypedRegion *R);
-  
+
   SVal getFunctionPointer(const FunctionDecl* FD);
 
   NonLoc makeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals) {
     return nonloc::CompoundVal(BasicVals.getCompoundValData(T, Vals));
   }
-  
+
   NonLoc makeLazyCompoundVal(const GRState *state, const TypedRegion *R) {
     return nonloc::LazyCompoundVal(BasicVals.getLazyCompoundValData(state, R));
   }
@@ -121,11 +120,11 @@ public:
   NonLoc makeZeroArrayIndex() {
     return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
   }
-  
+
   NonLoc makeArrayIndex(uint64_t idx) {
     return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
   }
-  
+
   SVal convertToArrayIndex(SVal V);
 
   nonloc::ConcreteInt makeIntVal(const IntegerLiteral* I) {
@@ -136,7 +135,7 @@ public:
   nonloc::ConcreteInt makeIntVal(const llvm::APSInt& V) {
     return nonloc::ConcreteInt(BasicVals.getValue(V));
   }
-  
+
   loc::ConcreteInt makeIntLocVal(const llvm::APSInt &v) {
     return loc::ConcreteInt(BasicVals.getValue(v));
   }
@@ -170,10 +169,10 @@ public:
 
   NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
                     const llvm::APSInt& rhs, QualType T);
-  
+
   NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
                     const SymExpr *rhs, QualType T);
-  
+
   NonLoc makeTruthVal(bool b, QualType T) {
     return nonloc::ConcreteInt(BasicVals.getTruthValue(b, T));
   }

+ 55 - 55
include/clang/Analysis/ProgramPoint.h

@@ -26,7 +26,7 @@
 namespace clang {
 
 class LocationContext;
-    
+
 class ProgramPoint {
 public:
   enum Kind { BlockEdgeKind,
@@ -55,12 +55,12 @@ private:
   // context insensitive analysis.
   const LocationContext *L;
   const void *Tag;
-  
+
 protected:
-  ProgramPoint(const void* P, Kind k, const LocationContext *l, 
+  ProgramPoint(const void* P, Kind k, const LocationContext *l,
                const void *tag = 0)
     : Data(P, NULL), K(k), L(l), Tag(tag) {}
-    
+
   ProgramPoint(const void* P1, const void* P2, Kind k, const LocationContext *l,
                const void *tag = 0)
     : Data(P1, P2), K(k), L(l), Tag(tag) {}
@@ -69,8 +69,8 @@ protected:
   const void* getData1() const { return Data.first; }
   const void* getData2() const { return Data.second; }
   const void *getTag() const { return Tag; }
-    
-public:    
+
+public:
   Kind getKind() const { return K; }
 
   const LocationContext *getLocationContext() const { return L; }
@@ -81,7 +81,7 @@ public:
     Profile(ID);
     return ID.ComputeHash();
   }
-  
+
   static bool classof(const ProgramPoint*) { return true; }
 
   bool operator==(const ProgramPoint & RHS) const {
@@ -91,7 +91,7 @@ public:
   bool operator!=(const ProgramPoint& RHS) const {
     return K != RHS.K || Data != RHS.Data || L != RHS.L || Tag != RHS.Tag;
   }
-    
+
   void Profile(llvm::FoldingSetNodeID& ID) const {
     ID.AddInteger((unsigned) K);
     ID.AddPointer(Data.first);
@@ -100,17 +100,17 @@ public:
     ID.AddPointer(Tag);
   }
 };
-               
+
 class BlockEntrance : public ProgramPoint {
 public:
-  BlockEntrance(const CFGBlock* B, const LocationContext *L, 
+  BlockEntrance(const CFGBlock* B, const LocationContext *L,
                 const void *tag = 0)
     : ProgramPoint(B, BlockEntranceKind, L, tag) {}
-    
+
   CFGBlock* getBlock() const {
     return const_cast<CFGBlock*>(reinterpret_cast<const CFGBlock*>(getData1()));
   }
-  
+
   Stmt* getFirstStmt() const {
     const CFGBlock* B = getBlock();
     return B->empty() ? NULL : B->front();
@@ -123,9 +123,9 @@ public:
 
 class BlockExit : public ProgramPoint {
 public:
-  BlockExit(const CFGBlock* B, const LocationContext *L) 
+  BlockExit(const CFGBlock* B, const LocationContext *L)
     : ProgramPoint(B, BlockExitKind, L) {}
-  
+
   CFGBlock* getBlock() const {
     return const_cast<CFGBlock*>(reinterpret_cast<const CFGBlock*>(getData1()));
   }
@@ -134,41 +134,41 @@ public:
     const CFGBlock* B = getBlock();
     return B->empty() ? NULL : B->back();
   }
-  
+
   Stmt* getTerminator() const {
     return getBlock()->getTerminator();
   }
-    
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == BlockExitKind;
   }
 };
-  
+
 class StmtPoint : public ProgramPoint {
 public:
-  StmtPoint(const Stmt *S, const void *p2, Kind k, const LocationContext *L, 
+  StmtPoint(const Stmt *S, const void *p2, Kind k, const LocationContext *L,
             const void *tag)
     : ProgramPoint(S, p2, k, L, tag) {}
-  
+
   const Stmt *getStmt() const { return (const Stmt*) getData1(); }
-  
+
   template <typename T>
   const T* getStmtAs() const { return llvm::dyn_cast<T>(getStmt()); }
-  
+
   static bool classof(const ProgramPoint* Location) {
     unsigned k = Location->getKind();
     return k >= PreStmtKind && k <= MaxPostStmtKind;
   }
-};  
+};
+
 
-  
 class PreStmt : public StmtPoint {
 public:
-  PreStmt(const Stmt *S, const LocationContext *L, const void *tag, 
+  PreStmt(const Stmt *S, const LocationContext *L, const void *tag,
           const Stmt *SubStmt = 0)
     : StmtPoint(S, SubStmt, PreStmtKind, L, tag) {}
 
-  const Stmt *getSubStmt() const { return (const Stmt*) getData2(); }  
+  const Stmt *getSubStmt() const { return (const Stmt*) getData2(); }
 
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PreStmtKind;
@@ -183,7 +183,7 @@ protected:
   PostStmt(const Stmt* S, const void* data, Kind k, const LocationContext *L,
            const void *tag =0)
     : StmtPoint(S, data, k, L, tag) {}
-  
+
 public:
   explicit PostStmt(const Stmt* S, const LocationContext *L,const void *tag = 0)
     : StmtPoint(S, NULL, PostStmtKind, L, tag) {}
@@ -196,15 +196,15 @@ public:
 
 class PostLocationChecksSucceed : public PostStmt {
 public:
-  PostLocationChecksSucceed(const Stmt* S, const LocationContext *L, 
+  PostLocationChecksSucceed(const Stmt* S, const LocationContext *L,
                             const void *tag = 0)
     : PostStmt(S, PostLocationChecksSucceedKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostLocationChecksSucceedKind;
   }
 };
-  
+
 class PostStmtCustom : public PostStmt {
 public:
   PostStmtCustom(const Stmt* S,
@@ -216,22 +216,22 @@ public:
     return
       *reinterpret_cast<const std::pair<const void*, const void*>*>(getData2());
   }
-  
+
   const void* getTag() const { return getTaggedPair().first; }
-  
+
   const void* getTaggedData() const { return getTaggedPair().second; }
-    
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostStmtCustomKind;
   }
 };
-  
+
 class PostOutOfBoundsCheckFailed : public PostStmt {
 public:
-  PostOutOfBoundsCheckFailed(const Stmt* S, const LocationContext *L, 
+  PostOutOfBoundsCheckFailed(const Stmt* S, const LocationContext *L,
                              const void *tag = 0)
     : PostStmt(S, PostOutOfBoundsCheckFailedKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostOutOfBoundsCheckFailedKind;
   }
@@ -242,38 +242,38 @@ public:
   PostUndefLocationCheckFailed(const Stmt* S, const LocationContext *L,
                                const void *tag = 0)
     : PostStmt(S, PostUndefLocationCheckFailedKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostUndefLocationCheckFailedKind;
   }
 };
-  
+
 class PostNullCheckFailed : public PostStmt {
 public:
   PostNullCheckFailed(const Stmt* S, const LocationContext *L,
                       const void *tag = 0)
     : PostStmt(S, PostNullCheckFailedKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostNullCheckFailedKind;
   }
 };
-  
+
 class PostLoad : public PostStmt {
 public:
   PostLoad(const Stmt* S, const LocationContext *L, const void *tag = 0)
     : PostStmt(S, PostLoadKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostLoadKind;
   }
 };
-  
+
 class PostStore : public PostStmt {
 public:
   PostStore(const Stmt* S, const LocationContext *L, const void *tag = 0)
     : PostStmt(S, PostStoreKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostStoreKind;
   }
@@ -283,52 +283,52 @@ class PostLValue : public PostStmt {
 public:
   PostLValue(const Stmt* S, const LocationContext *L, const void *tag = 0)
     : PostStmt(S, PostLValueKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostLValueKind;
   }
-};  
-  
+};
+
 class PostPurgeDeadSymbols : public PostStmt {
 public:
-  PostPurgeDeadSymbols(const Stmt* S, const LocationContext *L, 
+  PostPurgeDeadSymbols(const Stmt* S, const LocationContext *L,
                        const void *tag = 0)
     : PostStmt(S, PostPurgeDeadSymbolsKind, L, tag) {}
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == PostPurgeDeadSymbolsKind;
   }
 };
-  
+
 class BlockEdge : public ProgramPoint {
 public:
   BlockEdge(const CFGBlock* B1, const CFGBlock* B2, const LocationContext *L)
     : ProgramPoint(B1, B2, BlockEdgeKind, L) {}
-    
+
   CFGBlock* getSrc() const {
     return const_cast<CFGBlock*>(static_cast<const CFGBlock*>(getData1()));
   }
-    
+
   CFGBlock* getDst() const {
     return const_cast<CFGBlock*>(static_cast<const CFGBlock*>(getData2()));
   }
-  
+
   static bool classof(const ProgramPoint* Location) {
     return Location->getKind() == BlockEdgeKind;
   }
 };
 
-  
+
 } // end namespace clang
 
 
-namespace llvm { // Traits specialization for DenseMap 
-  
+namespace llvm { // Traits specialization for DenseMap
+
 template <> struct DenseMapInfo<clang::ProgramPoint> {
 
 static inline clang::ProgramPoint getEmptyKey() {
   uintptr_t x =
-   reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getEmptyKey()) & ~0x7;    
+   reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getEmptyKey()) & ~0x7;
   return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), 0);
 }
 

+ 63 - 63
include/clang/Analysis/Support/BlkExprDeclBitVector.h

@@ -23,18 +23,18 @@
 #include "llvm/ADT/DenseMap.h"
 
 namespace clang {
-  
+
   class Stmt;
   class ASTContext;
 
 struct DeclBitVector_Types {
-  
+
   class Idx {
     unsigned I;
   public:
     explicit Idx(unsigned i) : I(i) {}
     Idx() : I(~0U) {}
-    
+
     bool isValid() const {
       return I != ~0U;
     }
@@ -42,35 +42,35 @@ struct DeclBitVector_Types {
       assert (isValid());
       return I;
     }
-  };    
-    
+  };
+
   //===--------------------------------------------------------------------===//
   // AnalysisDataTy - Whole-function meta data.
   //===--------------------------------------------------------------------===//
-  
+
   class AnalysisDataTy {
   public:
     typedef llvm::DenseMap<const NamedDecl*, unsigned > DMapTy;
     typedef DMapTy::const_iterator decl_iterator;
-    
+
   protected:
-    DMapTy DMap;    
+    DMapTy DMap;
     unsigned NDecls;
-    
+
   public:
-    
+
     AnalysisDataTy() : NDecls(0) {}
     virtual ~AnalysisDataTy() {}
-    
+
     bool isTracked(const NamedDecl* SD) { return DMap.find(SD) != DMap.end(); }
-    
+
     Idx getIdx(const NamedDecl* SD) const {
       DMapTy::const_iterator I = DMap.find(SD);
       return I == DMap.end() ? Idx() : Idx(I->second);
     }
 
     unsigned getNumDecls() const { return NDecls; }
-    
+
     void Register(const NamedDecl* SD) {
       if (!isTracked(SD)) DMap[SD] = NDecls++;
     }
@@ -78,44 +78,44 @@ struct DeclBitVector_Types {
     decl_iterator begin_decl() const { return DMap.begin(); }
     decl_iterator end_decl() const { return DMap.end(); }
   };
-  
+
   //===--------------------------------------------------------------------===//
   // ValTy - Dataflow value.
   //===--------------------------------------------------------------------===//
-  
+
   class ValTy {
     llvm::BitVector DeclBV;
   public:
-    
+
     void resetDeclValues(AnalysisDataTy& AD) {
-      DeclBV.resize(AD.getNumDecls()); 
+      DeclBV.resize(AD.getNumDecls());
       DeclBV.reset();
     }
 
     void setDeclValues(AnalysisDataTy& AD) {
-      DeclBV.resize(AD.getNumDecls()); 
+      DeclBV.resize(AD.getNumDecls());
       DeclBV.set();
     }
-    
+
     void resetValues(AnalysisDataTy& AD) {
       resetDeclValues(AD);
-    }    
-    
-    bool operator==(const ValTy& RHS) const { 
+    }
+
+    bool operator==(const ValTy& RHS) const {
       assert (sizesEqual(RHS));
       return DeclBV == RHS.DeclBV;
     }
-    
+
     void copyValues(const ValTy& RHS) { DeclBV = RHS.DeclBV; }
-    
+
     llvm::BitVector::reference getBit(unsigned i) {
       return DeclBV[i];
     }
-    
+
     bool getBit(unsigned i) const {
       return DeclBV[i];
     }
-    
+
     llvm::BitVector::reference
     operator()(const NamedDecl* ND, const AnalysisDataTy& AD) {
       return getBit(AD.getIdx(ND));
@@ -124,48 +124,48 @@ struct DeclBitVector_Types {
     bool operator()(const NamedDecl* ND, const AnalysisDataTy& AD) const {
       return getBit(AD.getIdx(ND));
     }
-    
-    llvm::BitVector::reference getDeclBit(unsigned i) { return DeclBV[i]; }    
+
+    llvm::BitVector::reference getDeclBit(unsigned i) { return DeclBV[i]; }
     const llvm::BitVector::reference getDeclBit(unsigned i) const {
       return const_cast<llvm::BitVector&>(DeclBV)[i];
     }
-        
+
     ValTy& operator|=(const ValTy& RHS) {
       assert (sizesEqual(RHS));
       DeclBV |= RHS.DeclBV;
       return *this;
     }
-    
+
     ValTy& operator&=(const ValTy& RHS) {
       assert (sizesEqual(RHS));
       DeclBV &= RHS.DeclBV;
       return *this;
     }
-    
+
     ValTy& OrDeclBits(const ValTy& RHS) {
       return operator|=(RHS);
     }
-    
+
     ValTy& AndDeclBits(const ValTy& RHS) {
       return operator&=(RHS);
     }
-        
+
     bool sizesEqual(const ValTy& RHS) const {
       return DeclBV.size() == RHS.DeclBV.size();
     }
   };
-  
+
   //===--------------------------------------------------------------------===//
   // Some useful merge operations.
   //===--------------------------------------------------------------------===//
-    
+
   struct Union { void operator()(ValTy& Dst, ValTy& Src) { Dst |= Src; } };
   struct Intersect { void operator()(ValTy& Dst, ValTy& Src) { Dst &= Src; } };
 };
 
 
 struct StmtDeclBitVector_Types {
-  
+
   //===--------------------------------------------------------------------===//
   // AnalysisDataTy - Whole-function meta data.
   //===--------------------------------------------------------------------===//
@@ -179,13 +179,13 @@ struct StmtDeclBitVector_Types {
 
     void setContext(ASTContext& c) { ctx = &c; }
     ASTContext& getContext() {
-      assert(ctx && "ASTContext should not be NULL."); 
+      assert(ctx && "ASTContext should not be NULL.");
       return *ctx;
     }
 
     void setCFG(CFG& c) { cfg = &c; }
     CFG& getCFG() { assert(cfg && "CFG should not be NULL."); return *cfg; }
-    
+
     bool isTracked(const Stmt* S) { return cfg->isBlkExpr(S); }
     using DeclBitVector_Types::AnalysisDataTy::isTracked;
 
@@ -195,7 +195,7 @@ struct StmtDeclBitVector_Types {
       return I;
     }
     using DeclBitVector_Types::AnalysisDataTy::getIdx;
-    
+
     unsigned getNumBlkExprs() const { return cfg->getNumBlkExprs(); }
   };
 
@@ -206,101 +206,101 @@ struct StmtDeclBitVector_Types {
   class ValTy : public DeclBitVector_Types::ValTy {
     llvm::BitVector BlkExprBV;
     typedef DeclBitVector_Types::ValTy ParentTy;
-    
+
     static inline ParentTy& ParentRef(ValTy& X) {
       return static_cast<ParentTy&>(X);
     }
-    
+
     static inline const ParentTy& ParentRef(const ValTy& X) {
       return static_cast<const ParentTy&>(X);
     }
-    
+
   public:
 
     void resetBlkExprValues(AnalysisDataTy& AD) {
       BlkExprBV.resize(AD.getNumBlkExprs());
       BlkExprBV.reset();
     }
-    
+
     void setBlkExprValues(AnalysisDataTy& AD) {
       BlkExprBV.resize(AD.getNumBlkExprs());
       BlkExprBV.set();
     }
-    
+
     void resetValues(AnalysisDataTy& AD) {
       resetDeclValues(AD);
       resetBlkExprValues(AD);
     }
-    
+
     void setValues(AnalysisDataTy& AD) {
       setDeclValues(AD);
       setBlkExprValues(AD);
     }
-    
-    bool operator==(const ValTy& RHS) const { 
-      return ParentRef(*this) == ParentRef(RHS) 
+
+    bool operator==(const ValTy& RHS) const {
+      return ParentRef(*this) == ParentRef(RHS)
           && BlkExprBV == RHS.BlkExprBV;
     }
-    
+
     void copyValues(const ValTy& RHS) {
       ParentRef(*this).copyValues(ParentRef(RHS));
       BlkExprBV = RHS.BlkExprBV;
     }
-        
+
     llvm::BitVector::reference
     operator()(const Stmt* S, const AnalysisDataTy& AD) {
-      return BlkExprBV[AD.getIdx(S)];      
-    }    
+      return BlkExprBV[AD.getIdx(S)];
+    }
     const llvm::BitVector::reference
     operator()(const Stmt* S, const AnalysisDataTy& AD) const {
       return const_cast<ValTy&>(*this)(S,AD);
     }
-    
+
     using DeclBitVector_Types::ValTy::operator();
 
-    
-    llvm::BitVector::reference getStmtBit(unsigned i) { return BlkExprBV[i]; }    
+
+    llvm::BitVector::reference getStmtBit(unsigned i) { return BlkExprBV[i]; }
     const llvm::BitVector::reference getStmtBit(unsigned i) const {
       return const_cast<llvm::BitVector&>(BlkExprBV)[i];
     }
-    
+
     ValTy& OrBlkExprBits(const ValTy& RHS) {
       BlkExprBV |= RHS.BlkExprBV;
       return *this;
     }
-    
+
     ValTy& AndBlkExprBits(const ValTy& RHS) {
       BlkExprBV &= RHS.BlkExprBV;
       return *this;
     }
-    
+
     ValTy& operator|=(const ValTy& RHS) {
       assert (sizesEqual(RHS));
       ParentRef(*this) |= ParentRef(RHS);
       BlkExprBV |= RHS.BlkExprBV;
       return *this;
     }
-    
+
     ValTy& operator&=(const ValTy& RHS) {
       assert (sizesEqual(RHS));
       ParentRef(*this) &= ParentRef(RHS);
       BlkExprBV &= RHS.BlkExprBV;
       return *this;
     }
-    
+
     bool sizesEqual(const ValTy& RHS) const {
       return ParentRef(*this).sizesEqual(ParentRef(RHS))
           && BlkExprBV.size() == RHS.BlkExprBV.size();
     }
   };
-  
+
   //===--------------------------------------------------------------------===//
   // Some useful merge operations.
   //===--------------------------------------------------------------------===//
-  
+
   struct Union { void operator()(ValTy& Dst, ValTy& Src) { Dst |= Src; } };
   struct Intersect { void operator()(ValTy& Dst, ValTy& Src) { Dst &= Src; } };
-  
+
 };
 } // end namespace clang
 

+ 6 - 6
include/clang/Analysis/Support/Optional.h

@@ -17,7 +17,7 @@
 #define LLVM_CLANG_ANALYSIS_OPTIONAL
 
 namespace clang {
-  
+
 template<typename T>
 class Optional {
   const T x;
@@ -25,15 +25,15 @@ class Optional {
 public:
   explicit Optional() : hasVal(false) {}
   Optional(const T &y) : x(y), hasVal(true) {}
-  
+
   static inline Optional create(const T* y) {
     return y ? Optional(*y) : Optional();
   }
-  
+
   const T* getPointer() const { assert(hasVal); return &x; }
-  
+
   operator bool() const { return hasVal; }
-  const T* operator->() const { return getPointer(); } 
+  const T* operator->() const { return getPointer(); }
   const T& operator*() const { assert(hasVal); return x; }
 };
 } //end clang namespace
@@ -46,7 +46,7 @@ struct simplify_type<const ::clang::Optional<T> > {
     return Val.getPointer();
   }
 };
-  
+
 template <typename T>
 struct simplify_type< ::clang::Optional<T> >
   : public simplify_type<const ::clang::Optional<T> > {};

+ 3 - 3
include/clang/Analysis/Support/SaveAndRestore.h

@@ -16,7 +16,7 @@
 #define LLVM_CLANG_ANALYSIS_SAVERESTORE
 
 namespace clang {
-  
+
 // SaveAndRestore - A utility class that uses RAII to save and restore
 //  the value of a variable.
 template<typename T>
@@ -24,7 +24,7 @@ struct SaveAndRestore {
   SaveAndRestore(T& x) : X(x), old_value(x) {}
   ~SaveAndRestore() { X = old_value; }
   T get() { return old_value; }
-private:  
+private:
   T& X;
   T old_value;
 };
@@ -39,6 +39,6 @@ private:
   bool& X;
   const bool old_value;
 };
-  
+
 }
 #endif

+ 7 - 7
include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h

@@ -30,28 +30,28 @@ break;
 #define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS(CLASS* D)\
   { static_cast<ImplClass*>(this)->VisitVarDecl(D); }
 
-  
+
 namespace clang {
 template <typename ImplClass>
 class CFGRecStmtDeclVisitor : public CFGRecStmtVisitor<ImplClass> {
-public:  
+public:
 
   void VisitDeclRefExpr(DeclRefExpr* DR) {
-    static_cast<ImplClass*>(this)->VisitDecl(DR->getDecl()); 
+    static_cast<ImplClass*>(this)->VisitDecl(DR->getDecl());
   }
-  
+
   void VisitDeclStmt(DeclStmt* DS) {
     for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
         DI != DE; ++DI) {
       Decl* D = *DI;
-      static_cast<ImplClass*>(this)->VisitDecl(D); 
+      static_cast<ImplClass*>(this)->VisitDecl(D);
       // Visit the initializer.
       if (VarDecl* VD = dyn_cast<VarDecl>(D))
         if (Expr* I = VD->getInit())
           static_cast<ImplClass*>(this)->Visit(I);
     }
   }
-    
+
   void VisitDecl(Decl* D) {
     switch (D->getKind()) {
         DISPATCH_CASE(Function,FunctionDecl)
@@ -67,7 +67,7 @@ public:
         assert(false && "Subtype of ScopedDecl not handled.");
     }
   }
-  
+
   DEFAULT_DISPATCH(VarDecl)
   DEFAULT_DISPATCH(FunctionDecl)
   DEFAULT_DISPATCH_VARDECL(OriginalParmVarDecl)

+ 2 - 2
include/clang/Analysis/Visitors/CFGRecStmtVisitor.h

@@ -20,12 +20,12 @@
 namespace clang {
 template <typename ImplClass>
 class CFGRecStmtVisitor : public CFGStmtVisitor<ImplClass,void> {
-public:  
+public:
 
   void VisitStmt(Stmt* S) {
     static_cast< ImplClass* >(this)->VisitChildren(S);
   }
-      
+
   // Defining operator() allows the visitor to be used as a C++ style functor.
   void operator()(Stmt* S) { static_cast<ImplClass*>(this)->BlockStmt_Visit(S);}
 };

+ 30 - 30
include/clang/Analysis/Visitors/CFGStmtVisitor.h

@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines the CFGStmtVisitor interface, which extends 
+//  This file defines the CFGStmtVisitor interface, which extends
 //  StmtVisitor.  This interface is useful for visiting statements in a CFG
 //  where some statements have implicit control-flow and thus should
 //  be treated specially.
@@ -24,7 +24,7 @@ namespace clang {
 
 #define DISPATCH_CASE(CLASS) \
 case Stmt::CLASS ## Class: return \
-static_cast<ImplClass*>(this)->BlockStmt_Visit ## CLASS(static_cast<CLASS*>(S));  
+static_cast<ImplClass*>(this)->BlockStmt_Visit ## CLASS(static_cast<CLASS*>(S));
 
 #define DEFAULT_BLOCKSTMT_VISIT(CLASS) RetTy BlockStmt_Visit ## CLASS(CLASS *S)\
 { return\
@@ -36,40 +36,40 @@ class CFGStmtVisitor : public StmtVisitor<ImplClass,RetTy> {
   Stmt* CurrentBlkStmt;
 
   struct NullifyStmt {
-    Stmt*& S;  
-    
+    Stmt*& S;
+
     NullifyStmt(Stmt*& s) : S(s) {}
     ~NullifyStmt() { S = NULL; }
   };
-  
+
 public:
-  CFGStmtVisitor() : CurrentBlkStmt(NULL) {}  
-  
+  CFGStmtVisitor() : CurrentBlkStmt(NULL) {}
+
   Stmt* getCurrentBlkStmt() const { return CurrentBlkStmt; }
-  
+
   RetTy Visit(Stmt* S) {
-    if (S == CurrentBlkStmt || 
+    if (S == CurrentBlkStmt ||
         !static_cast<ImplClass*>(this)->getCFG().isBlkExpr(S))
       return StmtVisitor<ImplClass,RetTy>::Visit(S);
     else
       return RetTy();
   }
-  
+
   /// BlockVisit_XXX - Visitor methods for visiting the "root" statements in
-  /// CFGBlocks.  Root statements are the statements that appear explicitly in 
+  /// CFGBlocks.  Root statements are the statements that appear explicitly in
   /// the list of statements in a CFGBlock.  For substatements, or when there
   /// is no implementation provided for a BlockStmt_XXX method, we default
   /// to using StmtVisitor's Visit method.
   RetTy BlockStmt_Visit(Stmt* S) {
     CurrentBlkStmt = S;
     NullifyStmt cleanup(CurrentBlkStmt);
-    
+
     switch (S->getStmtClass()) {
 
       DISPATCH_CASE(StmtExpr)
       DISPATCH_CASE(ConditionalOperator)
       DISPATCH_CASE(ObjCForCollectionStmt)
-        
+
       case Stmt::BinaryOperatorClass: {
         BinaryOperator* B = cast<BinaryOperator>(S);
         if (B->isLogicalOp())
@@ -78,40 +78,40 @@ public:
           return static_cast<ImplClass*>(this)->BlockStmt_VisitComma(B);
         // Fall through.
       }
-      
+
       default:
         if (isa<Expr>(S))
-          return 
+          return
             static_cast<ImplClass*>(this)->BlockStmt_VisitExpr(cast<Expr>(S));
         else
-          return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);                             
+          return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);
     }
   }
 
   DEFAULT_BLOCKSTMT_VISIT(StmtExpr)
   DEFAULT_BLOCKSTMT_VISIT(ConditionalOperator)
-  
+
   RetTy BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
     return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);
   }
-  
+
   RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr* E) {
     return static_cast<ImplClass*>(this)->BlockStmt_VisitExpr(E);
   }
-  
+
   RetTy BlockStmt_VisitExpr(Expr* E) {
     return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(E);
   }
-  
+
   RetTy BlockStmt_VisitStmt(Stmt* S) {
     return static_cast<ImplClass*>(this)->Visit(S);
   }
 
   RetTy BlockStmt_VisitLogicalOp(BinaryOperator* B) {
-    return 
+    return
      static_cast<ImplClass*>(this)->BlockStmt_VisitImplicitControlFlowExpr(B);
   }
-  
+
   RetTy BlockStmt_VisitComma(BinaryOperator* B) {
     return
      static_cast<ImplClass*>(this)->BlockStmt_VisitImplicitControlFlowExpr(B);
@@ -120,21 +120,21 @@ public:
   //===--------------------------------------------------------------------===//
   // Utility methods.  Not called by default (but subclasses may use them).
   //===--------------------------------------------------------------------===//
-    
+
   /// VisitChildren: Call "Visit" on each child of S.
   void VisitChildren(Stmt* S) {
-    
+
     switch (S->getStmtClass()) {
       default:
         break;
-        
+
       case Stmt::StmtExprClass: {
         CompoundStmt* CS = cast<StmtExpr>(S)->getSubStmt();
         if (CS->body_empty()) return;
         static_cast<ImplClass*>(this)->Visit(CS->body_back());
         return;
       }
-        
+
       case Stmt::BinaryOperatorClass: {
         BinaryOperator* B = cast<BinaryOperator>(S);
         if (B->getOpcode() != BinaryOperator::Comma) break;
@@ -142,12 +142,12 @@ public:
         return;
       }
     }
-        
+
     for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I != E;++I)
-      if (*I) static_cast<ImplClass*>(this)->Visit(*I);    
+      if (*I) static_cast<ImplClass*>(this)->Visit(*I);
   }
-};  
-      
+};
+
 #undef DEFAULT_BLOCKSTMT_VISIT
 #undef DISPATCH_CASE
 

+ 10 - 10
include/clang/Analysis/Visitors/CFGVarDeclVisitor.h

@@ -24,37 +24,37 @@ namespace clang {
 template <typename ImplClass>
 class CFGVarDeclVisitor : public CFGStmtVisitor<ImplClass> {
   const CFG& cfg;
-public:  
+public:
   CFGVarDeclVisitor(const CFG& c) : cfg(c) {}
-  
+
   void VisitStmt(Stmt* S) {
     static_cast<ImplClass*>(this)->VisitChildren(S);
   }
-  
+
   void VisitDeclRefExpr(DeclRefExpr* DR) {
     static_cast<ImplClass*>(this)->VisitDeclChain(DR->getDecl());
   }
-  
+
   void VisitDeclStmt(DeclStmt* DS) {
     static_cast<ImplClass*>(this)->VisitDeclChain(DS->getDecl());
   }
-  
-  void VisitDeclChain(ScopedDecl* D) {  
+
+  void VisitDeclChain(ScopedDecl* D) {
     for (; D != NULL ; D = D->getNextDeclarator())
       static_cast<ImplClass*>(this)->VisitScopedDecl(D);
   }
-  
+
   void VisitScopedDecl(ScopedDecl* D) {
     if (VarDecl* V = dyn_cast<VarDecl>(D))
       static_cast<ImplClass*>(this)->VisitVarDecl(V);
   }
-  
+
   void VisitVarDecl(VarDecl* D) {}
-  
+
   void VisitAllDecls() {
     for (CFG::const_iterator BI = cfg.begin(), BE = cfg.end(); BI != BE; ++BI)
       for (CFGBlock::const_iterator SI=BI->begin(),SE = BI->end();SI != SE;++SI)
-        static_cast<ImplClass*>(this)->BlockStmt_Visit(const_cast<Stmt*>(*SI));    
+        static_cast<ImplClass*>(this)->BlockStmt_Visit(const_cast<Stmt*>(*SI));
   }
 };
 

+ 8 - 8
include/clang/Basic/Builtins.h

@@ -67,40 +67,40 @@ public:
   /// \brief Popular the vector with the names of all of the builtins.
   void GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names,
                        bool NoBuiltins);
-  
+
   /// Builtin::GetName - Return the identifier name for the specified builtin,
   /// e.g. "__builtin_abs".
   const char *GetName(unsigned ID) const {
     return GetRecord(ID).Name;
   }
-  
+
   /// GetTypeString - Get the type descriptor string for the specified builtin.
   const char *GetTypeString(unsigned ID) const {
     return GetRecord(ID).Type;
   }
-  
+
   /// isConst - Return true if this function has no side effects and doesn't
   /// read memory.
   bool isConst(unsigned ID) const {
     return strchr(GetRecord(ID).Attributes, 'c') != 0;
   }
-  
+
   /// isNoThrow - Return true if we know this builtin never throws an exception.
   bool isNoThrow(unsigned ID) const {
     return strchr(GetRecord(ID).Attributes, 'n') != 0;
   }
-  
+
   /// isNoReturn - Return true if we know this builtin never returns.
   bool isNoReturn(unsigned ID) const {
     return strchr(GetRecord(ID).Attributes, 'r') != 0;
   }
-  
+
   /// isLibFunction - Return true if this is a builtin for a libc/libm function,
   /// with a "__builtin_" prefix (e.g. __builtin_abs).
   bool isLibFunction(unsigned ID) const {
     return strchr(GetRecord(ID).Attributes, 'F') != 0;
   }
-  
+
   /// \brief Determines whether this builtin is a predefined libc/libm
   /// function, such as "malloc", where we know the signature a
   /// priori.
@@ -124,7 +124,7 @@ public:
   bool hasVAListUse(unsigned ID) const {
     return strpbrk(GetRecord(ID).Type, "Aa") != 0;
   }
-  
+
   /// isConstWithoutErrno - Return true if this function has no side
   /// effects and doesn't read memory, except for possibly errno. Such
   /// functions can be const when the MathErrno lang option is

+ 12 - 12
include/clang/Basic/ConvertUTF.h

@@ -8,9 +8,9 @@
  *==------------------------------------------------------------------------==*/
 /*
  * Copyright 2001-2004 Unicode, Inc.
- * 
+ *
  * Disclaimer
- * 
+ *
  * This source code is provided as is by Unicode, Inc. No claims are
  * made as to fitness for any particular purpose. No warranties of any
  * kind are expressed or implied. The recipient agrees to determine
@@ -18,9 +18,9 @@
  * purchased on magnetic or optical media from Unicode, Inc., the
  * sole remedy for any claim will be exchange of defective media
  * within 90 days of receipt.
- * 
+ *
  * Limitations on Rights to Redistribute This Code
- * 
+ *
  * Unicode, Inc. hereby grants the right to freely use the information
  * supplied in this file in the creation of products supporting the
  * Unicode Standard, and to make copies of this file in any form
@@ -41,7 +41,7 @@
 
     Each routine converts the text between *sourceStart and sourceEnd,
     putting the result into the buffer between *targetStart and
-    targetEnd. Note: the end pointers are *after* the last item: e.g. 
+    targetEnd. Note: the end pointers are *after* the last item: e.g.
     *(sourceEnd - 1) is the last item.
 
     The return result indicates whether the conversion was successful,
@@ -79,7 +79,7 @@
         sequence is malformed.  When "sourceIllegal" is returned, the source
         value will point to the illegal value that caused the problem. E.g.,
         in UTF-8 when a sequence is malformed, it points to the start of the
-        malformed sequence.  
+        malformed sequence.
 
     Author: Mark E. Davis, 1994.
     Rev History: Rick McGowan, fixes & updates May 2001.
@@ -125,28 +125,28 @@ extern "C" {
 #endif
 
 ConversionResult ConvertUTF8toUTF16 (
-  const UTF8** sourceStart, const UTF8* sourceEnd, 
+  const UTF8** sourceStart, const UTF8* sourceEnd,
   UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
 
 #ifdef CLANG_NEEDS_THESE_ONE_DAY
 ConversionResult ConvertUTF16toUTF8 (
-  const UTF16** sourceStart, const UTF16* sourceEnd, 
+  const UTF16** sourceStart, const UTF16* sourceEnd,
   UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
 
 ConversionResult ConvertUTF8toUTF32 (
-  const UTF8** sourceStart, const UTF8* sourceEnd, 
+  const UTF8** sourceStart, const UTF8* sourceEnd,
   UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
 
 ConversionResult ConvertUTF32toUTF8 (
-  const UTF32** sourceStart, const UTF32* sourceEnd, 
+  const UTF32** sourceStart, const UTF32* sourceEnd,
   UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
 
 ConversionResult ConvertUTF16toUTF32 (
-  const UTF16** sourceStart, const UTF16* sourceEnd, 
+  const UTF16** sourceStart, const UTF16* sourceEnd,
   UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
 
 ConversionResult ConvertUTF32toUTF16 (
-  const UTF32** sourceStart, const UTF32* sourceEnd, 
+  const UTF32** sourceStart, const UTF32* sourceEnd,
   UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
 #endif
 

+ 67 - 67
include/clang/Basic/Diagnostic.h

@@ -30,7 +30,7 @@ namespace clang {
   class LangOptions;
   class PartialDiagnostic;
   class SourceRange;
-  
+
   // Import the diagnostic enums themselves.
   namespace diag {
     // Start position for diagnostics.
@@ -46,7 +46,7 @@ namespace clang {
     };
 
     class CustomDiagInfo;
-    
+
     /// diag::kind - All of the diagnostics that can be emitted by the frontend.
     typedef unsigned kind;
 
@@ -57,7 +57,7 @@ namespace clang {
       NUM_BUILTIN_COMMON_DIAGNOSTICS
 #undef DIAG
     };
-      
+
     /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs
     /// to either MAP_IGNORE (nothing), MAP_WARNING (emit a warning), MAP_ERROR
     /// (emit as an error).  It allows clients to map errors to
@@ -69,13 +69,13 @@ namespace clang {
       MAP_WARNING = 2,     //< Map this diagnostic to a warning.
       MAP_ERROR   = 3,     //< Map this diagnostic to an error.
       MAP_FATAL   = 4,     //< Map this diagnostic to a fatal error.
-      
+
       /// Map this diagnostic to "warning", but make it immune to -Werror.  This
       /// happens when you specify -Wno-error=foo.
       MAP_WARNING_NO_WERROR = 5
     };
   }
-  
+
 /// \brief Annotates a diagnostic with some code that should be
 /// inserted, removed, or replaced to fix the problem.
 ///
@@ -104,7 +104,7 @@ public:
 
   /// \brief Create a code modification hint that inserts the given
   /// code string at a specific location.
-  static CodeModificationHint CreateInsertion(SourceLocation InsertionLoc, 
+  static CodeModificationHint CreateInsertion(SourceLocation InsertionLoc,
                                               const std::string &Code) {
     CodeModificationHint Hint;
     Hint.InsertionLoc = InsertionLoc;
@@ -122,7 +122,7 @@ public:
 
   /// \brief Create a code modification hint that replaces the given
   /// source range with the given code string.
-  static CodeModificationHint CreateReplacement(SourceRange RemoveRange, 
+  static CodeModificationHint CreateReplacement(SourceRange RemoveRange,
                                                 const std::string &Code) {
     CodeModificationHint Hint;
     Hint.RemoveRange = RemoveRange;
@@ -142,13 +142,13 @@ public:
   enum Level {
     Ignored, Note, Warning, Error, Fatal
   };
-  
+
   /// ExtensionHandling - How do we handle otherwise-unmapped extension?  This
   /// is controlled by -pedantic and -pedantic-errors.
   enum ExtensionHandling {
     Ext_Ignore, Ext_Warn, Ext_Error
   };
-  
+
   enum ArgumentKind {
     ak_std_string,      // std::string
     ak_c_string,        // const char *
@@ -161,10 +161,10 @@ public:
     ak_nestednamespec   // NestedNameSpecifier *
   };
 
-private: 
+private:
   unsigned char AllExtensionsSilenced; // Used by __extension__
   bool IgnoreAllWarnings;        // Ignore all warnings: -w
-  bool WarningsAsErrors;         // Treat warnings like errors: 
+  bool WarningsAsErrors;         // Treat warnings like errors:
   bool SuppressSystemWarnings;   // Suppress warnings in system headers.
   ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
   DiagnosticClient *Client;
@@ -183,7 +183,7 @@ private:
   /// fatal error is emitted, and is sticky.
   bool ErrorOccurred;
   bool FatalErrorOccurred;
-  
+
   /// LastDiagLevel - This is the level of the last diagnostic emitted.  This is
   /// used to emit continuation diagnostics with the same level as the
   /// diagnostic that they follow.
@@ -209,16 +209,16 @@ private:
 public:
   explicit Diagnostic(DiagnosticClient *client = 0);
   ~Diagnostic();
-  
+
   //===--------------------------------------------------------------------===//
   //  Diagnostic characterization methods, used by a client to customize how
   //
-  
+
   DiagnosticClient *getClient() { return Client; };
   const DiagnosticClient *getClient() const { return Client; };
-    
 
-  /// pushMappings - Copies the current DiagMappings and pushes the new copy 
+
+  /// pushMappings - Copies the current DiagMappings and pushes the new copy
   /// onto the top of the stack.
   void pushMappings();
 
@@ -234,12 +234,12 @@ public:
   /// ignored.  If this and WarningsAsErrors are both set, then this one wins.
   void setIgnoreAllWarnings(bool Val) { IgnoreAllWarnings = Val; }
   bool getIgnoreAllWarnings() const { return IgnoreAllWarnings; }
-  
+
   /// setWarningsAsErrors - When set to true, any warnings reported are issued
   /// as errors.
   void setWarningsAsErrors(bool Val) { WarningsAsErrors = Val; }
   bool getWarningsAsErrors() const { return WarningsAsErrors; }
-  
+
   /// setSuppressSystemWarnings - When set to true mask warnings that
   /// come from system headers.
   void setSuppressSystemWarnings(bool Val) { SuppressSystemWarnings = Val; }
@@ -251,14 +251,14 @@ public:
   void setExtensionHandlingBehavior(ExtensionHandling H) {
     ExtBehavior = H;
   }
-  
+
   /// AllExtensionsSilenced - This is a counter bumped when an __extension__
   /// block is encountered.  When non-zero, all extension diagnostics are
   /// entirely silenced, no matter how they are mapped.
   void IncrementAllExtensionsSilenced() { ++AllExtensionsSilenced; }
   void DecrementAllExtensionsSilenced() { --AllExtensionsSilenced; }
   bool hasAllExtensionsSilenced() { return AllExtensionsSilenced != 0; }
-  
+
   /// setDiagnosticMapping - This allows the client to specify that certain
   /// warnings are ignored.  Notes can never be mapped, errors can only be
   /// mapped to fatal, and WARNINGs and EXTENSIONs can be mapped arbitrarily.
@@ -269,7 +269,7 @@ public:
            "Cannot map errors!");
     setDiagnosticMappingInternal(Diag, Map, true);
   }
-  
+
   /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g.
   /// "unknown-pragmas" to have the specified mapping.  This returns true and
   /// ignores the request if "Group" was unknown, false otherwise.
@@ -280,13 +280,13 @@ public:
 
   unsigned getNumErrors() const { return NumErrors; }
   unsigned getNumDiagnostics() const { return NumDiagnostics; }
-  
+
   /// getCustomDiagID - Return an ID for a diagnostic with the specified message
   /// and level.  If this is the first request for this diagnosic, it is
   /// registered and created, otherwise the existing ID is returned.
   unsigned getCustomDiagID(Level L, const char *Message);
-  
-  
+
+
   /// ConvertArgToString - This method converts a diagnostic argument (as an
   /// intptr_t) into the string that represents it.
   void ConvertArgToString(ArgumentKind Kind, intptr_t Val,
@@ -296,12 +296,12 @@ public:
     ArgToStringFn(Kind, Val, Modifier, ModLen, Argument, ArgLen, Output,
                   ArgToStringCookie);
   }
-  
+
   void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie) {
     ArgToStringFn = Fn;
     ArgToStringCookie = Cookie;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Diagnostic classification and reporting interfaces.
   //
@@ -309,7 +309,7 @@ public:
   /// getDescription - Given a diagnostic ID, return a description of the
   /// issue.
   const char *getDescription(unsigned DiagID) const;
-  
+
   /// isNoteWarningOrExtension - Return true if the unmapped diagnostic
   /// level of the specified diagnostic ID is a Warning or Extension.
   /// This only works on builtin diagnostics, not custom ones, and is not legal to
@@ -319,12 +319,12 @@ public:
   /// \brief Determine whether the given built-in diagnostic ID is a
   /// Note.
   static bool isBuiltinNote(unsigned DiagID);
-  
+
   /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic
   /// ID is for an extension of some sort.
   ///
   static bool isBuiltinExtensionDiag(unsigned DiagID);
-  
+
   /// getWarningOptionForDiag - Return the lowest-level warning option that
   /// enables the specified diagnostic.  If there is no -Wfoo flag that controls
   /// the diagnostic, this returns null.
@@ -343,8 +343,8 @@ public:
   /// getDiagnosticLevel - Based on the way the client configured the Diagnostic
   /// object, classify the specified diagnostic ID into a Level, consumable by
   /// the DiagnosticClient.
-  Level getDiagnosticLevel(unsigned DiagID) const;  
-  
+  Level getDiagnosticLevel(unsigned DiagID) const;
+
   /// Report - Issue the message to the client.  @c DiagID is a member of the
   /// @c diag::kind enum.  This actually returns aninstance of DiagnosticBuilder
   /// which emits the diagnostics (through @c ProcessDiag) when it is destroyed.
@@ -354,7 +354,7 @@ public:
 
   /// \brief Clear out the current diagnostic.
   void Clear() { CurDiagID = ~0U; }
-  
+
 private:
   /// getDiagnosticMappingInfo - Return the mapping info currently set for the
   /// specified builtin diagnostic.  This returns the high bit encoding, or zero
@@ -363,7 +363,7 @@ private:
     const DiagMappings &currentMappings = DiagMappingsStack.back();
     return (diag::Mapping)((currentMappings[Diag/2] >> (Diag & 1)*4) & 15);
   }
-  
+
   void setDiagnosticMappingInternal(unsigned DiagId, unsigned Map,
                                     bool isUser) const {
     if (isUser) Map |= 8;  // Set the high bit for user mappings.
@@ -372,7 +372,7 @@ private:
     Slot &= ~(15 << Shift);
     Slot |= Map << Shift;
   }
-  
+
   /// getDiagnosticLevel - This is an internal implementation helper used when
   /// DiagClass is already known.
   Level getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const;
@@ -389,7 +389,7 @@ private:
   /// CurDiagLoc - This is the location of the current diagnostic that is in
   /// flight.
   FullSourceLoc CurDiagLoc;
-  
+
   /// CurDiagID - This is the ID of the current diagnostic that is in flight.
   /// This is set to ~0U when there is no diagnostic in flight.
   unsigned CurDiagID;
@@ -400,7 +400,7 @@ private:
     /// than that almost certainly has to be simplified anyway.
     MaxArguments = 10
   };
-  
+
   /// NumDiagArgs - This contains the number of entries in Arguments.
   signed char NumDiagArgs;
   /// NumRanges - This is the number of ranges in the DiagRanges array.
@@ -413,7 +413,7 @@ private:
   /// values, with one for each argument.  This specifies whether the argument
   /// is in DiagArgumentsStr or in DiagArguments.
   unsigned char DiagArgumentsKind[MaxArguments];
-  
+
   /// DiagArgumentsStr - This holds the values of each string argument for the
   /// current diagnostic.  This value is only used when the corresponding
   /// ArgumentKind is ak_std_string.
@@ -424,11 +424,11 @@ private:
   /// mangled into an intptr_t and the intepretation depends on exactly what
   /// sort of argument kind it is.
   intptr_t DiagArgumentsVal[MaxArguments];
-  
+
   /// DiagRanges - The list of ranges added to this diagnostic.  It currently
   /// only support 10 ranges, could easily be extended if needed.
   const SourceRange *DiagRanges[10];
-  
+
   enum { MaxCodeModificationHints = 3 };
 
   /// CodeModificationHints - If valid, provides a hint with some code
@@ -461,14 +461,14 @@ private:
 class DiagnosticBuilder {
   mutable Diagnostic *DiagObj;
   mutable unsigned NumArgs, NumRanges, NumCodeModificationHints;
-  
+
   void operator=(const DiagnosticBuilder&); // DO NOT IMPLEMENT
   friend class Diagnostic;
   explicit DiagnosticBuilder(Diagnostic *diagObj)
-    : DiagObj(diagObj), NumArgs(0), NumRanges(0), 
+    : DiagObj(diagObj), NumArgs(0), NumRanges(0),
       NumCodeModificationHints(0) {}
 
-public:  
+public:
   /// Copy constructor.  When copied, this "takes" the diagnostic info from the
   /// input and neuters it.
   DiagnosticBuilder(const DiagnosticBuilder &D) {
@@ -485,7 +485,7 @@ public:
 
   /// \brief Create an empty DiagnosticBuilder object that represents
   /// no actual diagnostic.
-  explicit DiagnosticBuilder(SuppressKind) 
+  explicit DiagnosticBuilder(SuppressKind)
     : DiagObj(0), NumArgs(0), NumRanges(0), NumCodeModificationHints(0) { }
 
   /// \brief Force the diagnostic builder to emit the diagnostic now.
@@ -522,7 +522,7 @@ public:
   /// Destructor - The dtor emits the diagnostic if it hasn't already
   /// been emitted.
   ~DiagnosticBuilder() { Emit(); }
-  
+
   /// Operator bool: conversion of DiagnosticBuilder to bool always returns
   /// true.  This allows is to be used in boolean error contexts like:
   /// return Diag(...);
@@ -536,7 +536,7 @@ public:
       DiagObj->DiagArgumentsStr[NumArgs++] = S;
     }
   }
-  
+
   void AddTaggedVal(intptr_t V, Diagnostic::ArgumentKind Kind) const {
     assert(NumArgs < Diagnostic::MaxArguments &&
            "Too many arguments to diagnostic!");
@@ -545,14 +545,14 @@ public:
       DiagObj->DiagArgumentsVal[NumArgs++] = V;
     }
   }
-  
+
   void AddSourceRange(const SourceRange &R) const {
-    assert(NumRanges < 
+    assert(NumRanges <
            sizeof(DiagObj->DiagRanges)/sizeof(DiagObj->DiagRanges[0]) &&
            "Too many arguments to diagnostic!");
     if (DiagObj)
       DiagObj->DiagRanges[NumRanges++] = &R;
-  }    
+  }
 
   void AddCodeModificationHint(const CodeModificationHint &Hint) const {
     assert(NumCodeModificationHints < Diagnostic::MaxCodeModificationHints &&
@@ -597,7 +597,7 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
                   Diagnostic::ak_identifierinfo);
   return DB;
 }
-  
+
 inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
                                            const SourceRange &R) {
   DB.AddSourceRange(R);
@@ -623,7 +623,7 @@ inline DiagnosticBuilder Diagnostic::Report(FullSourceLoc Loc, unsigned DiagID){
 //===----------------------------------------------------------------------===//
 // DiagnosticInfo
 //===----------------------------------------------------------------------===//
-  
+
 /// DiagnosticInfo - This is a little helper class (which is basically a smart
 /// pointer that forward info from Diagnostic) that allows clients to enquire
 /// about the currently in-flight diagnostic.
@@ -631,74 +631,74 @@ class DiagnosticInfo {
   const Diagnostic *DiagObj;
 public:
   explicit DiagnosticInfo(const Diagnostic *DO) : DiagObj(DO) {}
-  
+
   const Diagnostic *getDiags() const { return DiagObj; }
   unsigned getID() const { return DiagObj->CurDiagID; }
   const FullSourceLoc &getLocation() const { return DiagObj->CurDiagLoc; }
-  
+
   unsigned getNumArgs() const { return DiagObj->NumDiagArgs; }
-  
+
   /// getArgKind - Return the kind of the specified index.  Based on the kind
   /// of argument, the accessors below can be used to get the value.
   Diagnostic::ArgumentKind getArgKind(unsigned Idx) const {
     assert(Idx < getNumArgs() && "Argument index out of range!");
     return (Diagnostic::ArgumentKind)DiagObj->DiagArgumentsKind[Idx];
   }
-  
+
   /// getArgStdStr - Return the provided argument string specified by Idx.
   const std::string &getArgStdStr(unsigned Idx) const {
     assert(getArgKind(Idx) == Diagnostic::ak_std_string &&
            "invalid argument accessor!");
     return DiagObj->DiagArgumentsStr[Idx];
   }
-  
+
   /// getArgCStr - Return the specified C string argument.
   const char *getArgCStr(unsigned Idx) const {
     assert(getArgKind(Idx) == Diagnostic::ak_c_string &&
            "invalid argument accessor!");
     return reinterpret_cast<const char*>(DiagObj->DiagArgumentsVal[Idx]);
   }
-  
+
   /// getArgSInt - Return the specified signed integer argument.
   int getArgSInt(unsigned Idx) const {
     assert(getArgKind(Idx) == Diagnostic::ak_sint &&
            "invalid argument accessor!");
     return (int)DiagObj->DiagArgumentsVal[Idx];
   }
-  
+
   /// getArgUInt - Return the specified unsigned integer argument.
   unsigned getArgUInt(unsigned Idx) const {
     assert(getArgKind(Idx) == Diagnostic::ak_uint &&
            "invalid argument accessor!");
     return (unsigned)DiagObj->DiagArgumentsVal[Idx];
   }
-  
+
   /// getArgIdentifier - Return the specified IdentifierInfo argument.
   const IdentifierInfo *getArgIdentifier(unsigned Idx) const {
     assert(getArgKind(Idx) == Diagnostic::ak_identifierinfo &&
            "invalid argument accessor!");
     return reinterpret_cast<IdentifierInfo*>(DiagObj->DiagArgumentsVal[Idx]);
   }
-  
+
   /// getRawArg - Return the specified non-string argument in an opaque form.
   intptr_t getRawArg(unsigned Idx) const {
     assert(getArgKind(Idx) != Diagnostic::ak_std_string &&
            "invalid argument accessor!");
     return DiagObj->DiagArgumentsVal[Idx];
   }
-  
-  
+
+
   /// getNumRanges - Return the number of source ranges associated with this
   /// diagnostic.
   unsigned getNumRanges() const {
     return DiagObj->NumDiagRanges;
   }
-  
+
   const SourceRange &getRange(unsigned Idx) const {
     assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!");
     return *DiagObj->DiagRanges[Idx];
   }
-  
+
   unsigned getNumCodeModificationHints() const {
     return DiagObj->NumCodeModificationHints;
   }
@@ -708,7 +708,7 @@ public:
   }
 
   const CodeModificationHint *getCodeModificationHints() const {
-    return DiagObj->NumCodeModificationHints? 
+    return DiagObj->NumCodeModificationHints?
              &DiagObj->CodeModificationHints[0] : 0;
   }
 
@@ -717,20 +717,20 @@ public:
   /// array.
   void FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const;
 };
-  
+
 /// DiagnosticClient - This is an abstract interface implemented by clients of
 /// the front-end, which formats and prints fully processed diagnostics.
 class DiagnosticClient {
 public:
   virtual ~DiagnosticClient();
-  
+
   /// setLangOptions - This is set by clients of diagnostics when they know the
   /// language parameters of the diagnostics that may be sent through.  Note
   /// that this can change over time if a DiagClient has multiple languages sent
   /// through it.  It may also be set to null (e.g. when processing command line
   /// options).
   virtual void setLangOptions(const LangOptions *LO) {}
-  
+
   /// IncludeInDiagnosticCounts - This method (whose default implementation
   ///  returns true) indicates whether the diagnostics handled by this
   ///  DiagnosticClient should be included in the number of diagnostics

+ 17 - 17
include/clang/Basic/FileManager.h

@@ -25,7 +25,7 @@
 
 namespace clang {
 class FileManager;
-  
+
 /// DirectoryEntry - Cached information about one directory on the disk.
 ///
 class DirectoryEntry {
@@ -33,7 +33,7 @@ class DirectoryEntry {
   friend class FileManager;
 public:
   DirectoryEntry() : Name(0) {}
-  const char *getName() const { return Name; } 
+  const char *getName() const { return Name; }
 };
 
 /// FileEntry - Cached information about one file on the disk.
@@ -53,7 +53,7 @@ public:
     : Name(0), Device(device), Inode(inode), FileMode(m) {}
   // Add a default constructor for use with llvm::StringMap
   FileEntry() : Name(0), Device(0), Inode(0), FileMode(0) {}
-  
+
   const char *getName() const { return Name; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }
@@ -61,11 +61,11 @@ public:
   dev_t getDevice() const { return Device; }
   time_t getModificationTime() const { return ModTime; }
   mode_t getFileMode() const { return FileMode; }
-  
+
   /// getDir - Return the directory the file lives in.
   ///
   const DirectoryEntry *getDir() const { return Dir; }
-  
+
   bool operator<(const FileEntry& RHS) const {
     return Device < RHS.Device || (Device == RHS.Device && Inode < RHS.Inode);
   }
@@ -85,19 +85,19 @@ public:
 /// execution of the front end.
 class MemorizeStatCalls : public StatSysCallCache {
 public:
-  /// \brief The result of a stat() call. 
+  /// \brief The result of a stat() call.
   ///
   /// The first member is the result of calling stat(). If stat()
   /// found something, the second member is a copy of the stat
   /// structure.
   typedef std::pair<int, struct stat> StatResult;
 
-  /// \brief The set of stat() calls that have been 
+  /// \brief The set of stat() calls that have been
   llvm::StringMap<StatResult, llvm::BumpPtrAllocator> StatCalls;
 
   typedef llvm::StringMap<StatResult, llvm::BumpPtrAllocator>::const_iterator
     iterator;
-  
+
   iterator begin() const { return StatCalls.begin(); }
   iterator end() const { return StatCalls.end(); }
 
@@ -124,22 +124,22 @@ class FileManager {
   ///
   llvm::StringMap<DirectoryEntry*, llvm::BumpPtrAllocator> DirEntries;
   llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator> FileEntries;
-  
+
   /// NextFileUID - Each FileEntry we create is assigned a unique ID #.
   ///
   unsigned NextFileUID;
-  
+
   // Statistics.
   unsigned NumDirLookups, NumFileLookups;
   unsigned NumDirCacheMisses, NumFileCacheMisses;
-  
+
   // Caching.
   llvm::OwningPtr<StatSysCallCache> StatCache;
 
   int stat_cached(const char* path, struct stat* buf) {
     return StatCache.get() ? StatCache->stat(path, buf) : stat(path, buf);
   }
-  
+
 public:
   FileManager();
   ~FileManager();
@@ -150,24 +150,24 @@ public:
   void setStatCache(StatSysCallCache *statCache) {
     StatCache.reset(statCache);
   }
-  
+
   /// getDirectory - Lookup, cache, and verify the specified directory.  This
   /// returns null if the directory doesn't exist.
-  /// 
+  ///
   const DirectoryEntry *getDirectory(const llvm::StringRef &Filename) {
     return getDirectory(Filename.begin(), Filename.end());
   }
   const DirectoryEntry *getDirectory(const char *FileStart,const char *FileEnd);
-  
+
   /// getFile - Lookup, cache, and verify the specified file.  This returns null
   /// if the file doesn't exist.
-  /// 
+  ///
   const FileEntry *getFile(const llvm::StringRef &Filename) {
     return getFile(Filename.begin(), Filename.end());
   }
   const FileEntry *getFile(const char *FilenameStart,
                            const char *FilenameEnd);
-  
+
   void PrintStats() const;
 };
 

+ 59 - 59
include/clang/Basic/IdentifierTable.h

@@ -21,8 +21,8 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
-#include <string> 
-#include <cassert> 
+#include <string>
+#include <cassert>
 
 namespace llvm {
   template <typename T> struct DenseMapInfo;
@@ -38,21 +38,21 @@ namespace clang {
 
   /// IdentifierLocPair - A simple pair of identifier info and location.
   typedef std::pair<IdentifierInfo*, SourceLocation> IdentifierLocPair;
-  
-  
+
+
 /// IdentifierInfo - One of these records is kept for each identifier that
 /// is lexed.  This contains information about whether the token was #define'd,
 /// is a language keyword, or if it is a front-end token of some sort (e.g. a
 /// variable or function name).  The preprocessor keeps this information in a
-/// set, and all tok::identifier tokens have a pointer to one of these.  
+/// set, and all tok::identifier tokens have a pointer to one of these.
 class IdentifierInfo {
   // Note: DON'T make TokenID a 'tok::TokenKind'; MSVC will treat it as a
   //       signed char and TokenKinds > 127 won't be handled correctly.
-  unsigned TokenID            : 8; // Front-end token ID or tok::identifier. 
+  unsigned TokenID            : 8; // Front-end token ID or tok::identifier.
   // Objective-C keyword ('protocol' in '@protocol') or builtin (__builtin_inf).
   // First NUM_OBJC_KEYWORDS values are for Objective-C, the remaining values
   // are for builtins.
-  unsigned ObjCOrBuiltinID    :10; 
+  unsigned ObjCOrBuiltinID    :10;
   bool HasMacro               : 1; // True if there is a #define for this.
   bool IsExtension            : 1; // True if identifier is a lang extension.
   bool IsPoisoned             : 1; // True if identifier is poisoned.
@@ -61,50 +61,50 @@ class IdentifierInfo {
   // 9 bits left in 32-bit word.
   void *FETokenInfo;               // Managed by the language front-end.
   llvm::StringMapEntry<IdentifierInfo*> *Entry;
-  
+
   IdentifierInfo(const IdentifierInfo&);  // NONCOPYABLE.
   void operator=(const IdentifierInfo&);  // NONASSIGNABLE.
 
-  friend class IdentifierTable;  
+  friend class IdentifierTable;
 
 public:
   IdentifierInfo();
 
-  
+
   /// isStr - Return true if this is the identifier for the specified string.
   /// This is intended to be used for string literals only: II->isStr("foo").
   template <std::size_t StrLen>
   bool isStr(const char (&Str)[StrLen]) const {
     return getLength() == StrLen-1 && !memcmp(getName(), Str, StrLen-1);
   }
-  
-  /// getName - Return the actual string for this identifier.  The returned 
+
+  /// getName - Return the actual string for this identifier.  The returned
   /// string is properly null terminated.
   ///
-  const char *getName() const {    
+  const char *getName() const {
     if (Entry) return Entry->getKeyData();
     // FIXME: This is gross. It would be best not to embed specific details
     // of the PTH file format here.
-    // The 'this' pointer really points to a 
+    // The 'this' pointer really points to a
     // std::pair<IdentifierInfo, const char*>, where internal pointer
     // points to the external string data.
     return ((std::pair<IdentifierInfo, const char*>*) this)->second;
   }
-  
+
   /// getLength - Efficiently return the length of this identifier info.
   ///
   unsigned getLength() const {
     if (Entry) return Entry->getKeyLength();
     // FIXME: This is gross. It would be best not to embed specific details
     // of the PTH file format here.
-    // The 'this' pointer really points to a 
+    // The 'this' pointer really points to a
     // std::pair<IdentifierInfo, const char*>, where internal pointer
     // points to the external string data.
     const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2;
     return (((unsigned) p[0])
         | (((unsigned) p[1]) << 8)) - 1;
   }
-  
+
   /// hasMacroDefinition - Return true if this identifier is #defined to some
   /// other value.
   bool hasMacroDefinition() const {
@@ -112,29 +112,29 @@ public:
   }
   void setHasMacroDefinition(bool Val) {
     if (HasMacro == Val) return;
-    
+
     HasMacro = Val;
     if (Val)
       NeedsHandleIdentifier = 1;
     else
       RecomputeNeedsHandleIdentifier();
   }
-  
+
   /// get/setTokenID - If this is a source-language token (e.g. 'for'), this API
   /// can be used to cause the lexer to map identifiers to source-language
   /// tokens.
   tok::TokenKind getTokenID() const { return (tok::TokenKind)TokenID; }
   void setTokenID(tok::TokenKind ID) { TokenID = ID; }
-  
+
   /// getPPKeywordID - Return the preprocessor keyword ID for this identifier.
   /// For example, "define" will return tok::pp_define.
   tok::PPKeywordKind getPPKeywordID() const;
-  
+
   /// getObjCKeywordID - Return the Objective-C keyword ID for the this
   /// identifier.  For example, 'class' will return tok::objc_class if ObjC is
   /// enabled.
   tok::ObjCKeywordKind getObjCKeywordID() const {
-    if (ObjCOrBuiltinID < tok::NUM_OBJC_KEYWORDS) 
+    if (ObjCOrBuiltinID < tok::NUM_OBJC_KEYWORDS)
       return tok::ObjCKeywordKind(ObjCOrBuiltinID);
     else
       return tok::objc_not_keyword;
@@ -144,15 +144,15 @@ public:
   /// getBuiltinID - Return a value indicating whether this is a builtin
   /// function.  0 is not-built-in.  1 is builtin-for-some-nonprimary-target.
   /// 2+ are specific builtin functions.
-  unsigned getBuiltinID() const { 
+  unsigned getBuiltinID() const {
     if (ObjCOrBuiltinID >= tok::NUM_OBJC_KEYWORDS)
-      return ObjCOrBuiltinID - tok::NUM_OBJC_KEYWORDS; 
+      return ObjCOrBuiltinID - tok::NUM_OBJC_KEYWORDS;
     else
       return 0;
   }
   void setBuiltinID(unsigned ID) {
     ObjCOrBuiltinID = ID + tok::NUM_OBJC_KEYWORDS;
-    assert(ObjCOrBuiltinID - unsigned(tok::NUM_OBJC_KEYWORDS) == ID 
+    assert(ObjCOrBuiltinID - unsigned(tok::NUM_OBJC_KEYWORDS) == ID
            && "ID too large for field!");
   }
 
@@ -170,7 +170,7 @@ public:
     else
       RecomputeNeedsHandleIdentifier();
   }
-  
+
   /// setIsPoisoned - Mark this identifier as poisoned.  After poisoning, the
   /// Preprocessor will emit an error every time this token is used.
   void setIsPoisoned(bool Value = true) {
@@ -180,10 +180,10 @@ public:
     else
       RecomputeNeedsHandleIdentifier();
   }
-  
+
   /// isPoisoned - Return true if this token has been poisoned.
   bool isPoisoned() const { return IsPoisoned; }
-  
+
   /// isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether
   /// this identifier is a C++ alternate representation of an operator.
   void setIsCPlusPlusOperatorKeyword(bool Val = true) {
@@ -205,7 +205,7 @@ public:
   /// must be called on a token of this identifier.  If this returns false, we
   /// know that HandleIdentifier will not affect the token.
   bool isHandleIdentifierCase() const { return NeedsHandleIdentifier; }
-  
+
 private:
   /// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does
   /// several special (but rare) things to identifiers of various sorts.  For
@@ -227,13 +227,13 @@ private:
 class IdentifierInfoLookup {
 public:
   virtual ~IdentifierInfoLookup();
-  
+
   /// 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.
   virtual IdentifierInfo* get(const char *NameStart, const char *NameEnd) = 0;
-};  
+};
 
 /// \brief An abstract class used to resolve numerical identifier
 /// references (meaningful only to some external source) into
@@ -257,7 +257,7 @@ class IdentifierTable {
   // BumpPtrAllocator!
   typedef llvm::StringMap<IdentifierInfo*, llvm::BumpPtrAllocator> HashTableTy;
   HashTableTy HashTable;
-  
+
   IdentifierInfoLookup* ExternalLookup;
 
 public:
@@ -265,7 +265,7 @@ public:
   /// info about the language keywords for the language specified by LangOpts.
   IdentifierTable(const LangOptions &LangOpts,
                   IdentifierInfoLookup* externalLookup = 0);
-  
+
   /// \brief Set the external identifier lookup mechanism.
   void setExternalIdentifierLookup(IdentifierInfoLookup *IILookup) {
     ExternalLookup = IILookup;
@@ -274,16 +274,16 @@ public:
   llvm::BumpPtrAllocator& getAllocator() {
     return HashTable.getAllocator();
   }
-  
+
   /// get - Return the identifier token info for the specified named identifier.
   ///
   IdentifierInfo &get(const char *NameStart, const char *NameEnd) {
     llvm::StringMapEntry<IdentifierInfo*> &Entry =
       HashTable.GetOrCreateValue(NameStart, NameEnd);
-    
+
     IdentifierInfo *II = Entry.getValue();
     if (II) return *II;
-    
+
     // No entry; if we have an external lookup, look there first.
     if (ExternalLookup) {
       II = ExternalLookup->get(NameStart, NameEnd);
@@ -305,7 +305,7 @@ public:
 
     return *II;
   }
-  
+
   /// \brief Creates a new IdentifierInfo from the given string.
   ///
   /// This is a lower-level version of get() that requires that this
@@ -314,14 +314,14 @@ public:
   /// identifier sources can use this routine to build IdentifierInfo
   /// nodes and then introduce additional information about those
   /// identifiers.
-  IdentifierInfo &CreateIdentifierInfo(const char *NameStart, 
+  IdentifierInfo &CreateIdentifierInfo(const char *NameStart,
                                        const char *NameEnd) {
     llvm::StringMapEntry<IdentifierInfo*> &Entry =
       HashTable.GetOrCreateValue(NameStart, NameEnd);
-    
+
     IdentifierInfo *II = Entry.getValue();
     assert(!II && "IdentifierInfo already exists");
-    
+
     // Lookups failed, make a new IdentifierInfo.
     void *Mem = getAllocator().Allocate<IdentifierInfo>();
     II = new (Mem) IdentifierInfo();
@@ -345,26 +345,26 @@ public:
 
   typedef HashTableTy::const_iterator iterator;
   typedef HashTableTy::const_iterator const_iterator;
-  
+
   iterator begin() const { return HashTable.begin(); }
   iterator end() const   { return HashTable.end(); }
   unsigned size() const { return HashTable.size(); }
-  
+
   /// PrintStats - Print some statistics to stderr that indicate how well the
   /// hashing is doing.
   void PrintStats() const;
-  
+
   void AddKeywords(const LangOptions &LangOpts);
 };
 
 /// Selector - This smart pointer class efficiently represents Objective-C
 /// method names. This class will either point to an IdentifierInfo or a
 /// MultiKeywordSelector (which is private). This enables us to optimize
-/// selectors that take no arguments and selectors that take 1 argument, which 
+/// selectors that take no arguments and selectors that take 1 argument, which
 /// accounts for 78% of all selectors in Cocoa.h.
 class Selector {
   friend class DiagnosticInfo;
-  
+
   enum IdentifierInfoFlag {
     // MultiKeywordSelector = 0.
     ZeroArg  = 0x1,
@@ -372,7 +372,7 @@ class Selector {
     ArgFlags = ZeroArg|OneArg
   };
   uintptr_t InfoPtr; // a pointer to the MultiKeywordSelector or IdentifierInfo.
-  
+
   Selector(IdentifierInfo *II, unsigned nArgs) {
     InfoPtr = reinterpret_cast<uintptr_t>(II);
     assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo");
@@ -383,7 +383,7 @@ class Selector {
     InfoPtr = reinterpret_cast<uintptr_t>(SI);
     assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo");
   }
-  
+
   IdentifierInfo *getAsIdentifierInfo() const {
     if (getIdentifierInfoFlag())
       return reinterpret_cast<IdentifierInfo *>(InfoPtr & ~ArgFlags);
@@ -417,19 +417,19 @@ public:
   bool isNull() const { return InfoPtr == 0; }
 
   // Predicates to identify the selector type.
-  bool isKeywordSelector() const { 
-    return getIdentifierInfoFlag() != ZeroArg; 
+  bool isKeywordSelector() const {
+    return getIdentifierInfoFlag() != ZeroArg;
   }
-  bool isUnarySelector() const { 
+  bool isUnarySelector() const {
     return getIdentifierInfoFlag() == ZeroArg;
   }
   unsigned getNumArgs() const;
   IdentifierInfo *getIdentifierInfoForSlot(unsigned argIndex) const;
-  
+
   /// getAsString - Derive the full selector name (e.g. "foo:bar:") and return
   /// it as an std::string.
   std::string getAsString() const;
-  
+
   static Selector getEmptyMarker() {
     return Selector(uintptr_t(-1));
   }
@@ -452,7 +452,7 @@ public:
   /// whether this is a no argument selector "foo", a single argument selector
   /// "foo:" or multi-argument "foo:bar:".
   Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV);
-  
+
   Selector getUnarySelector(IdentifierInfo *ID) {
     return Selector(ID, 1);
   }
@@ -519,15 +519,15 @@ struct DenseMapInfo<clang::Selector> {
     return clang::Selector::getEmptyMarker();
   }
   static inline clang::Selector getTombstoneKey() {
-    return clang::Selector::getTombstoneMarker(); 
+    return clang::Selector::getTombstoneMarker();
   }
-  
+
   static unsigned getHashValue(clang::Selector S);
-  
+
   static bool isEqual(clang::Selector LHS, clang::Selector RHS) {
     return LHS == RHS;
   }
-  
+
   static bool isPod() { return true; }
 };
 
@@ -537,7 +537,7 @@ template<>
 class PointerLikeTypeTraits<clang::IdentifierInfo*> {
 public:
   static inline void *getAsVoidPointer(clang::IdentifierInfo* P) {
-    return P; 
+    return P;
   }
   static inline clang::IdentifierInfo *getFromVoidPointer(void *P) {
     return static_cast<clang::IdentifierInfo*>(P);
@@ -549,7 +549,7 @@ template<>
 class PointerLikeTypeTraits<const clang::IdentifierInfo*> {
 public:
   static inline const void *getAsVoidPointer(const clang::IdentifierInfo* P) {
-    return P; 
+    return P;
   }
   static inline const clang::IdentifierInfo *getFromVoidPointer(const void *P) {
     return static_cast<const clang::IdentifierInfo*>(P);

+ 15 - 15
include/clang/Basic/LangOptions.h

@@ -34,13 +34,13 @@ public:
   unsigned CPlusPlus         : 1;  // C++ Support
   unsigned CPlusPlus0x       : 1;  // C++0x Support
   unsigned CXXOperatorNames  : 1;  // Treat C++ operator names as keywords.
-    
+
   unsigned ObjC1             : 1;  // Objective-C 1 support enabled.
   unsigned ObjC2             : 1;  // Objective-C 2 support enabled.
   unsigned ObjCSenderDispatch: 1;  // Objective-C 2 three-dimensional dispatch
                                    // enabled.
   unsigned ObjCNonFragileABI : 1;  // Objective-C modern abi enabled
-    
+
   unsigned PascalStrings     : 1;  // Allow Pascal strings
   unsigned WritableStrings   : 1;  // Allow writable strings
   unsigned LaxVectorConversions : 1;
@@ -69,7 +69,7 @@ public:
                                   // may be ripped out at any time.
 
   unsigned Optimize          : 1; // Whether __OPTIMIZE__ should be defined.
-  unsigned OptimizeSize      : 1; // Whether __OPTIMIZE_SIZE__ should be 
+  unsigned OptimizeSize      : 1; // Whether __OPTIMIZE_SIZE__ should be
                                   // defined.
   unsigned Static            : 1; // Should __STATIC__ be defined (as
                                   // opposed to __DYNAMIC__).
@@ -82,7 +82,7 @@ public:
   unsigned ObjCGCBitmapPrint : 1; // Enable printing of gc's bitmap layout
                                   // for __weak/__strong ivars.
 
-  unsigned AccessControl     : 1; // Whether C++ access control should 
+  unsigned AccessControl     : 1; // Whether C++ access control should
                                   // be enabled.
   unsigned CharIsSigned      : 1; // Whether char is a signed or unsigned type
 
@@ -106,19 +106,19 @@ private:
   /// the original input file, for example with -save-temps.
   const char *MainFileName;
 
-public:  
+public:
   unsigned InstantiationDepth;    // Maximum template instantiation depth.
 
   const char *ObjCConstantStringClass;
 
   enum GCMode { NonGC, GCOnly, HybridGC };
   enum StackProtectorMode { SSPOff, SSPOn, SSPReq };
-  enum VisibilityMode { 
-    Default, 
-    Protected, 
+  enum VisibilityMode {
+    Default,
+    Protected,
     Hidden
   };
-  
+
   LangOptions() {
     Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0;
     GNUMode = ImplicitInt = Digraphs = 0;
@@ -134,7 +134,7 @@ public:
     AltiVec = OpenCL = StackProtector = 0;
 
     SymbolVisibility = (unsigned) Default;
-    
+
     // FIXME: The default should be 1.
     ThreadsafeStatics = 0;
     POSIXThreads = 0;
@@ -145,13 +145,13 @@ public:
     // FIXME: The default should be 1.
     AccessControl = 0;
     ElideConstructors = 1;
-    
+
     OverflowChecking = 0;
     ObjCGCBitmapPrint = 0;
     ObjCSenderDispatch = 0;
 
     InstantiationDepth = 99;
-    
+
     Optimize = 0;
     OptimizeSize = 0;
 
@@ -165,7 +165,7 @@ public:
 
     MainFileName = 0;
   }
-  
+
   GCMode getGCMode() const { return (GCMode) GC; }
   void setGCMode(GCMode m) { GC = (unsigned) m; }
 
@@ -179,8 +179,8 @@ public:
   const char *getMainFileName() const { return MainFileName; }
   void setMainFileName(const char *Name) { MainFileName = Name; }
 
-  VisibilityMode getVisibilityMode() const { 
-    return (VisibilityMode) SymbolVisibility; 
+  VisibilityMode getVisibilityMode() const {
+    return (VisibilityMode) SymbolVisibility;
   }
   void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; }
 };

+ 44 - 44
include/clang/Basic/OnDiskHashTable.h

@@ -29,7 +29,7 @@ namespace clang {
 // This is basically copy-and-paste from StringMap.  This likely won't
 // stay here, which is why I didn't both to expose this function from
 // String Map.
-inline unsigned BernsteinHash(const char* x) {  
+inline unsigned BernsteinHash(const char* x) {
   unsigned int R = 0;
   for ( ; *x != '\0' ; ++x) R = R * 33 + *x;
   return R + (R >> 5);
@@ -131,29 +131,29 @@ class OnDiskChainedHashTableGenerator {
   unsigned NumBuckets;
   unsigned NumEntries;
   llvm::BumpPtrAllocator BA;
-  
+
   class Item {
   public:
     typename Info::key_type key;
     typename Info::data_type data;
     Item *next;
     const uint32_t hash;
-    
+
     Item(typename Info::key_type_ref k, typename Info::data_type_ref d)
     : key(k), data(d), next(0), hash(Info::ComputeHash(k)) {}
   };
-  
-  class Bucket { 
+
+  class Bucket {
   public:
     io::Offset off;
     Item*  head;
     unsigned length;
-    
+
     Bucket() {}
   };
-  
+
   Bucket* Buckets;
-  
+
 private:
   void insert(Bucket* b, size_t size, Item* E) {
     unsigned idx = E->hash & (size - 1);
@@ -162,7 +162,7 @@ private:
     ++B.length;
     B.head = E;
   }
-  
+
   void resize(size_t newsize) {
     Bucket* newBuckets = (Bucket*) std::calloc(newsize, sizeof(Bucket));
     // Populate newBuckets with the old entries.
@@ -173,14 +173,14 @@ private:
         insert(newBuckets, newsize, E);
         E = N;
       }
-    
+
     free(Buckets);
     NumBuckets = newsize;
     Buckets = newBuckets;
-  }  
-  
+  }
+
 public:
-  
+
   void insert(typename Info::key_type_ref key,
               typename Info::data_type_ref data) {
 
@@ -188,7 +188,7 @@ public:
     if (4*NumEntries >= 3*NumBuckets) resize(NumBuckets*2);
     insert(Buckets, NumBuckets, new (BA.Allocate<Item>()) Item(key, data));
   }
-  
+
   io::Offset Emit(llvm::raw_ostream &out) {
     Info InfoObj;
     return Emit(out, InfoObj);
@@ -201,42 +201,42 @@ public:
     for (unsigned i = 0; i < NumBuckets; ++i) {
       Bucket& B = Buckets[i];
       if (!B.head) continue;
-      
+
       // Store the offset for the data of this bucket.
       B.off = out.tell();
       assert(B.off && "Cannot write a bucket at offset 0. Please add padding.");
 
       // Write out the number of items in the bucket.
       Emit16(out, B.length);
-      
+
       // Write out the entries in the bucket.
       for (Item *I = B.head; I ; I = I->next) {
         Emit32(out, I->hash);
-        const std::pair<unsigned, unsigned>& Len = 
+        const std::pair<unsigned, unsigned>& Len =
           InfoObj.EmitKeyDataLength(out, I->key, I->data);
         InfoObj.EmitKey(out, I->key, Len.first);
         InfoObj.EmitData(out, I->key, I->data, Len.second);
       }
     }
-    
+
     // Emit the hashtable itself.
     Pad(out, 4);
     io::Offset TableOff = out.tell();
     Emit32(out, NumBuckets);
     Emit32(out, NumEntries);
     for (unsigned i = 0; i < NumBuckets; ++i) Emit32(out, Buckets[i].off);
-    
+
     return TableOff;
   }
-  
+
   OnDiskChainedHashTableGenerator() {
     NumEntries = 0;
-    NumBuckets = 64;    
+    NumBuckets = 64;
     // Note that we do not need to run the constructors of the individual
     // Bucket objects since 'calloc' returns bytes that are all 0.
     Buckets = (Bucket*) std::calloc(NumBuckets, sizeof(Bucket));
   }
-  
+
   ~OnDiskChainedHashTableGenerator() {
     std::free(Buckets);
   }
@@ -254,7 +254,7 @@ public:
   typedef typename Info::internal_key_type internal_key_type;
   typedef typename Info::external_key_type external_key_type;
   typedef typename Info::data_type         data_type;
-  
+
   OnDiskChainedHashTable(unsigned numBuckets, unsigned numEntries,
                          const unsigned char* buckets,
                          const unsigned char* base,
@@ -271,7 +271,7 @@ public:
   const unsigned char* getBuckets() const { return Buckets; }
 
   bool isEmpty() const { return NumEntries == 0; }
-  
+
   class iterator {
     internal_key_type key;
     const unsigned char* const data;
@@ -282,12 +282,12 @@ public:
     iterator(const internal_key_type k, const unsigned char* d, unsigned l,
              Info *InfoObj)
       : key(k), data(d), len(l), InfoObj(InfoObj) {}
-    
-    data_type operator*() const { return InfoObj->ReadData(key, data, len); }    
-    bool operator==(const iterator& X) const { return X.data == data; }    
+
+    data_type operator*() const { return InfoObj->ReadData(key, data, len); }
+    bool operator==(const iterator& X) const { return X.data == data; }
     bool operator!=(const iterator& X) const { return X.data != data; }
-  };    
-  
+  };
+
   iterator find(const external_key_type& eKey, Info *InfoPtr = 0) {
     if (!InfoPtr)
       InfoPtr = &InfoObj;
@@ -295,25 +295,25 @@ public:
     using namespace io;
     const internal_key_type& iKey = Info::GetInternalKey(eKey);
     unsigned key_hash = Info::ComputeHash(iKey);
-    
+
     // Each bucket is just a 32-bit offset into the hash table file.
     unsigned idx = key_hash & (NumBuckets - 1);
     const unsigned char* Bucket = Buckets + sizeof(uint32_t)*idx;
-    
+
     unsigned offset = ReadLE32(Bucket);
     if (offset == 0) return iterator(); // Empty bucket.
     const unsigned char* Items = Base + offset;
-    
+
     // 'Items' starts with a 16-bit unsigned integer representing the
     // number of items in this bucket.
     unsigned len = ReadUnalignedLE16(Items);
-    
+
     for (unsigned i = 0; i < len; ++i) {
       // Read the hash.
       uint32_t item_hash = ReadUnalignedLE32(Items);
-      
+
       // Determine the length of the key and the data.
-      const std::pair<unsigned, unsigned>& L = Info::ReadKeyDataLength(Items);      
+      const std::pair<unsigned, unsigned>& L = Info::ReadKeyDataLength(Items);
       unsigned item_len = L.first + L.second;
 
       // Compare the hashes.  If they are not the same, skip the entry entirely.
@@ -321,7 +321,7 @@ public:
         Items += item_len;
         continue;
       }
-      
+
       // Read the key.
       const internal_key_type& X =
         InfoPtr->ReadKey((const unsigned char* const) Items, L.first);
@@ -331,17 +331,17 @@ public:
         Items += item_len;
         continue;
       }
-      
+
       // The key matches!
       return iterator(X, Items + L.first, L.second, InfoPtr);
     }
-    
+
     return iterator();
   }
-  
+
   iterator end() const { return iterator(); }
-  
-  
+
+
   static OnDiskChainedHashTable* Create(const unsigned char* buckets,
                                         const unsigned char* const base,
                                         const Info &InfoObj = Info()) {
@@ -349,14 +349,14 @@ public:
     assert(buckets > base);
     assert((reinterpret_cast<uintptr_t>(buckets) & 0x3) == 0 &&
            "buckets should be 4-byte aligned.");
-    
+
     unsigned numBuckets = ReadLE32(buckets);
     unsigned numEntries = ReadLE32(buckets);
     return new OnDiskChainedHashTable<Info>(numBuckets, numEntries, buckets,
                                             base, InfoObj);
-  }  
+  }
 };
 
 } // end namespace clang
 
-#endif 
+#endif

+ 45 - 45
include/clang/Basic/SourceLocation.h

@@ -24,10 +24,10 @@ namespace llvm {
 }
 
 namespace clang {
-  
+
 class SourceManager;
 class FileEntry;
-  
+
 /// FileID - This is an opaque identifier used by SourceManager which refers to
 /// a source file (MemoryBuffer) along with its #include path and #line data.
 ///
@@ -36,19 +36,19 @@ class FileID {
   unsigned ID;
 public:
   FileID() : ID(0) {}
-  
+
   bool isInvalid() const { return ID == 0; }
-  
+
   bool operator==(const FileID &RHS) const { return ID == RHS.ID; }
   bool operator<(const FileID &RHS) const { return ID < RHS.ID; }
   bool operator<=(const FileID &RHS) const { return ID <= RHS.ID; }
   bool operator!=(const FileID &RHS) const { return !(*this == RHS); }
   bool operator>(const FileID &RHS) const { return RHS < *this; }
   bool operator>=(const FileID &RHS) const { return RHS <= *this; }
-  
+
   static FileID getSentinel() { return get(~0U); }
   unsigned getHashValue() const { return ID; }
-  
+
 private:
   friend class SourceManager;
   static FileID get(unsigned V) {
@@ -58,8 +58,8 @@ private:
   }
   unsigned getOpaqueValue() const { return ID; }
 };
-  
-    
+
+
 /// SourceLocation - This is a carefully crafted 32-bit identifier that encodes
 /// a full include stack, line and column number information for a position in
 /// an input translation unit.
@@ -72,17 +72,17 @@ class SourceLocation {
 public:
 
   SourceLocation() : ID(0) {}  // 0 is an invalid FileID.
-  
+
   bool isFileID() const  { return (ID & MacroIDBit) == 0; }
   bool isMacroID() const { return (ID & MacroIDBit) != 0; }
-  
+
   /// isValid - Return true if this is a valid SourceLocation object.  Invalid
   /// SourceLocations are often used when events have no corresponding location
   /// in the source (e.g. a diagnostic is required for a command line option).
   ///
   bool isValid() const { return ID != 0; }
   bool isInvalid() const { return ID == 0; }
-  
+
 private:
   /// getOffset - Return the index for SourceManager's SLocEntryTable table,
   /// note that this is not an index *into* it though.
@@ -96,7 +96,7 @@ private:
     L.ID = ID;
     return L;
   }
-  
+
   static SourceLocation getMacroLoc(unsigned ID) {
     assert((ID & MacroIDBit) == 0 && "Ran out of source locations!");
     SourceLocation L;
@@ -104,7 +104,7 @@ private:
     return L;
   }
 public:
-  
+
   /// getFileLocWithOffset - Return a source location with the specified offset
   /// from this file SourceLocation.
   SourceLocation getFileLocWithOffset(int Offset) const {
@@ -113,14 +113,14 @@ public:
     L.ID = ID+Offset;
     return L;
   }
-  
+
   /// getRawEncoding - When a SourceLocation itself cannot be used, this returns
   /// an (opaque) 32-bit integer encoding for it.  This should only be passed
   /// to SourceLocation::getFromRawEncoding, it should not be inspected
   /// directly.
   unsigned getRawEncoding() const { return ID; }
-  
-  
+
+
   /// getFromRawEncoding - Turn a raw encoding of a SourceLocation object into
   /// a real SourceLocation.
   static SourceLocation getFromRawEncoding(unsigned Encoding) {
@@ -128,7 +128,7 @@ public:
     X.ID = Encoding;
     return X;
   }
-  
+
   void print(llvm::raw_ostream &OS, const SourceManager &SM) const;
   void dump(const SourceManager &SM) const;
 };
@@ -140,7 +140,7 @@ inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) {
 inline bool operator!=(const SourceLocation &LHS, const SourceLocation &RHS) {
   return !(LHS == RHS);
 }
-  
+
 inline bool operator<(const SourceLocation &LHS, const SourceLocation &RHS) {
   return LHS.getRawEncoding() < RHS.getRawEncoding();
 }
@@ -153,24 +153,24 @@ public:
   SourceRange(): B(SourceLocation()), E(SourceLocation()) {}
   SourceRange(SourceLocation loc) : B(loc), E(loc) {}
   SourceRange(SourceLocation begin, SourceLocation end) : B(begin), E(end) {}
-    
+
   SourceLocation getBegin() const { return B; }
   SourceLocation getEnd() const { return E; }
-  
+
   void setBegin(SourceLocation b) { B = b; }
   void setEnd(SourceLocation e) { E = e; }
-  
+
   bool isValid() const { return B.isValid() && E.isValid(); }
-  
+
   bool operator==(const SourceRange &X) const {
     return B == X.B && E == X.E;
   }
-  
+
   bool operator!=(const SourceRange &X) const {
     return B != X.B || E != X.E;
   }
 };
-  
+
 /// FullSourceLoc - A SourceLocation and its associated SourceManager.  Useful
 /// for argument passing to functions that expect both objects.
 class FullSourceLoc : public SourceLocation {
@@ -179,21 +179,21 @@ public:
   /// Creates a FullSourceLoc where isValid() returns false.
   explicit FullSourceLoc() : SrcMgr((SourceManager*) 0) {}
 
-  explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM) 
+  explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM)
     : SourceLocation(Loc), SrcMgr(&SM) {}
-    
+
   SourceManager &getManager() {
     assert(SrcMgr && "SourceManager is NULL.");
     return *SrcMgr;
   }
-  
+
   const SourceManager &getManager() const {
     assert(SrcMgr && "SourceManager is NULL.");
     return *SrcMgr;
   }
-  
+
   FileID getFileID() const;
-  
+
   FullSourceLoc getInstantiationLoc() const;
   FullSourceLoc getSpellingLoc() const;
 
@@ -204,37 +204,37 @@ public:
   unsigned getSpellingColumnNumber() const;
 
   const char *getCharacterData() const;
-  
+
   const llvm::MemoryBuffer* getBuffer() const;
-  
+
   /// getBufferData - Return a pointer to the start and end of the source buffer
   /// data for the specified FileID.
   std::pair<const char*, const char*> getBufferData() const;
-  
+
   /// getDecomposedLoc - Decompose the specified location into a raw FileID +
   /// Offset pair.  The first element is the FileID, the second is the
   /// offset from the start of the buffer of the location.
   std::pair<FileID, unsigned> getDecomposedLoc() const;
 
   bool isInSystemHeader() const;
-  
+
   /// Prints information about this FullSourceLoc to stderr. Useful for
   ///  debugging.
   void dump() const { SourceLocation::dump(*SrcMgr); }
 
-  friend inline bool 
+  friend inline bool
   operator==(const FullSourceLoc &LHS, const FullSourceLoc &RHS) {
     return LHS.getRawEncoding() == RHS.getRawEncoding() &&
           LHS.SrcMgr == RHS.SrcMgr;
   }
 
-  friend inline bool 
+  friend inline bool
   operator!=(const FullSourceLoc &LHS, const FullSourceLoc &RHS) {
     return !(LHS == RHS);
   }
 
 };
-  
+
 /// PresumedLoc - This class represents an unpacked "presumed" location which
 /// can be presented to the user.  A 'presumed' location can be modified by
 /// #line and GNU line marker directives and is always the instantiation point
@@ -250,13 +250,13 @@ public:
   PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL)
     : Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) {
   }
-  
+
   /// isInvalid - Return true if this object is invalid or uninitialized. This
   /// occurs when created with invalid source locations or when walking off
   /// the top of a #include stack.
   bool isInvalid() const { return Filename == 0; }
   bool isValid() const { return Filename != 0; }
-  
+
   /// getFilename - Return the presumed filename of this location.  This can be
   /// affected by #line etc.
   const char *getFilename() const { return Filename; }
@@ -264,7 +264,7 @@ public:
   /// getLine - Return the presumed line number of this location.  This can be
   /// affected by #line etc.
   unsigned getLine() const { return Line; }
-  
+
   /// getColumn - Return the presumed column number of this location.  This can
   /// not be affected by #line, but is packaged here for convenience.
   unsigned getColumn() const { return Col; }
@@ -274,7 +274,7 @@ public:
   SourceLocation getIncludeLoc() const { return IncludeLoc; }
 };
 
-  
+
 }  // end namespace clang
 
 namespace llvm {
@@ -286,20 +286,20 @@ namespace llvm {
       return clang::FileID();
     }
     static inline clang::FileID getTombstoneKey() {
-      return clang::FileID::getSentinel(); 
+      return clang::FileID::getSentinel();
     }
-    
+
     static unsigned getHashValue(clang::FileID S) {
       return S.getHashValue();
     }
-    
+
     static bool isEqual(clang::FileID LHS, clang::FileID RHS) {
       return LHS == RHS;
     }
-    
+
     static bool isPod() { return true; }
   };
-  
+
 }  // end namespace llvm
 
 #endif

+ 105 - 105
include/clang/Basic/SourceManager.h

@@ -24,9 +24,9 @@
 namespace llvm {
 class MemoryBuffer;
 }
-  
+
 namespace clang {
-  
+
 class SourceManager;
 class FileManager;
 class FileEntry;
@@ -46,7 +46,7 @@ namespace SrcMgr {
   enum CharacteristicKind {
     C_User, C_System, C_ExternCSystem
   };
-  
+
   /// ContentCache - Once instance of this struct is kept for every file
   /// loaded or used.  This object owns the MemoryBuffer object.
   class ContentCache {
@@ -59,12 +59,12 @@ namespace SrcMgr {
     /// the FileEntry object.  It is possible for this to be NULL if
     /// the ContentCache encapsulates an imaginary text buffer.
     const FileEntry *Entry;
-    
+
     /// SourceLineCache - A bump pointer allocated array of offsets for each
     /// source line.  This is lazily computed.  This is owned by the
     /// SourceManager BumpPointerAllocator object.
     unsigned *SourceLineCache;
-    
+
     /// NumLines - The number of lines in this ContentCache.  This is only valid
     /// if SourceLineCache is non-null.
     unsigned NumLines;
@@ -76,28 +76,28 @@ namespace SrcMgr {
 
     /// getBuffer - Returns the memory buffer for the associated content.
     const llvm::MemoryBuffer *getBuffer() const;
-    
+
     /// getSize - Returns the size of the content encapsulated by this
     ///  ContentCache. This can be the size of the source file or the size of an
     ///  arbitrary scratch buffer.  If the ContentCache encapsulates a source
     ///  file this size is retrieved from the file's FileEntry.
     unsigned getSize() const;
-    
+
     /// getSizeBytesMapped - Returns the number of bytes actually mapped for
     ///  this ContentCache.  This can be 0 if the MemBuffer was not actually
     ///  instantiated.
     unsigned getSizeBytesMapped() const;
-    
+
     void setBuffer(const llvm::MemoryBuffer *B) {
       assert(!Buffer && "MemoryBuffer already set.");
       Buffer = B;
     }
-        
+
     ContentCache(const FileEntry *Ent = 0)
       : Buffer(0), Entry(Ent), SourceLineCache(0), NumLines(0) {}
 
     ~ContentCache();
-    
+
     /// The copy ctor does not allow copies where source object has either
     ///  a non-NULL Buffer or SourceLineCache.  Ownership of allocated memory
     ///  is not transfered, so this is a logical error.
@@ -106,14 +106,14 @@ namespace SrcMgr {
 
       assert (RHS.Buffer == 0 && RHS.SourceLineCache == 0
               && "Passed ContentCache object cannot own a buffer.");
-              
-      NumLines = RHS.NumLines;      
+
+      NumLines = RHS.NumLines;
     }
-    
+
   private:
     // Disable assignments.
-    ContentCache &operator=(const ContentCache& RHS);    
-  };  
+    ContentCache &operator=(const ContentCache& RHS);
+  };
 
   /// FileInfo - Information about a FileID, basically just the logical file
   /// that it represents and include stack information.
@@ -128,7 +128,7 @@ namespace SrcMgr {
     /// IncludeLoc - The location of the #include that brought in this file.
     /// This is an invalid SLOC for the main file (top of the #include chain).
     unsigned IncludeLoc;  // Really a SourceLocation
-    
+
     /// Data - This contains the ContentCache* and the bits indicating the
     /// characteristic of the file and whether it has #line info, all bitmangled
     /// together.
@@ -145,39 +145,39 @@ namespace SrcMgr {
       X.Data |= (unsigned)FileCharacter;
       return X;
     }
-    
+
     SourceLocation getIncludeLoc() const {
       return SourceLocation::getFromRawEncoding(IncludeLoc);
     }
     const ContentCache* getContentCache() const {
       return reinterpret_cast<const ContentCache*>(Data & ~7UL);
     }
-    
+
     /// getCharacteristic - Return whether this is a system header or not.
-    CharacteristicKind getFileCharacteristic() const { 
+    CharacteristicKind getFileCharacteristic() const {
       return (CharacteristicKind)(Data & 3);
     }
 
     /// hasLineDirectives - Return true if this FileID has #line directives in
     /// it.
     bool hasLineDirectives() const { return (Data & 4) != 0; }
-    
+
     /// setHasLineDirectives - Set the flag that indicates that this FileID has
     /// line table entries associated with it.
     void setHasLineDirectives() {
       Data |= 4;
     }
   };
-  
+
   /// InstantiationInfo - Each InstantiationInfo encodes the Instantiation
   /// location - where the token was ultimately instantiated, and the
   /// SpellingLoc - where the actual character data for the token came from.
   class InstantiationInfo {
      // Really these are all SourceLocations.
-    
+
     /// SpellingLoc - Where the spelling for the token can be found.
     unsigned SpellingLoc;
-    
+
     /// InstantiationLocStart/InstantiationLocEnd - In a macro expansion, these
     /// indicate the start and end of the instantiation.  In object-like macros,
     /// these will be the same.  In a function-like macro instantiation, the
@@ -193,12 +193,12 @@ namespace SrcMgr {
     SourceLocation getInstantiationLocEnd() const {
       return SourceLocation::getFromRawEncoding(InstantiationLocEnd);
     }
-    
+
     std::pair<SourceLocation,SourceLocation> getInstantiationLocRange() const {
       return std::make_pair(getInstantiationLocStart(),
                             getInstantiationLocEnd());
     }
-    
+
     /// get - Return a InstantiationInfo for an expansion.  IL specifies
     /// the instantiation location (where the macro is expanded), and SL
     /// specifies the spelling location (where the characters from the token
@@ -213,7 +213,7 @@ namespace SrcMgr {
       return X;
     }
   };
-  
+
   /// SLocEntry - This is a discriminated union of FileInfo and
   /// InstantiationInfo.  SourceManager keeps an array of these objects, and
   /// they are uniquely identified by the FileID datatype.
@@ -225,10 +225,10 @@ namespace SrcMgr {
     };
   public:
     unsigned getOffset() const { return Offset >> 1; }
-    
+
     bool isInstantiation() const { return Offset & 1; }
     bool isFile() const { return !isInstantiation(); }
-    
+
     const FileInfo &getFile() const {
       assert(isFile() && "Not a file SLocEntry!");
       return File;
@@ -238,7 +238,7 @@ namespace SrcMgr {
       assert(isInstantiation() && "Not an instantiation SLocEntry!");
       return Instantiation;
     }
-    
+
     static SLocEntry get(unsigned Offset, const FileInfo &FI) {
       SLocEntry E;
       E.Offset = Offset << 1;
@@ -277,18 +277,18 @@ public:
 /// location specifies where it was expanded.
 class SourceManager {
   mutable llvm::BumpPtrAllocator ContentCacheAlloc;
-  
+
   /// FileInfos - Memoized information about all of the files tracked by this
   /// SourceManager.  This set allows us to merge ContentCache entries based
   /// on their FileEntry*.  All ContentCache objects will thus have unique,
-  /// non-null, FileEntry pointers.  
+  /// non-null, FileEntry pointers.
   llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> FileInfos;
-  
+
   /// MemBufferInfos - Information about various memory buffers that we have
   /// read in.  All FileEntry* within the stored ContentCache objects are NULL,
   /// as they do not refer to a file.
   std::vector<SrcMgr::ContentCache*> MemBufferInfos;
-  
+
   /// SLocEntryTable - This is an array of SLocEntry's that we have created.
   /// FileID is an index into this vector.  This array is sorted by the offset.
   std::vector<SrcMgr::SLocEntry> SLocEntryTable;
@@ -308,49 +308,49 @@ class SourceManager {
   /// LastFileIDLookup records the last FileID looked up or created, because it
   /// is very common to look up many tokens from the same file.
   mutable FileID LastFileIDLookup;
-  
+
   /// LineTable - This holds information for #line directives.  It is referenced
   /// by indices from SLocEntryTable.
   LineTableInfo *LineTable;
-  
+
   /// LastLineNo - These ivars serve as a cache used in the getLineNumber
   /// method which is used to speedup getLineNumber calls to nearby locations.
   mutable FileID LastLineNoFileIDQuery;
   mutable SrcMgr::ContentCache *LastLineNoContentCache;
   mutable unsigned LastLineNoFilePos;
   mutable unsigned LastLineNoResult;
-  
+
   /// MainFileID - The file ID for the main source file of the translation unit.
   FileID MainFileID;
 
   // Statistics for -print-stats.
   mutable unsigned NumLinearScans, NumBinaryProbes;
-  
+
   // Cache results for the isBeforeInTranslationUnit method.
   mutable FileID LastLFIDForBeforeTUCheck;
   mutable FileID LastRFIDForBeforeTUCheck;
   mutable bool   LastResForBeforeTUCheck;
-  
+
   // SourceManager doesn't support copy construction.
   explicit SourceManager(const SourceManager&);
-  void operator=(const SourceManager&);  
+  void operator=(const SourceManager&);
 public:
-  SourceManager() 
-    : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), 
+  SourceManager()
+    : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
       NumBinaryProbes(0) {
     clearIDTables();
   }
   ~SourceManager();
-  
+
   void clearIDTables();
-  
+
   //===--------------------------------------------------------------------===//
   // MainFileID creation and querying methods.
   //===--------------------------------------------------------------------===//
 
   /// getMainFileID - Returns the FileID of the main source file.
   FileID getMainFileID() const { return MainFileID; }
-  
+
   /// createMainFileID - Create the FileID for the main source file.
   FileID createMainFileID(const FileEntry *SourceFile,
                           SourceLocation IncludePos) {
@@ -358,15 +358,15 @@ public:
     MainFileID = createFileID(SourceFile, IncludePos, SrcMgr::C_User);
     return MainFileID;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Methods to create new FileID's and instantiations.
   //===--------------------------------------------------------------------===//
-  
+
   /// createFileID - Create a new FileID that represents the specified file
   /// being #included from the specified IncludePosition.  This returns 0 on
   /// error and translates NULL into standard input.
-  /// PreallocateID should be non-zero to specify which a pre-allocated, 
+  /// PreallocateID should be non-zero to specify which a pre-allocated,
   /// lazily computed source location is being filled in by this operation.
   FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos,
                       SrcMgr::CharacteristicKind FileCharacter,
@@ -376,7 +376,7 @@ public:
     if (IR == 0) return FileID();    // Error opening file?
     return createFileID(IR, IncludePos, FileCharacter, PreallocatedID, Offset);
   }
-  
+
   /// createFileIDForMemBuffer - Create a new FileID that represents the
   /// specified memory buffer.  This does no caching of the buffer and takes
   /// ownership of the MemoryBuffer, so only pass a MemoryBuffer to this once.
@@ -386,7 +386,7 @@ public:
     return createFileID(createMemBufferContentCache(Buffer), SourceLocation(),
                         SrcMgr::C_User, PreallocatedID, Offset);
   }
-  
+
   /// createMainFileIDForMembuffer - Create the FileID for a memory buffer
   ///  that will represent the FileID for the main source.  One example
   ///  of when this would be used is when the main source is read from STDIN.
@@ -405,31 +405,31 @@ public:
                                         unsigned TokLength,
                                         unsigned PreallocatedID = 0,
                                         unsigned Offset = 0);
-  
+
   //===--------------------------------------------------------------------===//
   // FileID manipulation methods.
   //===--------------------------------------------------------------------===//
-  
+
   /// getBuffer - Return the buffer for the specified FileID.
   ///
   const llvm::MemoryBuffer *getBuffer(FileID FID) const {
     return getSLocEntry(FID).getFile().getContentCache()->getBuffer();
   }
-  
+
   /// getFileEntryForID - Returns the FileEntry record for the provided FileID.
   const FileEntry *getFileEntryForID(FileID FID) const {
     return getSLocEntry(FID).getFile().getContentCache()->Entry;
   }
-  
+
   /// getBufferData - Return a pointer to the start and end of the source buffer
   /// data for the specified FileID.
   std::pair<const char*, const char*> getBufferData(FileID FID) const;
-  
-  
+
+
   //===--------------------------------------------------------------------===//
   // SourceLocation manipulation methods.
   //===--------------------------------------------------------------------===//
-  
+
   /// getFileID - Return the FileID for a SourceLocation.  This is a very
   /// hot method that is used for all SourceManager queries that start with a
   /// SourceLocation object.  It is responsible for finding the entry in
@@ -437,14 +437,14 @@ public:
   ///
   FileID getFileID(SourceLocation SpellingLoc) const {
     unsigned SLocOffset = SpellingLoc.getOffset();
-    
+
     // If our one-entry cache covers this offset, just return it.
     if (isOffsetInFileID(LastFileIDLookup, SLocOffset))
       return LastFileIDLookup;
 
     return getFileIDSlow(SLocOffset);
   }
-  
+
   /// getLocForStartOfFile - Return the source location corresponding to the
   /// first byte of the specified file.
   SourceLocation getLocForStartOfFile(FileID FID) const {
@@ -453,7 +453,7 @@ public:
     unsigned FileOffset = getSLocEntry(FID).getOffset();
     return SourceLocation::getFileLoc(FileOffset);
   }
-  
+
   /// getInstantiationLoc - Given a SourceLocation object, return the
   /// instantiation location referenced by the ID.
   SourceLocation getInstantiationLoc(SourceLocation Loc) const {
@@ -462,18 +462,18 @@ public:
     if (Loc.isFileID()) return Loc;
     return getInstantiationLocSlowCase(Loc);
   }
-  
+
   /// getImmediateInstantiationRange - Loc is required to be an instantiation
   /// location.  Return the start/end of the instantiation information.
   std::pair<SourceLocation,SourceLocation>
   getImmediateInstantiationRange(SourceLocation Loc) const;
-  
+
   /// getInstantiationRange - Given a SourceLocation object, return the
   /// range of tokens covered by the instantiation in the ultimate file.
   std::pair<SourceLocation,SourceLocation>
   getInstantiationRange(SourceLocation Loc) const;
-  
-  
+
+
   /// getSpellingLoc - Given a SourceLocation object, return the spelling
   /// location referenced by the ID.  This is the place where the characters
   /// that make up the lexed token can be found.
@@ -483,12 +483,12 @@ public:
     if (Loc.isFileID()) return Loc;
     return getSpellingLocSlowCase(Loc);
   }
-  
+
   /// getImmediateSpellingLoc - Given a SourceLocation object, return the
   /// spelling location referenced by the ID.  This is the first level down
   /// towards the place where the characters that make up the lexed token can be
   /// found.  This should not generally be used by clients.
-  SourceLocation getImmediateSpellingLoc(SourceLocation Loc) const;  
+  SourceLocation getImmediateSpellingLoc(SourceLocation Loc) const;
 
   /// getDecomposedLoc - Decompose the specified location into a raw FileID +
   /// Offset pair.  The first element is the FileID, the second is the
@@ -497,7 +497,7 @@ public:
     FileID FID = getFileID(Loc);
     return std::make_pair(FID, Loc.getOffset()-getSLocEntry(FID).getOffset());
   }
-  
+
   /// getDecomposedInstantiationLoc - Decompose the specified location into a
   /// raw FileID + Offset pair.  If the location is an instantiation record,
   /// walk through it until we find the final location instantiated.
@@ -505,11 +505,11 @@ public:
   getDecomposedInstantiationLoc(SourceLocation Loc) const {
     FileID FID = getFileID(Loc);
     const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
-    
+
     unsigned Offset = Loc.getOffset()-E->getOffset();
     if (Loc.isFileID())
       return std::make_pair(FID, Offset);
-    
+
     return getDecomposedInstantiationLocSlowCase(E, Offset);
   }
 
@@ -520,29 +520,29 @@ public:
   getDecomposedSpellingLoc(SourceLocation Loc) const {
     FileID FID = getFileID(Loc);
     const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
-    
+
     unsigned Offset = Loc.getOffset()-E->getOffset();
     if (Loc.isFileID())
       return std::make_pair(FID, Offset);
     return getDecomposedSpellingLocSlowCase(E, Offset);
-  }    
-  
+  }
+
   /// getFileOffset - This method returns the offset from the start
   /// of the file that the specified SourceLocation represents. This is not very
   /// meaningful for a macro ID.
   unsigned getFileOffset(SourceLocation SpellingLoc) const {
     return getDecomposedLoc(SpellingLoc).second;
   }
-  
-  
+
+
   //===--------------------------------------------------------------------===//
   // Queries about the code at a SourceLocation.
   //===--------------------------------------------------------------------===//
-  
+
   /// getCharacterData - Return a pointer to the start of the specified location
   /// in the appropriate spelling MemoryBuffer.
   const char *getCharacterData(SourceLocation SL) const;
-  
+
   /// getColumnNumber - Return the column # for the specified file position.
   /// This is significantly cheaper to compute than the line number.  This
   /// returns zero if the column number isn't known.  This may only be called on
@@ -551,24 +551,24 @@ public:
   unsigned getColumnNumber(FileID FID, unsigned FilePos) const;
   unsigned getSpellingColumnNumber(SourceLocation Loc) const;
   unsigned getInstantiationColumnNumber(SourceLocation Loc) const;
-  
-  
+
+
   /// getLineNumber - Given a SourceLocation, return the spelling line number
   /// for the position indicated.  This requires building and caching a table of
   /// line offsets for the MemoryBuffer, so this is not cheap: use only when
   /// about to emit a diagnostic.
   unsigned getLineNumber(FileID FID, unsigned FilePos) const;
-  
+
   unsigned getInstantiationLineNumber(SourceLocation Loc) const;
   unsigned getSpellingLineNumber(SourceLocation Loc) const;
-  
+
   /// Return the filename or buffer identifier of the buffer the location is in.
   /// Note that this name does not respect #line directives.  Use getPresumedLoc
   /// for normal clients.
   const char *getBufferName(SourceLocation Loc) const;
-  
+
   /// getFileCharacteristic - return the file characteristic of the specified
-  /// source location, indicating whether this is a normal file, a system 
+  /// source location, indicating whether this is a normal file, a system
   /// header, or an "implicit extern C" system header.
   ///
   /// This state can be modified with flags on GNU linemarker directives like:
@@ -576,7 +576,7 @@ public:
   /// which changes all source locations in the current file after that to be
   /// considered to be from a system header.
   SrcMgr::CharacteristicKind getFileCharacteristic(SourceLocation Loc) const;
-  
+
   /// getPresumedLoc - This method returns the "presumed" location of a
   /// SourceLocation specifies.  A "presumed location" can be modified by #line
   /// or GNU line marker directives.  This provides a view on the data that a
@@ -585,44 +585,44 @@ public:
   /// Note that a presumed location is always given as the instantiation point
   /// of an instantiation location, not at the spelling location.
   PresumedLoc getPresumedLoc(SourceLocation Loc) const;
-  
+
   /// isFromSameFile - Returns true if both SourceLocations correspond to
   ///  the same file.
   bool isFromSameFile(SourceLocation Loc1, SourceLocation Loc2) const {
     return getFileID(Loc1) == getFileID(Loc2);
   }
-  
+
   /// isFromMainFile - Returns true if the file of provided SourceLocation is
   ///   the main file.
   bool isFromMainFile(SourceLocation Loc) const {
     return getFileID(Loc) == getMainFileID();
-  } 
-  
+  }
+
   /// isInSystemHeader - Returns if a SourceLocation is in a system header.
   bool isInSystemHeader(SourceLocation Loc) const {
     return getFileCharacteristic(Loc) != SrcMgr::C_User;
   }
-  
+
   /// isInExternCSystemHeader - Returns if a SourceLocation is in an "extern C"
   /// system header.
   bool isInExternCSystemHeader(SourceLocation Loc) const {
     return getFileCharacteristic(Loc) == SrcMgr::C_ExternCSystem;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Line Table Manipulation Routines
   //===--------------------------------------------------------------------===//
-  
+
   /// getLineTableFilenameID - Return the uniqued ID for the specified filename.
-  /// 
+  ///
   unsigned getLineTableFilenameID(const char *Ptr, unsigned Len);
-  
+
   /// AddLineNote - Add a line note to the line table for the FileID and offset
   /// specified by Loc.  If FilenameID is -1, it is considered to be
   /// unspecified.
   void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID);
   void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID,
-                   bool IsFileEntry, bool IsFileExit, 
+                   bool IsFileEntry, bool IsFileExit,
                    bool IsSystemHeader, bool IsExternCHeader);
 
   /// \brief Determine if the source manager has a line table.
@@ -641,7 +641,7 @@ public:
   /// be based upon the first inclusion.
   SourceLocation getLocation(const FileEntry *SourceFile,
                              unsigned Line, unsigned Col) const;
-  
+
   /// \brief Determines the order of 2 source locations in the translation unit.
   ///
   /// \returns true if LHS source location comes before RHS, false otherwise.
@@ -657,22 +657,22 @@ public:
   ///
   void PrintStats() const;
 
-  // Iteration over the source location entry table.  
+  // Iteration over the source location entry table.
   typedef std::vector<SrcMgr::SLocEntry>::const_iterator sloc_entry_iterator;
 
-  sloc_entry_iterator sloc_entry_begin() const { 
-    return SLocEntryTable.begin(); 
+  sloc_entry_iterator sloc_entry_begin() const {
+    return SLocEntryTable.begin();
   }
 
-  sloc_entry_iterator sloc_entry_end() const { 
-    return SLocEntryTable.end(); 
+  sloc_entry_iterator sloc_entry_end() const {
+    return SLocEntryTable.end();
   }
 
   unsigned sloc_entry_size() const { return SLocEntryTable.size(); }
 
   const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const {
     assert(FID.ID < SLocEntryTable.size() && "Invalid id");
-    if (ExternalSLocEntries && 
+    if (ExternalSLocEntries &&
         FID.ID < SLocEntryLoaded.size() &&
         !SLocEntryLoaded[FID.ID])
       ExternalSLocEntries->ReadSLocEntry(FID.ID);
@@ -698,14 +698,14 @@ private:
     const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
     // If the entry is after the offset, it can't contain it.
     if (SLocOffset < Entry.getOffset()) return false;
-    
+
     // If this is the last entry than it does.  Otherwise, the entry after it
     // has to not include it.
     if (FID.ID+1 == SLocEntryTable.size()) return true;
 
     return SLocOffset < getSLocEntry(FileID::get(FID.ID+1)).getOffset();
   }
-  
+
   /// createFileID - Create a new fileID for the specified ContentCache and
   ///  include position.  This works regardless of whether the ContentCache
   ///  corresponds to a file or some other input source.
@@ -714,15 +714,15 @@ private:
                       SrcMgr::CharacteristicKind DirCharacter,
                       unsigned PreallocatedID = 0,
                       unsigned Offset = 0);
-    
+
   const SrcMgr::ContentCache *
     getOrCreateContentCache(const FileEntry *SourceFile);
 
   /// createMemBufferContentCache - Create a new ContentCache for the specified
   ///  memory buffer.
-  const SrcMgr::ContentCache* 
+  const SrcMgr::ContentCache*
   createMemBufferContentCache(const llvm::MemoryBuffer *Buf);
-  
+
   FileID getFileIDSlow(unsigned SLocOffset) const;
 
   SourceLocation getInstantiationLocSlowCase(SourceLocation Loc) const;
@@ -730,7 +730,7 @@ private:
 
   std::pair<FileID, unsigned>
   getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E,
-                                        unsigned Offset) const;  
+                                        unsigned Offset) const;
   std::pair<FileID, unsigned>
   getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
                                    unsigned Offset) const;

+ 12 - 12
include/clang/Basic/SourceManagerInternals.h

@@ -28,22 +28,22 @@ namespace clang {
 struct LineEntry {
   /// FileOffset - The offset in this file that the line entry occurs at.
   unsigned FileOffset;
-  
+
   /// LineNo - The presumed line number of this line entry: #line 4.
   unsigned LineNo;
-  
+
   /// FilenameID - The ID of the filename identified by this line entry:
   /// #line 4 "foo.c".  This is -1 if not specified.
   int FilenameID;
-  
-  /// Flags - Set the 0 if no flags, 1 if a system header, 
+
+  /// Flags - Set the 0 if no flags, 1 if a system header,
   SrcMgr::CharacteristicKind FileKind;
-  
+
   /// IncludeOffset - This is the offset of the virtual include stack location,
   /// which is manipulated by GNU linemarker directives.  If this is 0 then
   /// there is no virtual #includer.
   unsigned IncludeOffset;
-  
+
   static LineEntry get(unsigned Offs, unsigned Line, int Filename,
                        SrcMgr::CharacteristicKind FileKind,
                        unsigned IncludeOffset) {
@@ -70,7 +70,7 @@ inline bool operator<(const LineEntry &E, unsigned Offset) {
 inline bool operator<(unsigned Offset, const LineEntry &E) {
   return Offset < E.FileOffset;
 }
-  
+
 /// LineTableInfo - This class is used to hold and unique data used to
 /// represent #line information.
 class LineTableInfo {
@@ -81,22 +81,22 @@ class LineTableInfo {
   /// to string.
   llvm::StringMap<unsigned, llvm::BumpPtrAllocator> FilenameIDs;
   std::vector<llvm::StringMapEntry<unsigned>*> FilenamesByID;
-  
+
   /// LineEntries - This is a map from FileIDs to a list of line entries (sorted
   /// by the offset they occur in the file.
   std::map<unsigned, std::vector<LineEntry> > LineEntries;
 public:
   LineTableInfo() {
   }
-  
+
   void clear() {
     FilenameIDs.clear();
     FilenamesByID.clear();
     LineEntries.clear();
   }
-  
+
   ~LineTableInfo() {}
-  
+
   unsigned getLineTableFilenameID(const char *Ptr, unsigned Len);
   const char *getFilename(unsigned ID) const {
     assert(ID < FilenamesByID.size() && "Invalid FilenameID");
@@ -110,7 +110,7 @@ public:
                    unsigned LineNo, int FilenameID,
                    unsigned EntryExit, SrcMgr::CharacteristicKind FileKind);
 
-  
+
   /// FindNearestLineEntry - Find the line entry nearest to FID that is before
   /// it.  If there is no line entry before Offset in FID, return null.
   const LineEntry *FindNearestLineEntry(unsigned FID, unsigned Offset);

+ 40 - 40
include/clang/Basic/TargetInfo.h

@@ -34,7 +34,7 @@ class SourceLocation;
 class SourceManager;
 class LangOptions;
 namespace Builtin { struct Info; }
-  
+
 /// TargetInfo - This class exposes information about the current target.
 ///
 class TargetInfo {
@@ -61,8 +61,8 @@ protected:
 
   // TargetInfo Constructor.  Default initializes all fields.
   TargetInfo(const std::string &T);
-  
-public:  
+
+public:
   /// CreateTargetInfo - Return the target info object for the specified target
   /// triple.
   static TargetInfo* CreateTargetInfo(const std::string &Triple);
@@ -105,35 +105,35 @@ public:
   uint64_t getPointerAlign(unsigned AddrSpace) const {
     return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
   }
-  
+
   /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this
   /// target, in bits.
   unsigned getBoolWidth(bool isWide = false) const { return 8; }  // FIXME
   unsigned getBoolAlign(bool isWide = false) const { return 8; }  // FIXME
- 
+
   unsigned getCharWidth() const { return 8; } // FIXME
   unsigned getCharAlign() const { return 8; } // FIXME
-  
+
   /// getShortWidth/Align - Return the size of 'signed short' and
-  /// 'unsigned short' for this target, in bits.  
+  /// 'unsigned short' for this target, in bits.
   unsigned getShortWidth() const { return 16; } // FIXME
   unsigned getShortAlign() const { return 16; } // FIXME
-  
+
   /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
   /// this target, in bits.
   unsigned getIntWidth() const { return IntWidth; }
   unsigned getIntAlign() const { return IntAlign; }
-  
+
   /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
   /// for this target, in bits.
   unsigned getLongWidth() const { return LongWidth; }
   unsigned getLongAlign() const { return LongAlign; }
-  
+
   /// getLongLongWidth/Align - Return the size of 'signed long long' and
   /// 'unsigned long long' for this target, in bits.
   unsigned getLongLongWidth() const { return LongLongWidth; }
   unsigned getLongLongAlign() const { return LongLongAlign; }
-  
+
   /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
   /// bits.
   unsigned getWCharWidth() const { return WCharWidth; }
@@ -166,13 +166,13 @@ public:
   const llvm::fltSemantics &getLongDoubleFormat() const {
     return *LongDoubleFormat;
   }
-  
+
   /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
-  /// target, in bits.  
+  /// target, in bits.
   unsigned getIntMaxTWidth() const {
     return IntMaxTWidth;
   }
-  
+
   /// getUserLabelPrefix - This returns the default value of the
   /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by
   /// default.  On most platforms this is "_", but it is "" on some, and "." on
@@ -180,22 +180,22 @@ public:
   const char *getUserLabelPrefix() const {
     return UserLabelPrefix;
   }
-  
+
   /// getTypeName - Return the user string for the specified integer type enum.
   /// For example, SignedShort -> "short".
   static const char *getTypeName(IntType T);
-  
+
   ///===---- Other target property query methods --------------------------===//
-  
+
   /// getTargetDefines - Appends the target-specific #define values for this
   /// target set to the specified buffer.
   virtual void getTargetDefines(const LangOptions &Opts,
                                 std::vector<char> &DefineBuffer) const = 0;
-  
+
   /// getTargetBuiltins - Return information about target-specific builtins for
   /// the current primary target, and info about which builtins are non-portable
   /// across the current set of primary and secondary targets.
-  virtual void getTargetBuiltins(const Builtin::Info *&Records, 
+  virtual void getTargetBuiltins(const Builtin::Info *&Records,
                                  unsigned &NumRecords) const = 0;
 
   /// getVAListDeclaration - Return the declaration to use for
@@ -210,7 +210,7 @@ public:
   // getNormalizedGCCRegisterName - Returns the "normalized" GCC register name.
   // For example, on x86 it will return "ax" when "eax" is passed in.
   const char *getNormalizedGCCRegisterName(const char *Name) const;
-  
+
   struct ConstraintInfo {
     enum {
       CI_None = 0x00,
@@ -221,7 +221,7 @@ public:
     };
     unsigned Flags;
     int TiedOperand;
-    
+
     std::string ConstraintStr;  // constraint: "=rm"
     std::string Name;           // Operand name: [foo] with no []'s.
   public:
@@ -235,11 +235,11 @@ public:
     bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
     bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
     bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
-    
+
     /// hasMatchingInput - Return true if this output operand has a matching
     /// (tied) input operand.
     bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
-    
+
     /// hasTiedOperand() - Return true if this input operand is a matching
     /// constraint that ties it to an output operand.  If this returns true,
     /// then getTiedOperand will indicate which output operand this is tied to.
@@ -248,12 +248,12 @@ public:
       assert(hasTiedOperand() && "Has no tied operand!");
       return (unsigned)TiedOperand;
     }
-    
+
     void setIsReadWrite() { Flags |= CI_ReadWrite; }
     void setAllowsMemory() { Flags |= CI_AllowsMemory; }
     void setAllowsRegister() { Flags |= CI_AllowsRegister; }
     void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
-    
+
     /// setTiedOperand - Indicate that this is an input operand that is tied to
     /// the specified output operand.  Copy over the various constraint
     /// information from the output.
@@ -275,20 +275,20 @@ public:
   bool resolveSymbolicName(const char *&Name,
                            ConstraintInfo *OutputConstraints,
                            unsigned NumOutputs, unsigned &Index) const;
-  
+
   virtual std::string convertConstraint(const char Constraint) const {
     return std::string(1, Constraint);
   }
-  
+
   // Returns a string of target-specific clobbers, in LLVM format.
   virtual const char *getClobbers() const = 0;
-  
+
 
   /// getTriple - Return the target triple of the primary target.
   const llvm::Triple &getTriple() const {
     return Triple;
   }
-  
+
   const char *getTargetDescription() const {
     return DescriptionString;
   }
@@ -302,30 +302,30 @@ public:
 
   /// getUnicodeStringSymbolPrefix - Get the default symbol prefix to
   /// use for string literals.
-  virtual const char *getUnicodeStringSymbolPrefix() const { 
+  virtual const char *getUnicodeStringSymbolPrefix() const {
     return ".str";
   }
 
   /// getUnicodeStringSection - Return the section to use for unicode
   /// string literals, or 0 if no special section is used.
-  virtual const char *getUnicodeStringSection() const { 
+  virtual const char *getUnicodeStringSection() const {
     return 0;
   }
 
   /// getCFStringSection - Return the section to use for CFString
   /// literals, or 0 if no special section is used.
-  virtual const char *getCFStringSection() const { 
+  virtual const char *getCFStringSection() const {
     return "__DATA,__cfstring";
   }
 
   /// getCFStringDataSection - Return the section to use for the
   /// constant string data associated with a CFString literal, or 0 if
   /// no special section is used.
-  virtual const char *getCFStringDataSection() const { 
+  virtual const char *getCFStringDataSection() const {
     return "__TEXT,__cstring,cstring_literals";
   }
-  
-  
+
+
   /// isValidSectionSpecifier - This is an optional hook that targets can
   /// implement to perform semantic checking on attribute((section("foo")))
   /// specifiers.  In this case, "foo" is passed in to be checked.  If the
@@ -342,13 +342,13 @@ public:
 
   /// getDefaultLangOptions - Allow the target to specify default settings for
   /// various language options.  These may be overridden by command line
-  /// options. 
+  /// options.
   virtual void getDefaultLangOptions(LangOptions &Opts) {}
 
   /// getDefaultFeatures - Get the default set of target features for
   /// the \args CPU; this should include all legal feature strings on
   /// the target.
-  virtual void getDefaultFeatures(const std::string &CPU, 
+  virtual void getDefaultFeatures(const std::string &CPU,
                                   llvm::StringMap<bool> &Features) const {
   }
 
@@ -387,11 +387,11 @@ protected:
   virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
     return PtrDiffType;
   }
-  virtual void getGCCRegNames(const char * const *&Names, 
+  virtual void getGCCRegNames(const char * const *&Names,
                               unsigned &NumNames) const = 0;
-  virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 
+  virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
                                 unsigned &NumAliases) const = 0;
-  virtual bool validateAsmConstraint(const char *&Name, 
+  virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const= 0;
 };
 

+ 1 - 1
include/clang/Basic/TokenKinds.h

@@ -29,7 +29,7 @@ enum TokenKind {
 /// PPKeywordKind - This provides a namespace for preprocessor keywords which
 /// start with a '#' at the beginning of the line.
 enum PPKeywordKind {
-#define PPKEYWORD(X) pp_##X, 
+#define PPKEYWORD(X) pp_##X,
 #include "clang/Basic/TokenKinds.def"
   NUM_PP_KEYWORDS
 };

+ 3 - 3
include/clang/CodeGen/ModuleBuilder.h

@@ -26,13 +26,13 @@ namespace clang {
   class Diagnostic;
   class LangOptions;
   class CompileOptions;
-  
+
   class CodeGenerator : public ASTConsumer {
   public:
     virtual llvm::Module* GetModule() = 0;
-    virtual llvm::Module* ReleaseModule() = 0;    
+    virtual llvm::Module* ReleaseModule() = 0;
   };
-  
+
   CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags,
                                    const std::string &ModuleName,
                                    const CompileOptions &CO,

+ 19 - 19
include/clang/Driver/Action.h

@@ -26,7 +26,7 @@ namespace clang {
 namespace driver {
   class Arg;
 
-/// Action - Represent an abstract compilation step to perform. 
+/// Action - Represent an abstract compilation step to perform.
 ///
 /// An action represents an edge in the compilation graph; typically
 /// it is a job to transform an input using some tool.
@@ -63,15 +63,15 @@ private:
 
   /// The output type of this action.
   types::ID Type;
-  
+
   ActionList Inputs;
 
 protected:
   Action(ActionClass _Kind, types::ID _Type) : Kind(_Kind), Type(_Type) {}
-  Action(ActionClass _Kind, Action *Input, types::ID _Type) 
+  Action(ActionClass _Kind, Action *Input, types::ID _Type)
     : Kind(_Kind), Type(_Type), Inputs(&Input, &Input + 1) {}
-  Action(ActionClass _Kind, const ActionList &_Inputs, types::ID _Type) 
-    : Kind(_Kind), Type(_Type), Inputs(_Inputs) {}  
+  Action(ActionClass _Kind, const ActionList &_Inputs, types::ID _Type)
+    : Kind(_Kind), Type(_Type), Inputs(_Inputs) {}
 public:
   virtual ~Action();
 
@@ -90,7 +90,7 @@ public:
   const_iterator begin() const { return Inputs.begin(); }
   const_iterator end() const { return Inputs.end(); }
 
-  static bool classof(const Action *) { return true; }    
+  static bool classof(const Action *) { return true; }
 };
 
 class InputAction : public Action {
@@ -100,8 +100,8 @@ public:
 
   const Arg &getInputArg() const { return Input; }
 
-  static bool classof(const Action *A) { 
-    return A->getKind() == InputClass; 
+  static bool classof(const Action *A) {
+    return A->getKind() == InputClass;
   }
   static bool classof(const InputAction *) { return true; }
 };
@@ -116,8 +116,8 @@ public:
 
   const char *getArchName() const { return ArchName; }
 
-  static bool classof(const Action *A) { 
-    return A->getKind() == BindArchClass; 
+  static bool classof(const Action *A) {
+    return A->getKind() == BindArchClass;
   }
   static bool classof(const BindArchAction *) { return true; }
 };
@@ -128,9 +128,9 @@ protected:
   JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type);
 
 public:
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return (A->getKind() >= JobClassFirst &&
-            A->getKind() <= JobClassLast); 
+            A->getKind() <= JobClassLast);
   }
   static bool classof(const JobAction *) { return true; }
 };
@@ -139,7 +139,7 @@ class PreprocessJobAction : public JobAction {
 public:
   PreprocessJobAction(Action *Input, types::ID OutputType);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == PreprocessJobClass;
   }
   static bool classof(const PreprocessJobAction *) { return true; }
@@ -149,7 +149,7 @@ class PrecompileJobAction : public JobAction {
 public:
   PrecompileJobAction(Action *Input, types::ID OutputType);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == PrecompileJobClass;
   }
   static bool classof(const PrecompileJobAction *) { return true; }
@@ -159,7 +159,7 @@ class AnalyzeJobAction : public JobAction {
 public:
   AnalyzeJobAction(Action *Input, types::ID OutputType);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == AnalyzeJobClass;
   }
   static bool classof(const AnalyzeJobAction *) { return true; }
@@ -169,7 +169,7 @@ class CompileJobAction : public JobAction {
 public:
   CompileJobAction(Action *Input, types::ID OutputType);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == CompileJobClass;
   }
   static bool classof(const CompileJobAction *) { return true; }
@@ -179,7 +179,7 @@ class AssembleJobAction : public JobAction {
 public:
   AssembleJobAction(Action *Input, types::ID OutputType);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == AssembleJobClass;
   }
   static bool classof(const AssembleJobAction *) { return true; }
@@ -189,7 +189,7 @@ class LinkJobAction : public JobAction {
 public:
   LinkJobAction(ActionList &Inputs, types::ID Type);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == LinkJobClass;
   }
   static bool classof(const LinkJobAction *) { return true; }
@@ -199,7 +199,7 @@ class LipoJobAction : public JobAction {
 public:
   LipoJobAction(ActionList &Inputs, types::ID Type);
 
-  static bool classof(const Action *A) { 
+  static bool classof(const Action *A) {
     return A->getKind() == LipoJobClass;
   }
   static bool classof(const LipoJobAction *) { return true; }

+ 23 - 23
include/clang/Driver/Arg.h

@@ -49,7 +49,7 @@ namespace driver {
 
     /// The option this argument is an instance of.
     const Option *Opt;
-    
+
     /// The argument this argument was derived from (during tool chain
     /// argument translation), if any.
     const Arg *BaseArg;
@@ -66,7 +66,7 @@ namespace driver {
   protected:
     Arg(ArgClass Kind, const Option *Opt, unsigned Index,
         const Arg *BaseArg = 0);
-    
+
   public:
     Arg(const Arg &);
     virtual ~Arg();
@@ -74,12 +74,12 @@ namespace driver {
     ArgClass getKind() const { return Kind; }
     const Option &getOption() const { return *Opt; }
     unsigned getIndex() const { return Index; }
-    
+
     /// getBaseArg - Return the base argument which generated this
     /// arg; this is either the argument itself or the argument it was
     /// derived from during tool chain specific argument translation.
-    const Arg &getBaseArg() const { 
-      return BaseArg ? *BaseArg : *this; 
+    const Arg &getBaseArg() const {
+      return BaseArg ? *BaseArg : *this;
     }
     void setBaseArg(const Arg *_BaseArg) {
       BaseArg = _BaseArg;
@@ -88,14 +88,14 @@ namespace driver {
     bool isClaimed() const { return getBaseArg().Claimed; }
 
     /// claim - Set the Arg claimed bit.
-    
+
     // FIXME: We need to deal with derived arguments and set the bit
     // in the original argument; not the derived one.
     void claim() const { getBaseArg().Claimed = true; }
 
     virtual unsigned getNumValues() const = 0;
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const = 0;
-    
+
     /// render - Append the argument onto the given array as strings.
     virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
 
@@ -105,7 +105,7 @@ namespace driver {
     /// (e.g., Xlinker).
     void renderAsInput(const ArgList &Args, ArgStringList &Output) const;
 
-    static bool classof(const Arg *) { return true; }    
+    static bool classof(const Arg *) { return true; }
 
     void dump() const;
 
@@ -124,8 +124,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return 0; }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::FlagClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::FlagClass;
     }
     static bool classof(const FlagArg *) { return true; }
   };
@@ -140,8 +140,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return 1; }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::PositionalClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::PositionalClass;
     }
     static bool classof(const PositionalArg *) { return true; }
   };
@@ -157,8 +157,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return 1; }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::JoinedClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::JoinedClass;
     }
     static bool classof(const JoinedArg *) { return true; }
   };
@@ -169,7 +169,7 @@ namespace driver {
     unsigned NumValues;
 
   public:
-    SeparateArg(const Option *Opt, unsigned Index, unsigned NumValues, 
+    SeparateArg(const Option *Opt, unsigned Index, unsigned NumValues,
                 const Arg *BaseArg = 0);
 
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
@@ -177,8 +177,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return NumValues; }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::SeparateClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::SeparateClass;
     }
     static bool classof(const SeparateArg *) { return true; }
   };
@@ -193,7 +193,7 @@ namespace driver {
     std::vector<std::string> Values;
 
   public:
-    CommaJoinedArg(const Option *Opt, unsigned Index, const char *Str, 
+    CommaJoinedArg(const Option *Opt, unsigned Index, const char *Str,
                    const Arg *BaseArg = 0);
 
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
@@ -201,8 +201,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return Values.size(); }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::CommaJoinedClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::CommaJoinedClass;
     }
     static bool classof(const CommaJoinedArg *) { return true; }
   };
@@ -211,7 +211,7 @@ namespace driver {
   /// values.
   class JoinedAndSeparateArg : public Arg {
   public:
-    JoinedAndSeparateArg(const Option *Opt, unsigned Index, 
+    JoinedAndSeparateArg(const Option *Opt, unsigned Index,
                          const Arg *BaseArg = 0);
 
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
@@ -219,8 +219,8 @@ namespace driver {
     virtual unsigned getNumValues() const { return 2; }
     virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
-    static bool classof(const Arg *A) { 
-      return A->getKind() == Arg::JoinedAndSeparateClass; 
+    static bool classof(const Arg *A) {
+      return A->getKind() == Arg::JoinedAndSeparateClass;
     }
     static bool classof(const JoinedAndSeparateArg *) { return true; }
   };

+ 13 - 13
include/clang/Driver/ArgList.h

@@ -65,17 +65,17 @@ namespace driver {
 
     const_iterator begin() const { return Args.begin(); }
     const_iterator end() const { return Args.end(); }
-    
+
     const_reverse_iterator rbegin() const { return Args.rbegin(); }
     const_reverse_iterator rend() const { return Args.rend(); }
 
     /// hasArg - Does the arg list contain any option matching \arg Id.
     ///
     /// \arg Claim Whether the argument should be claimed, if it exists.
-    bool hasArg(options::ID Id, bool Claim=true) const { 
+    bool hasArg(options::ID Id, bool Claim=true) const {
       return getLastArg(Id, Claim) != 0;
     }
-    bool hasArg(options::ID Id0, options::ID Id1, bool Claim=true) const { 
+    bool hasArg(options::ID Id0, options::ID Id1, bool Claim=true) const {
       return getLastArg(Id0, Id1, Claim) != 0;
     }
 
@@ -105,15 +105,15 @@ namespace driver {
 
     /// AddAllArgs - Render all arguments matching the given ids.
     void AddAllArgs(ArgStringList &Output, options::ID Id0) const;
-    void AddAllArgs(ArgStringList &Output, options::ID Id0, 
+    void AddAllArgs(ArgStringList &Output, options::ID Id0,
                     options::ID Id1) const;
-    void AddAllArgs(ArgStringList &Output, options::ID Id0, options::ID Id1, 
+    void AddAllArgs(ArgStringList &Output, options::ID Id0, options::ID Id1,
                     options::ID Id2) const;
 
     /// AddAllArgValues - Render the argument values of all arguments
     /// matching the given ids.
     void AddAllArgValues(ArgStringList &Output, options::ID Id0) const;
-    void AddAllArgValues(ArgStringList &Output, options::ID Id0, 
+    void AddAllArgValues(ArgStringList &Output, options::ID Id0,
                          options::ID Id1) const;
 
     /// AddAllArgsTranslated - Render all the arguments matching the
@@ -123,7 +123,7 @@ namespace driver {
     /// \param Joined - If true, render the argument as joined with
     /// the option specifier.
     void AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
-                              const char *Translation, 
+                              const char *Translation,
                               bool Joined = false) const;
 
     /// ClaimAllArgs - Claim all arguments which match the given
@@ -168,8 +168,8 @@ namespace driver {
     InputArgList(const ArgList &);
     ~InputArgList();
 
-    virtual const char *getArgString(unsigned Index) const { 
-      return ArgStrings[Index]; 
+    virtual const char *getArgString(unsigned Index) const {
+      return ArgStrings[Index];
     }
 
     /// getNumInputArgStrings - Return the number of original input
@@ -212,7 +212,7 @@ namespace driver {
     ~DerivedArgList();
 
     virtual const char *getArgString(unsigned Index) const {
-      return BaseArgs.getArgString(Index); 
+      return BaseArgs.getArgString(Index);
     }
 
     /// @name Arg Synthesis
@@ -226,17 +226,17 @@ namespace driver {
 
     /// MakePositionalArg - Construct a new Positional arg for the
     /// given option \arg Id, with the provided \arg Value.
-    Arg *MakePositionalArg(const Arg *BaseArg, const Option *Opt, 
+    Arg *MakePositionalArg(const Arg *BaseArg, const Option *Opt,
                            const char *Value) const;
 
     /// MakeSeparateArg - Construct a new Positional arg for the
     /// given option \arg Id, with the provided \arg Value.
-    Arg *MakeSeparateArg(const Arg *BaseArg, const Option *Opt, 
+    Arg *MakeSeparateArg(const Arg *BaseArg, const Option *Opt,
                          const char *Value) const;
 
     /// MakeJoinedArg - Construct a new Positional arg for the
     /// given option \arg Id, with the provided \arg Value.
-    Arg *MakeJoinedArg(const Arg *BaseArg, const Option *Opt, 
+    Arg *MakeJoinedArg(const Arg *BaseArg, const Option *Opt,
                        const char *Value) const;
 
     /// @}

+ 5 - 5
include/clang/Driver/Compilation.h

@@ -56,7 +56,7 @@ class Compilation {
   ArgStringList ResultFiles;
 
 public:
-  Compilation(const Driver &D, const ToolChain &DefaultToolChain, 
+  Compilation(const Driver &D, const ToolChain &DefaultToolChain,
               InputArgList *Args);
   ~Compilation();
 
@@ -83,8 +83,8 @@ public:
 
   /// addTempFile - Add a file to remove on exit, and returns its
   /// argument.
-  const char *addTempFile(const char *Name) { 
-    TempFiles.push_back(Name); 
+  const char *addTempFile(const char *Name) {
+    TempFiles.push_back(Name);
     return Name;
   }
 
@@ -99,7 +99,7 @@ public:
   ///
   /// \param IssueErrors - Report failures as errors.
   /// \return Whether all files were removed successfully.
-  bool CleanupFileList(const ArgStringList &Files, 
+  bool CleanupFileList(const ArgStringList &Files,
                        bool IssueErrors=false) const;
 
   /// PrintJob - Print one job in -### format.
@@ -108,7 +108,7 @@ public:
   /// \param J - The job to print.
   /// \param Terminator - A string to print at the end of the line.
   /// \param Quote - Should separate arguments be quoted.
-  void PrintJob(llvm::raw_ostream &OS, const Job &J, 
+  void PrintJob(llvm::raw_ostream &OS, const Job &J,
                 const char *Terminator, bool Quote) const;
 
   /// ExecuteCommand - Execute an actual command.

+ 8 - 8
include/clang/Driver/Driver.h

@@ -55,11 +55,11 @@ public:
 public:
   /// The name the driver was invoked as.
   std::string Name;
-  
+
   /// The path the driver executable was in, as invoked from the
   /// command line.
   std::string Dir;
-  
+
   /// Default host triple.
   std::string DefaultHostTriple;
 
@@ -75,7 +75,7 @@ public:
 
   /// Whether the driver should follow g++ like behavior.
   bool CCCIsCXX : 1;
-  
+
   /// Echo commands while executing (in -v style).
   bool CCCEcho : 1;
 
@@ -107,7 +107,7 @@ private:
 
   /// Certain options suppress the 'no input files' warning.
   bool SuppressMissingInputWarning : 1;
-  
+
   std::list<std::string> TempFiles;
   std::list<std::string> ResultFiles;
 
@@ -243,7 +243,7 @@ public:
   /// \param BaseInput - The original input file that this action was
   /// triggered by.
   /// \param AtTopLevel - Whether this is a "top-level" action.
-  const char *GetNamedOutputPath(Compilation &C, 
+  const char *GetNamedOutputPath(Compilation &C,
                                  const JobAction &JA,
                                  const char *BaseInput,
                                  bool AtTopLevel) const;
@@ -253,14 +253,14 @@ public:
   ///
   /// GCC goes to extra lengths here to be a bit more robust.
   std::string GetTemporaryPath(const char *Suffix) const;
-                        
+
   /// GetHostInfo - Construct a new host info object for the given
   /// host triple.
   const HostInfo *GetHostInfo(const char *HostTriple) const;
 
   /// ShouldUseClangCompilar - Should the clang compiler be used to
   /// handle this action.
-  bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA, 
+  bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
                               const llvm::Triple &ArchName) const;
 
   /// @}
@@ -272,7 +272,7 @@ public:
   /// \return True if the entire string was parsed (9.2), or all
   /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
   /// groups were parsed but extra characters remain at the end.
-  static bool GetReleaseVersion(const char *Str, unsigned &Major, 
+  static bool GetReleaseVersion(const char *Str, unsigned &Major,
                                 unsigned &Minor, unsigned &Micro,
                                 bool &HadExtra);
 };

+ 1 - 1
include/clang/Driver/DriverDiagnostic.h

@@ -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 DRIVERSTART

+ 9 - 9
include/clang/Driver/HostInfo.h

@@ -22,7 +22,7 @@ namespace driver {
 
 /// HostInfo - Config information about a particular host which may interact
 /// with driver behavior.
-/// 
+///
 /// The host information is used for controlling the parts of the driver which
 /// interact with the platform the driver is ostensibly being run from. For
 /// testing purposes, the HostInfo used by the driver may differ from the actual
@@ -38,7 +38,7 @@ public:
   virtual ~HostInfo();
 
   const Driver &getDriver() const { return TheDriver; }
-  
+
   const llvm::Triple& getTriple() const { return Triple; }
   std::string getArchName() const { return Triple.getArchName(); }
   std::string getPlatformName() const { return Triple.getVendorName(); }
@@ -64,23 +64,23 @@ public:
 
   // FIXME: Pin down exactly what the HostInfo is allowed to use Args
   // for here. Currently this is for -m32 / -m64 defaulting.
-  virtual ToolChain *CreateToolChain(const ArgList &Args, 
+  virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName=0) const = 0;
 };
 
 const HostInfo *createAuroraUXHostInfo(const Driver &D,
                                        const llvm::Triple& Triple);
-const HostInfo *createDarwinHostInfo(const Driver &D, 
+const HostInfo *createDarwinHostInfo(const Driver &D,
                                      const llvm::Triple& Triple);
-const HostInfo *createOpenBSDHostInfo(const Driver &D, 
+const HostInfo *createOpenBSDHostInfo(const Driver &D,
                                       const llvm::Triple& Triple);
-const HostInfo *createFreeBSDHostInfo(const Driver &D, 
+const HostInfo *createFreeBSDHostInfo(const Driver &D,
                                       const llvm::Triple& Triple);
-const HostInfo *createDragonFlyHostInfo(const Driver &D, 
+const HostInfo *createDragonFlyHostInfo(const Driver &D,
                                         const llvm::Triple& Triple);
-const HostInfo *createLinuxHostInfo(const Driver &D, 
+const HostInfo *createLinuxHostInfo(const Driver &D,
                                     const llvm::Triple& Triple);
-const HostInfo *createUnknownHostInfo(const Driver &D, 
+const HostInfo *createUnknownHostInfo(const Driver &D,
                                       const llvm::Triple& Triple);
 
 } // end namespace driver

+ 11 - 11
include/clang/Driver/Job.h

@@ -46,7 +46,7 @@ public:
   /// either a piped job or a job list.
   void addCommand(Command *C);
 
-  static bool classof(const Job *) { return true; }      
+  static bool classof(const Job *) { return true; }
 };
 
   /// Command - An executable path/name and argument vector to
@@ -63,7 +63,7 @@ class Command : public Job {
   ArgStringList Arguments;
 
 public:
-  Command(const Action &_Source, const char *_Executable, 
+  Command(const Action &_Source, const char *_Executable,
           const ArgStringList &_Arguments);
 
   /// getSource - Return the Action which caused the creation of this job.
@@ -73,8 +73,8 @@ public:
 
   const ArgStringList &getArguments() const { return Arguments; }
 
-  static bool classof(const Job *J) { 
-    return J->getKind() == CommandClass; 
+  static bool classof(const Job *J) {
+    return J->getKind() == CommandClass;
   }
   static bool classof(const Command *) { return true; }
 };
@@ -97,15 +97,15 @@ public:
   void addCommand(Command *C) { Commands.push_back(C); }
 
   const list_type &getCommands() const { return Commands; }
-  
+
   size_type size() const { return Commands.size(); }
   iterator begin() { return Commands.begin(); }
   const_iterator begin() const { return Commands.begin(); }
   iterator end() { return Commands.end(); }
   const_iterator end() const { return Commands.end(); }
 
-  static bool classof(const Job *J) { 
-    return J->getKind() == PipedJobClass; 
+  static bool classof(const Job *J) {
+    return J->getKind() == PipedJobClass;
   }
   static bool classof(const PipedJob *) { return true; }
 };
@@ -133,13 +133,13 @@ public:
   const_iterator begin() const { return Jobs.begin(); }
   iterator end() { return Jobs.end(); }
   const_iterator end() const { return Jobs.end(); }
-  
-  static bool classof(const Job *J) { 
-    return J->getKind() == JobListClass; 
+
+  static bool classof(const Job *J) {
+    return J->getKind() == JobListClass;
   }
   static bool classof(const JobList *) { return true; }
 };
-    
+
 } // end namespace driver
 } // end namespace clang
 

+ 44 - 44
include/clang/Driver/Option.h

@@ -24,7 +24,7 @@ namespace driver {
   class Arg;
   class InputArgList;
   class OptionGroup;
-  
+
   /// Option - Abstract representation for a single form of driver
   /// argument.
   ///
@@ -57,10 +57,10 @@ namespace driver {
     options::ID ID;
 
     /// The option name.
-    const char *Name; 
+    const char *Name;
 
     /// Group this option is a member of, if any.
-    const OptionGroup *Group; 
+    const OptionGroup *Group;
 
     /// Option that this is an alias for, if any.
     const Option *Alias;
@@ -70,7 +70,7 @@ namespace driver {
 
     /// Treat this option like a linker input?
     bool LinkerInput : 1;
-    
+
     /// When rendering as an input, don't render the option.
 
     // FIXME: We should ditch the render/renderAsInput distinction.
@@ -78,18 +78,18 @@ namespace driver {
 
     /// Always render this option as separate form its value.
     bool ForceSeparateRender : 1;
-    
+
     /// Always render this option joined with its value.
-    bool ForceJoinedRender : 1;    
+    bool ForceJoinedRender : 1;
 
     /// This option is only consumed by the driver.
-    bool DriverOption : 1;    
+    bool DriverOption : 1;
 
     /// This option should not report argument unused errors.
-    bool NoArgumentUnused : 1;    
+    bool NoArgumentUnused : 1;
 
   protected:
-    Option(OptionClass Kind, options::ID ID, const char *Name, 
+    Option(OptionClass Kind, options::ID ID, const char *Name,
            const OptionGroup *Group, const Option *Alias);
   public:
     virtual ~Option();
@@ -108,13 +108,13 @@ namespace driver {
 
     bool hasNoOptAsInput() const { return NoOptAsInput; }
     void setNoOptAsInput(bool Value) { NoOptAsInput = Value; }
-    
+
     bool hasForceSeparateRender() const { return ForceSeparateRender; }
     void setForceSeparateRender(bool Value) { ForceSeparateRender = Value; }
-    
+
     bool hasForceJoinedRender() const { return ForceJoinedRender; }
     void setForceJoinedRender(bool Value) { ForceJoinedRender = Value; }
-    
+
     bool isDriverOption() const { return DriverOption; }
     void setDriverOption(bool Value) { DriverOption = Value; }
 
@@ -125,7 +125,7 @@ namespace driver {
 
     /// getUnaliasedOption - Return the final option this option
     /// aliases (itself, if the option has no alias).
-    const Option *getUnaliasedOption() const { 
+    const Option *getUnaliasedOption() const {
       if (Alias) return Alias->getUnaliasedOption();
       return this;
     }
@@ -149,12 +149,12 @@ namespace driver {
     /// Index to the position where argument parsing should resume
     /// (even if the argument is missing values).
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const = 0;
-    
+
     void dump() const;
 
     static bool classof(const Option *) { return true; }
   };
-  
+
   /// OptionGroup - A set of options which are can be handled uniformly
   /// by the driver.
   class OptionGroup : public Option {
@@ -163,14 +163,14 @@ namespace driver {
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::GroupClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::GroupClass;
     }
     static bool classof(const OptionGroup *) { return true; }
   };
-  
+
   // Dummy option classes.
-  
+
   /// InputOption - Dummy option class for representing driver inputs.
   class InputOption : public Option {
   public:
@@ -178,8 +178,8 @@ namespace driver {
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::InputClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::InputClass;
     }
     static bool classof(const InputOption *) { return true; }
   };
@@ -191,8 +191,8 @@ namespace driver {
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::UnknownClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::UnknownClass;
     }
     static bool classof(const UnknownOption *) { return true; }
   };
@@ -201,52 +201,52 @@ namespace driver {
 
   class FlagOption : public Option {
   public:
-    FlagOption(options::ID ID, const char *Name, const OptionGroup *Group, 
+    FlagOption(options::ID ID, const char *Name, const OptionGroup *Group,
                const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::FlagClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::FlagClass;
     }
     static bool classof(const FlagOption *) { return true; }
   };
 
   class JoinedOption : public Option {
   public:
-    JoinedOption(options::ID ID, const char *Name, const OptionGroup *Group, 
+    JoinedOption(options::ID ID, const char *Name, const OptionGroup *Group,
                  const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::JoinedClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::JoinedClass;
     }
     static bool classof(const JoinedOption *) { return true; }
   };
 
   class SeparateOption : public Option {
   public:
-    SeparateOption(options::ID ID, const char *Name, const OptionGroup *Group, 
+    SeparateOption(options::ID ID, const char *Name, const OptionGroup *Group,
                    const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::SeparateClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::SeparateClass;
     }
     static bool classof(const SeparateOption *) { return true; }
   };
 
   class CommaJoinedOption : public Option {
   public:
-    CommaJoinedOption(options::ID ID, const char *Name, 
+    CommaJoinedOption(options::ID ID, const char *Name,
                       const OptionGroup *Group, const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::CommaJoinedClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::CommaJoinedClass;
     }
     static bool classof(const CommaJoinedOption *) { return true; }
   };
@@ -259,15 +259,15 @@ namespace driver {
     unsigned NumArgs;
 
   public:
-    MultiArgOption(options::ID ID, const char *Name, const OptionGroup *Group, 
+    MultiArgOption(options::ID ID, const char *Name, const OptionGroup *Group,
                    const Option *Alias, unsigned NumArgs);
 
     unsigned getNumArgs() const { return NumArgs; }
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::MultiArgClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::MultiArgClass;
     }
     static bool classof(const MultiArgOption *) { return true; }
   };
@@ -276,13 +276,13 @@ namespace driver {
   /// prefixes its (non-empty) value, or is follwed by a value.
   class JoinedOrSeparateOption : public Option {
   public:
-    JoinedOrSeparateOption(options::ID ID, const char *Name, 
+    JoinedOrSeparateOption(options::ID ID, const char *Name,
                            const OptionGroup *Group, const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::JoinedOrSeparateClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::JoinedOrSeparateClass;
     }
     static bool classof(const JoinedOrSeparateOption *) { return true; }
   };
@@ -291,13 +291,13 @@ namespace driver {
   /// value and is followed by another value.
   class JoinedAndSeparateOption : public Option {
   public:
-    JoinedAndSeparateOption(options::ID ID, const char *Name, 
+    JoinedAndSeparateOption(options::ID ID, const char *Name,
                             const OptionGroup *Group, const Option *Alias);
 
     virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
 
-    static bool classof(const Option *O) { 
-      return O->getKind() == Option::JoinedAndSeparateClass; 
+    static bool classof(const Option *O) {
+      return O->getKind() == Option::JoinedAndSeparateClass;
     }
     static bool classof(const JoinedAndSeparateOption *) { return true; }
   };

+ 2 - 2
include/clang/Driver/Options.h

@@ -24,7 +24,7 @@ namespace options {
 #undef OPTION
   };
 }
-  
+
   class Arg;
   class InputArgList;
   class Option;
@@ -36,7 +36,7 @@ namespace options {
   /// few options will be needed at runtime; the OptTable class
   /// maintains enough information to parse command lines without
   /// instantiating Options, while letting other parts of the driver
-  /// still use Option instances where convient.  
+  /// still use Option instances where convient.
   class OptTable {
     /// The table of options which have been constructed, indexed by
     /// option::ID - 1.

+ 4 - 4
include/clang/Driver/Tool.h

@@ -22,7 +22,7 @@ namespace driver {
   class Job;
   class JobAction;
   class ToolChain;
-  
+
   typedef llvm::SmallVector<InputInfo, 4> InputInfoList;
 
 /// Tool - Information on a specific compilation tool.
@@ -57,9 +57,9 @@ public:
   /// linker, then this is the final output name of the linked image.
   virtual void ConstructJob(Compilation &C, const JobAction &JA,
                             Job &Dest,
-                            const InputInfo &Output, 
-                            const InputInfoList &Inputs, 
-                            const ArgList &TCArgs, 
+                            const InputInfo &Output,
+                            const InputInfoList &Inputs,
+                            const ArgList &TCArgs,
                             const char *LinkingOutput) const = 0;
 };
 

+ 2 - 2
include/clang/Frontend/ASTConsumers.h

@@ -38,9 +38,9 @@ class LangOptions;
 // implementation is still incomplete.
 ASTConsumer *CreateASTPrinter(llvm::raw_ostream *OS);
 
-// AST XML-printer: prints out the AST in a XML format 
+// AST XML-printer: prints out the AST in a XML format
 // The output is intended to be in a format such that
-// clang or any other tool could re-parse the output back into the same AST, 
+// clang or any other tool could re-parse the output back into the same AST,
 // but the implementation is still incomplete.
 ASTConsumer *CreateASTPrinterXML(llvm::raw_ostream *OS);
 

Някои файлове не бяха показани, защото твърде много файлове са промени