[java] treat all var names containing $ as temporaries

Summary:
We've had some issues with names like `arr$` appearing in error reports.
Any identifier name that contains $ cannot have come from source code because it is not a legal Java identifier.
This change should stop these reports because Errdesc.ml refuses to use temporary var names in error reports.

Reviewed By: jeremydubreil

Differential Revision: D4322305

fbshipit-source-id: 16237fe
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent 26ba5336a8
commit 6d7b8099f7

@ -251,17 +251,15 @@ let tmp_prefix = "0$?%__sil_tmp";
/** return true if [pvar] is a temporary variable generated by the frontend */
let is_frontend_tmp pvar => {
/* Check whether the program variable is a temporary one generated by sawja */
let is_sawja_tmp name =>
String.is_prefix prefix::"$irvar" name ||
String.is_prefix prefix::"$T" name ||
String.is_prefix prefix::"$bc" name || String.is_prefix prefix::"CatchVar" name;
/* Check whether the program variable is a temporary one generated by Sawja, javac, or some other
bytecode/name generation pass. valid java identifiers cannot contain `$` */
let is_bytecode_tmp name => String.contains name '$' || String.is_prefix prefix::"CatchVar" name;
/* Check whether the program variable is generated by [mk_tmp] */
let is_sil_tmp name => String.is_prefix prefix::tmp_prefix name;
let name = to_string pvar;
is_sil_tmp name || (
switch pvar.pv_kind {
| Local_var pname => Procname.is_java pname && is_sawja_tmp name
| Local_var pname => Procname.is_java pname && is_bytecode_tmp name
| _ => false
}
)

Loading…
Cancel
Save