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 | 7d26e7ef51d4847be98b1ebce1d3d39f1879ea62 (patch) | |
| tree | 4108abae974d1b2ba949c7c8cbb74d6e438a22dc /clang | |
| parent | 3822ef2c0c7875b5127a0516d255315596a47fde (diff) | |
| download | bcm5719-llvm-7d26e7ef51d4847be98b1ebce1d3d39f1879ea62.tar.gz bcm5719-llvm-7d26e7ef51d4847be98b1ebce1d3d39f1879ea62.zip | |
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.
llvm-svn: 175694
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/TypeLoc.h | 5 | ||||
| -rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index d58b79af012..147643c1e56 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/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/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index 2391d49c732..0e0108c2d53 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/clang/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)) |

