diff options
author | Mike Stump <mrs@apple.com> | 2009-09-09 15:08:12 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-09-09 15:08:12 +0000 |
commit | 1eb4433ac451dc16f4133a88af2d002ac26c58ef (patch) | |
tree | 07065b80cb7787bb7b9ffcb985196007a57e86f7 /lib/Index | |
parent | 79d39f92590cf2e91bf81486b02cd1156d13ca54 (diff) |
Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index')
-rw-r--r-- | lib/Index/ASTLocation.cpp | 16 | ||||
-rw-r--r-- | lib/Index/Analyzer.cpp | 30 | ||||
-rw-r--r-- | lib/Index/DeclReferenceMap.cpp | 6 | ||||
-rw-r--r-- | lib/Index/Entity.cpp | 22 | ||||
-rw-r--r-- | lib/Index/EntityImpl.h | 4 | ||||
-rw-r--r-- | lib/Index/GlobalSelector.cpp | 4 | ||||
-rw-r--r-- | lib/Index/Indexer.cpp | 8 | ||||
-rw-r--r-- | lib/Index/ProgramImpl.h | 6 | ||||
-rw-r--r-- | lib/Index/ResolveLocation.cpp | 16 |
9 files changed, 56 insertions, 56 deletions
diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp index f010a2bcc8..d6f5cc7cfb 100644 --- a/lib/Index/ASTLocation.cpp +++ b/lib/Index/ASTLocation.cpp @@ -32,7 +32,7 @@ static Decl *getDeclFromExpr(Stmt *E) { return getDeclFromExpr(CE->getCallee()); if (CastExpr *CE = dyn_cast<CastExpr>(E)) return getDeclFromExpr(CE->getSubExpr()); - + return 0; } @@ -41,7 +41,7 @@ Decl *ASTLocation::getReferencedDecl() { return 0; if (isDecl()) return getDecl(); - + assert(getStmt()); return getDeclFromExpr(getStmt()); } @@ -49,17 +49,17 @@ Decl *ASTLocation::getReferencedDecl() { static bool isContainedInStatement(Stmt *Node, Stmt *Parent) { assert(Node && Parent && "Passed null Node or Parent"); - + if (Node == Parent) return true; - + for (Stmt::child_iterator I = Parent->child_begin(), E = Parent->child_end(); I != E; ++I) { if (*I) if (isContainedInStatement(Node, *I)) return true; } - + return false; } @@ -76,7 +76,7 @@ Decl *ASTLocation::FindImmediateParent(Decl *D, Stmt *Node) { if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { if (!FD->isThisDeclarationADefinition()) return 0; - + for (DeclContext::decl_iterator I = FD->decls_begin(), E = FD->decls_end(); I != E; ++I) { Decl *Child = FindImmediateParent(*I, Node); @@ -138,7 +138,7 @@ void ASTLocation::print(llvm::raw_ostream &OS) const { OS << "[Decl: " << getDecl()->getDeclKindName() << " "; if (const NamedDecl *ND = dyn_cast<NamedDecl>(getDecl())) OS << ND->getNameAsString(); - + if (getStmt()) { ASTContext &Ctx = getDecl()->getASTContext(); OS << " | Stmt: " << getStmt()->getStmtClassName() << " "; @@ -146,7 +146,7 @@ void ASTLocation::print(llvm::raw_ostream &OS) const { } OS << "] <"; - + SourceRange Range = getSourceRange(); SourceManager &SourceMgr = getDecl()->getASTContext().getSourceManager(); Range.getBegin().print(OS, SourceMgr); diff --git a/lib/Index/Analyzer.cpp b/lib/Index/Analyzer.cpp index 1dd2178ad4..cda2c505fd 100644 --- a/lib/Index/Analyzer.cpp +++ b/lib/Index/Analyzer.cpp @@ -36,11 +36,11 @@ namespace { class VISIBILITY_HIDDEN DeclEntityAnalyzer : public TranslationUnitHandler { Entity Ent; TULocationHandler &TULocHandler; - + public: DeclEntityAnalyzer(Entity ent, TULocationHandler &handler) : Ent(ent), TULocHandler(handler) { } - + virtual void Handle(TranslationUnit *TU) { assert(TU && "Passed null translation unit"); @@ -60,11 +60,11 @@ public: class VISIBILITY_HIDDEN RefEntityAnalyzer : public TranslationUnitHandler { Entity Ent; TULocationHandler &TULocHandler; - + public: RefEntityAnalyzer(Entity ent, TULocationHandler &handler) : Ent(ent), TULocHandler(handler) { } - + virtual void Handle(TranslationUnit *TU) { assert(TU && "Passed null translation unit"); @@ -115,12 +115,12 @@ public: IFaceEnt = Entity::get(IFD, Prog); GlobSel = GlobalSelector::get(MD->getSelector(), Prog); IsInstanceMethod = MD->isInstanceMethod(); - + for (ObjCInterfaceDecl *Cls = IFD->getSuperClass(); Cls; Cls = Cls->getSuperClass()) HierarchyEntities.insert(Entity::get(Cls, Prog)); } - + virtual void Handle(TranslationUnit *TU) { assert(TU && "Passed null translation unit"); @@ -150,7 +150,7 @@ public: // FIXME: Finding @selector references should be through another Analyzer // method, like FindSelectors. if (isa<ObjCSelectorExpr>(ASTLoc.getStmt())) - return false; + return false; ObjCInterfaceDecl *MsgD = 0; ObjCMessageExpr *Msg = cast<ObjCMessageExpr>(ASTLoc.getStmt()); @@ -181,7 +181,7 @@ public: MsgD = Msg->getClassInfo().first; // FIXME: Case when we only have an identifier. - assert(MsgD && "Identifier only"); + assert(MsgD && "Identifier only"); } assert(MsgD); @@ -233,7 +233,7 @@ class VISIBILITY_HIDDEN MessageAnalyzer : public TranslationUnitHandler { /// \brief Super classes of the ObjCInterface. typedef llvm::SmallSet<Entity, 16> EntitiesSetTy; EntitiesSetTy HierarchyEntities; - + /// \brief The interface in the message interface hierarchy that "intercepts" /// the selector. Entity ReceiverIFaceEnt; @@ -254,7 +254,7 @@ public: CanBeClassMethod = true; MsgD = Msg->getClassInfo().first; // FIXME: Case when we only have an identifier. - assert(MsgD && "Identifier only"); + assert(MsgD && "Identifier only"); break; } @@ -276,7 +276,7 @@ public: CanBeInstanceMethod = true; break; } - + assert(CanBeInstanceMethod || CanBeClassMethod); Selector sel = Msg->getSelector(); @@ -304,7 +304,7 @@ public: break; } } - + if (isReceiver) { ReceiverIFaceEnt = Entity::get(Cls, Prog); break; @@ -312,7 +312,7 @@ public: } } } - + virtual void Handle(TranslationUnit *TU) { assert(TU && "Passed null translation unit"); ASTContext &Ctx = TU->getASTContext(); @@ -406,7 +406,7 @@ void Analyzer::FindDeclarations(Decl *D, TULocationHandler &Handler) { Entity Ent = Entity::get(D, Prog); if (Ent.isInvalid()) return; - + DeclEntityAnalyzer DEA(Ent, Handler); Idxer.GetTranslationUnitsFor(Ent, DEA); } @@ -423,7 +423,7 @@ void Analyzer::FindReferences(Decl *D, TULocationHandler &Handler) { Entity Ent = Entity::get(D, Prog); if (Ent.isInvalid()) return; - + RefEntityAnalyzer REA(Ent, Handler); Idxer.GetTranslationUnitsFor(Ent, REA); } diff --git a/lib/Index/DeclReferenceMap.cpp b/lib/Index/DeclReferenceMap.cpp index 1e6ae21a64..0aee2a40ec 100644 --- a/lib/Index/DeclReferenceMap.cpp +++ b/lib/Index/DeclReferenceMap.cpp @@ -63,16 +63,16 @@ DeclReferenceMap::DeclReferenceMap(ASTContext &Ctx) { DeclReferenceMap::astlocation_iterator DeclReferenceMap::refs_begin(NamedDecl *D) const { NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl()); - return astlocation_iterator(Map.lower_bound(Prim)); + return astlocation_iterator(Map.lower_bound(Prim)); } DeclReferenceMap::astlocation_iterator DeclReferenceMap::refs_end(NamedDecl *D) const { NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl()); - return astlocation_iterator(Map.upper_bound(Prim)); + return astlocation_iterator(Map.upper_bound(Prim)); } bool DeclReferenceMap::refs_empty(NamedDecl *D) const { NamedDecl *Prim = cast<NamedDecl>(D->getCanonicalDecl()); - return refs_begin(Prim) == refs_end(Prim); + return refs_begin(Prim) == refs_end(Prim); } diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp index 245fc9a555..77d7a84da4 100644 --- a/lib/Index/Entity.cpp +++ b/lib/Index/Entity.cpp @@ -41,10 +41,10 @@ class EntityGetter : public DeclVisitor<EntityGetter, Entity> { public: EntityGetter(Program &prog, ProgramImpl &progImpl) : Prog(prog), ProgImpl(progImpl) { } - + Entity VisitNamedDecl(NamedDecl *D); Entity VisitVarDecl(VarDecl *D); - Entity VisitFunctionDecl(FunctionDecl *D); + Entity VisitFunctionDecl(FunctionDecl *D); }; } @@ -80,12 +80,12 @@ Entity EntityGetter::VisitNamedDecl(NamedDecl *D) { // Treats other DeclarationNames as internal Decls for now.. if (LocalSel.isNull()) return Entity(D); - + Selector GlobSel = (uintptr_t)GlobalSelector::get(LocalSel, Prog).getAsOpaquePtr(); GlobName = DeclarationName(GlobSel); } - + assert(GlobName); unsigned IdNS = D->getIdentifierNamespace(); @@ -105,7 +105,7 @@ Entity EntityGetter::VisitNamedDecl(NamedDecl *D) { EntityImpl *New = new (Buf) EntityImpl(Parent, GlobName, IdNS, isObjCInstanceMethod); Entities.InsertNode(New, InsertPos); - + return Entity(New); } @@ -113,7 +113,7 @@ Entity EntityGetter::VisitVarDecl(VarDecl *D) { // If it's static it cannot be referred to by another translation unit. if (D->getStorageClass() == VarDecl::Static) return Entity(D); - + return VisitNamedDecl(D); } @@ -121,7 +121,7 @@ Entity EntityGetter::VisitFunctionDecl(FunctionDecl *D) { // If it's static it cannot be refered to by another translation unit. if (D->getStorageClass() == FunctionDecl::Static) return Entity(D); - + return VisitNamedDecl(D); } @@ -188,18 +188,18 @@ Entity::Entity(Decl *D) : Val(D->getCanonicalDecl()) { } Decl *Entity::getDecl(ASTContext &AST) const { if (isInvalid()) return 0; - + if (Decl *D = Val.dyn_cast<Decl *>()) // Check that the passed AST is actually the one that this Decl belongs to. return (&D->getASTContext() == &AST) ? D : 0; - + return Val.get<EntityImpl *>()->getDecl(AST); } std::string Entity::getPrintableName() const { if (isInvalid()) return "<< Invalid >>"; - + if (Decl *D = Val.dyn_cast<Decl *>()) { if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) return ND->getNameAsString(); @@ -219,7 +219,7 @@ Entity Entity::get(Decl *D, Program &Prog) { return EntityImpl::get(D, Prog, ProgImpl); } -unsigned +unsigned llvm::DenseMapInfo<Entity>::getHashValue(Entity E) { return DenseMapInfo<void*>::getHashValue(E.getAsOpaquePtr()); } diff --git a/lib/Index/EntityImpl.h b/lib/Index/EntityImpl.h index b4a883a3bf..cbce934bf7 100644 --- a/lib/Index/EntityImpl.h +++ b/lib/Index/EntityImpl.h @@ -30,7 +30,7 @@ class EntityImpl : public llvm::FoldingSetNode { /// \brief Identifier namespace. unsigned IdNS; - + /// \brief If Name is a selector, this keeps track whether it's for an /// instance method. bool IsObjCInstanceMethod; @@ -47,7 +47,7 @@ public: /// \brief Get an Entity associated with the given Decl. /// \returns Null if an Entity cannot refer to this Decl. static Entity get(Decl *D, Program &Prog, ProgramImpl &ProgImpl); - + std::string getPrintableName(); void Profile(llvm::FoldingSetNodeID &ID) const { diff --git a/lib/Index/GlobalSelector.cpp b/lib/Index/GlobalSelector.cpp index a1ec929901..f3ec41d44f 100644 --- a/lib/Index/GlobalSelector.cpp +++ b/lib/Index/GlobalSelector.cpp @@ -41,7 +41,7 @@ Selector GlobalSelector::getSelector(ASTContext &AST) const { std::string GlobalSelector::getPrintableName() const { if (isInvalid()) return "<< Invalid >>"; - + Selector GlobSel = Selector(reinterpret_cast<uintptr_t>(Val)); return GlobSel.getAsString(); } @@ -67,7 +67,7 @@ GlobalSelector GlobalSelector::get(Selector Sel, Program &Prog) { return GlobalSelector(GlobSel.getAsOpaquePtr()); } -unsigned +unsigned llvm::DenseMapInfo<GlobalSelector>::getHashValue(GlobalSelector Sel) { return DenseMapInfo<void*>::getHashValue(Sel.getAsOpaquePtr()); } diff --git a/lib/Index/Indexer.cpp b/lib/Index/Indexer.cpp index 75dfbd584c..57bfc5b4fb 100644 --- a/lib/Index/Indexer.cpp +++ b/lib/Index/Indexer.cpp @@ -25,7 +25,7 @@ namespace { class EntityIndexer : public EntityHandler { TranslationUnit *TU; Indexer::MapTy ⤅ - + public: EntityIndexer(TranslationUnit *tu, Indexer::MapTy &map) : TU(tu), Map(map) { } @@ -64,7 +64,7 @@ void Indexer::IndexAST(TranslationUnit *TU) { CtxTUMap[&Ctx] = TU; EntityIndexer Idx(TU, Map); Prog.FindEntities(Ctx, Idx); - + SelectorIndexer SelIdx(Prog, TU, SelMap); SelIdx.Visit(Ctx.getTranslationUnitDecl()); } @@ -84,7 +84,7 @@ void Indexer::GetTranslationUnitsFor(Entity Ent, MapTy::iterator I = Map.find(Ent); if (I == Map.end()) return; - + TUSetTy &Set = I->second; for (TUSetTy::iterator I = Set.begin(), E = Set.end(); I != E; ++I) Handler.Handle(*I); @@ -97,7 +97,7 @@ void Indexer::GetTranslationUnitsFor(GlobalSelector Sel, SelMapTy::iterator I = SelMap.find(Sel); if (I == SelMap.end()) return; - + TUSetTy &Set = I->second; for (TUSetTy::iterator I = Set.begin(), E = Set.end(); I != E; ++I) Handler.Handle(*I); diff --git a/lib/Index/ProgramImpl.h b/lib/Index/ProgramImpl.h index 1fbff9b325..57b9ce3115 100644 --- a/lib/Index/ProgramImpl.h +++ b/lib/Index/ProgramImpl.h @@ -30,16 +30,16 @@ public: private: EntitySetTy Entities; llvm::BumpPtrAllocator BumpAlloc; - + IdentifierTable Identifiers; SelectorTable Selectors; ProgramImpl(const ProgramImpl&); // do not implement ProgramImpl &operator=(const ProgramImpl &); // do not implement - + public: ProgramImpl() : Identifiers(LangOptions()) { } - + EntitySetTy &getEntities() { return Entities; } IdentifierTable &getIdents() { return Identifiers; } SelectorTable &getSelectors() { return Selectors; } diff --git a/lib/Index/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp index ce8512ddf3..281f4d9df1 100644 --- a/lib/Index/ResolveLocation.cpp +++ b/lib/Index/ResolveLocation.cpp @@ -119,7 +119,7 @@ StmtLocResolver::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) { Nodes.push_back(Node->getArg(0)); Nodes.push_back(Node->getCallee()); Nodes.push_back(Node->getArg(1)); - + for (unsigned i = 0, e = Nodes.size(); i != e; ++i) { RangePos RP = CheckRange(Nodes[i]); if (RP == AfterLoc) @@ -201,9 +201,9 @@ ASTLocation DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { if (RP == ContainsLoc) return Visit(*I); } - + // We didn't find the location in the parameters and we didn't get passed it. - + if (!D->isThisDeclarationADefinition()) return ASTLocation(D); @@ -214,7 +214,7 @@ ASTLocation DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { I = D->decls_begin(), E = D->decls_end(); I != E; ++I) { if (isa<ParmVarDecl>(*I)) continue; // We already searched through the parameters. - + RangePos RP = CheckRange(*I); if (RP == AfterLoc) break; @@ -223,7 +223,7 @@ ASTLocation DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { } // We didn't find a declaration that corresponds to the source location. - + // Finally, search through the body of the function. Stmt *Body = D->getBody(); assert(Body && "Expected definition"); @@ -325,10 +325,10 @@ LocResolverBase::RangePos LocResolverBase::CheckRange(SourceRange Range) { Ctx.getLangOptions()); Range.setEnd(Range.getEnd().getFileLocWithOffset(TokSize-1)); - SourceManager &SourceMgr = Ctx.getSourceManager(); + SourceManager &SourceMgr = Ctx.getSourceManager(); if (SourceMgr.isBeforeInTranslationUnit(Range.getEnd(), Loc)) return BeforeLoc; - + if (SourceMgr.isBeforeInTranslationUnit(Loc, Range.getBegin())) return AfterLoc; @@ -367,6 +367,6 @@ void LocResolverBase::print(Stmt *Node) { ASTLocation idx::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) { if (Loc.isInvalid()) return ASTLocation(); - + return DeclLocResolver(Ctx, Loc).Visit(Ctx.getTranslationUnitDecl()); } |