[llvm] ee267b1 - [IR] DIBuilder::createEnumerator - pass APSInt by const reference
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 25 03:58:24 PDT 2021
Author: Simon Pilgrim
Date: 2021-09-25T11:58:06+01:00
New Revision: ee267b1c7c0147925af8ca4c9d694d7c658b5fbd
URL: https://github.com/llvm/llvm-project/commit/ee267b1c7c0147925af8ca4c9d694d7c658b5fbd
DIFF: https://github.com/llvm/llvm-project/commit/ee267b1c7c0147925af8ca4c9d694d7c658b5fbd.diff
LOG: [IR] DIBuilder::createEnumerator - pass APSInt by const reference
Avoid unnecessary copy by value.
Added:
Modified:
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/IR/DIBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 1ce0165c251d0..28c70877aa2e8 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -181,7 +181,7 @@ namespace llvm {
DIFile *File);
/// Create a single enumerator value.
- DIEnumerator *createEnumerator(StringRef Name, APSInt Value);
+ DIEnumerator *createEnumerator(StringRef Name, const APSInt &Value);
DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
bool IsUnsigned = false);
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index c380936d2f661..8ff4c2182d2df 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -254,7 +254,7 @@ DIEnumerator *DIBuilder::createEnumerator(StringRef Name, uint64_t Val,
Name);
}
-DIEnumerator *DIBuilder::createEnumerator(StringRef Name, APSInt Value) {
+DIEnumerator *DIBuilder::createEnumerator(StringRef Name, const APSInt &Value) {
assert(!Name.empty() && "Unable to create enumerator without name");
return DIEnumerator::get(VMContext, APInt(Value), Value.isUnsigned(), Name);
}
More information about the llvm-commits
mailing list