Skip to content

Commit

Permalink
Merge branch 'main' into unreachable4
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffw0 committed Nov 8, 2024
2 parents c7112ef + 5490975 commit 727a7d4
Show file tree
Hide file tree
Showing 80 changed files with 819 additions and 327 deletions.
2 changes: 1 addition & 1 deletion go/extractor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toolchain go1.23.1
// when adding or removing dependencies, run
// bazel mod tidy
require (
golang.org/x/mod v0.21.0
golang.org/x/mod v0.22.0
golang.org/x/tools v0.26.0
)

Expand Down
4 changes: 2 additions & 2 deletions go/extractor/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/dataflow/TypeFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ private module Input implements TypeFlowInput<Location> {
n2.asSsa().(BaseSsaUpdate).getDefiningExpr().(VariableAssign).getSource() = n1.asExpr()
or
n2.asSsa().(BaseSsaImplicitInit).captures(n1.asSsa())
or
n2.asExpr().(NotNullExpr).getExpr() = n1.asExpr()
}

/**
Expand Down
15 changes: 8 additions & 7 deletions rust/codeql-extractor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ options:
title: Controls compression for the TRAP files written by the extractor.
description: >
This option is only intended for use in debugging the extractor. Accepted
values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none'
(to write uncompressed TRAP).
values are 'gzip' (to write gzip-compressed TRAP) and 'none'
(currently the default, to write uncompressed TRAP).
type: string
pattern: "^(none|gzip)$"
extract_dependencies:
title: Whether to extract dependencies.
cargo_target_dir:
title: Directory to use for cargo output files.
description: >
Extract the source code of dependencies and the standard libraries in addition to
normal source code.
This value is an optional path to use as `CARGO_TARGET_DIR` for the internal
cargo commands the extractor uses. Pointing it to a persistent directory may
reduce execution time of consecutive extractor runs. By default, a new scratch
directory is used for each run.
type: string
pattern: "^(false|true)$"
6 changes: 6 additions & 0 deletions rust/extractor/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ pub fn extractor_cli_config(_attr: TokenStream, item: TokenStream) -> TokenStrea
#id: bool,
};
}
if p.path.segments.len() == 1 && p.path.segments[0].ident == "Option" {
return quote! {
#[arg(long)]
#id: #ty,
};
}
}
if id == &format_ident!("verbose") {
quote! {
Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Config {
pub scratch_dir: PathBuf,
pub trap_dir: PathBuf,
pub source_archive_dir: PathBuf,
pub extract_dependencies: bool,
pub cargo_target_dir: Option<PathBuf>,
pub verbose: u8,
pub compression: Compression,
pub inputs: Vec<PathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/generated/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

171 changes: 117 additions & 54 deletions rust/extractor/src/generated/top.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion rust/extractor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ fn main() -> anyhow::Result<()> {
}
extractor.extract_without_semantics(file, "no manifest found");
}
let target_dir = &cfg
.cargo_target_dir
.unwrap_or_else(|| cfg.scratch_dir.join("target"));
for (manifest, files) in map.values().filter(|(_, files)| !files.is_empty()) {
if let Some((ref db, ref vfs)) = RustAnalyzer::load_workspace(manifest, &cfg.scratch_dir) {
if let Some((ref db, ref vfs)) = RustAnalyzer::load_workspace(manifest, target_dir) {
let semantics = Semantics::new(db);
for file in files {
let Some(id) = path_to_file_id(file, vfs) else {
Expand Down
6 changes: 2 additions & 4 deletions rust/extractor/src/rust_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ pub struct ParseResult<'a> {
impl<'a> RustAnalyzer<'a> {
pub fn load_workspace(
project: &ProjectManifest,
scratch_dir: &Path,
target_dir: &Path,
) -> Option<(RootDatabase, Vfs)> {
let config = CargoConfig {
sysroot: Some(RustLibSource::Discover),
target_dir: ra_ap_paths::Utf8PathBuf::from_path_buf(scratch_dir.to_path_buf())
.map(|x| x.join("target"))
.ok(),
target_dir: ra_ap_paths::Utf8PathBuf::from_path_buf(target_dir.to_path_buf()).ok(),
..Default::default()
};
let progress = |t| (log::trace!("progress: {}", t));
Expand Down
Loading

0 comments on commit 727a7d4

Please sign in to comment.