Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp2rust/converter/rules/expr_matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ using ResolvedDecl =
ResolvedDecl getResolvedDecl(clang::ASTContext &ctx, const clang::Expr *expr,
bool must_resolve) {
expr = RuleDecls::SkipImplicit(expr);
if (llvm::isa<clang::IntegerLiteral>(expr) &&
if (llvm::isa<clang::IntegerLiteral, clang::AtomicExpr>(expr) &&
expr->getBeginLoc().isMacroID()) {
return MacroUsage{
clang::Lexer::getImmediateMacroName(
Expand Down
2 changes: 1 addition & 1 deletion cpp2rust/converter/rules/rule_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ std::optional<ExprKey> getDeclKey(const clang::NamedDecl *decl) {
std::optional<ExprKey> getExprKey(clang::ASTContext &ctx,
const clang::Expr *expr) {
expr = RuleDecls::SkipImplicit(expr);
if (llvm::isa<clang::IntegerLiteral>(expr) &&
if (llvm::isa<clang::IntegerLiteral, clang::AtomicExpr>(expr) &&
expr->getBeginLoc().isMacroID()) {
auto macro = clang::Lexer::getImmediateMacroName(
expr->getBeginLoc(), ctx.getSourceManager(), ctx.getLangOpts());
Expand Down
2 changes: 1 addition & 1 deletion cpp2rust/converter/rules/rules_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ std::string DeclKey(const clang::NamedDecl *decl) {

std::string ExprKey(clang::ASTContext &ctx, const clang::Expr *expr) {
expr = expr->IgnoreParenImpCasts();
if (llvm::isa<clang::IntegerLiteral>(expr) &&
if (llvm::isa<clang::IntegerLiteral, clang::AtomicExpr>(expr) &&
expr->getBeginLoc().isMacroID()) {
return clang::Lexer::getImmediateMacroName(
expr->getBeginLoc(), ctx.getSourceManager(), ctx.getLangOpts())
Expand Down
6 changes: 6 additions & 0 deletions rules/stdatomic/src_until_cxx23.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

#include <stdatomic.h>

void f1(volatile atomic_flag *a0) { return atomic_flag_clear(a0); }
6 changes: 6 additions & 0 deletions rules/stdatomic/tgt_unsafe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

unsafe fn f1(a0: *mut ::std::sync::atomic::AtomicBool) {
(*a0).store(false, ::std::sync::atomic::Ordering::SeqCst)
}
Loading