diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-11-02 23:49:29 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-11-02 23:49:29 +0000 |
commit | 2f3017f9cbd3774f690c979410bfec38423d03af (patch) | |
tree | 3b689f1d50f90f99e56f29c571b160b04b739e2d /lib/StaticAnalyzer/Core/CheckerContext.cpp | |
parent | d624607d4196e4b37d235daa14699bcb3c1012a6 (diff) |
[analyzer] Add some convenience accessors to CallEvent, and use them.
These are CallEvent-equivalents of helpers already accessible in
CheckerContext, as part of making it easier for new checkers to be written
using CallEvent rather than raw CallExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/CheckerContext.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/CheckerContext.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp index 570ebc0272..74eeef1c67 100644 --- a/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/lib/StaticAnalyzer/Core/CheckerContext.cpp @@ -43,6 +43,8 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD, // Using a string compare is slow, we might want to switch on BuiltinID here. unsigned BId = FD->getBuiltinID(); if (BId != 0) { + if (Name.empty()) + return true; StringRef BName = FD->getASTContext().BuiltinInfo.GetName(BId); if (BName.find(Name) != StringRef::npos) return true; @@ -64,9 +66,14 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD, return false; // If this function is not externally visible, it is not a C library function. - if (FD->getLinkage() != ExternalLinkage) + // Note that we make an exception for inline functions, which may be + // declared in header files without external linkage. + if (!FD->isInlined() && FD->getLinkage() != ExternalLinkage) return false; + if (Name.empty()) + return true; + StringRef FName = II->getName(); if (FName.equals(Name)) return true; |