Skip to content

Revert "[NFC] Don't recompute type name" #119907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

IanWood1
Copy link
Contributor

@IanWood1 IanWood1 commented Dec 13, 2024

The change breaks windows builds because StringRef Key = "getTypeName<"; wasn't updated to getTypeNameImpl

StringRef Key = "getTypeName<";

Reverts #119631

@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2024

@llvm/pr-subscribers-llvm-support

Author: Ian Wood (IanWood1)

Changes

Breaks windows builds because StringRef Key = "getTypeName&lt;"; wasn't updated to getTypeNameImpl's name

Reverts llvm/llvm-project#119631


Full diff: https://github.com/llvm/llvm-project/pull/119907.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Support/TypeName.h (+12-18)
diff --git a/llvm/include/llvm/Support/TypeName.h b/llvm/include/llvm/Support/TypeName.h
index 61ba09c2163047..9547e76a7fa79b 100644
--- a/llvm/include/llvm/Support/TypeName.h
+++ b/llvm/include/llvm/Support/TypeName.h
@@ -13,8 +13,18 @@
 
 namespace llvm {
 
-namespace detail {
-template <typename DesiredTypeName> inline StringRef getTypeNameImpl() {
+/// We provide a function which tries to compute the (demangled) name of a type
+/// statically.
+///
+/// This routine may fail on some platforms or for particularly unusual types.
+/// Do not use it for anything other than logging and debugging aids. It isn't
+/// portable or dependendable in any real sense.
+///
+/// The returned StringRef will point into a static storage duration string.
+/// However, it may not be null terminated and may be some strangely aligned
+/// inner substring of a larger string.
+template <typename DesiredTypeName>
+inline StringRef getTypeName() {
 #if defined(__clang__) || defined(__GNUC__)
   StringRef Name = __PRETTY_FUNCTION__;
 
@@ -48,22 +58,6 @@ template <typename DesiredTypeName> inline StringRef getTypeNameImpl() {
   return "UNKNOWN_TYPE";
 #endif
 }
-} // namespace detail
-
-/// We provide a function which tries to compute the (demangled) name of a type
-/// statically.
-///
-/// This routine may fail on some platforms or for particularly unusual types.
-/// Do not use it for anything other than logging and debugging aids. It isn't
-/// portable or dependendable in any real sense.
-///
-/// The returned StringRef will point into a static storage duration string.
-/// However, it may not be null terminated and may be some strangely aligned
-/// inner substring of a larger string.
-template <typename DesiredTypeName> inline StringRef getTypeName() {
-  static StringRef Name = detail::getTypeNameImpl<DesiredTypeName>();
-  return Name;
-}
 
 } // namespace llvm
 

Copy link

github-actions bot commented Dec 13, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@IanWood1
Copy link
Contributor Author

needed to reformat since the formatting in this file was out of date before my change

@IanWood1
Copy link
Contributor Author

I also opened a PR to fix the suspected failure #119910

@IanWood1 IanWood1 closed this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants