Commit 31598ae
committed
Initialize
This is a followup of [a comment](https://github.com/carbon-language/carbon-lang/pull/5062/files/89e56d51858bcc18d4242d4e5c9ee0e7496d887e#r1979993815) in carbon-language#5062.
Change `File::cpp_ast()` to be `const` while keeping it returning a non-const pointer to `clang::ASTUnit`.
This makes the fact we use [Clang with lack of const correctness](llvm/llvm-project#130096 (comment)) explicit.
Alternatives:
* Change `ASTUnit::getASTContext() const` to return a non-const `ASTContext`. [Rejected due to weakening const correctness](llvm/llvm-project#130096).
* Change `createMangleContext()` to be `const`. Tried that and it seems like it relies heavily on non const API.
* Change Clang `MangleContext::mangleName()` to `const`.
* Use `const_cast` on `ASTContext` when calling `createMangleContext()`.cpp_mangle_context_ in Mangler's constructor1 parent b3be298 commit 31598ae
3 files changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
172 | 168 | | |
173 | 169 | | |
174 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
0 commit comments