aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h')
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index 0c51ac538f..eef5461f2d 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -66,7 +66,11 @@ public:
ASTContext &getASTContext() {
return Eng.getContext();
}
-
+
+ const LangOptions &getLangOptions() const {
+ return Eng.getContext().getLangOptions();
+ }
+
const LocationContext *getLocationContext() const {
return Pred->getLocationContext();
}
@@ -161,6 +165,17 @@ public:
/// function with the given name.
bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name);
+ /// \brief Depending on wither the location corresponds to a macro, return
+ /// either the macro name or the token spelling.
+ ///
+ /// This could be useful when checkers' logic depends on whether a function
+ /// is called with a given macro argument. For example:
+ /// s = socket(AF_INET,..)
+ /// If AF_INET is a macro, the result should be treated as a source of taint.
+ ///
+ /// \sa clang::Lexer::getSpelling(), clang::Lexer::getImmediateMacroName().
+ StringRef getMacroNameOrSpelling(SourceLocation &Loc);
+
private:
ExplodedNode *addTransitionImpl(const ProgramState *State,
bool MarkAsSink,