This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Don't try to add quotes to already quoted linker directives
ClosedPublic

Authored by mkuper on Dec 29 2014, 2:01 AM.

Details

Summary

If a linker directive is already quoted, don't try to quote it again, otherwise it creates a mess.

This pops up in places like:
#pragma comment(linker,"\"/foo bar'\"")

Diff Detail

Event Timeline

mkuper updated this revision to Diff 17666.Dec 29 2014, 2:01 AM
mkuper retitled this revision from to [COFF] Don't try to add quotes to already quoted linker directives.
mkuper updated this object.
mkuper edited the test plan for this revision. (Show Details)
mkuper added a reviewer: rnk.
mkuper added a subscriber: Unknown Object (MLST).
majnemer added inline comments.
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
989

This would probably be a little nicer as:
if (!Op.startswith("\"") && Op.find(" ") != StringRef::npos)

This way we don't need to hunt for spaces if it starts with a \" sequence.

mkuper added inline comments.Dec 29 2014, 3:32 AM
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
989

Right, noticed that myself after uploading, thanks. :-)

rnk accepted this revision.Dec 30 2014, 9:57 AM
rnk edited edge metadata.

lgtm with David's suggestion

This revision is now accepted and ready to land.Dec 30 2014, 9:57 AM
This revision was automatically updated to reflect the committed changes.