@@ -1331,13 +1331,13 @@ class SuperRefExpr : public Expr {
1331
1331
}
1332
1332
};
1333
1333
1334
- // / A reference to a type in expression context, spelled out as a TypeLoc .
1334
+ // / A reference to a type in expression context.
1335
1335
// /
1336
- // / The type of this expression is always \c MetaTypeType .
1336
+ // / The type of this expression is always \c MetatypeType .
1337
1337
class TypeExpr : public Expr {
1338
1338
TypeRepr *Repr;
1339
1339
public:
1340
- // Create a TypeExpr with location information .
1340
+ // / Create a \c TypeExpr from a parsed \c TypeRepr .
1341
1341
TypeExpr (TypeRepr *Ty);
1342
1342
1343
1343
// / Retrieves the corresponding instance type of the type referenced by this
@@ -1348,21 +1348,47 @@ class TypeExpr : public Expr {
1348
1348
// / resulting instance type is \c ErrorType.
1349
1349
Type getInstanceType () const ;
1350
1350
1351
- // Create an implicit TypeExpr, which has no location information.
1351
+ public:
1352
+ // / Create an implicit \c TypeExpr.
1353
+ // /
1354
+ // / The given type is required to be non-null and must be not be
1355
+ // / a \c MetatypeType as this function will wrap the given type in one.
1356
+ // /
1357
+ // / FIXME: This behavior is bizarre.
1352
1358
static TypeExpr *createImplicit (Type Ty, ASTContext &C);
1353
1359
1354
- // Create an implicit TypeExpr, with location information even though it
1355
- // shouldn't have one. This is presently used to work around other location
1356
- // processing bugs. If you have an implicit location, use createImplicit.
1360
+ // / Create an implicit \c TypeExpr that has artificial
1361
+ // / location information attached.
1362
+ // /
1363
+ // / The given type is required to be non-null and must be not be
1364
+ // / a \c MetatypeType as this function will wrap the given type in one.
1365
+ // /
1366
+ // / FIXME: This behavior is bizarre.
1367
+ // /
1368
+ // / Due to limitations in the modeling of certain AST elements, implicit
1369
+ // / \c TypeExpr nodes are often the only source of location information the
1370
+ // / expression checker has when it comes time to diagnose an error.
1357
1371
static TypeExpr *createImplicitHack (SourceLoc Loc, Type Ty, ASTContext &C);
1358
1372
1359
-
1360
- // / Create a TypeExpr for a TypeDecl at the specified location.
1361
- static TypeExpr *createForDecl (DeclNameLoc Loc, TypeDecl *D, DeclContext *DC);
1362
-
1373
+ // / Create an implicit \c TypeExpr for a given \c TypeDecl at the specified location.
1374
+ // /
1375
+ // / The given type is required to be non-null and must be not be
1376
+ // / a \c MetatypeType as this function will wrap the given type in one.
1377
+ // /
1378
+ // / FIXME: This behavior is bizarre.
1379
+ // /
1380
+ // / Unlike the non-implicit case, the given location is not required to be
1381
+ // / valid.
1363
1382
static TypeExpr *createImplicitForDecl (DeclNameLoc Loc, TypeDecl *D,
1364
1383
DeclContext *DC, Type ty);
1365
1384
1385
+ public:
1386
+ // / Create a \c TypeExpr for a given \c TypeDecl at the specified location.
1387
+ // /
1388
+ // / The given location must be valid. If it is not, you must use
1389
+ // / \c TypeExpr::createImplicitForDecl instead.
1390
+ static TypeExpr *createForDecl (DeclNameLoc Loc, TypeDecl *D, DeclContext *DC);
1391
+
1366
1392
// / Create a TypeExpr for a member TypeDecl of the given parent TypeDecl.
1367
1393
static TypeExpr *createForMemberDecl (DeclNameLoc ParentNameLoc,
1368
1394
TypeDecl *Parent,
0 commit comments