Don't use declarations in global namespace in stable headers#163352
Closed
mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/340/basefrom
Closed
Don't use declarations in global namespace in stable headers#163352mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/340/basefrom
mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/340/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/163352
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 894b5e5 with merge base 33e6c5a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Fixes #163338 Follow up could be to configure https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable [ghstack-poisoned]
Fixes #163338 Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable Note that doesn't error for the DeleterFnPtr case, but will generate the following for the `using torch::stable::Tensor;` ``` >>> Lint for torch/csrc/stable/ops.h: Error (CLANGTIDY) [google-global-names-in-headers,-warnings-as-errors] using declarations in the global namespace in headers are prohibited 10 |#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h> 11 |#include <torch/headeronly/core/ScalarType.h> 12 | >>> 13 |using torch::stable::Tensor; 14 | 15 |namespace torch::stable { 16 | ``` [ghstack-poisoned]
Fixes #163338 Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable Note that doesn't error for the DeleterFnPtr case, but will generate the following for the `using torch::stable::Tensor;` ``` >>> Lint for torch/csrc/stable/ops.h: Error (CLANGTIDY) [google-global-names-in-headers,-warnings-as-errors] using declarations in the global namespace in headers are prohibited 10 |#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h> 11 |#include <torch/headeronly/core/ScalarType.h> 12 | >>> 13 |using torch::stable::Tensor; 14 | 15 |namespace torch::stable { 16 | ``` [ghstack-poisoned]
Contributor
Author
|
@pytorchbot merge |
Collaborator
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
…#163352) Fixes pytorch#163338 Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable Note that doesn't error for the DeleterFnPtr case, but will generate the following for the `using torch::stable::Tensor;` ``` >>> Lint for torch/csrc/stable/ops.h: Error (CLANGTIDY) [google-global-names-in-headers,-warnings-as-errors] using declarations in the global namespace in headers are prohibited 10 |#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h> 11 |#include <torch/headeronly/core/ScalarType.h> 12 | >>> 13 |using torch::stable::Tensor; 14 | 15 |namespace torch::stable { 16 | ``` Pull Request resolved: pytorch#163352 Approved by: https://github.com/janeyx99
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
…#163352) Fixes pytorch#163338 Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable Note that doesn't error for the DeleterFnPtr case, but will generate the following for the `using torch::stable::Tensor;` ``` >>> Lint for torch/csrc/stable/ops.h: Error (CLANGTIDY) [google-global-names-in-headers,-warnings-as-errors] using declarations in the global namespace in headers are prohibited 10 |#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h> 11 |#include <torch/headeronly/core/ScalarType.h> 12 | >>> 13 |using torch::stable::Tensor; 14 | 15 |namespace torch::stable { 16 | ``` Pull Request resolved: pytorch#163352 Approved by: https://github.com/janeyx99
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
…#163352) Fixes pytorch#163338 Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable Note that doesn't error for the DeleterFnPtr case, but will generate the following for the `using torch::stable::Tensor;` ``` >>> Lint for torch/csrc/stable/ops.h: Error (CLANGTIDY) [google-global-names-in-headers,-warnings-as-errors] using declarations in the global namespace in headers are prohibited 10 |#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h> 11 |#include <torch/headeronly/core/ScalarType.h> 12 | >>> 13 |using torch::stable::Tensor; 14 | 15 |namespace torch::stable { 16 | ``` Pull Request resolved: pytorch#163352 Approved by: https://github.com/janeyx99
malfet
added a commit
to meta-pytorch/torch-release-notes
that referenced
this pull request
Jan 9, 2026
- Use inline instead of anon namespace for stableivalue from/to ([#164882](pytorch/pytorch#164882)) - Don't use declarations in global namespace in stable headers ([#163352](pytorch/pytorch#163352))
slayton58
pushed a commit
to meta-pytorch/torch-release-notes
that referenced
this pull request
Jan 9, 2026
* Those two should have gone to C++ frontend - Use inline instead of anon namespace for stableivalue from/to ([#164882](pytorch/pytorch#164882)) - Don't use declarations in global namespace in stable headers ([#163352](pytorch/pytorch#163352)) * Typo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #163338
Configured https://clang.llvm.org/extra/clang-tidy/checks/google/global-names-in-headers.html for torch/csrc/stable
Note that doesn't error for the DeleterFnPtr case, but will generate the following for the
using torch::stable::Tensor;Stack from ghstack (oldest at bottom):