This is an archive of the discontinued LLVM Phabricator instance.

Don't truncate the target triple when initializing clang

Authored by zturner on Jun 24 2014, 3:47 PM.



Don't truncate the target triple when initializing clang.

Target triples support an optional 4th component, the environment. Clang on Windows uses this 4th component to make various decisions when looking for header file includes, so truncating it leads to crashes on Windows when performing simple expression evaluation.

Diff Detail


Event Timeline

zturner updated this revision to Diff 10813.Jun 24 2014, 3:47 PM
zturner retitled this revision from to Don't truncate the target triple when initializing clang.
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added a reviewer: tfiala.
zturner added a subscriber: Unknown Object (MLST).
tfiala edited edge metadata.Jun 26 2014, 9:28 AM

Yep I'm planning on looking at this later today.

Looking at this now.

I'm going to look into why that was truncated in the first place. My guess is at least one other system depends on it not including the environment portion of the triple. We might need to conditionalize it but I'll at least test it as is on Linux and MacOSX.

tfiala added a comment.EditedJun 26 2014, 11:01 AM

It looks like that code came in with r164563:

svn log -r 164563

r164563 | spyffe | 2012-09-24 15:25:51 -0700 (Mon, 24 Sep 2012) | 10 lines

Brought LLDB top-of-tree into sync with LLVM/Clang
top-of-tree. Removed all local patches and

The intent is that fron now on top-of-tree will
always build against LLVM/Clang top-of-tree, and
that problems building will be resolved as they
occur. Stable release branches of LLDB can be
constructed as needed and linked to specific release
branches of LLVM/Clang.

tfiala added a comment.EditedJun 26 2014, 11:15 AM

LGTM - here's how I tested:

Linux x86_64:
(lldb) file /path/to/exe
(lldb) b main.cpp:10
(lldb) run
... at breakpoint ...
(lldb) expr 5*3
// prints result as expected

Same result for MacOSX 10.9.3 with x86_64 MacOS executable.

Let's ping the Apple folks and see if there is some kind of simulator/device that might choke on that, though, before you check this in.

+Greg and Jim, as one of them would probably know.

tfiala accepted this revision.Jun 27 2014, 3:56 PM
tfiala edited edge metadata.
This revision is now accepted and ready to land.Jun 27 2014, 3:56 PM
zturner closed this revision.Jun 27 2014, 4:28 PM
zturner updated this revision to Diff 10952.

Closed by commit rL211968 (authored by @zturner).