[PATCH] D104351: [HeaderSearch] Use `isImport` only for imported headers and not for `#pragma once`.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 15 20:07:30 PDT 2021


vsapsai added inline comments.


================
Comment at: clang/include/clang/Lex/HeaderSearch.h:444-447
   void MarkFileIncludeOnce(const FileEntry *File) {
     HeaderFileInfo &FI = getFileInfo(File);
-    FI.isImport = true;
     FI.isPragmaOnce = true;
----------------
This affects the result of `hasFileBeenImported` that is used only in Indexing.cpp as

```lang=c++
  bool isParsedOnceInclude(const FileEntry *FE) {
    return PP.getHeaderSearchInfo().isFileMultipleIncludeGuarded(FE) ||
           PP.getHeaderSearchInfo().hasFileBeenImported(FE);
  }
```

and `isFileMultipleIncludeGuarded` is checking `isPragmaOnce` already, so no behavior change as far as I can tell.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104351/new/

https://reviews.llvm.org/D104351



More information about the cfe-commits mailing list