================
@@ -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:
I don't think it is good to use source location to judge identicality. This
is a just workaroud. As the summary said, it can't work with the real ODR
issues caused by preprocessors.
https://github.com/llvm/llvm-project/pull/214345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits