[clang] [clang][bytecode] Ignore Namespace{Using, Alias}Decls (PR #125387)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 01:09:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
These were missing here and are used in a few libc++ tests.
---
Full diff: https://github.com/llvm/llvm-project/pull/125387.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+2-2)
- (modified) clang/test/AST/ByteCode/literals.cpp (+6)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/125387
More information about the cfe-commits
mailing list