[llvm] d49bc5e - [llvm][MemProf] Correct position of LLVM_ABI macro in computeFrameHistogram

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 06:17:35 PDT 2025


Author: David Spickett
Date: 2025-06-12T13:17:24Z
New Revision: d49bc5e621c8931679b232fa28abfc89a171105e

URL: https://github.com/llvm/llvm-project/commit/d49bc5e621c8931679b232fa28abfc89a171105e
DIFF: https://github.com/llvm/llvm-project/commit/d49bc5e621c8931679b232fa28abfc89a171105e.diff

LOG: [llvm][MemProf] Correct position of LLVM_ABI macro in computeFrameHistogram

The previous placement resulted in this warning when using g++-13:
/home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:120:43: warning: attribute ignored [-Wattributes]
  120 | #define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]]
      |                                           ^
/home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:213:18: note: in expansion of macro ‘LLVM_ATTRIBUTE_VISIBILITY_DEFAULT’
  213 | #define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/david.spickett/llvm-project/llvm/lib/ProfileData/MemProfRadixTree.cpp:245:5: note: in expansion of macro ‘LLVM_ABI’
  245 |     LLVM_ABI computeFrameHistogram<FrameId>(
      |     ^~~~~~~~
/home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:120:43: note: an attribute that appertains to a type-specifier is ignored
  120 | #define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]]
      |                                           ^

According to the interface guide, that macro should go before the return
type to be effective.

https://llvm.org/docs/InterfaceExportAnnotations.html#specialized-template-functions

Added: 
    

Modified: 
    llvm/lib/ProfileData/MemProfRadixTree.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/MemProfRadixTree.cpp b/llvm/lib/ProfileData/MemProfRadixTree.cpp
index ea9f5bd25534c..c0672eb6da282 100644
--- a/llvm/lib/ProfileData/MemProfRadixTree.cpp
+++ b/llvm/lib/ProfileData/MemProfRadixTree.cpp
@@ -241,13 +241,13 @@ computeFrameHistogram(llvm::MapVector<CallStackId, llvm::SmallVector<FrameIdTy>>
 }
 
 // Explicitly instantiate function with the utilized FrameIdTy.
-template llvm::DenseMap<FrameId, FrameStat>
-    LLVM_ABI computeFrameHistogram<FrameId>(
-        llvm::MapVector<CallStackId, llvm::SmallVector<FrameId>>
-            &MemProfCallStackData);
-template llvm::DenseMap<LinearFrameId, FrameStat>
-    LLVM_ABI computeFrameHistogram<LinearFrameId>(
-        llvm::MapVector<CallStackId, llvm::SmallVector<LinearFrameId>>
-            &MemProfCallStackData);
+template LLVM_ABI llvm::DenseMap<FrameId, FrameStat>
+computeFrameHistogram<FrameId>(
+    llvm::MapVector<CallStackId, llvm::SmallVector<FrameId>>
+        &MemProfCallStackData);
+template LLVM_ABI llvm::DenseMap<LinearFrameId, FrameStat>
+computeFrameHistogram<LinearFrameId>(
+    llvm::MapVector<CallStackId, llvm::SmallVector<LinearFrameId>>
+        &MemProfCallStackData);
 } // namespace memprof
 } // namespace llvm


        


More information about the llvm-commits mailing list