diff options
author | Adin Scannell <ascannell@google.com> | 2021-05-19 10:55:02 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-19 10:56:45 -0700 |
commit | 2f3eda37a4dd64f1202fac1c69ab819fb0bd7a5e (patch) | |
tree | 3152ea93c34fc1d0cfb3a7dd86aa4d83dd45102c /tools | |
parent | 52394c34afce6c2a8861d556c9929b1c87c3a201 (diff) |
Fix nogo analysis.
Ignore calls to atomic functions in case there is no analysis information.
It is unclear why this has broken in some cases, perhaps these functions
have been replaced by intrinsics as an optimization?
PiperOrigin-RevId: 374682441
Diffstat (limited to 'tools')
-rw-r--r-- | tools/checkescape/checkescape.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/checkescape/checkescape.go b/tools/checkescape/checkescape.go index 8eeabbc3d..c788654a8 100644 --- a/tools/checkescape/checkescape.go +++ b/tools/checkescape/checkescape.go @@ -709,8 +709,13 @@ func run(pass *analysis.Pass, localEscapes bool) (interface{}, error) { return } - // Recursively collect information from - // the other analyzers. + // If this package is the atomic package, the implementation + // may be replaced by instrinsics that don't have analysis. + if x.Pkg.Pkg.Path() == "sync/atomic" { + return + } + + // Recursively collect information. var imp packageEscapeFacts if !pass.ImportPackageFact(x.Pkg.Pkg, &imp) { // Unable to import the dependency; we must |