Skip to content

[NFC] Remove unnecessary copy of Triples #102469

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

Merged
merged 2 commits into from
Aug 8, 2024
Merged

Conversation

abhina-sree
Copy link
Contributor

@abhina-sree abhina-sree commented Aug 8, 2024

Remove unnecessary copy of Triple in ItaniumMangle.cpp, SemaType.cpp

@abhina-sree abhina-sree self-assigned this Aug 8, 2024
@abhina-sree abhina-sree requested a review from nikic August 8, 2024 13:57
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 8, 2024

@llvm/pr-subscribers-clang

Author: Abhina Sree (abhina-sree)

Changes

Remove unnecessary copy of Triple


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

1 Files Affected:

  • (modified) clang/lib/AST/ItaniumMangle.cpp (+1-3)
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index dc317f2a7870b..976670d1efa56 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -2727,8 +2727,6 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
     //   <type> ::= U <OpenCL-addrspace>
     //   <type> ::= U <CUDA-addrspace>
 
-    llvm::Triple Triple = getASTContext().getTargetInfo().getTriple();
-
     SmallString<64> ASString;
     LangAS AS = Quals.getAddressSpace();
 
@@ -2800,7 +2798,7 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
         // For z/OS, there are no special mangling rules applied to the ptr32
         // qualifier. Ex: void foo(int * __ptr32 p) -> _Z3f2Pi. The mangling for
         // "p" is treated the same as a regular integer pointer.
-        if (!Triple.isOSzOS())
+        if (!getASTContext().getTargetInfo().getTriple().isOSzOS())
           ASString = "ptr32_uptr";
         break;
       case LangAS::ptr64:

@nikic
Copy link
Contributor

nikic commented Aug 8, 2024

Could you please also adjust the other use in https://github.com/llvm/llvm-project/pull/101696/files#diff-e0ad0cd86168ae6b1bdbc14d96dce7bd4de45ec1da69b9ac18dacb7adf1e453cR7060?

@abhina-sree abhina-sree changed the title [NFC] Remove unnecessary copy of Triple in ItaniumMangle.cpp [NFC] Remove unnecessary copy of Triples Aug 8, 2024
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abhina-sree abhina-sree merged commit 6b5308b into llvm:main Aug 8, 2024
8 checks passed
@abhina-sree abhina-sree deleted the abhina/nfc branch August 8, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants