Finally bite the bullet and make the major change: split the clang namespace
out of the llvm namespace. This makes the clang namespace be a sibling of
llvm instead of being a child.
The good thing about this is that it makes many things unambiguous. The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.
llvm-svn: 39659
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp
index 6b6f3cb..8790009 100644
--- a/clang/CodeGen/CodeGenFunction.cpp
+++ b/clang/CodeGen/CodeGenFunction.cpp
@@ -19,7 +19,6 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Analysis/Verifier.h"
-using namespace llvm;
using namespace clang;
using namespace CodeGen;
@@ -32,11 +31,11 @@
llvm::BasicBlock *CodeGenFunction::getBasicBlockForLabel(const LabelStmt *S) {
- BasicBlock *&BB = LabelMap[S];
+ llvm::BasicBlock *&BB = LabelMap[S];
if (BB) return BB;
// Create, but don't insert, the new block.
- return BB = new BasicBlock(S->getName());
+ return BB = new llvm::BasicBlock(S->getName());
}
@@ -55,7 +54,7 @@
case BuiltinType::Char_U:
case BuiltinType::SChar:
case BuiltinType::UChar:
- return IntegerType::get(Target.getCharWidth(Loc));
+ return llvm::IntegerType::get(Target.getCharWidth(Loc));
case BuiltinType::Bool:
// FIXME: This is very strange. We want scalars to be i1, but in memory
@@ -64,19 +63,19 @@
case BuiltinType::Short:
case BuiltinType::UShort:
- return IntegerType::get(Target.getShortWidth(Loc));
+ return llvm::IntegerType::get(Target.getShortWidth(Loc));
case BuiltinType::Int:
case BuiltinType::UInt:
- return IntegerType::get(Target.getIntWidth(Loc));
+ return llvm::IntegerType::get(Target.getIntWidth(Loc));
case BuiltinType::Long:
case BuiltinType::ULong:
- return IntegerType::get(Target.getLongWidth(Loc));
+ return llvm::IntegerType::get(Target.getLongWidth(Loc));
case BuiltinType::LongLong:
case BuiltinType::ULongLong:
- return IntegerType::get(Target.getLongLongWidth(Loc));
+ return llvm::IntegerType::get(Target.getLongLongWidth(Loc));
case BuiltinType::Float: return llvm::Type::FloatTy;
case BuiltinType::Double: return llvm::Type::DoubleTy;
@@ -138,7 +137,7 @@
}
// FIXME: implement.
- return OpaqueType::get();
+ return llvm::OpaqueType::get();
}
void CodeGenFunction::DecodeArgumentTypes(const FunctionTypeProto &FTP,
@@ -163,17 +162,17 @@
// FIXME: param attributes for sext/zext etc.
CurFuncDecl = FD;
- CurFn = new Function(Ty, Function::ExternalLinkage,
- FD->getName(), &CGM.getModule());
+ CurFn = new llvm::Function(Ty, llvm::Function::ExternalLinkage,
+ FD->getName(), &CGM.getModule());
- BasicBlock *EntryBB = new BasicBlock("entry", CurFn);
+ llvm::BasicBlock *EntryBB = new llvm::BasicBlock("entry", CurFn);
Builder.SetInsertPoint(EntryBB);
// Create a marker to make it easy to insert allocas into the entryblock
// later.
- AllocaInsertPt = Builder.CreateBitCast(UndefValue::get(llvm::Type::Int32Ty),
- llvm::Type::Int32Ty, "allocapt");
+ llvm::Value *Undef = llvm::UndefValue::get(llvm::Type::Int32Ty);
+ AllocaInsertPt = Builder.CreateBitCast(Undef,llvm::Type::Int32Ty, "allocapt");
// Emit allocs for param decls.
llvm::Function::arg_iterator AI = CurFn->arg_begin();
@@ -190,9 +189,7 @@
if (Ty->getReturnType() == llvm::Type::VoidTy)
Builder.CreateRetVoid();
else
- Builder.CreateRet(UndefValue::get(Ty->getReturnType()));
-
-
+ Builder.CreateRet(llvm::UndefValue::get(Ty->getReturnType()));
// Verify that the function is well formed.
assert(!verifyFunction(*CurFn));