diff options
author | dim <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
commit | c49018d9cce52d8c9f34b44865ec3ba8e89a1488 (patch) | |
tree | c5e9e10bc189de0058aa763c47b9920a8351b7df /include/clang/Lex/HeaderSearch.h | |
parent | 110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab (diff) | |
download | FreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.zip FreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.tar.gz |
Vendor import of clang trunk r132879:
http://llvm.org/svn/llvm-project/cfe/trunk@132879
Diffstat (limited to 'include/clang/Lex/HeaderSearch.h')
-rw-r--r-- | include/clang/Lex/HeaderSearch.h | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index fec4dad..5e36d8e 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -31,6 +31,9 @@ struct HeaderFileInfo { /// isImport - True if this is a #import'd or #pragma once file. unsigned isImport : 1; + /// isPragmaOnce - True if this is #pragma once file. + unsigned isPragmaOnce : 1; + /// DirInfo - Keep track of whether this is a system header, and if so, /// whether it is C++ clean or not. This can be set by the include paths or /// by #pragma gcc system_header. This is an instance of @@ -66,8 +69,8 @@ struct HeaderFileInfo { const IdentifierInfo *ControllingMacro; HeaderFileInfo() - : isImport(false), DirInfo(SrcMgr::C_User), External(false), - Resolved(false), NumIncludes(0), ControllingMacroID(0), + : isImport(false), isPragmaOnce(false), DirInfo(SrcMgr::C_User), + External(false), Resolved(false), NumIncludes(0), ControllingMacroID(0), ControllingMacro(0) {} /// \brief Retrieve the controlling macro for this header file, if @@ -77,7 +80,8 @@ struct HeaderFileInfo { /// \brief Determine whether this is a non-default header file info, e.g., /// it corresponds to an actual header we've included or tried to include. bool isNonDefault() const { - return isImport || NumIncludes || ControllingMacro || ControllingMacroID; + return isImport || isPragmaOnce || NumIncludes || ControllingMacro || + ControllingMacroID; } }; @@ -101,11 +105,12 @@ class HeaderSearch { FileManager &FileMgr; /// #include search path information. Requests for #include "x" search the /// directory of the #including file first, then each directory in SearchDirs - /// consequtively. Requests for <x> search the current dir first, then each - /// directory in SearchDirs, starting at SystemDirIdx, consequtively. If + /// consecutively. Requests for <x> search the current dir first, then each + /// directory in SearchDirs, starting at AngledDirIdx, consecutively. If /// NoCurDirSearch is true, then the check for the file in the current /// directory is suppressed. std::vector<DirectoryLookup> SearchDirs; + unsigned AngledDirIdx; unsigned SystemDirIdx; bool NoCurDirSearch; @@ -156,8 +161,12 @@ public: /// SetSearchPaths - Interface for setting the file search paths. /// void SetSearchPaths(const std::vector<DirectoryLookup> &dirs, - unsigned systemDirIdx, bool noCurDirSearch) { + unsigned angledDirIdx, unsigned systemDirIdx, + bool noCurDirSearch) { + assert(angledDirIdx <= systemDirIdx && systemDirIdx <= dirs.size() && + "Directory indicies are unordered"); SearchDirs = dirs; + AngledDirIdx = angledDirIdx; SystemDirIdx = systemDirIdx; NoCurDirSearch = noCurDirSearch; //LookupFileCache.clear(); @@ -242,7 +251,9 @@ public: /// MarkFileIncludeOnce - Mark the specified file as a "once only" file, e.g. /// due to #pragma once. void MarkFileIncludeOnce(const FileEntry *File) { - getFileInfo(File).isImport = true; + HeaderFileInfo &FI = getFileInfo(File); + FI.isImport = true; + FI.isPragmaOnce = true; } /// MarkFileSystemHeader - Mark the specified file as a system header, e.g. @@ -265,6 +276,13 @@ public: getFileInfo(File).ControllingMacro = ControllingMacro; } + /// \brief Determine whether this file is intended to be safe from + /// multiple inclusions, e.g., it has #pragma once or a controlling + /// macro. + /// + /// This routine does not consider the effect of #import + bool isFileMultipleIncludeGuarded(const FileEntry *File); + /// CreateHeaderMap - This method returns a HeaderMap for the specified /// FileEntry, uniquing them through the the 'HeaderMaps' datastructure. const HeaderMap *CreateHeaderMap(const FileEntry *FE); @@ -285,6 +303,20 @@ public: search_dir_iterator search_dir_end() const { return SearchDirs.end(); } unsigned search_dir_size() const { return SearchDirs.size(); } + search_dir_iterator quoted_dir_begin() const { + return SearchDirs.begin(); + } + search_dir_iterator quoted_dir_end() const { + return SearchDirs.begin() + AngledDirIdx; + } + + search_dir_iterator angled_dir_begin() const { + return SearchDirs.begin() + AngledDirIdx; + } + search_dir_iterator angled_dir_end() const { + return SearchDirs.begin() + SystemDirIdx; + } + search_dir_iterator system_dir_begin() const { return SearchDirs.begin() + SystemDirIdx; } |