[PATCH] D16077: DIBuilder support DI Macro creation

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 04:27:05 PST 2016


aaboud added a comment.

In http://reviews.llvm.org/D16077#325861, @aprantl wrote:

> IIRC DIBuilder has a couple of unit tests (unittests/IR/IRBuilderTest.cpp). Could you add tests for the new functionality?


Done.


================
Comment at: include/llvm/IR/DIBuilder.h:49
@@ -48,2 +48,3 @@
     SmallVector<TrackingMDNodeRef, 4> AllImportedModules;
+    DenseMap<MDNode *, std::vector<Metadata*>> AllMacrosPerParent;
 
----------------
aprantl wrote:
> What are the allowed types of parents?
Added a comment explaining the types.
I still have to use "Metadata *" as "MDTuple::get()" function expect a vector of "Metadata *"!

================
Comment at: include/llvm/IR/DIBuilder.h:124
@@ +123,3 @@
+    /// \param Value      Macro value.
+    DIMacro *createMacro(DIMacroFile *Parent, unsigned LineNumber, bool IsUndef,
+                         StringRef Name, StringRef Value = "");
----------------
aprantl wrote:
> Instead of passing a bool, which leads to call sites like
> /* undef */ true
> would it make sense to have inline convenience wrappers like "createMacroDefine/Undef" or passing in the DW_MACINFO_undef value directly?
Changed the code to pass DW_MACINFO_define and DW_MACINFO_undef.


http://reviews.llvm.org/D16077





More information about the llvm-commits mailing list