diff options
-rw-r--r-- | include/clang/Analysis/CFG.h | 10 | ||||
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index 8cc5d814e8..5fcd64c76c 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -83,11 +83,13 @@ public: operator bool() const { return isValid(); } - template<class ElemTy> const ElemTy *getAs() const { - if (llvm::isa<ElemTy>(this)) - return static_cast<const ElemTy*>(this); - return 0; + template<class ElemTy> const ElemTy *getAs() const LLVM_LVALUE_FUNCTION { + return dyn_cast<ElemTy>(this); } + +#if LLVM_USE_RVALUE_REFERENCES + template<class ElemTy> void getAs() && LLVM_DELETED_FUNCTION; +#endif }; class CFGStmt : public CFGElement { diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index b112e66d30..ebdb02dd22 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -155,7 +155,14 @@ public: ProgramStateRef getState() const { return State; } template <typename T> - const T* getLocationAs() const { return llvm::dyn_cast<T>(&Location); } + const T* getLocationAs() const LLVM_LVALUE_FUNCTION { + return dyn_cast<T>(&Location); + } + +#if LLVM_USE_RVALUE_REFERENCES + template <typename T> + void getLocationAs() && LLVM_DELETED_FUNCTION; +#endif static void Profile(llvm::FoldingSetNodeID &ID, const ProgramPoint &Loc, |