From f05b4c408581f087e250e5f85d36c41177ac7acd Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Thu, 29 Jan 2026 08:03:22 -0800 Subject: [PATCH] [NFC][LLVM] Fix macro redefinition warning in Extensions.cpp (#178555) Also add missing file header and fixed code to used nested namespace for definining the anchor function. --- llvm/lib/Extensions/Extensions.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Extensions/Extensions.cpp b/llvm/lib/Extensions/Extensions.cpp index 3e9f76d12308..2f7401980d0b 100644 --- a/llvm/lib/Extensions/Extensions.cpp +++ b/llvm/lib/Extensions/Extensions.cpp @@ -1,15 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Anchor for pass plugins. +// +//===----------------------------------------------------------------------===// + #include "llvm/Plugins/PassPlugin.h" + #define HANDLE_EXTENSION(Ext) \ llvm::PassPluginLibraryInfo get##Ext##PluginInfo(); #include "llvm/Support/Extension.def" +#undef HANDLE_EXTENSION - -namespace llvm { - namespace details { - void extensions_anchor() { +namespace llvm::details { +void extensions_anchor() { #define HANDLE_EXTENSION(Ext) \ get##Ext##PluginInfo(); #include "llvm/Support/Extension.def" - } - } } +} // namespace llvm::details