File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 18
18
19
19
#ifndef SWIFT_BASIC_LOCATED_H
20
20
#define SWIFT_BASIC_LOCATED_H
21
+ #include " swift/Basic/Debug.h"
22
+ #include " swift/Basic/LLVM.h"
21
23
#include " swift/Basic/SourceLoc.h"
22
24
23
25
namespace swift {
@@ -41,11 +43,15 @@ struct Located {
41
43
42
44
Located (T Item, SourceLoc loc): Item(Item), Loc(loc) {}
43
45
46
+ SWIFT_DEBUG_DUMP;
47
+ void dump (raw_ostream &os) const ;
48
+
44
49
template <typename U>
45
50
friend bool operator ==(const Located<U>& lhs, const Located<U>& rhs) {
46
51
return lhs.Item == rhs.Item && lhs.Loc == rhs.Loc ;
47
52
}
48
53
};
49
- }
54
+
55
+ } // end namespace swift
50
56
51
57
#endif // SWIFT_BASIC_LOCATED_H
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ add_swift_host_library(swiftBasic STATIC
77
77
JSONSerialization.cpp
78
78
LangOptions.cpp
79
79
LLVMContext.cpp
80
+ Located.cpp
80
81
Mangler.cpp
81
82
OutputFileMap.cpp
82
83
Platform.cpp
Original file line number Diff line number Diff line change
1
+ // ===--- Located.cpp - Source Location and Associated Value ----------*- C++ -*-===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2019 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ #include " llvm/Support/raw_ostream.h"
12
+ #include " swift/Basic/Located.h"
13
+
14
+ using namespace swift ;
15
+
16
+ template <typename T>
17
+ void Located<T>::dump() const {
18
+ dump (llvm::errs ());
19
+ }
20
+
21
+ template <typename T>
22
+ void Located<T>::dump(raw_ostream &os) const {
23
+ os << Loc << " " << Item;
24
+ }
You can’t perform that action at this time.
0 commit comments