[llvm] 5bb9bf5 - [SampleFDO] Remove 'using namespace' (NFC)
Muhammad Asif Manzoor via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 14:19:46 PDT 2023
Author: Muhammad Asif Manzoor
Date: 2023-06-14T17:19:30-04:00
New Revision: 5bb9bf52cb0f94a820dc7d672bb53315ff62a9c5
URL: https://github.com/llvm/llvm-project/commit/5bb9bf52cb0f94a820dc7d672bb53315ff62a9c5
DIFF: https://github.com/llvm/llvm-project/commit/5bb9bf52cb0f94a820dc7d672bb53315ff62a9c5.diff
LOG: [SampleFDO] Remove 'using namespace' (NFC)
Remove 'using namespace' statement from header file to avoid propagating it to
other locations unnecessarily and avoid potential name collisions.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D152727
Added:
Modified:
llvm/include/llvm/Support/Discriminator.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/Discriminator.h b/llvm/include/llvm/Support/Discriminator.h
index 69cd82c876982..fa78cf3045de3 100644
--- a/llvm/include/llvm/Support/Discriminator.h
+++ b/llvm/include/llvm/Support/Discriminator.h
@@ -65,8 +65,6 @@ enum FSDiscriminatorPass {
};
} // namespace sampleprof
-using namespace sampleprof;
-
// The number of bits reserved for the base discrimininator. The base
// discriminaitor starts from bit 0.
static const unsigned BaseDiscriminatorBitWidth = 8;
@@ -82,33 +80,36 @@ static const unsigned FSDiscriminatorBitWidth = 6;
// + FSDiscriminatorBitWidth * getNumFSPasses()
// needs to fit in an unsigned int type.
static inline unsigned getNumFSPasses() {
- return static_cast<unsigned>(FSDiscriminatorPass::PassLast);
+ return static_cast<unsigned>(sampleprof::FSDiscriminatorPass::PassLast);
}
// Return the ending bit for FSPass P.
-static inline unsigned getFSPassBitEnd(FSDiscriminatorPass P) {
+static inline unsigned getFSPassBitEnd(sampleprof::FSDiscriminatorPass P) {
unsigned I = static_cast<unsigned>(P);
assert(I <= getNumFSPasses() && "Invalid FS discriminator pass number.");
return BaseDiscriminatorBitWidth + I * FSDiscriminatorBitWidth - 1;
}
// Return the begining bit for FSPass P.
-static inline unsigned getFSPassBitBegin(FSDiscriminatorPass P) {
- if (P == FSDiscriminatorPass::Base)
+static inline unsigned getFSPassBitBegin(sampleprof::FSDiscriminatorPass P) {
+ if (P == sampleprof::FSDiscriminatorPass::Base)
return 0;
unsigned I = static_cast<unsigned>(P);
assert(I <= getNumFSPasses() && "Invalid FS discriminator pass number.");
- return getFSPassBitEnd(static_cast<FSDiscriminatorPass>(I - 1)) + 1;
+ return getFSPassBitEnd(static_cast<sampleprof::FSDiscriminatorPass>(I - 1)) +
+ 1;
}
// Return the beginning bit for the last FSPass.
static inline int getLastFSPassBitBegin() {
- return getFSPassBitBegin(static_cast<FSDiscriminatorPass>(getNumFSPasses()));
+ return getFSPassBitBegin(
+ static_cast<sampleprof::FSDiscriminatorPass>(getNumFSPasses()));
}
// Return the ending bit for the last FSPass.
static inline unsigned getLastFSPassBitEnd() {
- return getFSPassBitEnd(static_cast<FSDiscriminatorPass>(getNumFSPasses()));
+ return getFSPassBitEnd(
+ static_cast<sampleprof::FSDiscriminatorPass>(getNumFSPasses()));
}
// Return the beginning bit for the base (first) FSPass.
More information about the llvm-commits
mailing list