[cfe-commits] r100891 - in /cfe/trunk: include/clang/Analysis/Support/Optional.h lib/Checker/RegionStore.cpp lib/Checker/UnixAPIChecker.cpp
Ted Kremenek
kremenek at apple.com
Fri Apr 9 13:26:58 PDT 2010
Author: kremenek
Date: Fri Apr 9 15:26:58 2010
New Revision: 100891
URL: http://llvm.org/viewvc/llvm-project?rev=100891&view=rev
Log:
Remove copy of 'Optional' in Clang tree, and convert clients to use the one now in the LLVM tree.
Removed:
cfe/trunk/include/clang/Analysis/Support/Optional.h
Modified:
cfe/trunk/lib/Checker/RegionStore.cpp
cfe/trunk/lib/Checker/UnixAPIChecker.cpp
Removed: cfe/trunk/include/clang/Analysis/Support/Optional.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/Optional.h?rev=100890&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/Support/Optional.h (original)
+++ cfe/trunk/include/clang/Analysis/Support/Optional.h (removed)
@@ -1,68 +0,0 @@
-//===-- Optional.h - Simple variant for passing optional values ---*- C++ -*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides Optional, a template class modeled in the spirit of
-// OCaml's 'opt' variant. The idea is to strongly type whether or not
-// a value can be optional.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_OPTIONAL
-#define LLVM_CLANG_ANALYSIS_OPTIONAL
-
-#include <cassert>
-
-namespace clang {
-
-template<typename T>
-class Optional {
- T x;
- unsigned hasVal : 1;
-public:
- explicit Optional() : x(), hasVal(false) {}
- Optional(const T &y) : x(y), hasVal(true) {}
-
- static inline Optional create(const T* y) {
- return y ? Optional(*y) : Optional();
- }
-
- Optional &operator=(const T &y) {
- x = y;
- hasVal = true;
- return *this;
- }
-
- const T* getPointer() const { assert(hasVal); return &x; }
- const T& getValue() const { assert(hasVal); return x; }
-
- operator bool() const { return hasVal; }
- bool hasValue() const { return hasVal; }
- const T* operator->() const { return getPointer(); }
- const T& operator*() const { assert(hasVal); return x; }
-};
-} //end clang namespace
-
-namespace llvm {
-
-template<typename T> struct simplify_type;
-
-template <typename T>
-struct simplify_type<const ::clang::Optional<T> > {
- typedef const T* SimpleType;
- static SimpleType getSimplifiedValue(const ::clang::Optional<T> &Val) {
- return Val.getPointer();
- }
-};
-
-template <typename T>
-struct simplify_type< ::clang::Optional<T> >
- : public simplify_type<const ::clang::Optional<T> > {};
-} // end llvm namespace
-
-#endif
Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=100891&r1=100890&r2=100891&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Fri Apr 9 15:26:58 2010
@@ -14,22 +14,22 @@
// parameters are created lazily.
//
//===----------------------------------------------------------------------===//
-#include "clang/Checker/PathSensitive/MemRegion.h"
-#include "clang/Analysis/AnalysisContext.h"
-#include "clang/Checker/PathSensitive/GRState.h"
-#include "clang/Checker/PathSensitive/GRStateTrait.h"
-#include "clang/Analysis/Analyses/LiveVariables.h"
-#include "clang/Analysis/Support/Optional.h"
-#include "clang/Basic/TargetInfo.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/ExprCXX.h"
-
-#include "llvm/ADT/ImmutableMap.h"
+#include "clang/Analysis/Analyses/LiveVariables.h"
+#include "clang/Analysis/AnalysisContext.h"
+#include "clang/Basic/TargetInfo.h"
+#include "clang/Checker/PathSensitive/GRState.h"
+#include "clang/Checker/PathSensitive/GRStateTrait.h"
+#include "clang/Checker/PathSensitive/MemRegion.h"
#include "llvm/ADT/ImmutableList.h"
+#include "llvm/ADT/ImmutableMap.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
+using llvm::Optional;
//===----------------------------------------------------------------------===//
// Representation of binding keys.
Modified: cfe/trunk/lib/Checker/UnixAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/UnixAPIChecker.cpp?rev=100891&r1=100890&r2=100891&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/UnixAPIChecker.cpp (original)
+++ cfe/trunk/lib/Checker/UnixAPIChecker.cpp Fri Apr 9 15:26:58 2010
@@ -13,14 +13,15 @@
//===----------------------------------------------------------------------===//
#include "GRExprEngineInternalChecks.h"
-#include "clang/Analysis/Support/Optional.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Checker/BugReporter/BugType.h"
#include "clang/Checker/PathSensitive/CheckerVisitor.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
#include <fcntl.h>
using namespace clang;
+using llvm::Optional;
namespace {
class UnixAPIChecker : public CheckerVisitor<UnixAPIChecker> {
More information about the cfe-commits
mailing list