diff options
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
| -rw-r--r-- | include/clang/Basic/SourceManager.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 99392a098274..23ad73894fd3 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -61,7 +61,6 @@ class SourceManager; class FileManager; class FileEntry; class LineTableInfo; -class LangOptions; class ASTWriter; class ASTReader; @@ -798,6 +797,15 @@ public: IncludeLoc, FileCharacter, LoadedID, LoadedOffset); } + /// \brief Get the FileID for \p SourceFile if it exists. Otherwise, create a + /// new FileID for the \p SourceFile. + FileID getOrCreateFileID(const FileEntry *SourceFile, + SrcMgr::CharacteristicKind FileCharacter) { + FileID ID = translateFile(SourceFile); + return ID.isValid() ? ID : createFileID(SourceFile, SourceLocation(), + FileCharacter); + } + /// \brief Return a new SourceLocation that encodes the /// fact that a token from SpellingLoc should actually be referenced from /// ExpansionLoc, and that it represents the expansion of a macro argument |
