clang 8.0.0

Macros | Functions
LocalizationChecker.cpp File Reference
`#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"`
`#include "clang/AST/Attr.h"`
`#include "clang/AST/Decl.h"`
`#include "clang/AST/DeclObjC.h"`
`#include "clang/AST/RecursiveASTVisitor.h"`
`#include "clang/AST/StmtVisitor.h"`
`#include "clang/Lex/Lexer.h"`
`#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"`
`#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"`
`#include "clang/StaticAnalyzer/Core/Checker.h"`
`#include "clang/StaticAnalyzer/Core/CheckerManager.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"`
`#include "llvm/Support/Unicode.h"`
Include dependency graph for LocalizationChecker.cpp:

Go to the source code of this file.

## Macros
#define | NEW_RECEIVER(receiver)
#define | ADD_NULLARY_METHOD(receiver, method, argument)
#define | ADD_UNARY_METHOD(receiver, method, argument)
#define | ADD_METHOD(receiver, method_list, count, argument) receiver##M.insert({Ctx.Selectors.getSelector(count, method_list), argument});
#define | LSF_INSERT(function_name) LSF.insert(&Ctx.Idents.get(function_name));
#define | LSM_INSERT_NULLARY(receiver, method_name)
#define | LSM_INSERT_UNARY(receiver, method_name)
#define | LSM_INSERT_SELECTOR(receiver, method_list, arguments)

## Functions
| REGISTER_MAP_WITH_PROGRAMSTATE (LocalizedMemMap, const MemRegion *, LocalizedState) NonLocalizedStringChecker
static bool | isDebuggingName (std::string name)
static bool | isDebuggingContext (CheckerContext &C)
| Returns true when, heuristically, the analyzer may be analyzing debugging code. More...
static bool | isNSStringType (QualType T, ASTContext &Ctx)

## Macro Definition Documentation

## ◆ ADD_METHOD

#define ADD_METHOD | ( |  | receiver,
|  |  | method_list,
|  |  | count,
|  |  | argument
| ) |  | receiver##M.insert({Ctx.Selectors.getSelector(count, method_list), argument});

Definition at line 148 of file LocalizationChecker.cpp.

## ◆ ADD_NULLARY_METHOD

#define ADD_NULLARY_METHOD | ( |  | receiver,
|  |  | method,
|  |  | argument
| ) |  |

Value:
receiver##M.insert( \
{Ctx.Selectors.getNullarySelector(&Ctx.Idents.get(#method)), argument});

Definition at line 142 of file LocalizationChecker.cpp.

## ◆ ADD_UNARY_METHOD

#define ADD_UNARY_METHOD | ( |  | receiver,
|  |  | method,
|  |  | argument
| ) |  |

Value:
receiver##M.insert( \
{Ctx.Selectors.getUnarySelector(&Ctx.Idents.get(#method)), argument});

Definition at line 145 of file LocalizationChecker.cpp.

## ◆ LSF_INSERT

#define LSF_INSERT | ( |  | function_name | ) | LSF.insert(&Ctx.Idents.get(function_name));

Definition at line 610 of file LocalizationChecker.cpp.

## ◆ LSM_INSERT_NULLARY

#define LSM_INSERT_NULLARY | ( |  | receiver,
|  |  | method_name
| ) |  |

Value:
LSM.insert({&Ctx.Idents.get(receiver), Ctx.Selectors.getNullarySelector( \
&Ctx.Idents.get(method_name))});

Definition at line 611 of file LocalizationChecker.cpp.

## ◆ LSM_INSERT_SELECTOR

#define LSM_INSERT_SELECTOR | ( |  | receiver,
|  |  | method_list,
|  |  | arguments
| ) |  |

Value:
LSM.insert({&Ctx.Idents.get(receiver), \
Ctx.Selectors.getSelector(arguments, method_list)});

Definition at line 617 of file LocalizationChecker.cpp.

## ◆ LSM_INSERT_UNARY

#define LSM_INSERT_UNARY | ( |  | receiver,
|  |  | method_name
| ) |  |

Value:
LSM.insert({&Ctx.Idents.get(receiver), \
Ctx.Selectors.getUnarySelector(&Ctx.Idents.get(method_name))});

Definition at line 614 of file LocalizationChecker.cpp.

## ◆ NEW_RECEIVER

#define NEW_RECEIVER | ( |  | receiver | ) |

Value:
llvm::DenseMap<Selector, uint8_t> &receiver##M = \
UIMethods.insert({&Ctx.Idents.get(#receiver), \
llvm::DenseMap<Selector, uint8_t>()}) \
.first->second;

Definition at line 137 of file LocalizationChecker.cpp.

## Function Documentation

## ◆ isDebuggingContext()

static bool isDebuggingContext | ( | CheckerContext & | C | ) |
| static

Returns true when, heuristically, the analyzer may be analyzing debugging code.

We use this to suppress localization diagnostics in un-localized user interfaces that are only used for debugging and are therefore not user facing.

Definition at line 727 of file LocalizationChecker.cpp.

References clang::Selector::getAsString(), clang::Decl::getDeclContext(), clang::ObjCMethodCall::getReceiverInterface(), clang::ObjCMethodCall::getReceiverSVal(), clang::ObjCMethodCall::getSelector(), isDebuggingName(), clang::IdentifierInfo::isStr(), and P.

## ◆ isDebuggingName()

static bool isDebuggingName | ( | std::string | name | ) |
| static

Definition at line 719 of file LocalizationChecker.cpp.

Referenced by isDebuggingContext().

## ◆ isNSStringType()

static bool isNSStringType | ( | QualType | T,
|  | ASTContext & | Ctx
| ) |  |
| inline static

Definition at line 904 of file LocalizationChecker.cpp.

References clang::IdentifierTable::get(), clang::Type::getAs(), clang::Selector::getAsString(), clang::ObjCMethodCall::getDecl(), clang::NamedDecl::getIdentifier(), clang::ObjCObjectType::getInterface(), clang::ObjCObjectPointerType::getObjectType(), clang::ObjCMethodCall::getReceiverInterface(), clang::ObjCMethodCall::getSelector(), Identifier, clang::ASTContext::Idents, and clang::ObjCMethodCall::isInstanceMessage().

## ◆ REGISTER_MAP_WITH_PROGRAMSTATE()

REGISTER_MAP_WITH_PROGRAMSTATE | ( | LocalizedMemMap | ,
|  | const MemRegion * | ,
|  | LocalizedState |
| ) |  |

Definition at line 107 of file LocalizationChecker.cpp.