summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2015-12-28 21:47:51 +0000
committerDevin Coughlin <dcoughlin@apple.com>2015-12-28 21:47:51 +0000
commitbe4b2b72b1bcfe56e74c28886d156952861c9764 (patch)
tree7b7280dd2a256e4572ff3afae81237438831c0ea
parent2aca0c622a22366d7e26e6002b910558fe641805 (diff)
downloadbcm5719-llvm-be4b2b72b1bcfe56e74c28886d156952861c9764.tar.gz
bcm5719-llvm-be4b2b72b1bcfe56e74c28886d156952861c9764.zip
Small refactoring in CheckerContext::isCLibraryFunction(). NFC.
Use getRedeclContext() instead of a manually-written loop and fix a comment. A patch by Aleksei Sidorin! Differential Revision: http://reviews.llvm.org/D15794 llvm-svn: 256524
-rw-r--r--clang/lib/StaticAnalyzer/Core/CheckerContext.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
index 37b2564a81f..5ec8bfa8007 100644
--- a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
@@ -57,12 +57,8 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD,
return false;
// Look through 'extern "C"' and anything similar invented in the future.
- const DeclContext *DC = FD->getDeclContext();
- while (DC->isTransparentContext())
- DC = DC->getParent();
-
- // If this function is in a namespace, it is not a C library function.
- if (!DC->isTranslationUnit())
+ // If this function is not in TU directly, it is not a C library function.
+ if (!FD->getDeclContext()->getRedeclContext()->isTranslationUnit())
return false;
// If this function is not externally visible, it is not a C library function.
OpenPOWER on IntegriCloud