diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-17 08:39:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-17 08:39:06 +0000 |
commit | a6f037cee1a80d7616f83f7ce0e629eeed19d357 (patch) | |
tree | 125a05a2e45291946a2b81f22d24d39190701992 /clang/lib/Basic/SourceManager.cpp | |
parent | 709322b8dfaae1b5dd9ef04c7ab0361d7d17c633 (diff) | |
download | bcm5719-llvm-a6f037cee1a80d7616f83f7ce0e629eeed19d357.tar.gz bcm5719-llvm-a6f037cee1a80d7616f83f7ce0e629eeed19d357.zip |
add an accessor.
llvm-svn: 64760
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 3f652274b80..2b581bb1ed3 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -857,6 +857,15 @@ SourceManager::getFileCharacteristic(SourceLocation Loc) const { return Entry->FileKind; } +/// Return the filename or buffer identifier of the buffer the location is in. +/// Note that this name does not respect #line directives. Use getPresumedLoc +/// for normal clients. +const char *SourceManager::getBufferName(SourceLocation Loc) const { + if (Loc.isInvalid()) return "<invalid loc>"; + + return getBuffer(getFileID(Loc))->getBufferIdentifier(); +} + /// getPresumedLoc - This method returns the "presumed" location of a /// SourceLocation specifies. A "presumed location" can be modified by #line |