r357985 - [ASTImporter] Fix in ASTImporter::Import_New(const Decl *)

Bjorn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 02:12:32 PDT 2019


Author: bjope
Date: Tue Apr  9 02:12:32 2019
New Revision: 357985

URL: http://llvm.org/viewvc/llvm-project?rev=357985&view=rev
Log:
[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)

Make sure ASTImporter::Import_New(const Decl *) returns
a Expected<const Decl *> and not Expected<Decl *> to
make the clang/unittests/AST/ASTImporterTest.cpp compile
without the warning

 clang/unittests/AST/ASTImporterTest.cpp:117:12: error: no viable conversion from 'Expected<clang::Decl *>' to 'Expected<const clang::Decl *>'
    return Imported;

(I got the above when building with clang 3.6).

Modified:
    cfe/trunk/include/clang/AST/ASTImporter.h

Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=357985&r1=357984&r2=357985&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Tue Apr  9 02:12:32 2019
@@ -215,7 +215,7 @@ class TypeSourceInfo;
     /// \returns The equivalent declaration in the "to" context, or the import
     /// error.
     llvm::Expected<Decl *> Import_New(Decl *FromD);
-    llvm::Expected<Decl *> Import_New(const Decl *FromD) {
+    llvm::Expected<const Decl *> Import_New(const Decl *FromD) {
       return Import_New(const_cast<Decl *>(FromD));
     }
     // FIXME: Remove this version.




More information about the cfe-commits mailing list