[AST] Add ClangNode::getLocation(), that returns the clang SourceLocation.

Swift SVN r15808
This commit is contained in:
Argyrios Kyrtzidis
2014-04-02 17:39:08 +00:00
parent 31bab38eb4
commit 41dbe5384b
2 changed files with 13 additions and 0 deletions

View File

@@ -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) {