[llvm] [clang] [clang] NFC: Deprecate `FileEntry::getName()` (PR #68157)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 15:11:14 PST 2023


================
@@ -157,6 +157,25 @@
 #define LLVM_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
 #endif
 
+// clang-format off
+#if defined(__clang__) || defined(__GNUC__)
+#define LLVM_IGNORE_DEPRECATIONS_OF_DECLARATIONS_BEGIN                         \
----------------
jansvoboda11 wrote:

Maybe we could have a more generic macro?

```c++
#define DO_PRAGMA(x) _Pragma(#x)
#if defined(__clang__) || defined(__GNUC__)
#define LLVM_DISABLE_WARNING_BEGIN(GCC_FLAG, MSVC_NUMBER) \
  DO_PRAGMA(GCC diagnostic push)                          \
  DO_PRAGMA(GCC diagnostic ignored "-W" GCC_FLAG)
#define LLVM_DISABLE_WARNING_END                          \
  DO_PRAGMA(GCC diagnostic pop)
#elif defined(_MSC_VER)
#define LLVM_DISABLE_WARNING_BEGIN(GCC_FLAG, MSVC_NUMBER) \
  DO_PRAGMA(warning(push))                                \
  DO_PRAGMA(warning(disable: MSVC_NUMBER))
#define LLVM_DISABLE_WARNING_END                          \
  DO_PRAGMA(warning(pop))
#else
#define LLVM_DISABLE_WARNING_BEGIN(GCC_FLAG, MSVC_NUMBER)
#define LLVM_DISABLE_WARNING_END
#endif

LLVM_DISABLE_WARNING_BEGIN("deprecated-declarations", 4996)
EXPECT_EQ("dir/f2.cpp", F2->getFileEntry().getName());
LLVM_DISABLE_WARNING_END
```

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


More information about the cfe-commits mailing list