[llvm] r289661 - New API for merging debug locations. NFC.

Robert Lougher via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 08:14:17 PST 2016


Author: rlougher
Date: Wed Dec 14 10:14:17 2016
New Revision: 289661

URL: http://llvm.org/viewvc/llvm-project?rev=289661&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/IR/DebugInfoMetadata.h

Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=289661&r1=289660&r2=289661&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Wed Dec 14 10:14:17 2016
@@ -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)




More information about the llvm-commits mailing list