From: Devin Coughlin Date: Mon, 28 Dec 2015 21:47:51 +0000 (+0000) Subject: Small refactoring in CheckerContext::isCLibraryFunction(). NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5669e0e37db396f468243c6c4ffda1cc07110ead;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256524 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp index 37b2564a81..5ec8bfa800 100644 --- a/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/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.