diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-04-20 05:24:46 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-04-20 05:24:46 +0000 |
commit | 369f447eded97e6048ced02c0c2be3842f61fc1c (patch) | |
tree | 54b9a91bb2c1d4438eaea591715cad10e09a1357 /include/clang/Analysis | |
parent | 5c3074f3cd4c33e30c55e851a3ecf21ebec0769e (diff) |
get a CodeTextRegion when visiting FunctionDecl reference.
get FunctionDecl with more general utility method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis')
-rw-r--r-- | include/clang/Analysis/PathSensitive/MemRegion.h | 9 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/SVals.h | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h index d9568b3eb1..3f287a0eb0 100644 --- a/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/include/clang/Analysis/PathSensitive/MemRegion.h @@ -39,11 +39,11 @@ class MemRegionManager; class MemRegion : public llvm::FoldingSetNode { public: enum Kind { MemSpaceRegionKind, - CodeTextRegionKind, SymbolicRegionKind, AllocaRegionKind, // Typed regions. BEG_TYPED_REGIONS, + CodeTextRegionKind, CompoundLiteralRegionKind, StringRegionKind, ElementRegionKind, TypedViewRegionKind, @@ -215,6 +215,13 @@ public: QualType getLValueType(ASTContext &C) const { return LocationType; } + + bool isDeclared() const { return codekind == Declared; } + + const FunctionDecl* getDecl() const { + assert(codekind == Declared); + return static_cast<const FunctionDecl*>(Data); + } virtual bool isBoundable(ASTContext&) const { return false; } diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h index 6c9285e532..d16b3390eb 100644 --- a/include/clang/Analysis/PathSensitive/SVals.h +++ b/include/clang/Analysis/PathSensitive/SVals.h @@ -89,6 +89,11 @@ public: } bool isZeroConstant() const; + + /// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a + /// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl. + /// Otherwise return 0. + const FunctionDecl* getAsFunctionDecl() const; /// getAsLocSymbol - If this SVal is a location (subclasses Loc) and /// wraps a symbol, return that SymbolRef. Otherwise return a SymbolData* |