github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions c,cpp,h --
clang/test/Preprocessor/header-shadowing.c
clang/include/clang/Lex/DirectoryLookup.h
clang/include/clang/Lex/HeaderSearch.h clang/lib/Lex/HeaderSearch.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index fe11be555..47cf79a29 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -481,8 +481,8 @@ OptionalFileEntryRef DirectoryLookup::LookupFile(
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
bool &InUserSpecifiedSystemFramework, bool &IsFrameworkFound,
- bool &IsInHeaderMap, SmallVectorImpl<char> &MappedName,
- bool NeedSuggest, bool OpenFile) const {
+ bool &IsInHeaderMap, SmallVectorImpl<char> &MappedName, bool NeedSuggest,
+ bool OpenFile) const {
InUserSpecifiedSystemFramework = false;
IsInHeaderMap = false;
MappedName.clear();
@@ -884,15 +884,13 @@ diagnoseFrameworkInclude(DiagnosticsEngine &Diags,
SourceLocation IncludeLoc,
<< IncludeFilename;
}
-
/// Return true if a shadow has been detected and the caller should
/// stop and return the first-found file and module, false otherwise.
static bool checkAndStoreCandidate(
- ModuleMap::KnownHeader *SuggestedModule,
- OptionalFileEntryRef CandidateFile, StringRef CandidateDir,
- DiagnosticsEngine &Diags, StringRef Filename, SourceLocation IncludeLoc,
- ModuleMap::KnownHeader &FirstModule, OptionalFileEntryRef &FirstHeader,
- SmallString<1024> &FirstDir) {
+ ModuleMap::KnownHeader *SuggestedModule, OptionalFileEntryRef
CandidateFile,
+ StringRef CandidateDir, DiagnosticsEngine &Diags, StringRef Filename,
+ SourceLocation IncludeLoc, ModuleMap::KnownHeader &FirstModule,
+ OptionalFileEntryRef &FirstHeader, SmallString<1024> &FirstDir) {
if (!FirstHeader) {
// Found the first candidate
FirstHeader = CandidateFile;
@@ -1003,10 +1001,9 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
RequestingModule, SuggestedModule, NeedSuggest)) {
if (!Includer) {
assert(First && "only first includer can have no file");
- checkAndStoreCandidate(SuggestedModule, FE,
- IncluderAndDir.second.getName(), Diags,
- Filename, IncludeLoc, FirstModule,
- FirstHeader, FirstDir);
+ checkAndStoreCandidate(
+ SuggestedModule, FE, IncluderAndDir.second.getName(), Diags,
+ Filename, IncludeLoc, FirstModule, FirstHeader, FirstDir);
NeedSuggest = false;
break;
}
@@ -1037,9 +1034,9 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
diagnoseFrameworkInclude(Diags, IncludeLoc,
IncluderAndDir.second.getName(), Filename,
*FE);
- checkAndStoreCandidate(SuggestedModule, FE,
- IncluderAndDir.second.getName(), Diags, Filename, IncludeLoc,
- FirstModule, FirstHeader, FirstDir);
+ checkAndStoreCandidate(
+ SuggestedModule, FE, IncluderAndDir.second.getName(), Diags,
+ Filename, IncludeLoc, FirstModule, FirstHeader, FirstDir);
NeedSuggest = false;
break;
}
@@ -1047,15 +1044,15 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
// Otherwise, we found the path via MSVC header search rules. If
// -Wmsvc-include is enabled, we have to keep searching to see if we
// would've found this header in -I or -isystem directories.
- if (checkAndStoreCandidate(SuggestedModule, FE,
- IncluderAndDir.second.getName(), Diags, Filename, IncludeLoc,
- FirstModule, FirstHeader, FirstDir)) {
+ if (checkAndStoreCandidate(
+ SuggestedModule, FE, IncluderAndDir.second.getName(), Diags,
+ Filename, IncludeLoc, FirstModule, FirstHeader, FirstDir)) {
// Found mutiple candidates via MSVC rules
if (Diags.isIgnored(diag::ext_pp_include_search_ms, IncludeLoc))
return FirstHeader;
else
NeedSuggest = false;
- break;
+ break;
}
MSFE = FE;
if (SuggestedModule) {
@@ -1171,27 +1168,29 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
for (unsigned j = SystemHeaderPrefixes.size(); j; --j) {
if (Filename.starts_with(SystemHeaderPrefixes[j - 1].first)) {
HFI.DirInfo = SystemHeaderPrefixes[j - 1].second ? SrcMgr::C_System
- : SrcMgr::C_User;
+ : SrcMgr::C_User;
break;
}
}
- if (checkMSVCHeaderSearch(Diags, MSFE, &File->getFileEntry(),
IncludeLoc) &&
+ if (checkMSVCHeaderSearch(Diags, MSFE, &File->getFileEntry(),
+ IncludeLoc) &&
SuggestedModule)
*SuggestedModule = MSSuggestedModule;
bool FoundByHeaderMap = !IsMapped ? false : *IsMapped;
if (!Includers.empty())
diagnoseFrameworkInclude(Diags, IncludeLoc,
- Includers.front().second.getName(), Filename,
- *File, isAngled, FoundByHeaderMap);
+ Includers.front().second.getName(), Filename,
+ *File, isAngled, FoundByHeaderMap);
// Remember this location for the next lookup we do.
cacheLookupSuccess(CacheLookup, It, IncludeLoc);
}
if (checkAndStoreCandidate(SuggestedModule, File, It->getName(), Diags,
- Filename, IncludeLoc, FirstModule, FirstHeader, FirstDir))
+ Filename, IncludeLoc, FirstModule, FirstHeader,
+ FirstDir))
return FirstHeader;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/162491
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits