[cfe-commits] [PATCH] Prior to fixing bug7505, some minor refactorings: const-correctness, extract method, convert function to method

Douglas Gregor dgregor at apple.com
Wed Dec 1 11:32:23 PST 2010


On Nov 20, 2010, at 7:59 AM, Faisal Vali wrote:

> While working on completing my long overdue patch  (Sorry Doug ;) for
> bug 7505 [http://llvm.org/bugs/show_bug.cgi?id=7505]
> I've felt the need to slightly refactor the code.
> 
> Thus, this is an interim patch (does not fix 7505) and should not
> change the semantics of the existing code.
> 
> It includes the following refactorings:
> 1) Moved NoteAllOverloadCandidates into Sema, next to NoteOverloadCandidate

I like this.

> 2) Made OverloadExpr::find const correct

I'm not too thrilled about this... AST nodes are effectively immutable anyway, so passing them around with pointers-to-const is just unnecessary typing. Although there are a few places where we pass around "const Expr*"'s, most of the time we don't bother with const, and I don't think it's useful to const'ify this code.

> 3) Extracted a function 'GetFunctionTypeSansPtrOrRef' out of the
> quite lengthy ResolveAddressOfOverloadedFunction
>    (I anticipate extracting a few more inline functions, please let
> me know if there is some philosophical or practical
>      reason not to continue to do so :)

Very nice.

Could you submit this patch without the const changes?

	- Doug



More information about the cfe-commits mailing list