diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 | 
| commit | 29cafa66ad3878dbb9f82615f19fa0bded2e443c (patch) | |
| tree | c5e9e10bc189de0058aa763c47b9920a8351b7df /lib/Lex/HeaderSearch.cpp | |
| parent | 01af97d3b23bded2b2b21af19bbc6e4cce49e5b3 (diff) | |
Notes
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
| -rw-r--r-- | lib/Lex/HeaderSearch.cpp | 18 | 
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 372078c60d20..bb4388195a32 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -37,6 +37,7 @@ ExternalHeaderFileInfoSource::~ExternalHeaderFileInfoSource() {}  HeaderSearch::HeaderSearch(FileManager &FM)      : FileMgr(FM), FrameworkMap(64) { +  AngledDirIdx = 0;    SystemDirIdx = 0;    NoCurDirSearch = false; @@ -317,7 +318,7 @@ const FileEntry *HeaderSearch::LookupFile(    CurDir = 0;    // If this is a system #include, ignore the user #include locs. -  unsigned i = isAngled ? SystemDirIdx : 0; +  unsigned i = isAngled ? AngledDirIdx : 0;    // If this is a #include_next request, start searching after the directory the    // file was found in. @@ -482,6 +483,21 @@ HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) {    return HFI;  } +bool HeaderSearch::isFileMultipleIncludeGuarded(const FileEntry *File) { +  // Check if we've ever seen this file as a header. +  if (File->getUID() >= FileInfo.size()) +    return false; + +  // Resolve header file info from the external source, if needed. +  HeaderFileInfo &HFI = FileInfo[File->getUID()]; +  if (ExternalSource && !HFI.Resolved) { +    HFI = ExternalSource->GetHeaderFileInfo(File); +    HFI.Resolved = true; +  } + +  return HFI.isPragmaOnce || HFI.ControllingMacro || HFI.ControllingMacroID; +} +  void HeaderSearch::setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID) {    if (UID >= FileInfo.size())      FileInfo.resize(UID+1);  | 
