New API for merging debug locations. NFC.

Given two debug locations the function getMergedLocation combines the
locations into a single location (which may be an empty location).
Please see https://reviews.llvm.org/D26256 for the discussion leading
up to this API.

Note the function is currently a stub.  This allows optimisations to
use the API although no location will actually be used.

This is patch 1 out of 8 for D26256.  As suggested by David Blaikie,
each change in D26256 has been broken out into a separate patch.

llvm-svn: 289661
This commit is contained in:
Robert Lougher 2016-12-14 16:14:17 +00:00
parent dcb038d4f2
commit 7bd04e3b2d
1 changed files with 18 additions and 0 deletions

View File

@ -1291,6 +1291,24 @@ public:
/// Returns a new DILocation with updated \p Discriminator.
inline DILocation *cloneWithDiscriminator(unsigned Discriminator) const;
/// When two instructions are combined into a single instruction we also
/// need to combine the original locations into a single location.
///
/// When the locations are the same we can use either location. When they
/// differ, we need a third location which is distinct from either. If
/// they have the same file/line but have a different discriminator we
/// could create a location with a new discriminator. If they are from
/// different files/lines the location is ambiguous and can't be
/// represented in a single line entry. In this case, no location
/// should be set.
///
/// Currently this function is simply a stub, and no location will be
/// used for all cases.
static DILocation *getMergedLocation(const DILocation *LocA,
const DILocation *LocB) {
return nullptr;
}
Metadata *getRawScope() const { return getOperand(0); }
Metadata *getRawInlinedAt() const {
if (getNumOperands() == 2)