summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-14 00:35:42 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-14 00:35:42 +0000
commit843237f5731243b21762adf5bb77da0c4d884df2 (patch)
tree7e320c09ae40d326af6c2f057625297ac1a3ac18 /llvm/lib/Transforms/Utils/AddDiscriminators.cpp
parent4fd839b0da90963ac23edf79cd7e1fdd7f0e2cbc (diff)
downloadbcm5719-llvm-843237f5731243b21762adf5bb77da0c4d884df2.tar.gz
bcm5719-llvm-843237f5731243b21762adf5bb77da0c4d884df2.zip
DebugInfo: Move DILocation::computeNewDiscriminators()
As documented in PR23200 (and the FIXMEs I've added to the code here), this logic is fairly broken: it modifies the `LLVMContext` in a way that affects other modules and cannot be serialized to assembly/bitcode. For now, move it over to `MDLocation::computeNewDiscriminators()` anyway. llvm-svn: 234825
Diffstat (limited to 'llvm/lib/Transforms/Utils/AddDiscriminators.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/AddDiscriminators.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
index 4197e35f267..2cbe93e30aa 100644
--- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
+++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
@@ -195,7 +195,13 @@ bool AddDiscriminators::runOnFunction(Function &F) {
StringRef Filename = FirstDIL.getFilename();
DIScope Scope = FirstDIL.getScope();
DIFile File = Builder.createFile(Filename, Scope.getDirectory());
- unsigned Discriminator = FirstDIL.computeNewDiscriminator(Ctx);
+
+ // FIXME: Calculate the discriminator here, based on local information,
+ // and delete MDLocation::computeNewDiscriminator(). The current
+ // solution gives different results depending on other modules in the
+ // same context. All we really need is to discriminate between
+ // FirstDIL and LastDIL -- a local map would suffice.
+ unsigned Discriminator = FirstDIL->computeNewDiscriminator();
DILexicalBlockFile NewScope =
Builder.createLexicalBlockFile(Scope, File, Discriminator);
DILocation NewDIL =
OpenPOWER on IntegriCloud