diff options
Diffstat (limited to 'include/clang/Analysis/Analyses/FormatString.h')
| -rw-r--r-- | include/clang/Analysis/Analyses/FormatString.h | 24 | 
1 files changed, 17 insertions, 7 deletions
| diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h index 174cce4f363c..2e8058dabda2 100644 --- a/include/clang/Analysis/Analyses/FormatString.h +++ b/include/clang/Analysis/Analyses/FormatString.h @@ -49,7 +49,7 @@ public:    const char *toString() const { return representation; }    // Overloaded operators for bool like qualities -  LLVM_EXPLICIT operator bool() const { return flag; } +  explicit operator bool() const { return flag; }    OptionalFlag& operator=(const bool &rhs) {      flag = rhs;      return *this;  // Return a reference to myself. @@ -161,6 +161,12 @@ public:      ObjCObjArg,  // '@'      ObjCBeg = ObjCObjArg, ObjCEnd = ObjCObjArg, +    // FreeBSD kernel specific specifiers. +    FreeBSDbArg, +    FreeBSDDArg, +    FreeBSDrArg, +    FreeBSDyArg, +      // GlibC specific specifiers.      PrintErrno,   // 'm' @@ -204,7 +210,8 @@ public:      return EndScanList ? EndScanList - Position : 1;    } -  bool isIntArg() const { return kind >= IntArgBeg && kind <= IntArgEnd; } +  bool isIntArg() const { return (kind >= IntArgBeg && kind <= IntArgEnd) || +    kind == FreeBSDrArg || kind == FreeBSDyArg; }    bool isUIntArg() const { return kind >= UIntArgBeg && kind <= UIntArgEnd; }    bool isAnyIntArg() const { return kind >= IntArgBeg && kind <= UIntArgEnd; }    const char *toString() const; @@ -224,6 +231,9 @@ class ArgType {  public:    enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CPointerTy,                AnyCharTy, CStrTy, WCStrTy, WIntTy }; + +  enum MatchKind { NoMatch = 0, Match = 1, NoMatchPedantic }; +  private:    const Kind K;    QualType T; @@ -247,7 +257,7 @@ public:      return Res;    } -  bool matchesType(ASTContext &C, QualType argTy) const; +  MatchKind matchesType(ASTContext &C, QualType argTy) const;    QualType getRepresentativeType(ASTContext &C) const; @@ -646,10 +656,10 @@ public:  bool ParsePrintfString(FormatStringHandler &H,                         const char *beg, const char *end, const LangOptions &LO, -                       const TargetInfo &Target); -   -bool ParseFormatStringHasSArg(const char *beg, const char *end, const LangOptions &LO, -                              const TargetInfo &Target); +                       const TargetInfo &Target, bool isFreeBSDKPrintf); + +bool ParseFormatStringHasSArg(const char *beg, const char *end, +                              const LangOptions &LO, const TargetInfo &Target);  bool ParseScanfString(FormatStringHandler &H,                        const char *beg, const char *end, const LangOptions &LO, | 
