This will be necessary to allow the global merge pass to attach
multiple debug info metdata nodes to global variables once we reverse
the edge from DIGlobalVariable to GlobalVariable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Couple of small inline comments.
include/llvm/IR/GlobalObject.h | ||
---|---|---|
108 ↗ | (On Diff #57736) | Short comment? |
lib/IR/Metadata.cpp | ||
1159 ↗ | (On Diff #57736) | Why is this check necessary? |
1327 ↗ | (On Diff #57736) | Maybe: if (hasMetadata()) getContext().pImpl->GlobalObjectMetadata[this].get(KindID, MDs); |
1334 ↗ | (On Diff #57736) | Same here |
1338 ↗ | (On Diff #57736) | if (!MD) return; |
1343 ↗ | (On Diff #57736) | redundant |
1382 ↗ | (On Diff #57736) | This condition is redundant since addMetadata will check for a nullptr. |
lib/IR/Verifier.cpp | ||
2002 ↗ | (On Diff #57736) | ++NumDebugAttachments <= 1 can never be <1, right? |
- Address review comments
lib/IR/Metadata.cpp | ||
---|---|---|
1159 ↗ | (On Diff #57736) | It isn't, removed. |
1338 ↗ | (On Diff #57736) | Rethinking this, maybe this function should always expect an non-null MDNode, since unlike setMetadata the intent is always to add an attachment. WDYT? |
1382 ↗ | (On Diff #57736) | See above |
lib/IR/Verifier.cpp | ||
2002 ↗ | (On Diff #57736) | No, changed to == |
lib/IR/LLVMContextImpl.h | ||
---|---|---|
1013 ↗ | (On Diff #57974) | Comment mentioning what happens if the ID is invalid? |
1014 ↗ | (On Diff #57974) | No t sure: should we define a type that inherits from std:pair<unsigned, MDNode &> and defines an operator< or would that be over-engineering? |
1014 ↗ | (On Diff #57974) | Usually, we're calling this method insert(). |
1016 ↗ | (On Diff #57974) | Comment explaining the sorting guarantees on the output? |
lib/IR/Metadata.cpp | ||
1332–1333 ↗ | (On Diff #57974) | Could/should we then change the signature to use MDNode &MD? |
1385 ↗ | (On Diff #57974) | The doxygen comment in the header should probably mention that this only works for singular attachments, though it's kind of obvious from the function signature. |
1388 ↗ | (On Diff #57974) | Please add an assertion message. |
lib/IR/Verifier.cpp | ||
2002 ↗ | (On Diff #57974) | Thanks! I also think I'd be more comfortable with the hoisting the increment onto its own line, given that AssertDI is a macro and all. |
unittests/IR/MetadataTest.cpp | ||
2244 ↗ | (On Diff #57974) | Can you remind me why it is safe to drop this test without replacement? |
- Address review comments
lib/IR/LLVMContextImpl.h | ||
---|---|---|
1014 ↗ | (On Diff #57974) | To me it would be clearer to define the ordering just in getAll. Defining the ordering in an operator< function would imply that two attachments with the same ID are "equal", while at the moment it's clear from reading the code for getAll that that isn't the case. |
lib/IR/Metadata.cpp | ||
1385 ↗ | (On Diff #57974) | From GlobalObject.h: The functions that return an MDNode require that the function have at most a single attachment of the given kind :) But I've split up the doxygen comment for getMetadata into two "blocks" so it's clearer which comments pertain to which functions. |
unittests/IR/MetadataTest.cpp | ||
2244 ↗ | (On Diff #57974) | Its purpose is to test the GlobalObject::dropUnknownMetadata function, which has no non-test users [1], so there's no point in keeping it. |