diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-21 00:26:14 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-21 00:26:14 +0000 |
commit | 464011827c5f9047caaba7e245556d66a65a15b6 (patch) | |
tree | 68202617cc556b044cfbc5182ea066a9fd1bfa10 | |
parent | 90a7820de7685cec75fcd47e98f0f9623c0f0477 (diff) |
Doxycomment SVal's getAs/castAs.
Also document TypeLoc's operations similarly, since it's a good idea.
Post-commit CR feedback from Anna Zaks regarding r175594.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175694 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/TypeLoc.h | 5 | ||||
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index d58b79af01..147643c1e5 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -44,6 +44,8 @@ protected: void *Data; public: + /// \brief Convert to the specified TypeLoc type, asserting that this TypeLoc + /// is of the desired type. template<typename T> T castAs() const { assert(T::isType(this)); @@ -52,6 +54,9 @@ public: tl = *this; return t; } + + /// \brief Convert to the specified TypeLoc type, returning a null TypeLoc if + /// this TypeLoc is not of the desired type. template<typename T> T getAs() const { if (!T::isType(this)) diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index 2391d49c73..0e0108c2d5 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h @@ -69,6 +69,8 @@ protected: public: explicit SVal() : Data(0), Kind(0) {} + /// \brief Convert to the specified SVal type, asserting that this SVal is of + /// the desired type. template<typename T> T castAs() const { assert(T::isKind(*this)); @@ -78,6 +80,8 @@ public: return t; } + /// \brief Convert to the specified SVal type, returning None if this SVal is + /// not of the desired type. template<typename T> Optional<T> getAs() const { if (!T::isKind(*this)) |