[PATCH] D15794: CheckerContext::isCLibraryFunction(): small refactoring; NFC
Aleksei Sidorin via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 28 07:26:40 PST 2015
a.sidorin created this revision.
a.sidorin added reviewers: zaks.anna, xazax.hun, dcoughlin.
a.sidorin added a subscriber: cfe-commits.
a.sidorin set the repository for this revision to rL LLVM.
Use getRedeclContext() instead of a manually written loop; fix a comment.
Repository:
rL LLVM
http://reviews.llvm.org/D15794
Files:
lib/StaticAnalyzer/Core/CheckerContext.cpp
Index: lib/StaticAnalyzer/Core/CheckerContext.cpp
===================================================================
--- lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ 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.43688.patch
Type: text/x-patch
Size: 804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151228/4f36b8a5/attachment-0001.bin>
More information about the cfe-commits
mailing list