I was thinking it might help some of the null-dereference issues if more things were to be passed as references. Is there a particular reason to use pointers instead? It seems there are several places which accept pointers and assume they're not null, which isn't really safe.
(And, there's probably some work to be done adding `const` in a bunch of places.) Jacob On Mon, Dec 14, 2015 at 11:34 AM, John McCall <rjmcc...@apple.com> wrote: > On Dec 12, 2015, at 4:20 PM, Michael Gottesman via swift-dev < > swift-dev@swift.org> wrote: > In general, we have not been particularly disciplined in this regard. I > would suggest following what is being done locally in the file you are > modifying, i.e. FuncDecl */TypeChecker & as per the LLVM style guide. > > > There are common rules at work here that govern most situations. We > almost always pass around objects that are part of the language > representation as either pointers (e.g. AST/SIL/LLVM nodes) or values (e.g. > Type, SILDeclRef); pretty much everything else is passed around as a > reference, especially classes that manage the creation or manipulation of > the language representation (e.g. IRGenModule, TypeChecker). > > The biggest grey area is for those parts of the language representation > that are either globally or contextually singleton, e.g. ASTContext and > SILFunction; these are almost always stored as references. > > John. > > > Michael > > On Dec 12, 2015, at 3:15 PM, Jacob Bandes-Storch via swift-dev < > swift-dev@swift.org> wrote: > > I've noticed a mix of pointers (FuncDecl*) and references (TypeChecker&) > in the C++ codebase. Is there a particular reason for this? Perhaps a style > guide? > > Jacob > _______________________________________________ > swift-dev mailing list > swift-dev@swift.org > https://lists.swift.org/mailman/listinfo/swift-dev > > > _______________________________________________ > swift-dev mailing list > swift-dev@swift.org > https://lists.swift.org/mailman/listinfo/swift-dev > > >
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev