================
@@ -109,9 +134,54 @@ void DuplicateIncludeCallbacks::MacroUndefined(const Token 
&MacroNameTok,
   Files.back().clear();
 }
 
+bool DuplicateIncludeCallbacks::IsAllowedDuplicateInclude(
+    StringRef TokenName, OptionalFileEntryRef File, StringRef RelativePath) {
+  SmallVector<StringRef, 3> matchArguments;
+  matchArguments.push_back(TokenName);
+
+  if (!RelativePath.empty())
+    matchArguments.push_back(llvm::sys::path::filename(RelativePath));
+
+  if (File) {
+    StringRef RealPath = File->getFileEntry().tryGetRealPathName();
+    if (!RealPath.empty())
+      matchArguments.push_back(llvm::sys::path::filename(RealPath));
+  }
----------------
vbvictor wrote:

Why do we need 3 separate `matchArguments` to match?
To my understanding when we encounter:
```cpp
#include "pack_begin.h"
#include "pack_begin.h" 
```
We only need to match only header name, what are other 2 `matchArguments`?

https://github.com/llvm/llvm-project/pull/167046
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to