From dcb64703a979790b13f0a436911a9cd09a482b26 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@cea.fr>
Date: Thu, 23 Jan 2025 15:39:12 +0100
Subject: [PATCH] [clang] ensure compatibility with clang 19

---
 framaCIRGen_src/ACSLLexer.h     | 1 +
 framaCIRGen_src/ACSLParser.cpp  | 2 +-
 framaCIRGen_src/Clang_utils.cpp | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/framaCIRGen_src/ACSLLexer.h b/framaCIRGen_src/ACSLLexer.h
index 1f621b60..b0743aad 100644
--- a/framaCIRGen_src/ACSLLexer.h
+++ b/framaCIRGen_src/ACSLLexer.h
@@ -29,6 +29,7 @@
 #define ACSL_LexerH
 
 #include <list>
+#include <stack>
 #include "DescentParse.h"
 #include "ACSLToken.h"
 
diff --git a/framaCIRGen_src/ACSLParser.cpp b/framaCIRGen_src/ACSLParser.cpp
index dec5ca8e..ae69532f 100644
--- a/framaCIRGen_src/ACSLParser.cpp
+++ b/framaCIRGen_src/ACSLParser.cpp
@@ -1115,7 +1115,7 @@ Parser::Arguments::findLogicLabel(const std::string& name) const {
       = _clangSema->getPreprocessor().getIdentifierTable().get(name);
   clang::NamedDecl* foundDecl = _clangSema->LookupSingleName(
       _clangScope /* scope */, &identifierInfo, _clangLocation,
-      clang::Sema::LookupLabel, clang::Sema::NotForRedeclaration);
+      clang::Sema::LookupLabel);
   if (!foundDecl || (foundDecl->getKind() != clang::Decl::Label))
     return NULL;
   assert(llvm::dyn_cast<clang::LabelDecl>(foundDecl));
diff --git a/framaCIRGen_src/Clang_utils.cpp b/framaCIRGen_src/Clang_utils.cpp
index 2943e2a2..bce1266a 100644
--- a/framaCIRGen_src/Clang_utils.cpp
+++ b/framaCIRGen_src/Clang_utils.cpp
@@ -964,14 +964,14 @@ Clang_utils::makeQualifiedName( const clang::DeclContext* Ctx, const char* name,
               ND = llvm::dyn_cast<clang::NamespaceDecl>(Ctx)) {
       if (ND->isAnonymousNamespace()) {
         std::map<const clang::Decl*, std::string>::iterator
-            found = _anonymousMap.find(ND->getOriginalNamespace());
+            found = _anonymousMap.find(ND->getCanonicalDecl());
         if (found == _anonymousMap.end()) {
           ++_anonymousIdent;
           std::ostringstream out;
           out << "anonymous_namespace_" << _anonymousIdent;
           found = _anonymousMap.insert(
               std::pair<const clang::Decl*, std::string>(
-                  ND->getOriginalNamespace(), out.str())).first;
+                  ND->getCanonicalDecl(), out.str())).first;
         };
         prefix = cons_container(qualification_QNamespace(
             copy_string(found->second.c_str())), prefix);
-- 
GitLab