[clang] ba4482f - [clang][NFC] Add specificity to compatibility hack

Nathan Sidwell via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 03:58:30 PDT 2022


Author: Nathan Sidwell
Date: 2022-04-06T03:57:36-07:00
New Revision: ba4482f481991799a922d5cf124a56bea5866254

URL: https://github.com/llvm/llvm-project/commit/ba4482f481991799a922d5cf124a56bea5866254
DIFF: https://github.com/llvm/llvm-project/commit/ba4482f481991799a922d5cf124a56bea5866254.diff

LOG: [clang][NFC] Add specificity to compatibility hack

Add specific dates and versions to note about source_location handling.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D123119

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 6c2447dc4420f..93950ac5341ba 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8838,10 +8838,11 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
                                           E->getType()->getPointeeType());
       // 1. We'll allow it in std::allocator::allocate, and anything which that
       //    calls.
-      // 2. We'll allow it in the body of std::source_location:current.  This is
-      //    necessary for libstdc++'s <source_location>, which gave its
-      //    parameter the type void*, and cast from that back to `const __impl*`
-      //    in the body. (Fixed for new versions in gcc.gnu.org/PR104602).
+      // 2. HACK 2022-03-28: Work around an issue with libstdc++'s
+      //    <source_location> header. Fixed in GCC 12 and later (2022-04-??).
+      //    We'll allow it in the body of std::source_location::current.  GCC's
+      //    implementation had a parameter of type `void*`, and casts from
+      //    that back to `const __impl*` in its body.
       if (VoidPtrCastMaybeOK &&
           (Info.getStdAllocatorCaller("allocate") ||
            IsDeclSourceLocationCurrent(Info.CurrentCall->Callee))) {


        


More information about the cfe-commits mailing list