[llvm] Use DIExpression::foldConstantMath at the result of a Salvaged expression (PR #71721)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 17:25:52 PDT 2024


================
@@ -0,0 +1,81 @@
+//===- llvm/IR/DIExpressionOptimizer.h - Constant folding of DIExpressions --*-
+//C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Declarations for functions to constant fold DIExpressions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IR_DIEXPRESSIONOPTIMIZER_H
+#define LLVM_IR_DIEXPRESSIONOPTIMIZER_H
+
+#include "llvm/IR/DebugInfoMetadata.h"
+
+using namespace llvm;
----------------
MaskRay wrote:

We use `using namespace llvm;` in .cpp files but avoid them in `.h`.

Instead, wrap the declarations in `namespace llvm {`. See neighbor files for convention.

https://github.com/llvm/llvm-project/pull/71721


More information about the llvm-commits mailing list