Jinjie-Huang wrote:
Thanks for the review.
> While I know this is disabled by default, have we considered the compilation
> time impact when it is enabled?
Regarding the execution time, I tested with some internal files (ranging from
average to small inputs) and didn't see any significant di
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 2928471bb58221e8eee08a1da92d8565fb0901ad Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Thu, 6 Nov 2025 19:38:53 +0800
Subject: [PATCH 1/6] header shadowing diagnostics
---
clang/docs/ReleaseNotes
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 2928471bb58221e8eee08a1da92d8565fb0901ad Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Thu, 6 Nov 2025 19:38:53 +0800
Subject: [PATCH 1/4] header shadowing diagnostics
---
clang/docs/ReleaseNotes
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 2928471bb58221e8eee08a1da92d8565fb0901ad Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Thu, 6 Nov 2025 19:38:53 +0800
Subject: [PATCH 1/4] header shadowing diagnostics
---
clang/docs/ReleaseNotes
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 2928471bb58221e8eee08a1da92d8565fb0901ad Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Thu, 6 Nov 2025 19:38:53 +0800
Subject: [PATCH 1/4] header shadowing diagnostics
---
clang/docs/ReleaseNotes
Jinjie-Huang wrote:
Sorry for the delay in this update.
I have refactored the implementation to perform the diagnostic logic within a
separate function that replicates the header search paths. The should simplify
the implementation and make the source code changes easier to comprehend.
I also
@@ -557,6 +557,10 @@ def warn_pp_hdrstop_filename_ignored : Warning<
def remark_pp_search_path_usage : Remark<
"search path used: '%0'">,
InGroup;
+def warn_header_shadowed
+ : Warning<"multiple candidates for header '%0' found; "
+"using the one from '%1', sha
@@ -789,6 +789,8 @@ def ShadowFieldInConstructor :
DiagGroup<"shadow-field-in-constructor",
def ShadowIvar : DiagGroup<"shadow-ivar">;
def ShadowUncapturedLocal : DiagGroup<"shadow-uncaptured-local">;
+def HeaderShadowing : DiagGroup<"header-shadowing">;
Jinj
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 4199d38c213ad859510664ed6510dbe466b35b91 Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Thu, 6 Nov 2025 19:38:53 +0800
Subject: [PATCH 1/2] header shadowing diagnostics
---
clang/docs/ReleaseNotes
Jinjie-Huang wrote:
> Both libcxx and glibc ship stdio.h. How do you handle #include ?
For current approach, this diagnostics is also performed for system headers
like . Because the Clang driver is theoretically supposed to
automatically specify the system header search paths, so there seems
Jinjie-Huang wrote:
Thanks for replies!
> I would not be in favor of that example being diagnosed because I think it
> would interfere with too much intentional use of #include_next.
>
> If the intent is to only issue a diagnostic if a header file is included via
> double quotes and is found
@@ -881,6 +886,35 @@ 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
Jinjie-Huang wrote:
@tahonermann Thank you for review and sharing the helpful context.
> I am worried that this diagnostic will be quite noisy for some projects. I
> think a more useful improvement would be more diagnostics for cases where
> `clang` and `clang-cl` would resolve a header file
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -881,6 +886,35 @@ 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
@@ -1097,53 +1145,62 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
if (!File)
continue;
-CurDir = It;
-
-IncludeNames[*File] = Filename;
-
-// This file is a system header or C++ unfriendly if the dir is.
-HeaderFileInfo &HFI = getFileInfo(*File);
https://github.com/Jinjie-Huang converted_to_draft
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 5e51efd320d3c3f7952126c8609ea52c495bcb32 Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Fri, 10 Oct 2025 16:12:11 +0800
Subject: [PATCH] support header shadowing detection
---
clang/include/clang/
@@ -462,6 +462,9 @@ OptionalFileEntryRef HeaderSearch::getFileAndSuggestModule(
return std::nullopt;
}
+ if (!NeedSuggest)
Jinjie-Huang wrote:
Only suggest the module during the first lookup, consistent with the baseline
https://github.com/llvm/llvm-p
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang created
https://github.com/llvm/llvm-project/pull/162491
When including a header file, multiple files with the same name may exist
across different search paths.
The compiler usually picks the first match it finds (typically following MSVC
rules for current/incl
Jinjie-Huang wrote:
The current implementation directly reuses the search logic from
HeaderSearch::LookupFile() and avoids side effects caused by performing
additional searches.
Alternatively, we could recalculate the default search paths after locating the
corresponding header file and then
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 2663a533bafda57b8fe6996897a4adab64e1 Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Wed, 8 Oct 2025 23:04:29 +0800
Subject: [PATCH] support header shadowing detection
---
clang/include/clang/B
https://github.com/Jinjie-Huang updated
https://github.com/llvm/llvm-project/pull/162491
>From 92f34226a128ff9f8ce8faf8bff045311ae06a4f Mon Sep 17 00:00:00 2001
From: huangjinjie
Date: Wed, 8 Oct 2025 23:00:22 +0800
Subject: [PATCH] support header shadowing detection
---
clang/include/clang/B
https://github.com/Jinjie-Huang edited
https://github.com/llvm/llvm-project/pull/162491
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
31 matches
Mail list logo