[clang] [modules] Avoid redefinition errors when access modular header as non-modular. (PR #214345)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 22:48:11 PDT 2026
================
@@ -1597,3 +1597,25 @@ void Sema::checkReferenceToTULocalFromOtherTU(
PendingCheckReferenceForTULocal.push_back(
std::make_pair(FD, PointOfInstantiation));
}
+
+bool Sema::isFromSameSingleIncludeHeader(const Decl *PrevD,
+ SourceLocation NewLoc) {
+ if (!PrevD->isFromASTFile())
+ return false;
+ SourceLocation PrevLoc = PrevD->getLocation();
+ if (!PrevLoc.isValid() || !NewLoc.isValid())
+ return false;
+ SourceManager &SM = getSourceManager();
+ auto [PrevFileID, PrevOffset] = SM.getDecomposedExpansionLoc(PrevLoc);
+ auto [NewFileID, NewOffset] = SM.getDecomposedExpansionLoc(NewLoc);
+ if (PrevOffset != NewOffset)
----------------
ChuanqiXu9 wrote:
It looks like I misunderstand the point.
https://github.com/llvm/llvm-project/pull/214345
More information about the cfe-commits
mailing list