Author: Simon Pilgrim
Date: 2021-01-25T11:35:44Z
New Revision: 9641bd0f87dda34c09c606358bb0cb08a641a4f6

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

LOG: [TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. 
NFCI.

Use const reference to avoid std::string copy - accordingly to the style guide 
we shouldn't be using auto anyway.

Fixes MSVC analyzer warning.

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISelEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp 
b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 8026a3a102be..cd97733ce984 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -933,7 +933,8 @@ class RuleMatcher : public Matcher {
                                 StringRef ParentSymbolicName) {
     std::string ParentName(ParentSymbolicName);
     if (ComplexSubOperands.count(SymbolicName)) {
-      auto RecordedParentName = ComplexSubOperandsParentName[SymbolicName];
+      const std::string &RecordedParentName =
+          ComplexSubOperandsParentName[SymbolicName];
       if (RecordedParentName != ParentName)
         return failedImport("Error: Complex suboperand " + SymbolicName +
                             " referenced by 
diff erent operands: " +


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to