OSDN Git Service

MC: Don't access the filesystem in MCContext's constructor
authorJustin Bogner <mail@justinbogner.com>
Tue, 22 Mar 2016 22:24:29 +0000 (22:24 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 22 Mar 2016 22:24:29 +0000 (22:24 +0000)
commit6d476e60b27298e0595bf21de49a798ed33eda98
treeedb447ff8a323f58b182f8330267481ed5f6706f
parentf7ed58465875ac258b1f8a69778a8d1ae9915818
MC: Don't access the filesystem in MCContext's constructor

MCContext shouldn't be accessing the filesystem - that's a gross
layering violation and makes it awkward to use as a library or in a
daemon where it may not even be allowed filesystem access.

The CWD lookup here is normally redundant anyway, since the calling
context either also looks up the CWD or sets this to something more
specific. Here, we fix up the one caller that doesn't already set up a
debug compilation dir and make it clear that the responsibility for
such set up is in the users of MCContext.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264109 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCContext.h
lib/MC/MCContext.cpp
tools/llvm-mc/llvm-mc.cpp