Commit Graph

19 Commits

Author SHA1 Message Date
Rui Ueyama 1fe682cf37 Don't return value rather than always returning true.
addInputElement() never fails, and no one checks its return value
except tests. Let's simplify the signature.

llvm-svn: 208109
2014-05-06 17:33:14 +00:00
Rui Ueyama 7cac0f784c Use range-based for loop. No functionality change.
llvm-svn: 205594
2014-04-04 00:59:50 +00:00
Rui Ueyama 8bd093b1e5 Rename getInputGraph() and getNextFile().
Seems getSomething() is more common naming scheme than just a noun
to get something, so renaming these members.

Differential Revision: http://llvm-reviews.chandlerc.com/D3285

llvm-svn: 205589
2014-04-04 00:14:04 +00:00
Rui Ueyama 69fcde8b0a Expand 'auto' that's hard for human to deduce its real type.
llvm-svn: 205564
2014-04-03 20:47:50 +00:00
Rui Ueyama b0e3b66fa5 Remove ordinals from Input Graph elements.
An ordinal is set to each child of Input Graph, but no one actually
uses it. The only piece of code that gets ordinaly values is
sortInputElements in InputGraph.cpp, but it does not actually do
anything -- we assign ordinals in increasing order just before
calling sort, so when sort is called it's already sorted. It's no-op.
We can simply remove it. No functionality change.

Differential Revision: http://llvm-reviews.chandlerc.com/D3270

llvm-svn: 205501
2014-04-03 02:21:44 +00:00
Rui Ueyama edd5c0a9ea Simplify communication between Resolver and Input Graph.
Resolver is sending too much information to Input Graph than Input
Graph actually needs. In order to collect the detailed information,
which wouldn't be consumed by anyone, we have a good amount of code
in Resolver, Input Graph and Input Elements. This patch is to
simplify it. No functionality change.

Specifically, this patch replaces ResolverState enum with a boolean
value. The enum defines many bits to notify the progress about
linking to Input Graph using bit masks, however, what Input Graph
actually does is to compare a given value with 0. The details of
the bit mask is simply being ignored, so the efforts to collect
such data is wasted.

This patch also changes the name of the notification interface from
setResolverState to notifyProgress, to make it sounds more like
message passing style. It's not a setter but something to notify of
an update, so the new name should be more appropriate than before.

Differential Revision: http://llvm-reviews.chandlerc.com/D3267

llvm-svn: 205463
2014-04-02 21:02:44 +00:00
Rui Ueyama eb4b54349d Move nextFile() from LinkingContext to InputGraph.
LinkingContext and InputGraph are unnecessarily entangled. Most linker
input file data, e.g. the vector containing input files, the next index
of the input file, etc. are managed by InputGraph, but only the current
input file is for no obvious reason managed by LinkingContext.

This patch is to move code from LinkingContext to InputGraph to fix it.
It's now clear who's reponsible for managing input file state, which is
InputGraph, and LinkingContext is now free from that responsibility.
It improves the readability as we now have fewer dependencies between
classes. No functionality change.

Differential Revision: http://llvm-reviews.chandlerc.com/D3259

llvm-svn: 205394
2014-04-02 05:03:40 +00:00
Rui Ueyama 5b8be49fed Remove unused enum Position::ANY and third parameter of insertElementAt().
insertElementAt()'s third parameter is not only unused but also ignored
if you pass Position::END. The actual meaning of the parameter was obscure.

Differential Revision: http://llvm-reviews.chandlerc.com/D3256

llvm-svn: 205376
2014-04-01 23:58:17 +00:00
Rui Ueyama ce749af25b Rename insertOneElementAt -> insertElementAt.
insertElementsAt() is removed, so "One" in insertOneElementAt() no longer
make much sense. Rename it for brevity.

llvm-svn: 205372
2014-04-01 23:17:28 +00:00
Rui Ueyama 26eb6c5bc2 Inline empty constructor.
llvm-svn: 205366
2014-04-01 22:11:18 +00:00
Rui Ueyama 5632e26d36 Greatly simplify InputGraph.
InputGraph has too many knobs and controls that are not being used. This
patch is to remove dead code, unused features and a class. There are two
things that worth noting, besides simple dead code removal:

1. ControlNode class is removed. We had it as the base class of Group
class, but it provides no functionality particularly meaningful. We now
have shallower class hierarchy that is easier to understand.

2. InputGraph provides a feature to replace a node with its internal data.
It is being used to "expand" some type of node, such as a Linker Script
node, with its actual files. We used to have two options when replacing
it -- ExpandOnly or ExpandAndReplace. ExpandOnly was to expand it but not
remove the node from the tree. There is no use of that option in the code,
so it was a dead feature.

Differential Revision: http://llvm-reviews.chandlerc.com/D3252

llvm-svn: 205363
2014-04-01 21:55:36 +00:00
Ahmed Charles 13c70b6d4b Replace OwningPtr with std::unique_ptr.
This results in some simplifications to the code where an OwningPtr had to
be used with the previous api and then ownership moved to a unique_ptr for
the rest of lld.

llvm-svn: 203809
2014-03-13 16:20:38 +00:00
Ahmed Charles d779459f21 [C++11] Add #include's for OwningPtr.
Allows removing #include's in LLVM while switching to std::unique_ptr.

llvm-svn: 202679
2014-03-03 07:20:05 +00:00
Rafael Espindola d28918b289 Use getError instead of the error_code operator.
llvm-svn: 198797
2014-01-08 22:00:09 +00:00
Joey Gouly 6eb02ef568 Make SimpleFileNode inherit from FileNode.
This removes a lot of duplicated code.

llvm-svn: 197751
2013-12-19 23:39:02 +00:00
Rui Ueyama 2f47acfd6a Make anonymous namespace as small as possible.
Use of static is recommended by the style guide.

llvm-svn: 196877
2013-12-10 05:15:38 +00:00
Shankar Easwaran 67e98f5197 [InputGraph] Add capability to process Hidden nodes.
Hidden nodes could be a result of expansion, where a flavor might decide to keep
the node that we want to expand but discard it from being processed by the
resolver.

Verifies with unittests.

llvm-svn: 195516
2013-11-22 23:19:53 +00:00
Shankar Easwaran 3ac09bcb8f [InputGraph] Expand InputGraph nodes.
Flavors may like to expand InputGraph nodes, when a filenode after parsing
results in more elements. One such example is while parsing GNU linker scripts.
The linker scripts after parsing would result in a lot of filenodes and probably
controlnodes too.

Adds unittests to verify functionality.

llvm-svn: 195515
2013-11-22 23:08:24 +00:00
Michael J. Spencer bb0919968b Move InputGraph from Driver to Core. LinkingContext depends on it.
llvm-svn: 194641
2013-11-14 00:51:33 +00:00