martong marked 3 inline comments as done.
martong added inline comments.

================
Comment at: lib/AST/ASTImporter.cpp:1441
+  To->setInit(ToInit);
+  if (From->isInitKnownICE()) {
+    EvaluatedStmt *Eval = To->ensureEvaluatedStmt();
----------------
a_sidorin wrote:
> I see that this is only a code move but I realized that ASTReader and 
> ASTImporter handle this case differently. ASTReader code says:
> 
> ```
>     if (Val > 1) { // IsInitKnownICE = 1, IsInitNotICE = 2, IsInitICE = 3
>       EvaluatedStmt *Eval = VD->ensureEvaluatedStmt();
>       Eval->CheckedICE = true;
>       Eval->IsICE = Val == 3;
>     }
> ```
> but ASTimporter sets these bits only if `isInitKnownICE()` is `true`. This 
> looks strange.
The comment in ASTReader seems to be wrong and misleading.
I checked the correspondent code in ASTWriter:
```
    Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2));
```
Thus, the comment in ASTReader should be:
```
if (Val > 1) { // IsInitNOTKnownICE = 1, IsInitNotICE = 2, IsInitICE = 3
```
So, `Val > 1` means that the original init expression written by the ASTWriter 
had the ICE-ness already determined.
Thus the ASTImporter code seems correct to me. 


Repository:
  rC Clang

https://reviews.llvm.org/D51597



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to