[flang-commits] [flang] 12bddc8 - [NFC][flang] Fix PushSemantics macro

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Mon Jun 26 05:42:39 PDT 2023


Author: Leandro Lupori
Date: 2023-06-26T09:37:42-03:00
New Revision: 12bddc81b076a8acb62e940020e5b66597c86aca

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

LOG: [NFC][flang] Fix PushSemantics macro

Add and use the CONCAT macro to force the expansion of __LINE__ in
PushSemantics body.

Reviewed By: clementval

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

Added: 
    

Modified: 
    flang/lib/Lower/ConvertExpr.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 45ac890fd7b93..809dd07716121 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -3020,10 +3020,13 @@ class ScalarExprLowering {
 };
 } // namespace
 
+#define CONCAT(x, y) CONCAT2(x, y)
+#define CONCAT2(x, y) x##y
+
 // Helper for changing the semantics in a given context. Preserves the current
 // semantics which is resumed when the "push" goes out of scope.
 #define PushSemantics(PushVal)                                                 \
-  [[maybe_unused]] auto pushSemanticsLocalVariable##__LINE__ =                 \
+  [[maybe_unused]] auto CONCAT(pushSemanticsLocalVariable, __LINE__) =         \
       Fortran::common::ScopedSet(semant, PushVal);
 
 static bool isAdjustedArrayElementType(mlir::Type t) {


        


More information about the flang-commits mailing list