mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Add ClangNode::getLocation(), that returns the clang SourceLocation.
Swift SVN r15808
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "swift/AST/LazyResolver.h"
|
||||
#include "swift/AST/Mangle.h"
|
||||
#include "swift/AST/TypeLoc.h"
|
||||
#include "clang/Lex/MacroInfo.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "swift/Basic/Range.h"
|
||||
@@ -34,6 +35,15 @@
|
||||
|
||||
using namespace swift;
|
||||
|
||||
clang::SourceLocation ClangNode::getLocation() const {
|
||||
if (auto D = getAsDecl())
|
||||
return D->getLocation();
|
||||
if (auto M = getAsMacro())
|
||||
return M->getDefinitionLoc();
|
||||
|
||||
return clang::SourceLocation();
|
||||
}
|
||||
|
||||
// Only allow allocation of Decls using the allocator in ASTContext.
|
||||
void *Decl::operator new(size_t Bytes, ASTContext &C,
|
||||
unsigned Alignment) {
|
||||
|
||||
Reference in New Issue
Block a user