File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class TargetInfo;
51
51
// / The preprocessor keeps track of this information for each
52
52
// / file that is \#included.
53
53
struct HeaderFileInfo {
54
- // / True if this is a \#import'd or \#pragma once file.
54
+ // / True if this is a \#import'd file.
55
55
unsigned isImport : 1 ;
56
56
57
57
// / True if this is a \#pragma once file.
@@ -450,11 +450,10 @@ class HeaderSearch {
450
450
return (SrcMgr::CharacteristicKind)getFileInfo (File).DirInfo ;
451
451
}
452
452
453
- // / Mark the specified file as a "once only" file, e.g. due to
453
+ // / Mark the specified file as a "once only" file due to
454
454
// / \#pragma once.
455
455
void MarkFileIncludeOnce (const FileEntry *File) {
456
456
HeaderFileInfo &FI = getFileInfo (File);
457
- FI.isImport = true ;
458
457
FI.isPragmaOnce = true ;
459
458
}
460
459
@@ -500,8 +499,7 @@ class HeaderSearch {
500
499
// / This routine does not consider the effect of \#import
501
500
bool isFileMultipleIncludeGuarded (const FileEntry *File);
502
501
503
- // / Determine whether the given file is known to have ever been \#imported
504
- // / (or if it has been \#included and we've encountered a \#pragma once).
502
+ // / Determine whether the given file is known to have ever been \#imported.
505
503
bool hasFileBeenImported (const FileEntry *File) {
506
504
const HeaderFileInfo *FI = getExistingFileInfo (File);
507
505
return FI && FI->isImport ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ void HeaderSearch::PrintStats() {
91
91
<< FileInfo.size () << " files tracked.\n " ;
92
92
unsigned NumOnceOnlyFiles = 0 , MaxNumIncludes = 0 , NumSingleIncludedFiles = 0 ;
93
93
for (unsigned i = 0 , e = FileInfo.size (); i != e; ++i) {
94
- NumOnceOnlyFiles += FileInfo[i].isImport ;
94
+ NumOnceOnlyFiles += ( FileInfo[i].isPragmaOnce || FileInfo[i]. isImport ) ;
95
95
if (MaxNumIncludes < FileInfo[i].NumIncludes )
96
96
MaxNumIncludes = FileInfo[i].NumIncludes ;
97
97
NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1 ;
@@ -1325,7 +1325,7 @@ bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor &PP,
1325
1325
} else {
1326
1326
// Otherwise, if this is a #include of a file that was previously #import'd
1327
1327
// or if this is the second #include of a #pragma once file, ignore it.
1328
- if (FileInfo.isImport && !TryEnterImported ())
1328
+ if (( FileInfo.isPragmaOnce || FileInfo. isImport ) && !TryEnterImported ())
1329
1329
return false ;
1330
1330
}
1331
1331
You can’t perform that action at this time.
0 commit comments