This is an archive of the discontinued LLVM Phabricator instance.

Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
ClosedPublic

Authored by dsanders on Jun 10 2015, 11:38 AM.

Details

Summary

This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. In-tree tools will be updated with a
trivial patch when this is committed to avoid breaking -Werror builds.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Depends on D10362.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 27460.Jun 10 2015, 11:38 AM
dsanders retitled this revision from to Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added subscribers: rengolin, Unknown Object (MLST).
rengolin added inline comments.Jun 11 2015, 3:28 AM
lib/MC/MCObjectFileInfo.cpp
757

Can't you just call the argument TT and get rid of this line?

lib/Target/TargetLoweringObjectFile.cpp
47–48

Didn't getTargetTriple return a Triple after your changes? Or is this before that?

tools/dsymutil/DwarfLinker.cpp
531

.str()?

tools/llvm-mc/llvm-mc.cpp
432

.str()?

dsanders added inline comments.Jun 11 2015, 3:47 AM
lib/MC/MCObjectFileInfo.cpp
757

I thought the same thing but doing so causes bugs. The problem is that changing the argument to TT silently shadows MCObjectFileInfo::TT. As a result, MCObjectFileInfo::TT was uninitialized and caused a few test failures.

lib/Target/TargetLoweringObjectFile.cpp
47–48

You're correct, the constructor is unnecessary. I've fixed it in D10382

tools/dsymutil/DwarfLinker.cpp
531

It should be 'TheTriple'. I haven't fixed this one in a later patch so I'll update this one to fix it. Thanks for spotting it.

tools/llvm-mc/llvm-mc.cpp
432

It should be 'TheTriple'. I haven't fixed this one in a later patch so I'll update this one to fix it. Thanks for spotting it.

dsanders added inline comments.Jun 11 2015, 3:51 AM
lib/Target/TargetLoweringObjectFile.cpp
47–48

Sorry, I'm mixing up 'Depends on' and 'Dependencies' in phabricator. The next patch (D10381) makes getTargetTriple() return a Triple.

dsanders updated this revision to Diff 27576.Jun 12 2015, 6:39 AM

Fixed the two redundant constructor calls.
The third is already fixed by a subsequent patch.
The remaining comment would hit the argument shadowing field problem I ran into the other day.

There wasn't a conditional LGTM so I ought to double-check: Ok to commit?

rengolin added inline comments.Jun 12 2015, 10:36 AM
lib/Target/TargetLoweringObjectFile.cpp
47–48

Yeah, it's a bit confusing, but as long as it's right in the end, it's ok.

Maybe not squashing all of it for commit, but I normally squash (or diff master) just to see if the overall changes make sense. If they do, and the split makes sense, I'm ok with it.

rengolin accepted this revision.Jun 12 2015, 10:36 AM
rengolin added a reviewer: rengolin.

LGTM. Thanks!

This revision is now accepted and ready to land.Jun 12 2015, 10:36 AM
This revision was automatically updated to reflect the committed changes.

Committed with a small fix in r239721. It turns out that GetTarget() in llvm-mc can potentially replace the triple and this showed up in one of the Mips EH tests.
Also made the trivial change to clang in the same commit to avoid breaking -Werror builds.