r175694 - Doxycomment SVal's getAs/castAs.
David Blaikie
dblaikie at gmail.com
Wed Feb 20 16:26:14 PST 2013
Author: dblaikie
Date: Wed Feb 20 18:26:14 2013
New Revision: 175694
URL: http://llvm.org/viewvc/llvm-project?rev=175694&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/AST/TypeLoc.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=175694&r1=175693&r2=175694&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Wed Feb 20 18:26:14 2013
@@ -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))
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h?rev=175694&r1=175693&r2=175694&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h Wed Feb 20 18:26:14 2013
@@ -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))
More information about the cfe-commits
mailing list