Add assignment operator to InputSectDesc::Spec#1562
Add assignment operator to InputSectDesc::Spec#1562Rachit Mehta (rachitmeht) wants to merge 5 commits into
Conversation
Parth (parth-07)
left a comment
There was a problem hiding this comment.
Can you please add the 'Resolves #' directive in the commit message and the PR description so that the issue automatically gets closed once the PR is merged?
There was a problem hiding this comment.
| *this = Spec; |
e41f3a1 to
eac65bb
Compare
Parth (parth-07)
left a comment
There was a problem hiding this comment.
Rachit Mehta (@rachitmeht) The commit references a wrong issue: #1300. This patch is not fixing this issue. Can you please update the commit message and the PR description as well with the correct 'Resolves' message.
| } | ||
|
|
||
| Spec &operator=(const Spec &RHS) { | ||
| if (this != &RHS) { |
There was a problem hiding this comment.
early return ?
There was a problem hiding this comment.
updated with early return
| this->WildcardSectionPattern = Spec.WildcardSectionPattern; | ||
| this->InputIsArchive = Spec.InputIsArchive; | ||
| this->ExcludeFilesRule = Spec.ExcludeFilesRule; | ||
| *this = Spec; |
There was a problem hiding this comment.
do we need this et all ?
There was a problem hiding this comment.
Do you mean if we need the InputSectDesc::initialize function at all?
This change adds a copy assignment operator to InputSectDesc::Spec, allowing for more concise and readable code when copying Spec objects. Previously, code had to manually assign each of the 5 member fields: MSpec.WildcardFilePattern = source.WildcardFilePattern; MSpec.WildcardSectionPattern = source.WildcardSectionPattern; MSpec.InputArchiveMember = source.InputArchiveMember; MSpec.InputIsArchive = source.InputIsArchive; MSpec.ExcludeFilesRule = source.ExcludeFilesRule; With this change, the same operation can be expressed as: MSpec = source; This improves maintainability by centralizing the copy logic in one place, making it easier to add new fields in the future. The operator includes proper self-assignment protection. The initialize(const Spec &) method has been updated to delegate to the new operator= to eliminate code duplication. Changes: - Added Spec::operator= to InputSectDesc.h (after line 93) - Updated initialize(const Spec &) to use operator= (line 107) - Updated RuleContainer.cpp to use the new operator (line 43) - Resolved FIXME comment in RuleContainer.cpp:43 Resolves qualcomm#1302 Signed-off-by: Rachit Mehta <[email protected]>
This commit fixes the --reproduce functionality so that command-line
shared libraries specified using a sysroot marker (e.g. =/lib.so)
works correctly.
The root cause was incorrect mapped path for non-namespec shared
libraries when the shared library was specified using the sysroot marker
(=). For a shared library, '=/lib1.so', the mapped path was the expanded
path '${SYSROOT}/lib1.so'. However, response.txt file contains the
lib1.so entry using 'rewritePath('=lib1.so')'. The rewritePath calls
returns 'lib1.so' as fallback because there is no entry for '=lib1.so'.
This is because '=lib1.so' entry was never added because we used incorrect
mapped path for non-namespec shared libraries (decoratedPath instead of the
command-line name used for everything else).
Resolves qualcomm#972
Signed-off-by: Parth Arora <[email protected]>
Signed-off-by: Parth <[email protected]>
Refactor Spec::operator= to use a guard-clause / early return on self-assignment instead of wrapping the body in an if-block. This lowers nesting and matches the style of the adjacent operator==. No functional change. Signed-off-by: Rachit Mehta <[email protected]>
b5a3951 to
e5c3441
Compare
This change adds a copy assignment operator to InputSectDesc::Spec,
Previously, code had to manually assign each of the 5 member fields:
MSpec.WildcardFilePattern = source.WildcardFilePattern;
MSpec.WildcardSectionPattern = source.WildcardSectionPattern;
MSpec.InputArchiveMember = source.InputArchiveMember;
MSpec.InputIsArchive = source.InputIsArchive;
MSpec.ExcludeFilesRule = source.ExcludeFilesRule;
With this change, the same operation can be expressed as:
MSpec = source;
Changes:
Resolves #1302