[CallSite] Make construction from Value* (or Instruction*) explicit.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Apr 2015 14:50:08 +0000 (14:50 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Apr 2015 14:50:08 +0000 (14:50 +0000)
commite749325463058c3df21185715cc1287029c3124b
tree2ca73f3832d34aa6d2e2428c5886263467f0090e
parent3905bb619cd71e847c3c65d0886424e92915f37a
[CallSite] Make construction from Value* (or Instruction*) explicit.

CallSite roughly behaves as a common base CallInst and InvokeInst. Bring
the behavior closer to that model by making upcasts explicit. Downcasts
remain implicit and work as before.

Following dyn_cast as a mental model checking whether a Value *V isa
CallSite now looks like this:
  if (auto CS = CallSite(V)) // think dyn_cast
instead of:
  if (CallSite CS = V)

This is an extra token but I think it is slightly clearer. Making the
ctor explicit has the advantage of not accidentally creating nullptr
CallSites, e.g. when you pass a Value * to a function taking a CallSite
argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234601 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
include/llvm/Analysis/TargetTransformInfoImpl.h
include/llvm/IR/CallSite.h
lib/Analysis/AliasAnalysisEvaluator.cpp
lib/Analysis/AliasSetTracker.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/MemDepPrinter.cpp
lib/Analysis/MemoryDependenceAnalysis.cpp
lib/Analysis/ValueTracking.cpp
lib/IR/Value.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
lib/Transforms/ObjCARC/DependencyAnalysis.cpp
lib/Transforms/Scalar/DeadStoreElimination.cpp
lib/Transforms/Scalar/MemCpyOptimizer.cpp
lib/Transforms/Scalar/PlaceSafepoints.cpp
lib/Transforms/Utils/GlobalStatus.cpp