[PATCH] D15794: CheckerContext::isCLibraryFunction(): small refactoring; NFC

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 28 13:51:23 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL256524: Small refactoring in CheckerContext::isCLibraryFunction(). NFC. (authored by dcoughlin).

Changed prior to commit:
  http://reviews.llvm.org/D15794?vs=43688&id=43706#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15794

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp
@@ -57,12 +57,8 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15794.43706.patch
Type: text/x-patch
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151228/58ce12cb/attachment.bin>


More information about the cfe-commits mailing list