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
Event Timeline
Couple of small inline comments.
include/llvm/IR/GlobalObject.h | ||
---|---|---|
114–115 | Short comment? | |
lib/IR/Metadata.cpp | ||
1159 | Why is this check necessary? | |
1322 | Maybe: if (hasMetadata()) getContext().pImpl->GlobalObjectMetadata[this].get(KindID, MDs); | |
1328 | Same here | |
1332–1333 | if (!MD) return; | |
1336–1337 | redundant | |
1375 | This condition is redundant since addMetadata will check for a nullptr. | |
lib/IR/Verifier.cpp | ||
2002 | ++NumDebugAttachments <= 1 can never be <1, right? |
lib/IR/LLVMContextImpl.h | ||
---|---|---|
1013 | Comment mentioning what happens if the ID is invalid? | |
1014 | 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 | Usually, we're calling this method insert(). | |
1016 | Comment explaining the sorting guarantees on the output? | |
lib/IR/Metadata.cpp | ||
1332–1335 | Could/should we then change the signature to use MDNode &MD? | |
1383–1389 | 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. | |
1386 | Please add an assertion message. | |
lib/IR/Verifier.cpp | ||
2002 | 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–2245 | Can you remind me why it is safe to drop this test without replacement? |
- Address review comments
lib/IR/LLVMContextImpl.h | ||
---|---|---|
1014 | 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 | ||
1383–1389 | 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–2245 | Its purpose is to test the GlobalObject::dropUnknownMetadata function, which has no non-test users [1], so there's no point in keeping it. |
Short comment?