[PATCH] D17865: Add an optional string argument to DeprecatedAttr for Fix-It.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 11 14:43:19 PST 2016
aaron.ballman added inline comments.
================
Comment at: include/clang/Basic/Attr.td:726
@@ +725,3 @@
+ let Args = [StringArgument<"Message", 1>,
+ // An optional string argument that enables us to provide a Fix-It.
+ StringArgument<"Replacement", 1>];
----------------
The formatting here is a bit strange.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:5143
@@ +5142,3 @@
+
+ D->addAttr(::new (S.Context) DeprecatedAttr(Attr.getRange(), S.Context, Str,
+ Replacement,
----------------
This should move back down below the extension warning (the effect is the same, but logically we want to warn before attaching).
================
Comment at: utils/TableGen/ClangAttrEmitter.cpp:1234
@@ +1233,3 @@
+ if ((Spelling == "deprecated" || Spelling == "gnu::deprecated") &&
+ Variety != "GNU" && index == 1)
+ continue;
----------------
manmanren wrote:
> This does not look pretty. Maybe we can implement a function writeDeprecatedValue that can skip the second argument if it is empty?
I wouldn't be opposed to that approach; we already do it for `writeAvailabilityValue()`, so another one for deprecated wouldn't be that horrible.
http://reviews.llvm.org/D17865
More information about the cfe-commits
mailing list