[clang] 00bdce1 - [clang][bytecode] Ignore Namespace{Using,Alias}Decls (#125387)

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 2 01:43:19 PST 2025


Author: Timm Baeder
Date: 2025-02-02T10:43:15+01:00
New Revision: 00bdce1c373a1c5b756f4cf694a952ef702d0294

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

LOG: [clang][bytecode] Ignore Namespace{Using,Alias}Decls (#125387)

These were missing here and are used in a few libc++ tests.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Compiler.cpp
    clang/test/AST/ByteCode/literals.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index f7f4f713c787f25..b9e22ebb7a41a90 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4991,8 +4991,8 @@ bool Compiler<Emitter>::visitCompoundStmt(const CompoundStmt *S) {
 template <class Emitter>
 bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
   for (const auto *D : DS->decls()) {
-    if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, UsingEnumDecl,
-            FunctionDecl>(D))
+    if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, BaseUsingDecl,
+            FunctionDecl, NamespaceAliasDecl>(D))
       continue;
 
     const auto *VD = dyn_cast<VarDecl>(D);

diff  --git a/clang/test/AST/ByteCode/literals.cpp b/clang/test/AST/ByteCode/literals.cpp
index b75ca2b19a969a9..a80ee7ad84fc748 100644
--- a/clang/test/AST/ByteCode/literals.cpp
+++ b/clang/test/AST/ByteCode/literals.cpp
@@ -914,12 +914,18 @@ namespace TypeTraits {
 }
 
 #if __cplusplus >= 201402L
+namespace SomeNS {
+  using MyInt = int;
+}
+
 constexpr int ignoredDecls() {
   static_assert(true, "");
   struct F { int a; };
   enum E { b };
   using A = int;
   typedef int Z;
+  namespace NewNS = SomeNS;
+  using NewNS::MyInt;
 
   return F{12}.a;
 }


        


More information about the cfe-commits mailing list