[PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 05:19:44 PDT 2019
martong marked an inline comment as done.
martong added inline comments.
================
Comment at: clang/include/clang/AST/ASTImporter.h:203
/// context, or the import error.
- llvm::Expected<TypeSourceInfo *> Import_New(TypeSourceInfo *FromTSI);
- // FIXME: Remove this version.
- TypeSourceInfo *Import(TypeSourceInfo *FromTSI);
+ llvm::Expected<TypeSourceInfo *> Import(TypeSourceInfo *FromTSI);
----------------
aprantl wrote:
> Wouldn't it make more sense to return `Expected<TypeSourceInfo &>`?
That would not be consistent with the other changes. In this patch we change the signature of each functions similarly:
>From `T foo(...)` to `Expected<T> foo(...)`.
Also, `TypeSourceInfo` factory functions in `ASTContext` do return with a pointer. For example:
```
TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const;
/// Allocate a TypeSourceInfo where all locations have been
/// initialized to a given location, which defaults to the empty
/// location.
TypeSourceInfo *
getTrivialTypeSourceInfo(QualType T,
SourceLocation Loc = SourceLocation()) const;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61438/new/
https://reviews.llvm.org/D61438
More information about the cfe-commits
mailing list