[clang] 6ebc3ab - [NFC] Replace use of !isTranslationUnit && !isNamespace with !isFileContext
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 09:41:01 PDT 2022
Author: Erich Keane
Date: 2022-10-06T09:40:51-07:00
New Revision: 6ebc3abd7603ddefc08e3ab2f5daed2bdd8ec631
URL: https://github.com/llvm/llvm-project/commit/6ebc3abd7603ddefc08e3ab2f5daed2bdd8ec631
DIFF: https://github.com/llvm/llvm-project/commit/6ebc3abd7603ddefc08e3ab2f5daed2bdd8ec631.diff
LOG: [NFC] Replace use of !isTranslationUnit && !isNamespace with !isFileContext
isFileContext is exactly equal to these two, so simplify the function.
Added:
Modified:
clang/lib/AST/DeclBase.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 763fc1d9f17fb..72922ef977f92 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -295,8 +295,7 @@ unsigned Decl::getTemplateDepth() const {
const DeclContext *Decl::getParentFunctionOrMethod(bool LexicalParent) const {
for (const DeclContext *DC = LexicalParent ? getLexicalDeclContext()
: getDeclContext();
- DC && !DC->isTranslationUnit() && !DC->isNamespace();
- DC = DC->getParent())
+ DC && !DC->isFileContext(); DC = DC->getParent())
if (DC->isFunctionOrMethod())
return DC;
More information about the cfe-commits
mailing list