[PATCH] D65064: [CrossTU] Add a function to retrieve original source location.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 05:46:22 PDT 2019
balazske updated this revision to Diff 211059.
balazske marked an inline comment as done.
balazske added a comment.
Removed ASTImporter from "callback" function.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65064/new/
https://reviews.llvm.org/D65064
Files:
clang/include/clang/AST/ASTImporter.h
clang/lib/AST/ASTImporter.cpp
clang/lib/CrossTU/CrossTranslationUnit.cpp
Index: clang/lib/CrossTU/CrossTranslationUnit.cpp
===================================================================
--- clang/lib/CrossTU/CrossTranslationUnit.cpp
+++ clang/lib/CrossTU/CrossTranslationUnit.cpp
@@ -472,12 +472,11 @@
ASTImporter *NewImporter = new ASTImporter(
Context, Context.getSourceManager().getFileManager(), From,
From.getSourceManager().getFileManager(), false, ImporterSharedSt);
- NewImporter->setFileIDImportHandler(
- [this, Unit](FileID ToID, FileID FromID, ASTImporter &Importer) {
- assert(ImportedFileIDs.find(ToID) == ImportedFileIDs.end() &&
- "FileID already imported, should not happen.");
- ImportedFileIDs[ToID] = std::make_pair(FromID, Unit);
- });
+ NewImporter->setFileIDImportHandler([this, Unit](FileID ToID, FileID FromID) {
+ assert(ImportedFileIDs.find(ToID) == ImportedFileIDs.end() &&
+ "FileID already imported, should not happen.");
+ ImportedFileIDs[ToID] = std::make_pair(FromID, Unit);
+ });
ASTUnitImporterMap[From.getTranslationUnitDecl()].reset(NewImporter);
return *NewImporter;
}
Index: clang/lib/AST/ASTImporter.cpp
===================================================================
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -8423,7 +8423,7 @@
ImportedFileIDs[FromID] = ToID;
if (FileIDImportHandler)
- FileIDImportHandler(ToID, FromID, *this);
+ FileIDImportHandler(ToID, FromID);
return ToID;
}
Index: clang/include/clang/AST/ASTImporter.h
===================================================================
--- clang/include/clang/AST/ASTImporter.h
+++ clang/include/clang/AST/ASTImporter.h
@@ -87,8 +87,8 @@
using NonEquivalentDeclSet = llvm::DenseSet<std::pair<Decl *, Decl *>>;
using ImportedCXXBaseSpecifierMap =
llvm::DenseMap<const CXXBaseSpecifier *, CXXBaseSpecifier *>;
- using FileIDImportHandlerType = std::function<void(
- FileID /*ToID*/, FileID /*FromID*/, ASTImporter & /*Importer*/)>;
+ using FileIDImportHandlerType =
+ std::function<void(FileID /*ToID*/, FileID /*FromID*/)>;
// An ImportPath is the list of the AST nodes which we visit during an
// Import call.
@@ -317,7 +317,7 @@
/// Set a callback function for FileID import handling.
/// The function is invoked when a FileID is imported from the From context.
/// The imported FileID in the To context and the original FileID in the
- /// From context, and the ASTImporter itself are passed to it.
+ /// From context is passed to it.
void setFileIDImportHandler(FileIDImportHandlerType H) {
FileIDImportHandler = H;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65064.211059.patch
Type: text/x-patch
Size: 2675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190722/9c92050e/attachment-0001.bin>
More information about the cfe-commits
mailing list