aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceManager.h
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-10 02:57:03 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-10 02:57:03 +0000
commitaa48fe80a1b2000809900a437f0819d929793002 (patch)
tree0da14e6488b80bd660701f222537ff9143ee4794 /include/clang/Basic/SourceManager.h
parent4313c013c658f6c97e6460e7780c26faa6b78d9a (diff)
Allow line numbers on -verify directives.
// expected-warning@10 {{some text}} The line number may be absolute (as above), or relative to the current line by prefixing the number with either '+' or '-'. Patch by Andy Gibbs! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r--include/clang/Basic/SourceManager.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 0cb3b834d7..415b017b73 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -36,6 +36,7 @@
#define LLVM_CLANG_SOURCEMANAGER_H
#include "clang/Basic/LLVM.h"
+#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/DataTypes.h"
@@ -897,6 +898,13 @@ public:
return getFileIDSlow(SLocOffset);
}
+ /// \brief Return the filename of the file containing a SourceLocation.
+ StringRef getFilename(SourceLocation SpellingLoc) const {
+ if (const FileEntry *F = getFileEntryForID(getFileID(SpellingLoc)))
+ return F->getName();
+ return StringRef();
+ }
+
/// \brief Return the source location corresponding to the first byte of
/// the specified file.
SourceLocation getLocForStartOfFile(FileID FID) const {