summaryrefslogtreecommitdiffstats
path: root/lld/include/lld/Core/AliasAtom.h
blob: 22dfca162ec01ad6633bc6aeca66b7dc2df84c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//===- Core/AliasAtom.h - Alias to another Atom ---------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_CORE_ALIAS_ATOM_H_
#define LLD_CORE_ALIAS_ATOM_H_

#include "lld/Core/Atom.h"

#include "llvm/ADT/StringRef.h"

namespace lld {

class AliasAtom : public Atom {
public:
  AliasAtom(StringRef nm, const Atom &target,  Atom::Scope scope)
    : Atom( target.definition()
          , Atom::combineNever
          , scope
          , target.contentType()
          , target.sectionChoice()
          , target.userVisibleName()
          , target.deadStrip()
          , target.isThumb()
          , true
          , target.alignment()
          )
    , _name(nm)
    , _aliasOf(target) {}

  // overrides of Atom
  virtual const File *file() const {
    return _aliasOf.file();
  }

  virtual bool translationUnitSource(StringRef &path) const {
    return _aliasOf.translationUnitSource(path);
  }

  virtual StringRef name() const {
    return _name;
  }

private:
  const StringRef _name;
  const Atom &_aliasOf;
};

} // namespace lld

#endif // LLD_CORE_ALIAS_ATOM_H_
OpenPOWER on IntegriCloud