ariccio updated this revision to Diff 46481. ariccio marked 10 inline comments as done. ariccio added a comment.
Removed extra spaces. http://reviews.llvm.org/D16748 Files: C:/LLVM/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h C:/LLVM/llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
Index: C:/LLVM/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h =================================================================== --- C:/LLVM/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h +++ C:/LLVM/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h @@ -1319,8 +1319,8 @@ void setTrait(SymbolRef Sym, InvalidationKinds IK); void setTrait(const MemRegion *MR, InvalidationKinds IK); - bool hasTrait(SymbolRef Sym, InvalidationKinds IK); - bool hasTrait(const MemRegion *MR, InvalidationKinds IK); + bool hasTrait(SymbolRef Sym, InvalidationKinds IK) const; + bool hasTrait(const MemRegion *MR, InvalidationKinds IK) const; }; } // end GR namespace Index: C:/LLVM/llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp =================================================================== --- C:/LLVM/llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ C:/LLVM/llvm/tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -46,7 +46,7 @@ InsertPos)); if (!R) { - R = (RegionTy*) A.Allocate<RegionTy>(); + R = A.Allocate<RegionTy>(); new (R) RegionTy(a1, superRegion); Regions.InsertNode(R, InsertPos); } @@ -64,7 +64,7 @@ InsertPos)); if (!R) { - R = (RegionTy*) A.Allocate<RegionTy>(); + R = A.Allocate<RegionTy>(); new (R) RegionTy(a1, superRegion); Regions.InsertNode(R, InsertPos); } @@ -85,7 +85,7 @@ InsertPos)); if (!R) { - R = (RegionTy*) A.Allocate<RegionTy>(); + R = A.Allocate<RegionTy>(); new (R) RegionTy(a1, a2, superRegion); Regions.InsertNode(R, InsertPos); } @@ -104,7 +104,7 @@ InsertPos)); if (!R) { - R = (RegionTy*) A.Allocate<RegionTy>(); + R = A.Allocate<RegionTy>(); new (R) RegionTy(a1, a2, superRegion); Regions.InsertNode(R, InsertPos); } @@ -123,7 +123,7 @@ InsertPos)); if (!R) { - R = (RegionTy*) A.Allocate<RegionTy>(); + R = A.Allocate<RegionTy>(); new (R) RegionTy(a1, a2, a3, superRegion); Regions.InsertNode(R, InsertPos); } @@ -246,39 +246,39 @@ //===----------------------------------------------------------------------===// void MemSpaceRegion::Profile(llvm::FoldingSetNodeID &ID) const { - ID.AddInteger((unsigned)getKind()); + ID.AddInteger(static_cast<unsigned>(getKind())); } void StackSpaceRegion::Profile(llvm::FoldingSetNodeID &ID) const { - ID.AddInteger((unsigned)getKind()); + ID.AddInteger(static_cast<unsigned>(getKind())); ID.AddPointer(getStackFrame()); } void StaticGlobalSpaceRegion::Profile(llvm::FoldingSetNodeID &ID) const { - ID.AddInteger((unsigned)getKind()); + ID.AddInteger(static_cast<unsigned>(getKind())); ID.AddPointer(getCodeRegion()); } void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const StringLiteral* Str, const MemRegion* superRegion) { - ID.AddInteger((unsigned) StringRegionKind); + ID.AddInteger(static_cast<unsigned>(StringRegionKind)); ID.AddPointer(Str); ID.AddPointer(superRegion); } void ObjCStringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const ObjCStringLiteral* Str, const MemRegion* superRegion) { - ID.AddInteger((unsigned) ObjCStringRegionKind); + ID.AddInteger(static_cast<unsigned>(ObjCStringRegionKind)); ID.AddPointer(Str); ID.AddPointer(superRegion); } void AllocaRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr *Ex, unsigned cnt, const MemRegion *superRegion) { - ID.AddInteger((unsigned) AllocaRegionKind); + ID.AddInteger(static_cast<unsigned>(AllocaRegionKind)); ID.AddPointer(Ex); ID.AddInteger(cnt); ID.AddPointer(superRegion); @@ -295,15 +295,15 @@ void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const CompoundLiteralExpr *CL, const MemRegion* superRegion) { - ID.AddInteger((unsigned) CompoundLiteralRegionKind); + ID.AddInteger(static_cast<unsigned>(CompoundLiteralRegionKind)); ID.AddPointer(CL); ID.AddPointer(superRegion); } void CXXThisRegion::ProfileRegion(llvm::FoldingSetNodeID &ID, const PointerType *PT, const MemRegion *sRegion) { - ID.AddInteger((unsigned) CXXThisRegionKind); + ID.AddInteger(static_cast<unsigned>(CXXThisRegionKind)); ID.AddPointer(PT); ID.AddPointer(sRegion); } @@ -320,7 +320,7 @@ void DeclRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl *D, const MemRegion* superRegion, Kind k) { - ID.AddInteger((unsigned) k); + ID.AddInteger(static_cast<unsigned>(k)); ID.AddPointer(D); ID.AddPointer(superRegion); } @@ -335,7 +335,7 @@ void SymbolicRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef sym, const MemRegion *sreg) { - ID.AddInteger((unsigned) MemRegion::SymbolicRegionKind); + ID.AddInteger(static_cast<unsigned>(MemRegion::SymbolicRegionKind)); ID.Add(sym); ID.AddPointer(sreg); } @@ -454,15 +454,15 @@ } void AllocaRegion::dumpToStream(raw_ostream &os) const { - os << "alloca{" << (const void*) Ex << ',' << Cnt << '}'; + os << "alloca{" << static_cast<const void*>(Ex) << ',' << Cnt << '}'; } void FunctionCodeRegion::dumpToStream(raw_ostream &os) const { os << "code{" << getDecl()->getDeclName().getAsString() << '}'; } void BlockCodeRegion::dumpToStream(raw_ostream &os) const { - os << "block_code{" << (const void*) this << '}'; + os << "block_code{" << static_cast<const void*>(this) << '}'; } void BlockDataRegion::dumpToStream(raw_ostream &os) const { @@ -478,12 +478,12 @@ void CompoundLiteralRegion::dumpToStream(raw_ostream &os) const { // FIXME: More elaborate pretty-printing. - os << "{ " << (const void*) CL << " }"; + os << "{ " << static_cast<const void*>(CL) << " }"; } void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const { os << "temp_object{" << getValueType().getAsString() << ',' - << (const void*) Ex << '}'; + << static_cast<const void*>(Ex) << '}'; } void CXXBaseObjectRegion::dumpToStream(raw_ostream &os) const { @@ -646,7 +646,7 @@ template <typename REG> const REG *MemRegionManager::LazyAllocate(REG*& region) { if (!region) { - region = (REG*) A.Allocate<REG>(); + region = A.Allocate<REG>(); new (region) REG(this); } @@ -656,7 +656,7 @@ template <typename REG, typename ARG> const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) { if (!region) { - region = (REG*) A.Allocate<REG>(); + region = A.Allocate<REG>(); new (region) REG(this, a); } @@ -921,7 +921,7 @@ ElementRegion* R = cast_or_null<ElementRegion>(data); if (!R) { - R = (ElementRegion*) A.Allocate<ElementRegion>(); + R = A.Allocate<ElementRegion>(); new (R) ElementRegion(T, Idx, superRegion); Regions.InsertNode(R, InsertPos); } @@ -1342,10 +1342,10 @@ // Get the field number. unsigned idx = 0; for (RecordDecl::field_iterator FI = RD->field_begin(), - FE = RD->field_end(); FI != FE; ++FI, ++idx) + FE = RD->field_end(); FI != FE; ++FI, ++idx) { if (FR->getDecl() == *FI) break; - + } const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD); // This is offset in bits. Offset += Layout.getFieldOffset(idx); @@ -1393,7 +1393,7 @@ AnalysisDeclContext *AC = getCodeRegion()->getAnalysisDeclContext(); const auto &ReferencedBlockVars = AC->getReferencedBlockVars(BC->getDecl()); - auto NumBlockVars = + const auto NumBlockVars = std::distance(ReferencedBlockVars.begin(), ReferencedBlockVars.end()); if (NumBlockVars == 0) { @@ -1488,16 +1488,16 @@ } bool RegionAndSymbolInvalidationTraits::hasTrait(SymbolRef Sym, - InvalidationKinds IK) { + InvalidationKinds IK) const { const_symbol_iterator I = SymTraitsMap.find(Sym); if (I != SymTraitsMap.end()) return I->second & IK; return false; } bool RegionAndSymbolInvalidationTraits::hasTrait(const MemRegion *MR, - InvalidationKinds IK) { + InvalidationKinds IK) const { if (!MR) return false;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits