diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-10-30 12:37:16 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-10-30 12:37:16 +0000 |
commit | dbebe6ee9c0b6e15541bf03b3bf08dd1fd107a88 (patch) | |
tree | 3e0f8c5a9f8b6dd43535df32b782ddb325f08c50 /include | |
parent | 29bc80e5f70b8a72ea47803d45e78e5117baa27b (diff) |
[clang] Move two utility functions into SourceManager
Summary: So we can keep that not-so-great logic in one place.
Reviewers: rsmith, aaron.ballman
Reviewed By: rsmith
Subscribers: nemanjai, kbarton, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D53837
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index c5a53960b3..914225a5c2 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -1428,6 +1428,18 @@ public: return getFileID(Loc) == getMainFileID(); } + /// Returns whether \p Loc is located in a <built-in> file. + bool isWrittenInBuiltinFile(SourceLocation Loc) const { + StringRef Filename(getPresumedLoc(Loc).getFilename()); + return Filename.equals("<built-in>"); + } + + /// Returns whether \p Loc is located in a <command line> file. + bool isWrittenInCommandLineFile(SourceLocation Loc) const { + StringRef Filename(getPresumedLoc(Loc).getFilename()); + return Filename.equals("<command line>"); + } + /// Returns if a SourceLocation is in a system header. bool isInSystemHeader(SourceLocation Loc) const { return isSystem(getFileCharacteristic(Loc)); |