[PATCH] D27549: [DebugInfo] Add support for __fp16, float, and double constants.

David Gross via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 15:59:23 PST 2016


dgross added inline comments.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:3765
+    InitExpr =
+        DBuilder.createConstantValueExpression(Init.getFloat().bitcastToAPInt().getZExtValue());
   GV.reset(DBuilder.createGlobalVariable(
----------------
probinson wrote:
> This line exceeds 80 columns.  clang-format is your friend.
Done.  Is clang-format mentioned in any of the documentation that describes the development process?  I might have missed it (not that that's an excuse for a needless violation of the coding guidelines).


================
Comment at: test/CodeGen/debug-info-static-const-fp.c:19
+// CHECK: !4 = distinct !DIGlobalVariable(name: "hVal", scope: !0, file: !1, line: 6, type: !5, isLocal: true, isDefinition: true, expr: !7)
+// CHECK: !7 = !DIExpression(DW_OP_constu, 16502, DW_OP_stack_value)
+// CHECK: !8 = distinct !DIGlobalVariable(name: "fVal", scope: !0, file: !1, line: 8, type: !9, isLocal: true, isDefinition: true, expr: !11)
----------------
probinson wrote:
> Checking for the entire exact line for the variable is a bit fragile.  Really what you want to do is associate the variable with the correct expression, and ignore all the irrelevant details.  Something like this:
> ```
> // CHECK: DIGlobalVariable(name: "hVal", {{.*}} expr: ![[HEXPR:{{[0-9]+}}]]
> // CHECK: ![[HEXPR] = ! DIExpression(DW_OP_constu, 16502, DW_OP_stack_value)
> ```
> And similar pairs for the other variables.  I'd use a different FileCheck variable for each case.
> 
Thanks for the suggestion.  I didn't realize FileCheck had variable support.


https://reviews.llvm.org/D27549





More information about the cfe-commits mailing list