[PATCH] D39722: [ASTImporter] Support TypeTraitExpr Importing

Takafumi Kubota via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 19 23:55:09 PST 2017


tk1012 added a comment.

Description of the Sema::BuildTypeTrait()



================
Comment at: lib/AST/ASTImporter.cpp:5631
+  // Value is always false.
+  bool ToValue = (!E->isValueDependent()) ? E->getValue() : false;
+
----------------
According to Sema::BuildTypeTrait() in lib/Sema/SemaExprCXX.cpp, 
if an argument of TypeTraitExpr has a dependent type,
TypeTraitExpr's value (`Result`) is always false.

```
ExprResult Sema::BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc,
....
 bool Dependent = false;
 for (unsigned I = 0, N = Args.size(); I != N; ++I) {
   if (Args[I]->getType()->isDependentType()) {
     Dependent = true;
     break;
   }
 }

 bool Result = false;
 if (!Dependent)
   Result = evaluateTypeTrait(*this, Kind, KWLoc, Args, RParenLoc);

 return TypeTraitExpr::Create(Context, ResultType, KWLoc, Kind, Args,
                              RParenLoc, Result);
...

```


https://reviews.llvm.org/D39722





More information about the cfe-commits mailing list