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.
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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits