sberg updated this revision to Diff 224303. sberg edited the summary of this revision.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68581/new/ https://reviews.llvm.org/D68581 Files: clang/lib/Parse/ParseStmt.cpp clang/test/AST/sourceranges.cpp Index: clang/test/AST/sourceranges.cpp =================================================================== --- clang/test/AST/sourceranges.cpp +++ clang/test/AST/sourceranges.cpp @@ -143,4 +143,14 @@ new int{0}; } } + +// CHECK-1Z: NamespaceDecl {{.*}} attributed_decl +namespace attributed_decl { + void f() { + // CHECK-1Z: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:27> + [[maybe_unused]] int i; + // CHECK-1Z: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:34> + int __attribute__((unused)) j; + } +} #endif Index: clang/lib/Parse/ParseStmt.cpp =================================================================== --- clang/lib/Parse/ParseStmt.cpp +++ clang/lib/Parse/ParseStmt.cpp @@ -220,6 +220,8 @@ Decl = ParseDeclaration(DeclaratorContext::BlockContext, DeclEnd, Attrs); } + if (Attrs.Range.getBegin().isValid()) + DeclStart = Attrs.Range.getBegin(); return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd); }
Index: clang/test/AST/sourceranges.cpp =================================================================== --- clang/test/AST/sourceranges.cpp +++ clang/test/AST/sourceranges.cpp @@ -143,4 +143,14 @@ new int{0}; } } + +// CHECK-1Z: NamespaceDecl {{.*}} attributed_decl +namespace attributed_decl { + void f() { + // CHECK-1Z: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:27> + [[maybe_unused]] int i; + // CHECK-1Z: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:34> + int __attribute__((unused)) j; + } +} #endif Index: clang/lib/Parse/ParseStmt.cpp =================================================================== --- clang/lib/Parse/ParseStmt.cpp +++ clang/lib/Parse/ParseStmt.cpp @@ -220,6 +220,8 @@ Decl = ParseDeclaration(DeclaratorContext::BlockContext, DeclEnd, Attrs); } + if (Attrs.Range.getBegin().isValid()) + DeclStart = Attrs.Range.getBegin(); return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits