r188991 - Constify more uses of ASTContext&. No functional change.

John McCall rjmccall at apple.com
Thu Aug 22 17:41:56 PDT 2013


On Aug 22, 2013, at 12:09 AM, Craig Topper <craig.topper at gmail.com> wrote:
> Author: ctopper
> Date: Thu Aug 22 02:09:37 2013
> New Revision: 188991
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=188991&view=rev
> Log:
> Constify more uses of ASTContext&. No functional change.

Is this actually useful?  Are there interesting bugs we can catch by
distinguishing a const vs. a non-const ASTContext?

I mean, having const AST nodes makes sense inasmuch as the AST is not
fully immutable after construction and it’s useful to record that consumers
are not supposed to modify the AST.  But who actually cares about having
a const ASTContext?

Because if it’s not catching real bugs, it’s just adding a ton of noise to the
code, and we should just say that you always have a non-const ASTContext
the same way that you always pass around non-const llvm::Type*s.

John.



More information about the cfe-commits mailing list