[CrossTU] Add a function to retrieve original source location.
authorBalazs Keri <1.int32@gmail.com>
Thu, 18 Jul 2019 15:23:10 +0000 (15:23 +0000)
committerBalazs Keri <1.int32@gmail.com>
Thu, 18 Jul 2019 15:23:10 +0000 (15:23 +0000)
commitd2c576110ef52da573f6dafd5ef268bde5ef5999
treeb6a9e808064254e8cebbc49eecba5617b307142d
parent5de0c85e88bea9a8cf312c93d9276f13d68af476
[CrossTU] Add a function to retrieve original source location.

Summary:
A new function will be added to get the original SourceLocation
for a SourceLocation that was imported as result of getCrossTUDefinition.
The returned SourceLocation is in the context of the (original)
SourceManager for the original source file. Additionally the
ASTUnit object for that source file is returned. This is needed
to get a SourceManager to operate on with the returned source location.

The new function works if multiple different source files are loaded
with the same CrossTU context.

This patch can be treated as part of a bigger change that is needed to
improve macro expansion handliong at plist generation.

Reviewers: martong, shafik, a_sidorin, xazax.hun

Reviewed By: martong

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64554

llvm-svn: 366449
clang/include/clang/AST/ASTImporter.h
clang/include/clang/AST/ASTImporterSharedState.h
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/lib/AST/ASTImporter.cpp
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/unittests/CrossTU/CrossTranslationUnitTest.cpp