summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/AST/ASTContext.cpp14
-rw-r--r--clang/AST/Attr.cpp1
-rw-r--r--clang/AST/Builtins.cpp3
-rw-r--r--clang/AST/Decl.cpp1
-rw-r--r--clang/AST/Expr.cpp7
-rw-r--r--clang/AST/Stmt.cpp1
-rw-r--r--clang/AST/StmtPrinter.cpp2
-rw-r--r--clang/AST/StmtVisitor.cpp1
-rw-r--r--clang/AST/Type.cpp10
-rw-r--r--clang/Basic/Diagnostic.cpp1
-rw-r--r--clang/Basic/FileManager.cpp5
-rw-r--r--clang/Basic/SourceManager.cpp2
-rw-r--r--clang/Basic/TargetInfo.cpp1
-rw-r--r--clang/Basic/TokenKinds.cpp3
-rw-r--r--clang/CodeGen/CGDecl.cpp7
-rw-r--r--clang/CodeGen/CGExpr.cpp107
-rw-r--r--clang/CodeGen/CGStmt.cpp37
-rw-r--r--clang/CodeGen/CodeGenFunction.cpp31
-rw-r--r--clang/CodeGen/CodeGenFunction.h27
-rw-r--r--clang/CodeGen/CodeGenModule.cpp1
-rw-r--r--clang/CodeGen/CodeGenModule.h9
-rw-r--r--clang/CodeGen/ModuleBuilder.cpp11
-rw-r--r--clang/Driver/LLVMCodegen.cpp7
-rw-r--r--clang/Driver/PrintParserCallbacks.cpp4
-rw-r--r--clang/Driver/PrintPreprocessedOutput.cpp18
-rw-r--r--clang/Driver/Targets.cpp7
-rw-r--r--clang/Driver/TextDiagnosticPrinter.cpp44
-rw-r--r--clang/Driver/TextDiagnosticPrinter.h50
-rw-r--r--clang/Driver/TextDiagnostics.cpp1
-rw-r--r--clang/Driver/TextDiagnostics.h68
-rw-r--r--clang/Driver/clang.cpp150
-rw-r--r--clang/Driver/clang.h2
-rw-r--r--clang/Lex/HeaderSearch.cpp40
-rw-r--r--clang/Lex/IdentifierTable.cpp20
-rw-r--r--clang/Lex/Lexer.cpp3
-rw-r--r--clang/Lex/LiteralSupport.cpp13
-rw-r--r--clang/Lex/MacroExpander.cpp5
-rw-r--r--clang/Lex/MacroInfo.cpp1
-rw-r--r--clang/Lex/PPExpressions.cpp21
-rw-r--r--clang/Lex/Pragma.cpp3
-rw-r--r--clang/Lex/Preprocessor.cpp7
-rw-r--r--clang/Lex/ScratchBuffer.cpp5
-rw-r--r--clang/Parse/AttributeList.cpp1
-rw-r--r--clang/Parse/DeclSpec.cpp1
-rw-r--r--clang/Parse/MinimalAction.cpp1
-rw-r--r--clang/Parse/ParseDecl.cpp13
-rw-r--r--clang/Parse/ParseExpr.cpp7
-rw-r--r--clang/Parse/ParseExprCXX.cpp1
-rw-r--r--clang/Parse/ParseInit.cpp1
-rw-r--r--clang/Parse/ParseObjc.cpp3
-rw-r--r--clang/Parse/ParseStmt.cpp3
-rw-r--r--clang/Parse/Parser.cpp4
-rw-r--r--clang/Sema/ASTStreamer.cpp12
-rw-r--r--clang/Sema/Sema.cpp1
-rw-r--r--clang/Sema/Sema.h4
-rw-r--r--clang/Sema/SemaDecl.cpp20
-rw-r--r--clang/Sema/SemaExpr.cpp12
-rw-r--r--clang/Sema/SemaExprCXX.cpp1
-rw-r--r--clang/Sema/SemaStmt.cpp1
-rw-r--r--clang/Sema/SemaType.cpp3
-rw-r--r--clang/include/clang/AST/ASTContext.h12
-rw-r--r--clang/include/clang/AST/Attr.h2
-rw-r--r--clang/include/clang/AST/Builtins.h2
-rw-r--r--clang/include/clang/AST/Decl.h8
-rw-r--r--clang/include/clang/AST/Expr.h12
-rw-r--r--clang/include/clang/AST/ExprCXX.h2
-rw-r--r--clang/include/clang/AST/Stmt.h10
-rw-r--r--clang/include/clang/AST/StmtVisitor.h2
-rw-r--r--clang/include/clang/AST/Type.h53
-rw-r--r--clang/include/clang/Basic/Diagnostic.h2
-rw-r--r--clang/include/clang/Basic/FileManager.h6
-rw-r--r--clang/include/clang/Basic/LangOptions.h2
-rw-r--r--clang/include/clang/Basic/SourceLocation.h2
-rw-r--r--clang/include/clang/Basic/SourceManager.h10
-rw-r--r--clang/include/clang/Basic/TargetInfo.h2
-rw-r--r--clang/include/clang/Basic/TokenKinds.h2
-rw-r--r--clang/include/clang/CodeGen/ModuleBuilder.h5
-rw-r--r--clang/include/clang/Lex/DirectoryLookup.h2
-rw-r--r--clang/include/clang/Lex/HeaderSearch.h4
-rw-r--r--clang/include/clang/Lex/IdentifierTable.h4
-rw-r--r--clang/include/clang/Lex/Lexer.h10
-rw-r--r--clang/include/clang/Lex/LexerToken.h2
-rw-r--r--clang/include/clang/Lex/LiteralSupport.h11
-rw-r--r--clang/include/clang/Lex/MacroExpander.h2
-rw-r--r--clang/include/clang/Lex/MacroInfo.h2
-rw-r--r--clang/include/clang/Lex/MultipleIncludeOpt.h2
-rw-r--r--clang/include/clang/Lex/PPCallbacks.h2
-rw-r--r--clang/include/clang/Lex/Pragma.h2
-rw-r--r--clang/include/clang/Lex/Preprocessor.h2
-rw-r--r--clang/include/clang/Lex/ScratchBuffer.h2
-rw-r--r--clang/include/clang/Parse/Action.h2
-rw-r--r--clang/include/clang/Parse/AttributeList.h2
-rw-r--r--clang/include/clang/Parse/DeclSpec.h4
-rw-r--r--clang/include/clang/Parse/Parser.h2
-rw-r--r--clang/include/clang/Parse/Scope.h5
-rw-r--r--clang/include/clang/Sema/ASTStreamer.h2
96 files changed, 463 insertions, 575 deletions
diff --git a/clang/AST/ASTContext.cpp b/clang/AST/ASTContext.cpp
index 36eda88ed17..6bf01473554 100644
--- a/clang/AST/ASTContext.cpp
+++ b/clang/AST/ASTContext.cpp
@@ -16,8 +16,6 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallVector.h"
-
-using namespace llvm;
using namespace clang;
enum FloatingRank {
@@ -144,7 +142,7 @@ void ASTContext::InitBuiltinTypes() {
QualType ASTContext::getPointerType(QualType T) {
// Unique pointers, to guarantee there is only one pointer of a particular
// structure.
- FoldingSetNodeID ID;
+ llvm::FoldingSetNodeID ID;
PointerType::Profile(ID, T);
void *InsertPos = 0;
@@ -172,7 +170,7 @@ QualType ASTContext::getPointerType(QualType T) {
QualType ASTContext::getReferenceType(QualType T) {
// Unique pointers, to guarantee there is only one pointer of a particular
// structure.
- FoldingSetNodeID ID;
+ llvm::FoldingSetNodeID ID;
ReferenceType::Profile(ID, T);
void *InsertPos = 0;
@@ -202,7 +200,7 @@ QualType ASTContext::getArrayType(QualType EltTy,ArrayType::ArraySizeModifier AS
unsigned EltTypeQuals, Expr *NumElts) {
// Unique array types, to guarantee there is only one array of a particular
// structure.
- FoldingSetNodeID ID;
+ llvm::FoldingSetNodeID ID;
ArrayType::Profile(ID, ASM, EltTypeQuals, EltTy, NumElts);
void *InsertPos = 0;
@@ -232,7 +230,7 @@ QualType ASTContext::getArrayType(QualType EltTy,ArrayType::ArraySizeModifier AS
QualType ASTContext::getFunctionTypeNoProto(QualType ResultTy) {
// Unique functions, to guarantee there is only one function of a particular
// structure.
- FoldingSetNodeID ID;
+ llvm::FoldingSetNodeID ID;
FunctionTypeNoProto::Profile(ID, ResultTy);
void *InsertPos = 0;
@@ -262,7 +260,7 @@ QualType ASTContext::getFunctionType(QualType ResultTy, QualType *ArgArray,
unsigned NumArgs, bool isVariadic) {
// Unique functions, to guarantee there is only one function of a particular
// structure.
- FoldingSetNodeID ID;
+ llvm::FoldingSetNodeID ID;
FunctionTypeProto::Profile(ID, ResultTy, ArgArray, NumArgs, isVariadic);
void *InsertPos = 0;
@@ -279,7 +277,7 @@ QualType ASTContext::getFunctionType(QualType ResultTy, QualType *ArgArray,
// If this type isn't canonical, get the canonical version of it.
QualType Canonical;
if (!isCanonical) {
- SmallVector<QualType, 16> CanonicalArgs;
+ llvm::SmallVector<QualType, 16> CanonicalArgs;
CanonicalArgs.reserve(NumArgs);
for (unsigned i = 0; i != NumArgs; ++i)
CanonicalArgs.push_back(ArgArray[i].getCanonicalType());
diff --git a/clang/AST/Attr.cpp b/clang/AST/Attr.cpp
index 3a684301f1e..ed96ed4dfdb 100644
--- a/clang/AST/Attr.cpp
+++ b/clang/AST/Attr.cpp
@@ -14,6 +14,5 @@
#include "clang/AST/Attr.h"
#include "clang/AST/Expr.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
diff --git a/clang/AST/Builtins.cpp b/clang/AST/Builtins.cpp
index af505620662..454085bf2a5 100644
--- a/clang/AST/Builtins.cpp
+++ b/clang/AST/Builtins.cpp
@@ -15,7 +15,6 @@
#include "clang/AST/ASTContext.h"
#include "clang/Lex/IdentifierTable.h"
#include "clang/Basic/TargetInfo.h"
-using namespace llvm;
using namespace clang;
static const Builtin::Info BuiltinInfo[] = {
@@ -112,7 +111,7 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context) {
QualType Builtin::Context::GetBuiltinType(unsigned id, ASTContext &Context)const{
const char *TypeStr = GetRecord(id).Type;
- SmallVector<QualType, 8> ArgTypes;
+ llvm::SmallVector<QualType, 8> ArgTypes;
QualType ResType = DecodeTypeFromStr(TypeStr, Context);
while (TypeStr[0] && TypeStr[0] != '.')
diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp
index f7301181d72..22fbabbd30c 100644
--- a/clang/AST/Decl.cpp
+++ b/clang/AST/Decl.cpp
@@ -13,7 +13,6 @@
#include "clang/AST/Decl.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
// temporary statistics gathering
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp
index 74b3ac9b2de..b3916f49b28 100644
--- a/clang/AST/Expr.cpp
+++ b/clang/AST/Expr.cpp
@@ -14,7 +14,6 @@
#include "clang/AST/Expr.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -209,7 +208,7 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue() {
///
/// FIXME: This should ext-warn on overflow during evaluation! ISO C does not
/// permit this.
-bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc,
+bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, SourceLocation *Loc,
bool isEvaluated) const {
switch (getStmtClass()) {
default:
@@ -299,7 +298,7 @@ bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc,
if (!Exp->getLHS()->isIntegerConstantExpr(Result, Loc, isEvaluated))
return false;
- APSInt RHS(Result);
+ llvm::APSInt RHS(Result);
// The short-circuiting &&/|| operators don't necessarily evaluate their
// RHS. Make sure to pass isEvaluated down correctly.
@@ -469,6 +468,6 @@ bool Expr::isNullPointerConstant() const {
// If we have an integer constant expression, we need to *evaluate* it and
// test for the value 0.
- APSInt Val(32);
+ llvm::APSInt Val(32);
return isIntegerConstantExpr(Val, 0, true) && Val == 0;
}
diff --git a/clang/AST/Stmt.cpp b/clang/AST/Stmt.cpp
index 0abbe47bf45..e43f03c404a 100644
--- a/clang/AST/Stmt.cpp
+++ b/clang/AST/Stmt.cpp
@@ -15,7 +15,6 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
// Implement all the AST node visit methods using the StmtNodes.def database.
diff --git a/clang/AST/StmtPrinter.cpp b/clang/AST/StmtPrinter.cpp
index bdf8378caf8..e90b9f2c3f4 100644
--- a/clang/AST/StmtPrinter.cpp
+++ b/clang/AST/StmtPrinter.cpp
@@ -17,7 +17,6 @@
#include "clang/Lex/IdentifierTable.h"
#include "llvm/Support/Compiler.h"
#include <iostream>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -422,6 +421,7 @@ void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
//===----------------------------------------------------------------------===//
void Stmt::dump() const {
+ // FIXME: eliminate use of <iostream>
print(std::cerr);
}
diff --git a/clang/AST/StmtVisitor.cpp b/clang/AST/StmtVisitor.cpp
index 77fa1292bcb..9171ef75665 100644
--- a/clang/AST/StmtVisitor.cpp
+++ b/clang/AST/StmtVisitor.cpp
@@ -13,7 +13,6 @@
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/ExprCXX.h"
-using namespace llvm;
using namespace clang;
StmtVisitor::~StmtVisitor() {
diff --git a/clang/AST/Type.cpp b/clang/AST/Type.cpp
index 6a51dae0115..80cdc291436 100644
--- a/clang/AST/Type.cpp
+++ b/clang/AST/Type.cpp
@@ -17,8 +17,6 @@
#include "clang/AST/Expr.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/Support/Streams.h"
-
-using namespace llvm;
using namespace clang;
Type::~Type() {}
@@ -386,7 +384,7 @@ const char *BuiltinType::getName() const {
}
}
-void FunctionTypeProto::Profile(FoldingSetNodeID &ID, QualType Result,
+void FunctionTypeProto::Profile(llvm::FoldingSetNodeID &ID, QualType Result,
QualType* ArgTys,
unsigned NumArgs, bool isVariadic) {
ID.AddPointer(Result.getAsOpaquePtr());
@@ -395,7 +393,7 @@ void FunctionTypeProto::Profile(FoldingSetNodeID &ID, QualType Result,
ID.AddInteger(isVariadic);
}
-void FunctionTypeProto::Profile(FoldingSetNodeID &ID) {
+void FunctionTypeProto::Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getResultType(), ArgInfo, NumArgs, isVariadic());
}
@@ -415,9 +413,9 @@ void QualType::dump(const char *msg) const {
std::string R = "foo";
getAsStringInternal(R);
if (msg)
- cerr << msg << ": " << R << "\n";
+ fprintf(stderr, "%s: %s\n", msg, R.c_str());
else
- cerr << R << "\n";
+ fprintf(stderr, "%s\n", R.c_str());
}
static void AppendTypeQualList(std::string &S, unsigned TypeQuals) {
diff --git a/clang/Basic/Diagnostic.cpp b/clang/Basic/Diagnostic.cpp
index 0e1feee9959..155b6fca124 100644
--- a/clang/Basic/Diagnostic.cpp
+++ b/clang/Basic/Diagnostic.cpp
@@ -14,7 +14,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include <cassert>
-using namespace llvm;
using namespace clang;
/// Flag values for diagnostics.
diff --git a/clang/Basic/FileManager.cpp b/clang/Basic/FileManager.cpp
index be9d951a63d..9886e032b43 100644
--- a/clang/Basic/FileManager.cpp
+++ b/clang/Basic/FileManager.cpp
@@ -20,7 +20,6 @@
#include "clang/Basic/FileManager.h"
#include "llvm/ADT/SmallString.h"
#include <iostream>
-using namespace llvm;
using namespace clang;
// FIXME: Enhance libsystem to support inode and other fields.
@@ -37,7 +36,7 @@ using namespace clang;
const DirectoryEntry *FileManager::getDirectory(const char *NameStart,
const char *NameEnd) {
++NumDirLookups;
- StringMapEntry<DirectoryEntry *> &NamedDirEnt =
+ llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
DirEntries.GetOrCreateValue(NameStart, NameEnd);
// See if there is already an entry in the map.
@@ -87,7 +86,7 @@ const FileEntry *FileManager::getFile(const char *NameStart,
++NumFileLookups;
// See if there is already an entry in the map.
- StringMapEntry<FileEntry *> &NamedFileEnt =
+ llvm::StringMapEntry<FileEntry *> &NamedFileEnt =
FileEntries.GetOrCreateValue(NameStart, NameEnd);
// See if there is already an entry in the map.
diff --git a/clang/Basic/SourceManager.cpp b/clang/Basic/SourceManager.cpp
index 09c7e747ff0..f6148c1602b 100644
--- a/clang/Basic/SourceManager.cpp
+++ b/clang/Basic/SourceManager.cpp
@@ -17,9 +17,9 @@
#include "llvm/System/Path.h"
#include <algorithm>
#include <iostream>
-using namespace llvm;
using namespace clang;
using namespace SrcMgr;
+using llvm::MemoryBuffer;
SourceManager::~SourceManager() {
for (std::map<const FileEntry *, FileInfo>::iterator I = FileInfos.begin(),
diff --git a/clang/Basic/TargetInfo.cpp b/clang/Basic/TargetInfo.cpp
index 65f70b471f4..a565536fd6f 100644
--- a/clang/Basic/TargetInfo.cpp
+++ b/clang/Basic/TargetInfo.cpp
@@ -16,7 +16,6 @@
#include "clang/AST/Builtins.h"
#include <map>
#include <set>
-using namespace llvm;
using namespace clang;
void TargetInfoImpl::ANCHOR() {} // out-of-line virtual method for class.
diff --git a/clang/Basic/TokenKinds.cpp b/clang/Basic/TokenKinds.cpp
index 234713476fc..772925b1e51 100644
--- a/clang/Basic/TokenKinds.cpp
+++ b/clang/Basic/TokenKinds.cpp
@@ -13,8 +13,7 @@
#include "clang/Basic/TokenKinds.h"
#include <cassert>
-using namespace llvm;
-using namespace llvm::clang;
+using namespace clang;
static const char * const TokNames[] = {
#define TOK(X) #X,
diff --git a/clang/CodeGen/CGDecl.cpp b/clang/CodeGen/CGDecl.cpp
index bebf6752fb3..108538bb1fb 100644
--- a/clang/CodeGen/CGDecl.cpp
+++ b/clang/CodeGen/CGDecl.cpp
@@ -14,7 +14,6 @@
#include "CodeGenFunction.h"
#include "clang/AST/AST.h"
#include "llvm/Type.h"
-using namespace llvm;
using namespace clang;
using namespace CodeGen;
@@ -75,7 +74,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const BlockVarDecl &D) {
// A normal fixed sized variable becomes an alloca in the entry block.
const llvm::Type *LTy = ConvertType(Ty, D.getLocation());
// TODO: Alignment
- DeclPtr = new AllocaInst(LTy, 0, D.getName(), AllocaInsertPt);
+ DeclPtr = new llvm::AllocaInst(LTy, 0, D.getName(), AllocaInsertPt);
} else {
// TODO: Create a dynamic alloca.
assert(0 && "FIXME: Local VLAs not implemented yet");
@@ -102,8 +101,8 @@ void CodeGenFunction::EmitParmDecl(const ParmVarDecl &D, llvm::Value *Arg) {
const llvm::Type *LTy = ConvertType(Ty, D.getLocation());
if (LTy->isFirstClassType()) {
// TODO: Alignment
- DeclPtr = new AllocaInst(LTy, 0,
- std::string(D.getName())+".addr",AllocaInsertPt);
+ DeclPtr = new llvm::AllocaInst(LTy, 0, std::string(D.getName())+".addr",
+ AllocaInsertPt);
// Store the initial value into the alloca.
Builder.CreateStore(Arg, DeclPtr);
diff --git a/clang/CodeGen/CGExpr.cpp b/clang/CodeGen/CGExpr.cpp
index 20d7c7f7cb2..63879ad66be 100644
--- a/clang/CodeGen/CGExpr.cpp
+++ b/clang/CodeGen/CGExpr.cpp
@@ -17,7 +17,6 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
-using namespace llvm;
using namespace clang;
using namespace CodeGen;
@@ -28,7 +27,7 @@ using namespace CodeGen;
/// EvaluateExprAsBool - Perform the usual unary conversions on the specified
/// expression and compare the result against zero, returning an Int1Ty value.
-Value *CodeGenFunction::EvaluateExprAsBool(const Expr *E) {
+llvm::Value *CodeGenFunction::EvaluateExprAsBool(const Expr *E) {
QualType Ty;
RValue Val = EmitExprWithUsualUnaryConversions(E, Ty);
return ConvertScalarValueToBool(Val, Ty);
@@ -77,11 +76,11 @@ RValue CodeGenFunction::EmitConversion(RValue Val, QualType ValTy,
if (Val.isScalar() && DstTy->isRealType()) {
// We know that these are representable as scalars in LLVM, convert to LLVM
// types since they are easier to reason about.
- Value *SrcVal = Val.getVal();
+ llvm::Value *SrcVal = Val.getVal();
const llvm::Type *DestTy = ConvertType(DstTy, Loc);
if (SrcVal->getType() == DestTy) return Val;
- Value *Result;
+ llvm::Value *Result;
if (isa<llvm::IntegerType>(SrcVal->getType())) {
bool InputSigned = ValTy->isSignedIntegerType();
if (isa<llvm::IntegerType>(DestTy))
@@ -114,9 +113,9 @@ RValue CodeGenFunction::EmitConversion(RValue Val, QualType ValTy,
/// ConvertScalarValueToBool - Convert the specified expression value to a
/// boolean (i1) truth value. This is equivalent to "Val == 0".
-Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty) {
+llvm::Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty){
Ty = Ty.getCanonicalType();
- Value *Result;
+ llvm::Value *Result;
if (const BuiltinType *BT = dyn_cast<BuiltinType>(Ty)) {
switch (BT->getKind()) {
default: assert(0 && "Unknown scalar value");
@@ -145,7 +144,7 @@ Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty) {
case BuiltinType::LongDouble: {
// Compare against 0.0 for fp scalars.
Result = Val.getVal();
- llvm::Value *Zero = Constant::getNullValue(Result->getType());
+ llvm::Value *Zero = llvm::Constant::getNullValue(Result->getType());
// FIXME: llvm-gcc produces a une comparison: validate this is right.
Result = Builder.CreateFCmpUNE(Result, Zero, "tobool");
return Result;
@@ -169,7 +168,7 @@ Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty) {
// Because of the type rules of C, we often end up computing a logical value,
// then zero extending it to int, then wanting it as a logical value again.
// Optimize this common case.
- if (llvm::ZExtInst *ZI = dyn_cast<ZExtInst>(Result)) {
+ if (llvm::ZExtInst *ZI = dyn_cast<llvm::ZExtInst>(Result)) {
if (ZI->getOperand(0)->getType() == llvm::Type::Int1Ty) {
Result = ZI->getOperand(0);
ZI->eraseFromParent();
@@ -177,7 +176,7 @@ Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty) {
}
}
- llvm::Value *Zero = Constant::getNullValue(Result->getType());
+ llvm::Value *Zero = llvm::Constant::getNullValue(Result->getType());
return Builder.CreateICmpNE(Result, Zero, "tobool");
}
@@ -206,7 +205,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
default:
fprintf(stderr, "Unimplemented lvalue expr!\n");
E->dump();
- return LValue::getAddr(UndefValue::get(
+ return LValue::getAddr(llvm::UndefValue::get(
llvm::PointerType::get(llvm::Type::Int32Ty)));
case Expr::DeclRefExprClass: return EmitDeclRefLValue(cast<DeclRefExpr>(E));
@@ -244,7 +243,7 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
assert(Src.isScalar() && "FIXME: Don't support store of aggregate yet");
// TODO: Handle volatility etc.
- Value *Addr = Dst.getAddress();
+ llvm::Value *Addr = Dst.getAddress();
const llvm::Type *SrcTy = Src.getVal()->getType();
const llvm::Type *AddrTy =
cast<llvm::PointerType>(Addr->getType())->getElementType();
@@ -259,7 +258,7 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
const Decl *D = E->getDecl();
if (isa<BlockVarDecl>(D) || isa<ParmVarDecl>(D)) {
- Value *V = LocalDeclMap[D];
+ llvm::Value *V = LocalDeclMap[D];
assert(V && "BlockVarDecl not entered in LocalDeclMap?");
return LValue::getAddr(V);
}
@@ -282,14 +281,15 @@ LValue CodeGenFunction::EmitStringLiteralLValue(const StringLiteral *E) {
unsigned Len = E->getByteLength();
// FIXME: Can cache/reuse these within the module.
- Constant *C = llvm::ConstantArray::get(std::string(StrData, StrData+Len));
+ llvm::Constant *C=llvm::ConstantArray::get(std::string(StrData, StrData+Len));
// Create a global variable for this.
- C = new llvm::GlobalVariable(C->getType(), true, GlobalValue::InternalLinkage,
+ C = new llvm::GlobalVariable(C->getType(), true,
+ llvm::GlobalValue::InternalLinkage,
C, ".str", CurFn->getParent());
- Constant *Zero = llvm::Constant::getNullValue(llvm::Type::Int32Ty);
- Constant *Zeros[] = { Zero, Zero };
- C = ConstantExpr::getGetElementPtr(C, Zeros, 2);
+ llvm::Constant *Zero = llvm::Constant::getNullValue(llvm::Type::Int32Ty);
+ llvm::Constant *Zeros[] = { Zero, Zero };
+ C = llvm::ConstantExpr::getGetElementPtr(C, Zeros, 2);
return LValue::getAddr(C);
}
@@ -297,9 +297,11 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
// The base and index must be pointers or integers, neither of which are
// aggregates. Emit them.
QualType BaseTy;
- Value *Base =EmitExprWithUsualUnaryConversions(E->getBase(), BaseTy).getVal();
+ llvm::Value *Base =
+ EmitExprWithUsualUnaryConversions(E->getBase(), BaseTy).getVal();
QualType IdxTy;
- Value *Idx = EmitExprWithUsualUnaryConversions(E->getIdx(), IdxTy).getVal();
+ llvm::Value *Idx =
+ EmitExprWithUsualUnaryConversions(E->getIdx(), IdxTy).getVal();
// Usually the base is the pointer type, but sometimes it is the index.
// Canonicalize to have the pointer as the base.
@@ -311,9 +313,9 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
// The pointer is now the base. Extend or truncate the index type to 32 or
// 64-bits.
bool IdxSigned = IdxTy->isSignedIntegerType();
- unsigned IdxBitwidth = cast<IntegerType>(Idx->getType())->getBitWidth();
+ unsigned IdxBitwidth = cast<llvm::IntegerType>(Idx->getType())->getBitWidth();
if (IdxBitwidth != LLVMPointerWidth)
- Idx = Builder.CreateIntCast(Idx, IntegerType::get(LLVMPointerWidth),
+ Idx = Builder.CreateIntCast(Idx, llvm::IntegerType::get(LLVMPointerWidth),
IdxSigned, "idxprom");
// We know that the pointer points to a type of the correct size, unless the
@@ -334,14 +336,14 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
default:
printf("Unimplemented expr!\n");
E->dump();
- return RValue::get(UndefValue::get(llvm::Type::Int32Ty));
+ return RValue::get(llvm::UndefValue::get(llvm::Type::Int32Ty));
// l-values.
case Expr::DeclRefExprClass:
// DeclRef's of EnumConstantDecl's are simple rvalues.
if (const EnumConstantDecl *EC =
dyn_cast<EnumConstantDecl>(cast<DeclRefExpr>(E)->getDecl()))
- return RValue::get(ConstantInt::get(EC->getInitVal()));
+ return RValue::get(llvm::ConstantInt::get(EC->getInitVal()));
// FALLTHROUGH
case Expr::ArraySubscriptExprClass:
@@ -369,7 +371,7 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
}
RValue CodeGenFunction::EmitIntegerLiteral(const IntegerLiteral *E) {
- return RValue::get(ConstantInt::get(E->getValue()));
+ return RValue::get(llvm::ConstantInt::get(E->getValue()));
}
RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
@@ -385,9 +387,10 @@ RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
QualType Ty;
- Value *Callee =EmitExprWithUsualUnaryConversions(E->getCallee(), Ty).getVal();
+ llvm::Value *Callee =
+ EmitExprWithUsualUnaryConversions(E->getCallee(), Ty).getVal();
- SmallVector<Value*, 16> Args;
+ llvm::SmallVector<llvm::Value*, 16> Args;
// FIXME: Handle struct return.
for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
@@ -399,7 +402,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
Args.push_back(ArgVal.getAggregateVal());
}
- Value *V = Builder.CreateCall(Callee, &Args[0], Args.size());
+ llvm::Value *V = Builder.CreateCall(Callee, &Args[0], Args.size());
if (V->getType() != llvm::Type::VoidTy)
V->setName("call");
@@ -460,7 +463,7 @@ RValue CodeGenFunction::EmitUnaryOperator(const UnaryOperator *E) {
default:
printf("Unimplemented unary expr!\n");
E->dump();
- return RValue::get(UndefValue::get(llvm::Type::Int32Ty));
+ return RValue::get(llvm::UndefValue::get(llvm::Type::Int32Ty));
// FIXME: pre/post inc/dec
case UnaryOperator::AddrOf: return EmitUnaryAddrOf(E);
case UnaryOperator::Deref : return EmitLoadOfLValue(E);
@@ -512,7 +515,7 @@ RValue CodeGenFunction::EmitUnaryNot(const UnaryOperator *E) {
/// C99 6.5.3.3
RValue CodeGenFunction::EmitUnaryLNot(const UnaryOperator *E) {
// Compare operand to zero.
- Value *BoolVal = EvaluateExprAsBool(E->getSubExpr());
+ llvm::Value *BoolVal = EvaluateExprAsBool(E->getSubExpr());
// Invert value.
// TODO: Could dynamically modify easy computations here. For example, if
@@ -630,7 +633,7 @@ RValue CodeGenFunction::EmitBinaryOperator(const BinaryOperator *E) {
default:
fprintf(stderr, "Unimplemented expr!\n");
E->dump();
- return RValue::get(UndefValue::get(llvm::Type::Int32Ty));
+ return RValue::get(llvm::UndefValue::get(llvm::Type::Int32Ty));
case BinaryOperator::Mul: return EmitBinaryMul(E);
case BinaryOperator::Div: return EmitBinaryDiv(E);
case BinaryOperator::Rem: return EmitBinaryRem(E);
@@ -668,7 +671,7 @@ RValue CodeGenFunction::EmitBinaryDiv(const BinaryOperator *E) {
EmitUsualArithmeticConversions(E, LHS, RHS);
if (LHS.isScalar()) {
- Value *RV;
+ llvm::Value *RV;
if (LHS.getVal()->getType()->isFloatingPoint())
RV = Builder.CreateFDiv(LHS.getVal(), RHS.getVal(), "div");
else if (E->getType()->isUnsignedIntegerType())
@@ -685,7 +688,7 @@ RValue CodeGenFunction::EmitBinaryRem(const BinaryOperator *E) {
EmitUsualArithmeticConversions(E, LHS, RHS);
if (LHS.isScalar()) {
- Value *RV;
+ llvm::Value *RV;
// Rem in C can't be a floating point type: C99 6.5.5p2.
if (E->getType()->isUnsignedIntegerType())
RV = Builder.CreateURem(LHS.getVal(), RHS.getVal(), "rem");
@@ -728,8 +731,10 @@ RValue CodeGenFunction::EmitBinaryShl(const BinaryOperator *E) {
// conversions are not. The LHS and RHS need not have the same type.
QualType ResTy;
- Value *LHS = EmitExprWithUsualUnaryConversions(E->getLHS(), ResTy).getVal();
- Value *RHS = EmitExprWithUsualUnaryConversions(E->getRHS(), ResTy).getVal();
+ llvm::Value *LHS =
+ EmitExprWithUsualUnaryConversions(E->getLHS(), ResTy).getVal();
+ llvm::Value *RHS =
+ EmitExprWithUsualUnaryConversions(E->getRHS(), ResTy).getVal();
// LLVM requires the LHS and RHS to be the same type, promote or truncate the
// RHS to the same size as the LHS.
@@ -744,8 +749,10 @@ RValue CodeGenFunction::EmitBinaryShr(const BinaryOperator *E) {
// conversions are not. The LHS and RHS need not have the same type.
QualType ResTy;
- Value *LHS = EmitExprWithUsualUnaryConversions(E->getLHS(), ResTy).getVal();
- Value *RHS = EmitExprWithUsualUnaryConversions(E->getRHS(), ResTy).getVal();
+ llvm::Value *LHS =
+ EmitExprWithUsualUnaryConversions(E->getLHS(), ResTy).getVal();
+ llvm::Value *RHS =
+ EmitExprWithUsualUnaryConversions(E->getRHS(), ResTy).getVal();
// LLVM requires the LHS and RHS to be the same type, promote or truncate the
// RHS to the same size as the LHS.
@@ -789,16 +796,16 @@ RValue CodeGenFunction::EmitBinaryOr(const BinaryOperator *E) {
}
RValue CodeGenFunction::EmitBinaryLAnd(const BinaryOperator *E) {
- Value *LHSCond = EvaluateExprAsBool(E->getLHS());
+ llvm::Value *LHSCond = EvaluateExprAsBool(E->getLHS());
- BasicBlock *ContBlock = new BasicBlock("land_cont");
- BasicBlock *RHSBlock = new BasicBlock("land_rhs");
+ llvm::BasicBlock *ContBlock = new llvm::BasicBlock("land_cont");
+ llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("land_rhs");
- BasicBlock *OrigBlock = Builder.GetInsertBlock();
+ llvm::BasicBlock *OrigBlock = Builder.GetInsertBlock();
Builder.CreateCondBr(LHSCond, RHSBlock, ContBlock);
EmitBlock(RHSBlock);
- Value *RHSCond = EvaluateExprAsBool(E->getRHS());
+ llvm::Value *RHSCond = EvaluateExprAsBool(E->getRHS());
// Reaquire the RHS block, as there may be subblocks inserted.
RHSBlock = Builder.GetInsertBlock();
@@ -806,9 +813,9 @@ RValue CodeGenFunction::EmitBinaryLAnd(const BinaryOperator *E) {
// Create a PHI node. If we just evaluted the LHS condition, the result is
// false. If we evaluated both, the result is the RHS condition.
- PHINode *PN = Builder.CreatePHI(llvm::Type::Int1Ty, "land");
+ llvm::PHINode *PN = Builder.CreatePHI(llvm::Type::Int1Ty, "land");
PN->reserveOperandSpace(2);
- PN->addIncoming(ConstantInt::getFalse(), OrigBlock);
+ PN->addIncoming(llvm::ConstantInt::getFalse(), OrigBlock);
PN->addIncoming(RHSCond, RHSBlock);
// ZExt result to int.
@@ -816,16 +823,16 @@ RValue CodeGenFunction::EmitBinaryLAnd(const BinaryOperator *E) {
}
RValue CodeGenFunction::EmitBinaryLOr(const BinaryOperator *E) {
- Value *LHSCond = EvaluateExprAsBool(E->getLHS());
+ llvm::Value *LHSCond = EvaluateExprAsBool(E->getLHS());
- BasicBlock *ContBlock = new BasicBlock("lor_cont");
- BasicBlock *RHSBlock = new BasicBlock("lor_rhs");
+ llvm::BasicBlock *ContBlock = new llvm::BasicBlock("lor_cont");
+ llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("lor_rhs");
- BasicBlock *OrigBlock = Builder.GetInsertBlock();
+ llvm::BasicBlock *OrigBlock = Builder.GetInsertBlock();
Builder.CreateCondBr(LHSCond, ContBlock, RHSBlock);
EmitBlock(RHSBlock);
- Value *RHSCond = EvaluateExprAsBool(E->getRHS());
+ llvm::Value *RHSCond = EvaluateExprAsBool(E->getRHS());
// Reaquire the RHS block, as there may be subblocks inserted.
RHSBlock = Builder.GetInsertBlock();
@@ -833,9 +840,9 @@ RValue CodeGenFunction::EmitBinaryLOr(const BinaryOperator *E) {
// Create a PHI node. If we just evaluted the LHS condition, the result is
// true. If we evaluated both, the result is the RHS condition.
- PHINode *PN = Builder.CreatePHI(llvm::Type::Int1Ty, "lor");
+ llvm::PHINode *PN = Builder.CreatePHI(llvm::Type::Int1Ty, "lor");
PN->reserveOperandSpace(2);
- PN->addIncoming(ConstantInt::getTrue(), OrigBlock);
+ PN->addIncoming(llvm::ConstantInt::getTrue(), OrigBlock);
PN->addIncoming(RHSCond, RHSBlock);
// ZExt result to int.
diff --git a/clang/CodeGen/CGStmt.cpp b/clang/CodeGen/CGStmt.cpp
index 8672a622c98..d874e513614 100644
--- a/clang/CodeGen/CGStmt.cpp
+++ b/clang/CodeGen/CGStmt.cpp
@@ -16,7 +16,6 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
-using namespace llvm;
using namespace clang;
using namespace CodeGen;
@@ -61,10 +60,10 @@ void CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S) {
EmitStmt(*I);
}
-void CodeGenFunction::EmitBlock(BasicBlock *BB) {
+void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB) {
// Emit a branch from this block to the next one if this was a real block. If
// this was just a fall-through block after a terminator, don't emit it.
- BasicBlock *LastBB = Builder.GetInsertBlock();
+ llvm::BasicBlock *LastBB = Builder.GetInsertBlock();
if (LastBB->getTerminator()) {
// If the previous block is already terminated, don't touch it.
@@ -92,7 +91,7 @@ void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) {
// Emit a block after the branch so that dead code after a goto has some place
// to go.
- Builder.SetInsertPoint(new BasicBlock("", CurFn));
+ Builder.SetInsertPoint(new llvm::BasicBlock("", CurFn));
}
void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
@@ -100,12 +99,12 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
// unequal to 0. The condition must be a scalar type.
llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond());
- BasicBlock *ContBlock = new BasicBlock("ifend");
- BasicBlock *ThenBlock = new BasicBlock("ifthen");
- BasicBlock *ElseBlock = ContBlock;
+ llvm::BasicBlock *ContBlock = new llvm::BasicBlock("ifend");
+ llvm::BasicBlock *ThenBlock = new llvm::BasicBlock("ifthen");
+ llvm::BasicBlock *ElseBlock = ContBlock;
if (S.getElse())
- ElseBlock = new BasicBlock("ifelse");
+ ElseBlock = new llvm::BasicBlock("ifelse");
// Insert the conditional branch.
Builder.CreateCondBr(BoolCondVal, ThenBlock, ElseBlock);
@@ -131,7 +130,7 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) {
// Emit the header for the loop, insert it, which will create an uncond br to
// it.
- BasicBlock *LoopHeader = new BasicBlock("whilecond");
+ llvm::BasicBlock *LoopHeader = new llvm::BasicBlock("whilecond");
EmitBlock(LoopHeader);
// Evaluate the conditional in the while header. C99 6.8.5.1: The evaluation
@@ -144,8 +143,8 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) {
// Create an exit block for when the condition fails, create a block for the
// body of the loop.
- BasicBlock *ExitBlock = new BasicBlock("whileexit");
- BasicBlock *LoopBody = new BasicBlock("whilebody");
+ llvm::BasicBlock *ExitBlock = new llvm::BasicBlock("whileexit");
+ llvm::BasicBlock *LoopBody = new llvm::BasicBlock("whilebody");
// As long as the condition is true, go to the loop body.
Builder.CreateCondBr(BoolCondVal, LoopBody, ExitBlock);
@@ -168,8 +167,8 @@ void CodeGenFunction::EmitDoStmt(const DoStmt &S) {
// Emit the body for the loop, insert it, which will create an uncond br to
// it.
- BasicBlock *LoopBody = new BasicBlock("dobody");
- BasicBlock *AfterDo = new BasicBlock("afterdo");
+ llvm::BasicBlock *LoopBody = new llvm::BasicBlock("dobody");
+ llvm::BasicBlock *AfterDo = new llvm::BasicBlock("afterdo");
EmitBlock(LoopBody);
// Emit the body of the loop into the block.
@@ -200,8 +199,8 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
EmitStmt(S.getInit());
// Start the loop with a block that tests the condition.
- BasicBlock *CondBlock = new BasicBlock("forcond");
- BasicBlock *AfterFor = 0;
+ llvm::BasicBlock *CondBlock = new llvm::BasicBlock("forcond");
+ llvm::BasicBlock *AfterFor = 0;
EmitBlock(CondBlock);
// Evaluate the condition if present. If not, treat it as a non-zero-constant
@@ -212,8 +211,8 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond());
// As long as the condition is true, iterate the loop.
- BasicBlock *ForBody = new BasicBlock("forbody");
- AfterFor = new BasicBlock("afterfor");
+ llvm::BasicBlock *ForBody = new llvm::BasicBlock("forbody");
+ AfterFor = new llvm::BasicBlock("afterfor");
Builder.CreateCondBr(BoolCondVal, ForBody, AfterFor);
EmitBlock(ForBody);
} else {
@@ -235,7 +234,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
if (AfterFor)
EmitBlock(AfterFor);
else
- EmitBlock(new BasicBlock());
+ EmitBlock(new llvm::BasicBlock());
}
/// EmitReturnStmt - Note that due to GCC extensions, this can have an operand
@@ -276,7 +275,7 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
// Emit a block after the branch so that dead code after a return has some
// place to go.
- EmitBlock(new BasicBlock());
+ EmitBlock(new llvm::BasicBlock());
}
void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp
index 6b6f3cbbdc7..87900096df4 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 @@ ASTContext &CodeGenFunction::getContext() const {
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 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
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 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
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 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
}
// FIXME: implement.
- return OpaqueType::get();
+ return llvm::OpaqueType::get();
}
void CodeGenFunction::DecodeArgumentTypes(const FunctionTypeProto &FTP,
@@ -163,17 +162,17 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
// 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 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
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));
diff --git a/clang/CodeGen/CodeGenFunction.h b/clang/CodeGen/CodeGenFunction.h
index 1b078879dff..b4123123c70 100644
--- a/clang/CodeGen/CodeGenFunction.h
+++ b/clang/CodeGen/CodeGenFunction.h
@@ -20,6 +20,8 @@
namespace llvm {
class Module;
+}
+
namespace clang {
class SourceLocation;
class TargetInfo;
@@ -62,7 +64,7 @@ namespace CodeGen {
/// LLVM SSA value, or the address of an aggregate value in memory. These two
/// possibilities are discriminated by isAggregate/isScalar.
class RValue {
- Value *V;
+ llvm::Value *V;
// TODO: Encode this into the low bit of pointer for more efficient
// return-by-value.
bool IsAggregate;
@@ -72,24 +74,24 @@ public:
bool isScalar() const { return !IsAggregate; }
/// getVal() - Return the Value* of this scalar value.
- Value *getVal() const {
+ llvm::Value *getVal() const {
assert(!isAggregate() && "Not a scalar!");
return V;
}
/// getAggregateVal() - Return the Value* of the address of the aggregate.
- Value *getAggregateVal() const {
+ llvm::Value *getAggregateVal() const {
assert(isAggregate() && "Not an aggregate!");
return V;
}
- static RValue get(Value *V) {
+ static RValue get(llvm::Value *V) {
RValue ER;
ER.V = V;
ER.IsAggregate = false;
return ER;
}
- static RValue getAggregate(Value *V) {
+ static RValue getAggregate(llvm::Value *V) {
RValue ER;
ER.V = V;
ER.IsAggregate = true;
@@ -110,7 +112,7 @@ public:
llvm::Value *getAddress() const { assert(!isBitfield()); return V; }
- static LValue getAddr(Value *V) {
+ static LValue getAddr(llvm::Value *V) {
LValue R;
R.V = V;
return R;
@@ -122,7 +124,7 @@ public:
class CodeGenFunction {
CodeGenModule &CGM; // Per-module state.
TargetInfo &Target;
- LLVMBuilder Builder;
+ llvm::LLVMBuilder Builder;
const FunctionDecl *CurFuncDecl;
llvm::Function *CurFn;
@@ -136,10 +138,10 @@ class CodeGenFunction {
/// LocalDeclMap - This keeps track of the LLVM allocas or globals for local C
/// decls.
- DenseMap<const Decl*, llvm::Value*> LocalDeclMap;
+ llvm::DenseMap<const Decl*, llvm::Value*> LocalDeclMap;
/// LabelMap - This keeps track of the LLVM basic block for each C label.
- DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
+ llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
public:
CodeGenFunction(CodeGenModule &cgm);
@@ -158,12 +160,12 @@ public:
llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
- void EmitBlock(BasicBlock *BB);
+ void EmitBlock(llvm::BasicBlock *BB);
/// EvaluateExprAsBool - Perform the usual unary conversions on the specified
/// expression and compare the result against zero, returning an Int1Ty value.
- Value *EvaluateExprAsBool(const Expr *E);
+ llvm::Value *EvaluateExprAsBool(const Expr *E);
//===--------------------------------------------------------------------===//
// Conversions
@@ -176,7 +178,7 @@ public:
/// ConvertScalarValueToBool - Convert the specified expression value to a
/// boolean (i1) truth value. This is equivalent to "Val == 0".
- Value *ConvertScalarValueToBool(RValue Val, QualType Ty);
+ llvm::Value *ConvertScalarValueToBool(RValue Val, QualType Ty);
//===--------------------------------------------------------------------===//
// Declaration Emission
@@ -290,6 +292,5 @@ public:
};
} // end namespace CodeGen
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp
index fa1a3d2332e..648e0ad30a5 100644
--- a/clang/CodeGen/CodeGenModule.cpp
+++ b/clang/CodeGen/CodeGenModule.cpp
@@ -14,7 +14,6 @@
#include "CodeGenModule.h"
#include "CodeGenFunction.h"
#include "clang/AST/Decl.h"
-using namespace llvm;
using namespace clang;
using namespace CodeGen;
diff --git a/clang/CodeGen/CodeGenModule.h b/clang/CodeGen/CodeGenModule.h
index 7de3bc0e33b..d58f90d2560 100644
--- a/clang/CodeGen/CodeGenModule.h
+++ b/clang/CodeGen/CodeGenModule.h
@@ -16,6 +16,8 @@
namespace llvm {
class Module;
+}
+
namespace clang {
class ASTContext;
class FunctionDecl;
@@ -26,12 +28,12 @@ namespace CodeGen {
/// while generating LLVM code.
class CodeGenModule {
ASTContext &Context;
- Module &TheModule;
+ llvm::Module &TheModule;
public:
- CodeGenModule(ASTContext &C, Module &M) : Context(C), TheModule(M) {}
+ CodeGenModule(ASTContext &C, llvm::Module &M) : Context(C), TheModule(M) {}
ASTContext &getContext() const { return Context; }
- Module &getModule() const { return TheModule; }
+ llvm::Module &getModule() const { return TheModule; }
void EmitFunction(FunctionDecl *FD);
@@ -39,6 +41,5 @@ public:
};
} // end namespace CodeGen
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/CodeGen/ModuleBuilder.cpp b/clang/CodeGen/ModuleBuilder.cpp
index 2de81721826..16b13d1c4dd 100644
--- a/clang/CodeGen/ModuleBuilder.cpp
+++ b/clang/CodeGen/ModuleBuilder.cpp
@@ -13,28 +13,27 @@
#include "clang/CodeGen/ModuleBuilder.h"
#include "CodeGenModule.h"
-using namespace llvm;
using namespace clang;
/// Init - Create an ModuleBuilder with the specified ASTContext.
-llvm::clang::CodeGen::BuilderTy *
-llvm::clang::CodeGen::Init(ASTContext &Context, Module &M) {
+clang::CodeGen::BuilderTy *
+clang::CodeGen::Init(ASTContext &Context, llvm::Module &M) {
return new CodeGenModule(Context, M);
}
-void llvm::clang::CodeGen::Terminate(BuilderTy *B) {
+void clang::CodeGen::Terminate(BuilderTy *B) {
delete static_cast<CodeGenModule*>(B);
}
/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
///
-void llvm::clang::CodeGen::CodeGenFunction(BuilderTy *B, FunctionDecl *D) {
+void clang::CodeGen::CodeGenFunction(BuilderTy *B, FunctionDecl *D) {
static_cast<CodeGenModule*>(B)->EmitFunction(D);
}
/// PrintStats - Emit statistic information to stderr.
///
-void llvm::clang::CodeGen::PrintStats(BuilderTy *B) {
+void clang::CodeGen::PrintStats(BuilderTy *B) {
static_cast<CodeGenModule*>(B)->PrintStats();
}
diff --git a/clang/Driver/LLVMCodegen.cpp b/clang/Driver/LLVMCodegen.cpp
index e86a0359fa4..e593b66cfde 100644
--- a/clang/Driver/LLVMCodegen.cpp
+++ b/clang/Driver/LLVMCodegen.cpp
@@ -19,22 +19,21 @@
#include "clang/Basic/Diagnostic.h"
#include "llvm/Module.h"
#include <iostream>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
// LLVM Emission
//===----------------------------------------------------------------------===//
-void llvm::clang::EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
- bool PrintStats) {
+void clang::EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
+ bool PrintStats) {
Diagnostic &Diags = PP.getDiagnostics();
// Create the streamer to read the file.
ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
// Create the module to codegen into.
- Module M("foo");
+ llvm::Module M("foo");
CodeGen::BuilderTy *Builder = CodeGen::Init(Context, M);
diff --git a/clang/Driver/PrintParserCallbacks.cpp b/clang/Driver/PrintParserCallbacks.cpp
index 68f7c7d9e8f..3730d19a7d0 100644
--- a/clang/Driver/PrintParserCallbacks.cpp
+++ b/clang/Driver/PrintParserCallbacks.cpp
@@ -17,8 +17,6 @@
#include "clang/Parse/Action.h"
#include "clang/Parse/DeclSpec.h"
#include <iostream>
-
-using namespace llvm;
using namespace clang;
namespace {
@@ -52,6 +50,6 @@ namespace {
};
}
-MinimalAction *llvm::clang::CreatePrintParserActionsAction() {
+MinimalAction *clang::CreatePrintParserActionsAction() {
return new ParserPrintActions();
}
diff --git a/clang/Driver/PrintPreprocessedOutput.cpp b/clang/Driver/PrintPreprocessedOutput.cpp
index bf5c3a2cac5..4a4f6783da3 100644
--- a/clang/Driver/PrintPreprocessedOutput.cpp
+++ b/clang/Driver/PrintPreprocessedOutput.cpp
@@ -21,7 +21,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/config.h"
#include <cstdio>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -98,12 +97,13 @@ static void OutputString(const char *Ptr, unsigned Size) {
// Preprocessed token printer
//===----------------------------------------------------------------------===//
-static cl::opt<bool>
-DisableLineMarkers("P", cl::desc("Disable linemarker output in -E mode"));
-static cl::opt<bool>
-EnableCommentOutput("C", cl::desc("Enable comment output in -E mode"));
-static cl::opt<bool>
-EnableMacroCommentOutput("CC", cl::desc("Enable comment output in -E mode, "
+static llvm::cl::opt<bool>
+DisableLineMarkers("P", llvm::cl::desc("Disable linemarker output in -E mode"));
+static llvm::cl::opt<bool>
+EnableCommentOutput("C", llvm::cl::desc("Enable comment output in -E mode"));
+static llvm::cl::opt<bool>
+EnableMacroCommentOutput("CC",
+ llvm::cl::desc("Enable comment output in -E mode, "
"even from macro expansions"));
namespace {
@@ -165,7 +165,7 @@ void PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) {
OutputChar('#');
OutputChar(' ');
- std::string Num = utostr_32(LineNo);
+ std::string Num = llvm::utostr_32(LineNo);
OutputString(&Num[0], Num.size());
OutputChar(' ');
OutputString(&CurFilename[0], CurFilename.size());
@@ -213,7 +213,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
OutputChar('#');
OutputChar(' ');
- std::string Num = utostr_32(CurLine);
+ std::string Num = llvm::utostr_32(CurLine);
OutputString(&Num[0], Num.size());
OutputChar(' ');
OutputString(&CurFilename[0], CurFilename.size());
diff --git a/clang/Driver/Targets.cpp b/clang/Driver/Targets.cpp
index 6bec70cc5f8..168084dcd73 100644
--- a/clang/Driver/Targets.cpp
+++ b/clang/Driver/Targets.cpp
@@ -17,7 +17,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/Support/CommandLine.h"
-using namespace llvm;
using namespace clang;
/// Note: a hard coded list of targets is clearly silly, these should be
@@ -28,9 +27,9 @@ enum SupportedTargets {
target_linux_i386
};
-static cl::list<SupportedTargets>
-Archs("arch", cl::desc("Architectures to compile for"),
- cl::values(clEnumValN(target_ppc, "ppc", "32-bit Darwin PowerPC"),
+static llvm::cl::list<SupportedTargets>
+Archs("arch", llvm::cl::desc("Architectures to compile for"),
+llvm::cl::values(clEnumValN(target_ppc, "ppc", "32-bit Darwin PowerPC"),
clEnumValN(target_ppc64, "ppc64", "64-bit Darwin PowerPC"),
clEnumValN(target_i386, "i386", "32-bit Darwin X86"),
clEnumValN(target_x86_64, "x86_64","64-bit Darwin X86"),
diff --git a/clang/Driver/TextDiagnosticPrinter.cpp b/clang/Driver/TextDiagnosticPrinter.cpp
index 8478c58e898..1acd210898b 100644
--- a/clang/Driver/TextDiagnosticPrinter.cpp
+++ b/clang/Driver/TextDiagnosticPrinter.cpp
@@ -18,19 +18,17 @@
#include "clang/Lex/Lexer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Streams.h"
#include <iostream>
#include <string>
-using namespace llvm;
using namespace clang;
-static cl::opt<bool>
+static llvm::cl::opt<bool>
NoShowColumn("fno-show-column",
- cl::desc("Do not include column number on diagnostics"));
-static cl::opt<bool>
+ llvm::cl::desc("Do not include column number on diagnostics"));
+static llvm::cl::opt<bool>
NoCaretDiagnostics("fno-caret-diagnostics",
- cl::desc("Do not include source line and caret with"
- " diagnostics"));
+ llvm::cl::desc("Do not include source line and caret with"
+ " diagnostics"));
void TextDiagnosticPrinter::
PrintIncludeStack(SourceLocation Pos) {
@@ -42,9 +40,9 @@ PrintIncludeStack(SourceLocation Pos) {
unsigned LineNo = SourceMgr.getLineNumber(Pos);
- const MemoryBuffer *Buffer = SourceMgr.getBuffer(FileID);
- cerr << "In file included from " << Buffer->getBufferIdentifier()
- << ":" << LineNo << ":\n";
+ const llvm::MemoryBuffer *Buffer = SourceMgr.getBuffer(FileID);
+ std::cerr << "In file included from " << Buffer->getBufferIdentifier()
+ << ":" << LineNo << ":\n";
}
/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
@@ -130,7 +128,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
unsigned NumRanges) {
unsigned LineNo = 0, FilePos = 0, FileID = 0, ColNo = 0;
unsigned LineStart = 0, LineEnd = 0;
- const MemoryBuffer *Buffer = 0;
+ const llvm::MemoryBuffer *Buffer = 0;
if (Pos.isValid()) {
LineNo = SourceMgr.getLineNumber(Pos);
@@ -159,24 +157,24 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
Buf[LineEnd] != '\n' && Buf[LineEnd] != '\r')
++LineEnd;
- cerr << Buffer->getBufferIdentifier()
- << ":" << LineNo << ":";
+ std::cerr << Buffer->getBufferIdentifier()
+ << ":" << LineNo << ":";
if (ColNo && !NoShowColumn)
- cerr << ColNo << ":";
- cerr << " ";
+ std::cerr << ColNo << ":";
+ std::cerr << " ";
}
switch (Level) {
default: assert(0 && "Unknown diagnostic type!");
- case Diagnostic::Note: cerr << "note: "; break;
- case Diagnostic::Warning: cerr << "warning: "; break;
- case Diagnostic::Error: cerr << "error: "; break;
- case Diagnostic::Fatal: cerr << "fatal error: "; break;
- case Diagnostic::Sorry: cerr << "sorry, unimplemented: ";
+ case Diagnostic::Note: std::cerr << "note: "; break;
+ case Diagnostic::Warning: std::cerr << "warning: "; break;
+ case Diagnostic::Error: std::cerr << "error: "; break;
+ case Diagnostic::Fatal: std::cerr << "fatal error: "; break;
+ case Diagnostic::Sorry: std::cerr << "sorry, unimplemented: ";
break;
}
- cerr << FormatDiagnostic(Level, ID, Strs, NumStrs) << "\n";
+ std::cerr << FormatDiagnostic(Level, ID, Strs, NumStrs) << "\n";
if (!NoCaretDiagnostics && Pos.isValid()) {
// Get the line of the source file.
@@ -221,7 +219,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
CaratLine.erase(CaratLine.end()-1);
// Emit what we have computed.
- cerr << SourceLine << "\n";
- cerr << CaratLine << "\n";
+ std::cerr << SourceLine << "\n";
+ std::cerr << CaratLine << "\n";
}
}
diff --git a/clang/Driver/TextDiagnosticPrinter.h b/clang/Driver/TextDiagnosticPrinter.h
index a10224e78b6..71e584ebf4a 100644
--- a/clang/Driver/TextDiagnosticPrinter.h
+++ b/clang/Driver/TextDiagnosticPrinter.h
@@ -18,31 +18,29 @@
#include "TextDiagnostics.h"
#include "clang/Basic/SourceLocation.h"
-namespace llvm {
- namespace clang {
- class SourceManager;
-
- class TextDiagnosticPrinter : public TextDiagnostics {
- SourceLocation LastWarningLoc;
- public:
- TextDiagnosticPrinter(SourceManager &sourceMgr)
- : TextDiagnostics(sourceMgr) {}
-
- void PrintIncludeStack(SourceLocation Pos);
- void HighlightRange(const SourceRange &R, unsigned LineNo,
- std::string &CaratLine,
- const std::string &SourceLine);
- unsigned GetTokenLength(SourceLocation Loc);
-
- virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
- SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges);
- };
-
- } // end namspace clang
-} // end namespace llvm
+namespace clang {
+class SourceManager;
+
+class TextDiagnosticPrinter : public TextDiagnostics {
+ SourceLocation LastWarningLoc;
+public:
+ TextDiagnosticPrinter(SourceManager &sourceMgr)
+ : TextDiagnostics(sourceMgr) {}
+
+ void PrintIncludeStack(SourceLocation Pos);
+ void HighlightRange(const SourceRange &R, unsigned LineNo,
+ std::string &CaratLine,
+ const std::string &SourceLine);
+ unsigned GetTokenLength(SourceLocation Loc);
+
+ virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
+ SourceLocation Pos,
+ diag::kind ID, const std::string *Strs,
+ unsigned NumStrs,
+ const SourceRange *Ranges,
+ unsigned NumRanges);
+};
+
+} // end namspace clang
#endif
diff --git a/clang/Driver/TextDiagnostics.cpp b/clang/Driver/TextDiagnostics.cpp
index cab53b75e64..4fc7e0c921c 100644
--- a/clang/Driver/TextDiagnostics.cpp
+++ b/clang/Driver/TextDiagnostics.cpp
@@ -15,7 +15,6 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/HeaderSearch.h"
-using namespace llvm;
using namespace clang;
TextDiagnostics:: ~TextDiagnostics() {}
diff --git a/clang/Driver/TextDiagnostics.h b/clang/Driver/TextDiagnostics.h
index 7e937a89966..faf1b412b2c 100644
--- a/clang/Driver/TextDiagnostics.h
+++ b/clang/Driver/TextDiagnostics.h
@@ -16,40 +16,38 @@
#include "clang/Basic/Diagnostic.h"
-namespace llvm {
- namespace clang {
- class SourceManager;
- class HeaderSearch;
- class Preprocessor;
-
- class TextDiagnostics : public DiagnosticClient {
- HeaderSearch *TheHeaderSearch;
- protected:
- SourceManager &SourceMgr;
- Preprocessor *ThePreprocessor;
-
- std::string FormatDiagnostic(Diagnostic::Level Level,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs);
- public:
- TextDiagnostics(SourceManager &sourceMgr) : SourceMgr(sourceMgr) {}
- virtual ~TextDiagnostics();
-
- void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
- void setPreprocessor(Preprocessor &P) { ThePreprocessor = &P; }
-
- virtual bool IgnoreDiagnostic(Diagnostic::Level Level,
- SourceLocation Pos);
- virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
- SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges) = 0;
- };
-
- } // end namspace clang
-} // end namespace llvm
+namespace clang {
+class SourceManager;
+class HeaderSearch;
+class Preprocessor;
+
+class TextDiagnostics : public DiagnosticClient {
+ HeaderSearch *TheHeaderSearch;
+protected:
+ SourceManager &SourceMgr;
+ Preprocessor *ThePreprocessor;
+
+ std::string FormatDiagnostic(Diagnostic::Level Level,
+ diag::kind ID,
+ const std::string *Strs,
+ unsigned NumStrs);
+public:
+ TextDiagnostics(SourceManager &sourceMgr) : SourceMgr(sourceMgr) {}
+ virtual ~TextDiagnostics();
+
+ void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
+ void setPreprocessor(Preprocessor &P) { ThePreprocessor = &P; }
+
+ virtual bool IgnoreDiagnostic(Diagnostic::Level Level,
+ SourceLocation Pos);
+ virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
+ SourceLocation Pos,
+ diag::kind ID, const std::string *Strs,
+ unsigned NumStrs,
+ const SourceRange *Ranges,
+ unsigned NumRanges) = 0;
+};
+
+} // end namspace clang
#endif
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp
index 73bbe731b93..5a60cb5cf69 100644
--- a/clang/Driver/clang.cpp
+++ b/clang/Driver/clang.cpp
@@ -35,17 +35,16 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/System/Signals.h"
#include <iostream>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
// Global options.
//===----------------------------------------------------------------------===//
-static cl::opt<bool>
-Verbose("v", cl::desc("Enable verbose output"));
-static cl::opt<bool>
-Stats("stats", cl::desc("Print performance metrics and statistics"));
+static llvm::cl::opt<bool>
+Verbose("v", llvm::cl::desc("Enable verbose output"));
+static llvm::cl::opt<bool>
+Stats("stats", llvm::cl::desc("Print performance metrics and statistics"));
enum ProgActions {
EmitLLVM, // Emit a .ll file.
@@ -59,10 +58,10 @@ enum ProgActions {
DumpTokens // Token dump mode.
};
-static cl::opt<ProgActions>
-ProgAction(cl::desc("Choose output type:"), cl::ZeroOrMore,
- cl::init(ParseSyntaxOnly),
- cl::values(
+static llvm::cl::opt<ProgActions>
+ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
+ llvm::cl::init(ParseSyntaxOnly),
+ llvm::cl::values(
clEnumValN(RunPreprocessorOnly, "Eonly",
"Just run preprocessor, no output (for timings)"),
clEnumValN(PrintPreprocessedInput, "E",
@@ -104,10 +103,10 @@ enum LangKind {
assembler assembler-with-cpp
ada, f77*, ratfor (!), f95, java, treelang
*/
-static cl::opt<LangKind>
-BaseLang("x", cl::desc("Base language to compile"),
- cl::init(langkind_unspecified),
- cl::values(clEnumValN(langkind_c, "c", "C"),
+static llvm::cl::opt<LangKind>
+BaseLang("x", llvm::cl::desc("Base language to compile"),
+ llvm::cl::init(langkind_unspecified),
+ llvm::cl::values(clEnumValN(langkind_c, "c", "C"),
clEnumValN(langkind_cxx, "c++", "C++"),
clEnumValN(langkind_objc, "objective-c", "Objective C"),
clEnumValN(langkind_objcxx,"objective-c++","Objective C++"),
@@ -121,12 +120,12 @@ BaseLang("x", cl::desc("Base language to compile"),
"Preprocessed Objective C++"),
clEnumValEnd));
-static cl::opt<bool>
-LangObjC("ObjC", cl::desc("Set base language to Objective-C"),
- cl::Hidden);
-static cl::opt<bool>
-LangObjCXX("ObjC++", cl::desc("Set base language to Objective-C++"),
- cl::Hidden);
+static llvm::cl::opt<bool>
+LangObjC("ObjC", llvm::cl::desc("Set base language to Objective-C"),
+ llvm::cl::Hidden);
+static llvm::cl::opt<bool>
+LangObjCXX("ObjC++", llvm::cl::desc("Set base language to Objective-C++"),
+ llvm::cl::Hidden);
/// InitializeBaseLanguage - Handle the -x foo options or infer a base language
/// from the input filename.
@@ -208,10 +207,10 @@ enum LangStds {
lang_cxx98, lang_gnucxx98
};
-static cl::opt<LangStds>
-LangStd("std", cl::desc("Language standard to compile for"),
- cl::init(lang_unspecified),
- cl::values(clEnumValN(lang_c89, "c89", "ISO C 1990"),
+static llvm::cl::opt<LangStds>
+LangStd("std", llvm::cl::desc("Language standard to compile for"),
+ llvm::cl::init(lang_unspecified),
+ llvm::cl::values(clEnumValN(lang_c89, "c89", "ISO C 1990"),
clEnumValN(lang_c89, "c90", "ISO C 1990"),
clEnumValN(lang_c89, "iso9899:1990", "ISO C 1990"),
clEnumValN(lang_c94, "iso9899:199409",
@@ -233,10 +232,10 @@ LangStd("std", cl::desc("Language standard to compile for"),
"extensions (default for C++)"),
clEnumValEnd));
-static cl::opt<bool>
+static llvm::cl::opt<bool>
NoOperatorNames("fno-operator-names",
- cl::desc("Do not treat C++ operator name keywords as "
- "synonyms for operators"));
+ llvm::cl::desc("Do not treat C++ operator name keywords as "
+ "synonyms for operators"));
// FIXME: add:
// -ansi
@@ -295,20 +294,20 @@ static void InitializeLanguageStandard(LangOptions &Options) {
//===----------------------------------------------------------------------===//
// FIXME: Werror should take a list of things, -Werror=foo,bar
-static cl::opt<bool>
-WarningsAsErrors("Werror", cl::desc("Treat all warnings as errors"));
+static llvm::cl::opt<bool>
+WarningsAsErrors("Werror", llvm::cl::desc("Treat all warnings as errors"));
-static cl::opt<bool>
-WarnOnExtensions("pedantic", cl::init(true),
- cl::desc("Issue a warning on uses of GCC extensions"));
+static llvm::cl::opt<bool>
+WarnOnExtensions("pedantic", llvm::cl::init(true),
+ llvm::cl::desc("Issue a warning on uses of GCC extensions"));
-static cl::opt<bool>
+static llvm::cl::opt<bool>
ErrorOnExtensions("pedantic-errors",
- cl::desc("Issue an error on uses of GCC extensions"));
+ llvm::cl::desc("Issue an error on uses of GCC extensions"));
-static cl::opt<bool>
+static llvm::cl::opt<bool>
WarnUnusedMacros("Wunused_macros",
- cl::desc("Warn for unused macros in the main translation unit"));
+ llvm::cl::desc("Warn for unused macros in the main translation unit"));
/// InitializeDiagnostics - Initialize the diagnostic object, based on the
@@ -331,12 +330,12 @@ static void InitializeDiagnostics(Diagnostic &Diags) {
// -A... - Play with #assertions
// -undef - Undefine all predefined macros
-static cl::list<std::string>
-D_macros("D", cl::value_desc("macro"), cl::Prefix,
- cl::desc("Predefine the specified macro"));
-static cl::list<std::string>
-U_macros("U", cl::value_desc("macro"), cl::Prefix,
- cl::desc("Undefine the specified macro"));
+static llvm::cl::list<std::string>
+D_macros("D", llvm::cl::value_desc("macro"), llvm::cl::Prefix,
+ llvm::cl::desc("Predefine the specified macro"));
+static llvm::cl::list<std::string>
+U_macros("U", llvm::cl::value_desc("macro"), llvm::cl::Prefix,
+ llvm::cl::desc("Undefine the specified macro"));
// Append a #define line to Buf for Macro. Macro should be of the form XXX,
// in which case we emit "#define XXX 1" or "XXX=Y z W" in which case we emit
@@ -442,36 +441,37 @@ static void InitializePredefinedMacros(Preprocessor &PP,
//
// FIXME: -include,-imacros
-static cl::opt<bool>
-nostdinc("nostdinc", cl::desc("Disable standard #include directories"));
+static llvm::cl::opt<bool>
+nostdinc("nostdinc", llvm::cl::desc("Disable standard #include directories"));
// Various command line options. These four add directories to each chain.
-static cl::list<std::string>
-F_dirs("F", cl::value_desc("directory"), cl::Prefix,
- cl::desc("Add directory to framework include search path"));
-static cl::list<std::string>
-I_dirs("I", cl::value_desc("directory"), cl::Prefix,
- cl::desc("Add directory to include search path"));
-static cl::list<std::string>
-idirafter_dirs("idirafter", cl::value_desc("directory"), cl::Prefix,
- cl::desc("Add directory to AFTER include search path"));
-static cl::list<std::string>
-iquote_dirs("iquote", cl::value_desc("directory"), cl::Prefix,
- cl::desc("Add directory to QUOTE include search path"));
-static cl::list<std::string>
-isystem_dirs("isystem", cl::value_desc("directory"), cl::Prefix,
- cl::desc("Add directory to SYSTEM include search path"));
+static llvm::cl::list<std::string>
+F_dirs("F", llvm::cl::value_desc("directory"), llvm::cl::Prefix,
+ llvm::cl::desc("Add directory to framework include search path"));
+static llvm::cl::list<std::string>
+I_dirs("I", llvm::cl::value_desc("directory"), llvm::cl::Prefix,
+ llvm::cl::desc("Add directory to include search path"));
+static llvm::cl::list<std::string>
+idirafter_dirs("idirafter", llvm::cl::value_desc("directory"), llvm::cl::Prefix,
+ llvm::cl::desc("Add directory to AFTER include search path"));
+static llvm::cl::list<std::string>
+iquote_dirs("iquote", llvm::cl::value_desc("directory"), llvm::cl::Prefix,
+ llvm::cl::desc("Add directory to QUOTE include search path"));
+static llvm::cl::list<std::string>
+isystem_dirs("isystem", llvm::cl::value_desc("directory"), llvm::cl::Prefix,
+ llvm::cl::desc("Add directory to SYSTEM include search path"));
// These handle -iprefix/-iwithprefix/-iwithprefixbefore.
-static cl::list<std::string>
-iprefix_vals("iprefix", cl::value_desc("prefix"), cl::Prefix,
- cl::desc("Set the -iwithprefix/-iwithprefixbefore prefix"));
-static cl::list<std::string>
-iwithprefix_vals("iwithprefix", cl::value_desc("dir"), cl::Prefix,
- cl::desc("Set directory to SYSTEM include search path with prefix"));
-static cl::list<std::string>
-iwithprefixbefore_vals("iwithprefixbefore", cl::value_desc("dir"), cl::Prefix,
- cl::desc("Set directory to include search path with prefix"));
+static llvm::cl::list<std::string>
+iprefix_vals("iprefix", llvm::cl::value_desc("prefix"), llvm::cl::Prefix,
+ llvm::cl::desc("Set the -iwithprefix/-iwithprefixbefore prefix"));
+static llvm::cl::list<std::string>
+iwithprefix_vals("iwithprefix", llvm::cl::value_desc("dir"), llvm::cl::Prefix,
+ llvm::cl::desc("Set directory to SYSTEM include search path with prefix"));
+static llvm::cl::list<std::string>
+iwithprefixbefore_vals("iwithprefixbefore", llvm::cl::value_desc("dir"),
+ llvm::cl::Prefix,
+ llvm::cl::desc("Set directory to include search path with prefix"));
// Finally, implement the code that groks the options above.
enum IncludeDirGroup {
@@ -808,7 +808,7 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
return 0;
}
} else {
- MemoryBuffer *SB = MemoryBuffer::getSTDIN();
+ llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
if (SB) MainFileID = SourceMgr.createFileIDForMemBuffer(SB);
if (MainFileID == 0) {
std::cerr << "Error reading standard input! Empty?\n";
@@ -822,9 +822,9 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
// Memory buffer must end with a null byte!
PrologMacros.push_back(0);
- MemoryBuffer *SB = MemoryBuffer::getMemBuffer(&PrologMacros.front(),
- &PrologMacros.back(),
- "<predefines>");
+ llvm::MemoryBuffer *SB =
+ llvm::MemoryBuffer::getMemBuffer(&PrologMacros.front(),&PrologMacros.back(),
+ "<predefines>");
assert(SB && "Cannot fail to create predefined source buffer");
unsigned FileID = SourceMgr.createFileIDForMemBuffer(SB);
assert(FileID && "Could not create FileID for predefines?");
@@ -905,12 +905,12 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
HeaderInfo.ClearFileInfo();
}
-static cl::list<std::string>
-InputFilenames(cl::Positional, cl::desc("<input files>"));
+static llvm::cl::list<std::string>
+InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input files>"));
int main(int argc, char **argv) {
- cl::ParseCommandLineOptions(argc, argv, " llvm cfe\n");
- sys::PrintStackTraceOnErrorSignal();
+ llvm::cl::ParseCommandLineOptions(argc, argv, " llvm cfe\n");
+ llvm::sys::PrintStackTraceOnErrorSignal();
// If no input was specified, read from stdin.
if (InputFilenames.empty())
diff --git a/clang/Driver/clang.h b/clang/Driver/clang.h
index 8c21e660ed8..3d241e0389c 100644
--- a/clang/Driver/clang.h
+++ b/clang/Driver/clang.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_CLANG_H
#define LLVM_CLANG_CLANG_H
-namespace llvm {
namespace clang {
class Preprocessor;
class LangOptions;
@@ -39,6 +38,5 @@ void EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
bool PrintStats);
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/Lex/HeaderSearch.cpp b/clang/Lex/HeaderSearch.cpp
index 7937024aaee..520205e1dae 100644
--- a/clang/Lex/HeaderSearch.cpp
+++ b/clang/Lex/HeaderSearch.cpp
@@ -16,8 +16,6 @@
#include "clang/Lex/IdentifierTable.h"
#include "llvm/System/Path.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Streams.h"
-using namespace llvm;
using namespace clang;
HeaderSearch::HeaderSearch(FileManager &FM) : FileMgr(FM), FrameworkMap(64) {
@@ -30,8 +28,8 @@ HeaderSearch::HeaderSearch(FileManager &FM) : FileMgr(FM), FrameworkMap(64) {
}
void HeaderSearch::PrintStats() {
- cerr << "\n*** HeaderSearch Stats:\n";
- cerr << FileInfo.size() << " files tracked.\n";
+ fprintf(stderr, "\n*** HeaderSearch Stats:\n");
+ fprintf(stderr, "%d files tracked.\n", (int)FileInfo.size());
unsigned NumOnceOnlyFiles = 0, MaxNumIncludes = 0, NumSingleIncludedFiles = 0;
for (unsigned i = 0, e = FileInfo.size(); i != e; ++i) {
NumOnceOnlyFiles += FileInfo[i].isImport;
@@ -39,16 +37,16 @@ void HeaderSearch::PrintStats() {
MaxNumIncludes = FileInfo[i].NumIncludes;
NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1;
}
- cerr << " " << NumOnceOnlyFiles << " #import/#pragma once files.\n";
- cerr << " " << NumSingleIncludedFiles << " included exactly once.\n";
- cerr << " " << MaxNumIncludes << " max times a file is included.\n";
+ fprintf(stderr, " %d #import/#pragma once files.\n", NumOnceOnlyFiles);
+ fprintf(stderr, " %d included exactly once.\n", NumSingleIncludedFiles);
+ fprintf(stderr, " %d max times a file is included.\n", MaxNumIncludes);
- cerr << " " << NumIncluded << " #include/#include_next/#import.\n";
- cerr << " " << NumMultiIncludeFileOptzn << " #includes skipped due to"
- << " the multi-include optimization.\n";
+ fprintf(stderr, " %d #include/#include_next/#import.\n", NumIncluded);
+ fprintf(stderr, " %d #includes skipped due to"
+ " the multi-include optimization.\n", NumMultiIncludeFileOptzn);
- cerr << NumFrameworkLookups << " framework lookups.\n";
- cerr << NumSubFrameworkLookups << " subframework lookups.\n";
+ fprintf(stderr, "%d framework lookups.\n", NumFrameworkLookups);
+ fprintf(stderr, "%d subframework lookups.\n", NumSubFrameworkLookups);
}
//===----------------------------------------------------------------------===//
@@ -62,7 +60,7 @@ const FileEntry *HeaderSearch::DoFrameworkLookup(const DirectoryEntry *Dir,
const char *SlashPos = std::find(FilenameStart, FilenameEnd, '/');
if (SlashPos == FilenameEnd) return 0;
- StringMapEntry<const DirectoryEntry *> &CacheLookup =
+ llvm::StringMapEntry<const DirectoryEntry *> &CacheLookup =
FrameworkMap.GetOrCreateValue(FilenameStart, SlashPos);
// If it is some other directory, fail.
@@ -70,7 +68,7 @@ const FileEntry *HeaderSearch::DoFrameworkLookup(const DirectoryEntry *Dir,
return 0;
// FrameworkName = "/System/Library/Frameworks/"
- SmallString<1024> FrameworkName;
+ llvm::SmallString<1024> FrameworkName;
FrameworkName += Dir->getName();
if (FrameworkName.empty() || FrameworkName.back() != '/')
FrameworkName.push_back('/');
@@ -85,8 +83,8 @@ const FileEntry *HeaderSearch::DoFrameworkLookup(const DirectoryEntry *Dir,
++NumFrameworkLookups;
// If the framework dir doesn't exist, we fail.
- if (!sys::Path(std::string(FrameworkName.begin(),
- FrameworkName.end())).exists())
+ if (!llvm::sys::Path(std::string(FrameworkName.begin(),
+ FrameworkName.end())).exists())
return 0;
// Otherwise, if it does, remember that this is the right direntry for this
@@ -135,7 +133,7 @@ const FileEntry *HeaderSearch::LookupFile(const char *FilenameStart,
return FileMgr.getFile(FilenameStart, FilenameEnd);
}
- SmallString<1024> TmpDir;
+ llvm::SmallString<1024> TmpDir;
// Step #0, unless disabled, check to see if the file is in the #includer's
// directory. This search is not done for <> headers.
@@ -214,15 +212,15 @@ LookupSubframeworkHeader(const char *FilenameStart,
if (FrameworkPos == 0)
return 0;
- SmallString<1024> FrameworkName(ContextName,
- FrameworkPos+strlen(".framework/"));
+ llvm::SmallString<1024> FrameworkName(ContextName,
+ FrameworkPos+strlen(".framework/"));
// Append Frameworks/HIToolbox.framework/
FrameworkName += "Frameworks/";
FrameworkName.append(FilenameStart, SlashPos);
FrameworkName += ".framework/";
- StringMapEntry<const DirectoryEntry *> &CacheLookup =
+ llvm::StringMapEntry<const DirectoryEntry *> &CacheLookup =
FrameworkMap.GetOrCreateValue(FilenameStart, SlashPos);
// Some other location?
@@ -249,7 +247,7 @@ LookupSubframeworkHeader(const char *FilenameStart,
const FileEntry *FE = 0;
// Check ".../Frameworks/HIToolbox.framework/Headers/HIToolbox.h"
- SmallString<1024> HeadersFilename(FrameworkName);
+ llvm::SmallString<1024> HeadersFilename(FrameworkName);
HeadersFilename += "Headers/";
HeadersFilename.append(SlashPos+1, FilenameEnd);
if (!(FE = FileMgr.getFile(HeadersFilename.begin(),
diff --git a/clang/Lex/IdentifierTable.cpp b/clang/Lex/IdentifierTable.cpp
index f86d4f8b40d..e671af98391 100644
--- a/clang/Lex/IdentifierTable.cpp
+++ b/clang/Lex/IdentifierTable.cpp
@@ -15,8 +15,6 @@
#include "clang/Lex/IdentifierTable.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Basic/LangOptions.h"
-#include <iostream>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -168,7 +166,7 @@ void IdentifierTable::PrintStats() const {
unsigned MaxIdentifierLength = 0;
// TODO: Figure out maximum times an identifier had to probe for -stats.
- for (StringMap<IdentifierInfo, BumpPtrAllocator>::const_iterator
+ for (llvm::StringMap<IdentifierInfo, llvm::BumpPtrAllocator>::const_iterator
I = HashTable.begin(), E = HashTable.end(); I != E; ++I) {
unsigned IdLen = I->getKeyLength();
AverageIdentifierSize += IdLen;
@@ -176,14 +174,14 @@ void IdentifierTable::PrintStats() const {
MaxIdentifierLength = IdLen;
}
- std::cerr << "\n*** Identifier Table Stats:\n";
- std::cerr << "# Identifiers: " << NumIdentifiers << "\n";
- std::cerr << "# Empty Buckets: " << NumEmptyBuckets << "\n";
- std::cerr << "Hash density (#identifiers per bucket): "
- << NumIdentifiers/(double)NumBuckets << "\n";
- std::cerr << "Ave identifier length: "
- << (AverageIdentifierSize/(double)NumIdentifiers) << "\n";
- std::cerr << "Max identifier length: " << MaxIdentifierLength << "\n";
+ fprintf(stderr, "\n*** Identifier Table Stats:\n");
+ fprintf(stderr, "# Identifiers: %d\n", NumIdentifiers);
+ fprintf(stderr, "# Empty Buckets: %d\n", NumEmptyBuckets);
+ fprintf(stderr, "Hash density (#identifiers per bucket): %f\n",
+ NumIdentifiers/(double)NumBuckets);
+ fprintf(stderr, "Ave identifier length: %f\n",
+ (AverageIdentifierSize/(double)NumIdentifiers));
+ fprintf(stderr, "Max identifier length: %d\n", MaxIdentifierLength);
// Compute statistics about the memory allocated for identifiers.
HashTable.getAllocator().PrintStats();
diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp
index 9c95af1475a..1775b2f7bf4 100644
--- a/clang/Lex/Lexer.cpp
+++ b/clang/Lex/Lexer.cpp
@@ -30,12 +30,11 @@
#include "clang/Basic/SourceLocation.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cctype>
-using namespace llvm;
using namespace clang;
static void InitCharacterInfo();
-Lexer::Lexer(const MemoryBuffer *File, unsigned fileid, Preprocessor &pp,
+Lexer::Lexer(const llvm::MemoryBuffer *File, unsigned fileid, Preprocessor &pp,
const char *BufStart, const char *BufEnd)
: BufferEnd(BufEnd ? BufEnd : File->getBufferEnd()),
InputFile(File), CurFileID(fileid), PP(pp), Features(PP.getLangOptions()) {
diff --git a/clang/Lex/LiteralSupport.cpp b/clang/Lex/LiteralSupport.cpp
index 5b13487f502..fbc34165439 100644
--- a/clang/Lex/LiteralSupport.cpp
+++ b/clang/Lex/LiteralSupport.cpp
@@ -18,7 +18,6 @@
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/StringExtras.h"
-using namespace llvm;
using namespace clang;
/// HexDigitValue - Return the value of the specified hex digit, or -1 if it's
@@ -145,7 +144,7 @@ static unsigned ProcessCharEscape(const char *&ThisTokBuf,
if (isgraph(ThisTokBuf[0])) {
PP.Diag(Loc, diag::ext_unknown_escape, std::string()+(char)ResultChar);
} else {
- PP.Diag(Loc, diag::ext_unknown_escape, "x"+utohexstr(ResultChar));
+ PP.Diag(Loc, diag::ext_unknown_escape, "x"+llvm::utohexstr(ResultChar));
}
break;
}
@@ -377,13 +376,13 @@ NumericLiteralParser(const char *begin, const char *end,
/// GetIntegerValue - Convert this numeric literal value to an APInt that
/// matches Val's input width. If there is an overflow, set Val to the low bits
/// of the result and return true. Otherwise, return false.
-bool NumericLiteralParser::GetIntegerValue(APInt &Val) {
+bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
Val = 0;
s = DigitsBegin;
- APInt RadixVal(Val.getBitWidth(), radix);
- APInt CharVal(Val.getBitWidth(), 0);
- APInt OldVal = Val;
+ llvm::APInt RadixVal(Val.getBitWidth(), radix);
+ llvm::APInt CharVal(Val.getBitWidth(), 0);
+ llvm::APInt OldVal = Val;
bool OverflowOccurred = false;
while (s < SuffixBegin) {
@@ -579,7 +578,7 @@ StringLiteralParser(const LexerToken *StringToks, unsigned NumStringToks,
ResultBuf.resize(SizeBound);
// Likewise, but for each string piece.
- SmallString<512> TokenBuf;
+ llvm::SmallString<512> TokenBuf;
TokenBuf.resize(MaxTokenLength);
// Loop over all the strings, getting their spelling, and expanding them to
diff --git a/clang/Lex/MacroExpander.cpp b/clang/Lex/MacroExpander.cpp
index daf0c555ade..a45efbd86e9 100644
--- a/clang/Lex/MacroExpander.cpp
+++ b/clang/Lex/MacroExpander.cpp
@@ -17,7 +17,6 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallVector.h"
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -286,7 +285,7 @@ MacroExpander::~MacroExpander() {
/// Expand the arguments of a function-like macro so that we can quickly
/// return preexpanded tokens from MacroTokens.
void MacroExpander::ExpandFunctionArguments() {
- SmallVector<LexerToken, 128> ResultToks;
+ llvm::SmallVector<LexerToken, 128> ResultToks;
// Loop through the MacroTokens tokens, expanding them into ResultToks. Keep
// track of whether we change anything. If not, no need to keep them. If so,
@@ -509,7 +508,7 @@ void MacroExpander::Lex(LexerToken &Tok) {
/// operator. Read the ## and RHS, and paste the LHS/RHS together. If there
/// are is another ## after it, chomp it iteratively. Return the result as Tok.
void MacroExpander::PasteTokens(LexerToken &Tok) {
- SmallVector<char, 128> Buffer;
+ llvm::SmallVector<char, 128> Buffer;
do {
// Consume the ## operator.
SourceLocation PasteOpLoc = MacroTokens[CurToken].getLocation();
diff --git a/clang/Lex/MacroInfo.cpp b/clang/Lex/MacroInfo.cpp
index bc3a27d7a15..e6dae42769f 100644
--- a/clang/Lex/MacroInfo.cpp
+++ b/clang/Lex/MacroInfo.cpp
@@ -13,7 +13,6 @@
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/Preprocessor.h"
-using namespace llvm;
using namespace clang;
MacroInfo::MacroInfo(SourceLocation DefLoc) : Location(DefLoc) {
diff --git a/clang/Lex/PPExpressions.cpp b/clang/Lex/PPExpressions.cpp
index 83679423a4b..b3457e79271 100644
--- a/clang/Lex/PPExpressions.cpp
+++ b/clang/Lex/PPExpressions.cpp
@@ -24,10 +24,9 @@
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallString.h"
-using namespace llvm;
using namespace clang;
-static bool EvaluateDirectiveSubExpr(APSInt &LHS, unsigned MinPrec,
+static bool EvaluateDirectiveSubExpr(llvm::APSInt &LHS, unsigned MinPrec,
LexerToken &PeekTok, bool ValueLive,
Preprocessor &PP);
@@ -61,7 +60,7 @@ struct DefinedTracker {
/// If ValueLive is false, then this value is being evaluated in a context where
/// the result is not used. As such, avoid diagnostics that relate to
/// evaluation.
-static bool EvaluateValue(APSInt &Result, LexerToken &PeekTok,
+static bool EvaluateValue(llvm::APSInt &Result, LexerToken &PeekTok,
DefinedTracker &DT, bool ValueLive,
Preprocessor &PP) {
Result = 0;
@@ -153,7 +152,7 @@ static bool EvaluateValue(APSInt &Result, LexerToken &PeekTok,
PP.Diag(PeekTok, diag::err_pp_expected_value_in_expr);
return true;
case tok::numeric_constant: {
- SmallString<64> IntegerBuffer;
+ llvm::SmallString<64> IntegerBuffer;
IntegerBuffer.resize(PeekTok.getLength());
const char *ThisTokBegin = &IntegerBuffer[0];
unsigned ActualLength = PP.getSpelling(PeekTok, ThisTokBegin);
@@ -193,7 +192,7 @@ static bool EvaluateValue(APSInt &Result, LexerToken &PeekTok,
return false;
}
case tok::char_constant: { // 'x'
- SmallString<32> CharBuffer;
+ llvm::SmallString<32> CharBuffer;
CharBuffer.resize(PeekTok.getLength());
const char *ThisTokBegin = &CharBuffer[0];
unsigned ActualLength = PP.getSpelling(PeekTok, ThisTokBegin);
@@ -211,7 +210,7 @@ static bool EvaluateValue(APSInt &Result, LexerToken &PeekTok,
NumBits = TI.getCharWidth(PeekTok.getLocation());
// Set the width.
- APSInt Val(NumBits);
+ llvm::APSInt Val(NumBits);
// Set the value.
Val = Literal.getValue();
// Set the signedness.
@@ -360,7 +359,7 @@ static unsigned getPrecedence(tok::TokenKind Kind) {
/// If ValueLive is false, then this value is being evaluated in a context where
/// the result is not used. As such, avoid diagnostics that relate to
/// evaluation.
-static bool EvaluateDirectiveSubExpr(APSInt &LHS, unsigned MinPrec,
+static bool EvaluateDirectiveSubExpr(llvm::APSInt &LHS, unsigned MinPrec,
LexerToken &PeekTok, bool ValueLive,
Preprocessor &PP) {
unsigned PeekPrec = getPrecedence(PeekTok.getKind());
@@ -397,7 +396,7 @@ static bool EvaluateDirectiveSubExpr(APSInt &LHS, unsigned MinPrec,
LexerToken OpToken = PeekTok;
PP.LexNonComment(PeekTok);
- APSInt RHS(LHS.getBitWidth());
+ llvm::APSInt RHS(LHS.getBitWidth());
// Parse the RHS of the operator.
DefinedTracker DT;
if (EvaluateValue(RHS, PeekTok, DT, RHSIsLive, PP)) return true;
@@ -427,7 +426,7 @@ static bool EvaluateDirectiveSubExpr(APSInt &LHS, unsigned MinPrec,
// Usual arithmetic conversions (C99 6.3.1.8p1): result is unsigned if
// either operand is unsigned. Don't do this for x and y in "x ? y : z".
- APSInt Res(LHS.getBitWidth());
+ llvm::APSInt Res(LHS.getBitWidth());
if (Operator != tok::question) {
Res.setIsUnsigned(LHS.isUnsigned()|RHS.isUnsigned());
// If this just promoted something from signed to unsigned, and if the
@@ -564,7 +563,7 @@ static bool EvaluateDirectiveSubExpr(APSInt &LHS, unsigned MinPrec,
// Evaluate the value after the :.
bool AfterColonLive = ValueLive && LHS == 0;
- APSInt AfterColonVal(LHS.getBitWidth());
+ llvm::APSInt AfterColonVal(LHS.getBitWidth());
DefinedTracker DT;
if (EvaluateValue(AfterColonVal, PeekTok, DT, AfterColonLive, PP))
return true;
@@ -613,7 +612,7 @@ EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
// C99 6.10.1p3 - All expressions are evaluated as intmax_t or uintmax_t.
unsigned BitWidth = getTargetInfo().getIntMaxTWidth(Tok.getLocation());
- APSInt ResVal(BitWidth);
+ llvm::APSInt ResVal(BitWidth);
DefinedTracker DT;
if (EvaluateValue(ResVal, Tok, DT, true, *this)) {
// Parse error, skip the rest of the macro line.
diff --git a/clang/Lex/Pragma.cpp b/clang/Lex/Pragma.cpp
index 1b542feb183..de59934b4d0 100644
--- a/clang/Lex/Pragma.cpp
+++ b/clang/Lex/Pragma.cpp
@@ -20,7 +20,6 @@
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/SmallVector.h"
-using namespace llvm;
using namespace clang;
// Out-of-line destructor to provide a home for the class.
@@ -256,7 +255,7 @@ void Preprocessor::HandlePragmaDependency(LexerToken &DependencyTok) {
return;
// Reserve a buffer to get the spelling.
- SmallVector<char, 128> FilenameBuffer;
+ llvm::SmallVector<char, 128> FilenameBuffer;
FilenameBuffer.resize(FilenameTok.getLength());
const char *FilenameStart = &FilenameBuffer[0], *FilenameEnd;
diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp
index 77e1677755a..104fb651521 100644
--- a/clang/Lex/Preprocessor.cpp
+++ b/clang/Lex/Preprocessor.cpp
@@ -37,7 +37,6 @@
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallVector.h"
#include <iostream>
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -343,7 +342,7 @@ void Preprocessor::EnterSourceFile(unsigned FileID,
if (MaxIncludeStackDepth < IncludeMacroStack.size())
MaxIncludeStackDepth = IncludeMacroStack.size();
- const MemoryBuffer *Buffer = SourceMgr.getBuffer(FileID);
+ const llvm::MemoryBuffer *Buffer = SourceMgr.getBuffer(FileID);
Lexer *TheLexer = new Lexer(Buffer, FileID, *this);
if (isMainFile) TheLexer->setIsMainFile();
EnterSourceFileWithLexer(TheLexer, CurDir);
@@ -658,7 +657,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(LexerToken &MacroName,
// ArgTokens - Build up a list of tokens that make up each argument. Each
// argument is separated by an EOF token. Use a SmallVector so we can avoid
// heap allocations in the common case.
- SmallVector<LexerToken, 64> ArgTokens;
+ llvm::SmallVector<LexerToken, 64> ArgTokens;
unsigned NumActuals = 0;
while (Tok.getKind() == tok::comma) {
@@ -1556,7 +1555,7 @@ void Preprocessor::HandleIncludeDirective(LexerToken &IncludeTok,
return;
// Reserve a buffer to get the spelling.
- SmallVector<char, 128> FilenameBuffer;
+ llvm::SmallVector<char, 128> FilenameBuffer;
FilenameBuffer.resize(FilenameTok.getLength());
const char *FilenameStart = &FilenameBuffer[0], *FilenameEnd;
diff --git a/clang/Lex/ScratchBuffer.cpp b/clang/Lex/ScratchBuffer.cpp
index a53bb2e17ea..12cb0965ce8 100644
--- a/clang/Lex/ScratchBuffer.cpp
+++ b/clang/Lex/ScratchBuffer.cpp
@@ -14,7 +14,6 @@
#include "clang/Lex/ScratchBuffer.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/MemoryBuffer.h"
-using namespace llvm;
using namespace clang;
// ScratchBufSize - The size of each chunk of scratch memory. Slightly less
@@ -64,8 +63,8 @@ void ScratchBuffer::AllocScratchBuffer(unsigned RequestLen) {
if (RequestLen < ScratchBufSize)
RequestLen = ScratchBufSize;
- MemoryBuffer *Buf =
- MemoryBuffer::getNewMemBuffer(RequestLen, "<scratch space>");
+ llvm::MemoryBuffer *Buf =
+ llvm::MemoryBuffer::getNewMemBuffer(RequestLen, "<scratch space>");
FileID = SourceMgr.createFileIDForMemBuffer(Buf);
CurBuffer = const_cast<char*>(Buf->getBufferStart());
BytesUsed = 0;
diff --git a/clang/Parse/AttributeList.cpp b/clang/Parse/AttributeList.cpp
index 23050d778b8..385dc03490e 100644
--- a/clang/Parse/AttributeList.cpp
+++ b/clang/Parse/AttributeList.cpp
@@ -13,7 +13,6 @@
#include "clang/Parse/AttributeList.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
AttributeList::AttributeList(IdentifierInfo *aName, SourceLocation aLoc,
diff --git a/clang/Parse/DeclSpec.cpp b/clang/Parse/DeclSpec.cpp
index 955b9d8d51d..117ff12e597 100644
--- a/clang/Parse/DeclSpec.cpp
+++ b/clang/Parse/DeclSpec.cpp
@@ -14,7 +14,6 @@
#include "clang/Parse/DeclSpec.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
-using namespace llvm;
using namespace clang;
/// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
diff --git a/clang/Parse/MinimalAction.cpp b/clang/Parse/MinimalAction.cpp
index bd0e30e2049..65bdca64db8 100644
--- a/clang/Parse/MinimalAction.cpp
+++ b/clang/Parse/MinimalAction.cpp
@@ -14,7 +14,6 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Scope.h"
-using namespace llvm;
using namespace clang;
/// TypeNameInfo - A link exists here for each scope that an identifier is
diff --git a/clang/Parse/ParseDecl.cpp b/clang/Parse/ParseDecl.cpp
index 48c32dea66a..02a79e68e58 100644
--- a/clang/Parse/ParseDecl.cpp
+++ b/clang/Parse/ParseDecl.cpp
@@ -14,7 +14,6 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/DeclSpec.h"
#include "llvm/ADT/SmallSet.h"
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -117,7 +116,7 @@ AttributeList *Parser::ParseAttributes() {
} else if (Tok.getKind() == tok::comma) {
ConsumeToken();
// __attribute__(( format(printf, 1, 2) ))
- SmallVector<ExprTy*, 8> ArgExprs;
+ llvm::SmallVector<ExprTy*, 8> ArgExprs;
bool ArgExprsOk = true;
// now parse the non-empty comma separated list of expressions
@@ -149,7 +148,7 @@ AttributeList *Parser::ParseAttributes() {
0, SourceLocation(), 0, 0, CurrAttr);
} else {
// __attribute__(( aligned(16) ))
- SmallVector<ExprTy*, 8> ArgExprs;
+ llvm::SmallVector<ExprTy*, 8> ArgExprs;
bool ArgExprsOk = true;
// now parse the list of expressions
@@ -626,7 +625,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
Diag(Tok, diag::ext_empty_struct_union_enum,
DeclSpec::getSpecifierName((DeclSpec::TST)TagType));
- SmallVector<DeclTy*, 32> FieldDecls;
+ llvm::SmallVector<DeclTy*, 32> FieldDecls;
// While we still have something to read, read the declarations in the struct.
while (Tok.getKind() != tok::r_brace &&
@@ -768,7 +767,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclTy *EnumDecl) {
if (Tok.getKind() == tok::r_brace)
Diag(Tok, diag::ext_empty_struct_union_enum, "enum");
- SmallVector<DeclTy*, 32> EnumConstantDecls;
+ llvm::SmallVector<DeclTy*, 32> EnumConstantDecls;
DeclTy *LastEnumConstDecl = 0;
@@ -1162,8 +1161,8 @@ void Parser::ParseParenDeclarator(Declarator &D) {
bool ErrorEmitted = false;
// Build up an array of information about the parsed arguments.
- SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
- SmallSet<const IdentifierInfo*, 16> ParamsSoFar;
+ llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
+ llvm::SmallSet<const IdentifierInfo*, 16> ParamsSoFar;
if (Tok.getKind() == tok::r_paren) {
// int() -> no prototype, no '...'.
diff --git a/clang/Parse/ParseExpr.cpp b/clang/Parse/ParseExpr.cpp
index 76395f76f19..e0076b8aa35 100644
--- a/clang/Parse/ParseExpr.cpp
+++ b/clang/Parse/ParseExpr.cpp
@@ -23,7 +23,6 @@
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallString.h"
-using namespace llvm;
using namespace clang;
/// PrecedenceLevels - These are precedences for the binary/ternary operators in
@@ -620,8 +619,8 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
}
case tok::l_paren: { // p-e: p-e '(' argument-expression-list[opt] ')'
- SmallVector<ExprTy*, 8> ArgExprs;
- SmallVector<SourceLocation, 8> CommaLocs;
+ llvm::SmallVector<ExprTy*, 8> ArgExprs;
+ llvm::SmallVector<SourceLocation, 8> CommaLocs;
bool ArgExprsOk = true;
Loc = ConsumeParen();
@@ -921,7 +920,7 @@ Parser::ExprResult Parser::ParseStringLiteralExpression() {
// String concat. Note that keywords like __func__ and __FUNCTION__ are not
// considered to be strings for concatenation purposes.
- SmallVector<LexerToken, 4> StringToks;
+ llvm::SmallVector<LexerToken, 4> StringToks;
do {
StringToks.push_back(Tok);
diff --git a/clang/Parse/ParseExprCXX.cpp b/clang/Parse/ParseExprCXX.cpp
index 80048db6c6c..7048660467d 100644
--- a/clang/Parse/ParseExprCXX.cpp
+++ b/clang/Parse/ParseExprCXX.cpp
@@ -13,7 +13,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Parse/Parser.h"
-using namespace llvm;
using namespace clang;
/// ParseCXXCasts - This handles the various ways to cast expressions to another
diff --git a/clang/Parse/ParseInit.cpp b/clang/Parse/ParseInit.cpp
index 69bdfe6edb5..01169d88594 100644
--- a/clang/Parse/ParseInit.cpp
+++ b/clang/Parse/ParseInit.cpp
@@ -13,7 +13,6 @@
#include "clang/Parse/Parser.h"
#include "clang/Basic/Diagnostic.h"
-using namespace llvm;
using namespace clang;
diff --git a/clang/Parse/ParseObjc.cpp b/clang/Parse/ParseObjc.cpp
index 16e9216d857..00b606ac1a5 100644
--- a/clang/Parse/ParseObjc.cpp
+++ b/clang/Parse/ParseObjc.cpp
@@ -14,7 +14,6 @@
#include "clang/Parse/Parser.h"
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallVector.h"
-using namespace llvm;
using namespace clang;
@@ -55,7 +54,7 @@ void Parser::ParseObjCAtDirectives() {
///
void Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
ConsumeToken(); // the identifier "class"
- SmallVector<IdentifierInfo *, 8> ClassNames;
+ llvm::SmallVector<IdentifierInfo *, 8> ClassNames;
while (1) {
if (Tok.getKind() != tok::identifier) {
diff --git a/clang/Parse/ParseStmt.cpp b/clang/Parse/ParseStmt.cpp
index dae9437fafd..a7219cc270f 100644
--- a/clang/Parse/ParseStmt.cpp
+++ b/clang/Parse/ParseStmt.cpp
@@ -16,7 +16,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Scope.h"
-using namespace llvm;
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -394,7 +393,7 @@ Parser::StmtResult Parser::ParseCompoundStatementBody() {
// TODO: "__label__ X, Y, Z;" is the GNU "Local Label" extension. These are
// only allowed at the start of a compound stmt.
- SmallVector<StmtTy*, 32> Stmts;
+ llvm::SmallVector<StmtTy*, 32> Stmts;
while (Tok.getKind() != tok::r_brace && Tok.getKind() != tok::eof) {
StmtResult R = ParseStatementOrDeclaration(false);
if (!R.isInvalid && R.Val)
diff --git a/clang/Parse/Parser.cpp b/clang/Parse/Parser.cpp
index 6ffbb51da27..251febbcd65 100644
--- a/clang/Parse/Parser.cpp
+++ b/clang/Parse/Parser.cpp
@@ -14,7 +14,6 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Scope.h"
-using namespace llvm;
using namespace clang;
Parser::Parser(Preprocessor &pp, Action &actions)
@@ -174,7 +173,8 @@ bool Parser::SkipUntil(const tok::TokenKind *Toks, unsigned NumToks,
//===----------------------------------------------------------------------===//
/// ScopeCache - Cache scopes to avoid malloc traffic.
-static SmallVector<Scope*, 16> ScopeCache;
+/// FIXME: eliminate this static ctor
+static llvm::SmallVector<Scope*, 16> ScopeCache;
/// EnterScope - Start a new scope.
void Parser::EnterScope(unsigned ScopeFlags) {
diff --git a/clang/Sema/ASTStreamer.cpp b/clang/Sema/ASTStreamer.cpp
index 4ff2ba9af5f..1057d932818 100644
--- a/clang/Sema/ASTStreamer.cpp
+++ b/clang/Sema/ASTStreamer.cpp
@@ -16,7 +16,6 @@
#include "Sema.h"
#include "clang/Parse/Action.h"
#include "clang/Parse/Parser.h"
-using namespace llvm;
using namespace clang;
namespace {
@@ -87,27 +86,26 @@ void ASTStreamer::PrintStats() const {
/// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
/// and FileID.
-ASTStreamerTy *llvm::clang::ASTStreamer_Init(Preprocessor &pp,
- ASTContext &ctxt,
- unsigned MainFileID) {
+ASTStreamerTy *clang::ASTStreamer_Init(Preprocessor &pp, ASTContext &ctxt,
+ unsigned MainFileID) {
return new ASTStreamer(pp, ctxt, MainFileID);
}
/// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration. This
/// returns null at end of file.
-Decl *llvm::clang::ASTStreamer_ReadTopLevelDecl(ASTStreamerTy *Streamer) {
+Decl *clang::ASTStreamer_ReadTopLevelDecl(ASTStreamerTy *Streamer) {
return static_cast<ASTStreamer*>(Streamer)->ReadTopLevelDecl();
}
/// ASTStreamer_PrintStats - Emit statistic information to stderr.
///
-void llvm::clang::ASTStreamer_PrintStats(ASTStreamerTy *Streamer) {
+void clang::ASTStreamer_PrintStats(ASTStreamerTy *Streamer) {
return static_cast<ASTStreamer*>(Streamer)->PrintStats();
}
/// ASTStreamer_Terminate - Gracefully shut down the streamer.
///
-void llvm::clang::ASTStreamer_Terminate(ASTStreamerTy *Streamer) {
+void clang::ASTStreamer_Terminate(ASTStreamerTy *Streamer) {
delete static_cast<ASTStreamer*>(Streamer);
}
diff --git a/clang/Sema/Sema.cpp b/clang/Sema/Sema.cpp
index 91d0ec6d26d..64c18a80c0e 100644
--- a/clang/Sema/Sema.cpp
+++ b/clang/Sema/Sema.cpp
@@ -16,7 +16,6 @@
#include "clang/AST/ASTContext.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/Diagnostic.h"
-using namespace llvm;
using namespace clang;
Sema::Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup)
diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h
index 54cc87e8566..e4b7f18d0d4 100644
--- a/clang/Sema/Sema.h
+++ b/clang/Sema/Sema.h
@@ -20,7 +20,6 @@
#include <vector>
#include <string>
-namespace llvm {
namespace clang {
class ASTContext;
class Preprocessor;
@@ -57,7 +56,7 @@ class Sema : public Action {
/// LabelMap - This is a mapping from label identifiers to the LabelStmt for
/// it (which acts like the label decl in some ways). Forward referenced
/// labels have a LabelStmt created for them with a null location & SubStmt.
- DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
+ llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
public:
Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup);
@@ -347,6 +346,5 @@ private:
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp
index 40b82c71c74..802685b930d 100644
--- a/clang/Sema/SemaDecl.cpp
+++ b/clang/Sema/SemaDecl.cpp
@@ -24,8 +24,6 @@
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallSet.h"
-
-using namespace llvm;
using namespace clang;
// C99: 6.7.5p3: Used by ParseDeclarator/ParseField to make sure we have
@@ -43,7 +41,7 @@ bool Sema::VerifyConstantArrayType(const ArrayType *Array,
// Verify that the size of the array is an integer constant expr.
SourceLocation Loc;
- APSInt SizeVal(32);
+ llvm::APSInt SizeVal(32);
if (!Size->isIntegerConstantExpr(SizeVal, &Loc)) {
// FIXME: This emits the diagnostic to enforce 6.7.2.1p8, but the message
// is wrong. It is also wrong for static variables.
@@ -61,7 +59,7 @@ bool Sema::VerifyConstantArrayType(const ArrayType *Array,
// elsewhere or replicated. 'int X[-1];' inside a function should emit an
// error.
if (SizeVal.isSigned()) {
- APSInt Zero(SizeVal.getBitWidth());
+ llvm::APSInt Zero(SizeVal.getBitWidth());
Zero.setIsUnsigned(false);
if (SizeVal < Zero) {
Diag(DeclLoc, diag::err_typecheck_negative_array_size,
@@ -504,7 +502,7 @@ Sema::DeclTy *Sema::ParseStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
CurFunctionDecl = FD;
// Create Decl objects for each parameter, adding them to the FunctionDecl.
- SmallVector<ParmVarDecl*, 16> Params;
+ llvm::SmallVector<ParmVarDecl*, 16> Params;
// Check for C99 6.7.5.3p10 - foo(void) is a non-varargs function that takes
// no arguments, not a function that takes a single void argument.
@@ -531,8 +529,8 @@ Sema::DeclTy *Sema::ParseFunctionDefBody(DeclTy *D, StmtTy *Body) {
// Verify and clean out per-function state.
// Check goto/label use.
- for (DenseMap<IdentifierInfo*, LabelStmt*>::iterator I = LabelMap.begin(),
- E = LabelMap.end(); I != E; ++I) {
+ for (llvm::DenseMap<IdentifierInfo*, LabelStmt*>::iterator
+ I = LabelMap.begin(), E = LabelMap.end(); I != E; ++I) {
// Verify that we have no forward references left. If so, there was a goto
// or address of a label taken, but no definition of it. Label fwd
// definitions are indicated with a null substmt.
@@ -753,8 +751,8 @@ void Sema::ParseRecordBody(SourceLocation RecLoc, DeclTy *RecDecl,
// Verify that all the fields are okay.
unsigned NumNamedMembers = 0;
- SmallVector<FieldDecl*, 32> RecFields;
- SmallSet<const IdentifierInfo*, 32> FieldIDs;
+ llvm::SmallVector<FieldDecl*, 32> RecFields;
+ llvm::SmallSet<const IdentifierInfo*, 32> FieldIDs;
for (unsigned i = 0; i != NumFields; ++i) {
FieldDecl *FD = cast_or_null<FieldDecl>(static_cast<Decl*>(Fields[i]));
@@ -872,7 +870,7 @@ Sema::DeclTy *Sema::ParseEnumConstant(Scope *S, DeclTy *theEnumDecl,
}
}
- APSInt EnumVal(32);
+ llvm::APSInt EnumVal(32);
QualType EltTy;
if (Val) {
// C99 6.7.2.2p2: Make sure we have an integer constant expression.
@@ -975,7 +973,7 @@ void *Sema::HandleVectorTypeAttribute(QualType curType,
return 0;
}
Expr *sizeExpr = static_cast<Expr *>(rawAttr->getArg(0));
- APSInt vecSize(32);
+ llvm::APSInt vecSize(32);
if (!sizeExpr->isIntegerConstantExpr(vecSize)) {
Diag(rawAttr->getAttributeLoc(), diag::err_attribute_vector_size_not_int,
sizeExpr->getSourceRange());
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp
index 53c5b048db7..57830ca1b16 100644
--- a/clang/Sema/SemaExpr.cpp
+++ b/clang/Sema/SemaExpr.cpp
@@ -22,7 +22,6 @@
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallString.h"
-using namespace llvm;
using namespace clang;
/// ParseStringLiteral - The specified tokens were lexed as pasted string
@@ -39,7 +38,7 @@ Sema::ParseStringLiteral(const LexerToken *StringToks, unsigned NumStringToks) {
if (Literal.hadError)
return ExprResult(true);
- SmallVector<SourceLocation, 4> StringTokLocs;
+ llvm::SmallVector<SourceLocation, 4> StringTokLocs;
for (unsigned i = 0; i != NumStringToks; ++i)
StringTokLocs.push_back(StringToks[i].getLocation());
@@ -97,7 +96,7 @@ Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc,
}
Sema::ExprResult Sema::ParseCharacterConstant(const LexerToken &Tok) {
- SmallString<16> CharBuffer;
+ llvm::SmallString<16> CharBuffer;
CharBuffer.resize(Tok.getLength());
const char *ThisTokBegin = &CharBuffer[0];
unsigned ActualLength = PP.getSpelling(Tok, ThisTokBegin);
@@ -117,10 +116,11 @@ Action::ExprResult Sema::ParseNumericConstant(const LexerToken &Tok) {
const char *t = PP.getSourceManager().getCharacterData(Tok.getLocation());
unsigned IntSize = Context.Target.getIntWidth(Tok.getLocation());
- return ExprResult(new IntegerLiteral(APInt(IntSize, *t-'0'), Context.IntTy,
+ return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, *t-'0'),
+ Context.IntTy,
Tok.getLocation()));
}
- SmallString<512> IntegerBuffer;
+ llvm::SmallString<512> IntegerBuffer;
IntegerBuffer.resize(Tok.getLength());
const char *ThisTokBegin = &IntegerBuffer[0];
@@ -135,7 +135,7 @@ Action::ExprResult Sema::ParseNumericConstant(const LexerToken &Tok) {
QualType t;
// Get the value in the widest-possible width.
- APInt ResultVal(Context.Target.getIntMaxTWidth(Tok.getLocation()), 0);
+ llvm::APInt ResultVal(Context.Target.getIntMaxTWidth(Tok.getLocation()), 0);
if (Literal.GetIntegerValue(ResultVal)) {
// If this value didn't fit into uintmax_t, warn and force to ull.
diff --git a/clang/Sema/SemaExprCXX.cpp b/clang/Sema/SemaExprCXX.cpp
index 5b0c17086d5..15e77464417 100644
--- a/clang/Sema/SemaExprCXX.cpp
+++ b/clang/Sema/SemaExprCXX.cpp
@@ -13,7 +13,6 @@
#include "Sema.h"
#include "clang/AST/ExprCXX.h"
-using namespace llvm;
using namespace clang;
/// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index c7b752bd307..4a270162fa7 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -18,7 +18,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
Sema::StmtResult Sema::ParseNullStmt(SourceLocation SemiLoc) {
diff --git a/clang/Sema/SemaType.cpp b/clang/Sema/SemaType.cpp
index 46a0022b7f6..cdb767f58c7 100644
--- a/clang/Sema/SemaType.cpp
+++ b/clang/Sema/SemaType.cpp
@@ -16,7 +16,6 @@
#include "clang/AST/Decl.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Lex/IdentifierTable.h"
-using namespace llvm;
using namespace clang;
/// ConvertDeclSpecToType - Convert the specified declspec to the appropriate
@@ -193,7 +192,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
} else {
// Otherwise, we have a function with an argument list that is
// potentially variadic.
- SmallVector<QualType, 16> ArgTys;
+ llvm::SmallVector<QualType, 16> ArgTys;
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
QualType ArgTy = QualType::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index c2ddebb38b7..03006e1f7da 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -19,7 +19,6 @@
#include "clang/AST/Expr.h"
#include <vector>
-namespace llvm {
namespace clang {
class TargetInfo;
@@ -27,11 +26,11 @@ namespace clang {
/// decls) that can be referred to throughout the semantic analysis of a file.
class ASTContext {
std::vector<Type*> Types;
- FoldingSet<PointerType> PointerTypes;
- FoldingSet<ReferenceType> ReferenceTypes;
- FoldingSet<ArrayType> ArrayTypes;
- FoldingSet<FunctionTypeNoProto> FunctionTypeNoProtos;
- FoldingSet<FunctionTypeProto> FunctionTypeProtos;
+ llvm::FoldingSet<PointerType> PointerTypes;
+ llvm::FoldingSet<ReferenceType> ReferenceTypes;
+ llvm::FoldingSet<ArrayType> ArrayTypes;
+ llvm::FoldingSet<FunctionTypeNoProto> FunctionTypeNoProtos;
+ llvm::FoldingSet<FunctionTypeProto> FunctionTypeProtos;
public:
TargetInfo &Target;
Builtin::Context BuiltinInfo;
@@ -114,6 +113,5 @@ private:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 6b1474b5765..ea2a4678369 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -17,7 +17,6 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/AST/Type.h"
-namespace llvm {
namespace clang {
class IdentifierInfo;
class Expr;
@@ -27,6 +26,5 @@ class Expr;
/// in "clang/Parse/AttributeList.h"
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/Builtins.h b/clang/include/clang/AST/Builtins.h
index dda01892b00..682031f7be2 100644
--- a/clang/include/clang/AST/Builtins.h
+++ b/clang/include/clang/AST/Builtins.h
@@ -17,7 +17,6 @@
#include <cstring>
-namespace llvm {
namespace clang {
class TargetInfo;
class IdentifierTable;
@@ -70,5 +69,4 @@ private:
}
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 92a897b489b..de8cc2b427a 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -18,7 +18,6 @@
#include "clang/AST/Type.h"
#include "llvm/ADT/APSInt.h"
-namespace llvm {
namespace clang {
class IdentifierInfo;
class Expr;
@@ -279,15 +278,15 @@ public:
/// TagType for the X EnumDecl.
class EnumConstantDecl : public ValueDecl {
Expr *Init; // an integer constant expression
- APSInt Val; // The value.
+ llvm::APSInt Val; // The value.
public:
EnumConstantDecl(SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E,
- const APSInt &V, Decl *PrevDecl)
+ const llvm::APSInt &V, Decl *PrevDecl)
: ValueDecl(EnumConstant, L, Id, T, PrevDecl), Init(E), Val(V) {}
const Expr *getInitExpr() const { return Init; }
Expr *getInitExpr() { return Init; }
- const APSInt &getInitVal() const { return Val; }
+ const llvm::APSInt &getInitVal() const { return Val; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
@@ -437,6 +436,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 3fff41399f2..82d8e3e86e4 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -19,7 +19,6 @@
#include "clang/AST/Decl.h"
#include "llvm/ADT/APSInt.h"
-namespace llvm {
namespace clang {
class IdentifierInfo;
class Decl;
@@ -83,10 +82,10 @@ public:
/// constant expression, and, if so, return its value in Result. If not a
/// valid i-c-e, return false and fill in Loc (if specified) with the location
/// of the invalid expression.
- bool isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc = 0,
+ bool isIntegerConstantExpr(llvm::APSInt &Result, SourceLocation *Loc = 0,
bool isEvaluated = true) const;
bool isIntegerConstantExpr(SourceLocation *Loc = 0) const {
- APSInt X(32);
+ llvm::APSInt X(32);
return isIntegerConstantExpr(X, Loc);
}
@@ -123,16 +122,16 @@ public:
};
class IntegerLiteral : public Expr {
- APInt Value;
+ llvm::APInt Value;
SourceLocation Loc;
public:
// type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
// or UnsignedLongLongTy
- IntegerLiteral(const APInt &V, QualType type, SourceLocation l)
+ IntegerLiteral(const llvm::APInt &V, QualType type, SourceLocation l)
: Expr(IntegerLiteralClass, type), Value(V), Loc(l) {
assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
}
- const APInt &getValue() const { return Value; }
+ const llvm::APInt &getValue() const { return Value; }
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
virtual void visit(StmtVisitor &Visitor);
@@ -541,6 +540,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 872e5c594ea..3d28d75b65f 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -16,7 +16,6 @@
#include "clang/AST/Expr.h"
-namespace llvm {
namespace clang {
//===--------------------------------------------------------------------===//
@@ -60,6 +59,5 @@ namespace clang {
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index e5ec7770476..f3fb9079357 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -18,7 +18,6 @@
#include "llvm/ADT/SmallVector.h"
#include <iosfwd>
-namespace llvm {
namespace clang {
class Expr;
class Decl;
@@ -102,16 +101,16 @@ public:
/// CompoundStmt - This represents a group of statements like { stmt stmt }.
///
class CompoundStmt : public Stmt {
- SmallVector<Stmt*, 16> Body;
+ llvm::SmallVector<Stmt*, 16> Body;
public:
CompoundStmt(Stmt **StmtStart, unsigned NumStmts)
: Stmt(CompoundStmtClass), Body(StmtStart, StmtStart+NumStmts) {}
- typedef SmallVector<Stmt*, 16>::iterator body_iterator;
+ typedef llvm::SmallVector<Stmt*, 16>::iterator body_iterator;
body_iterator body_begin() { return Body.begin(); }
body_iterator body_end() { return Body.end(); }
- typedef SmallVector<Stmt*, 16>::const_iterator const_body_iterator;
+ typedef llvm::SmallVector<Stmt*, 16>::const_iterator const_body_iterator;
const_body_iterator body_begin() const { return Body.begin(); }
const_body_iterator body_end() const { return Body.end(); }
@@ -374,9 +373,6 @@ public:
static bool classof(const ReturnStmt *) { return true; }
};
-
-
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/AST/StmtVisitor.h b/clang/include/clang/AST/StmtVisitor.h
index 87a902e5bd3..9422765e8c3 100644
--- a/clang/include/clang/AST/StmtVisitor.h
+++ b/clang/include/clang/AST/StmtVisitor.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_AST_STMTVISITOR_H
#define LLVM_CLANG_AST_STMTVISITOR_H
-namespace llvm {
namespace clang {
class Stmt;
// Add prototypes for all AST node classes.
@@ -37,6 +36,5 @@ public:
};
}
-}
#endif
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index eb8a4865245..ab3874e06f4 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -17,7 +17,12 @@
#include "llvm/Support/Casting.h"
#include "llvm/ADT/FoldingSet.h"
-namespace llvm {
+using llvm::isa;
+using llvm::cast;
+using llvm::cast_or_null;
+using llvm::dyn_cast;
+using llvm::dyn_cast_or_null;
+
namespace clang {
class ASTContext;
class Type;
@@ -131,16 +136,18 @@ private:
} // end clang.
+namespace llvm {
/// Implement simplify_type for QualType, so that we can dyn_cast from QualType
/// to a specific Type class.
-template<> struct simplify_type<const clang::QualType> {
- typedef clang::Type* SimpleType;
- static SimpleType getSimplifiedValue(const clang::QualType &Val) {
+template<> struct simplify_type<const ::clang::QualType> {
+ typedef ::clang::Type* SimpleType;
+ static SimpleType getSimplifiedValue(const ::clang::QualType &Val) {
return Val.getTypePtr();
}
};
-template<> struct simplify_type<clang::QualType>
- : public simplify_type<const clang::QualType> {};
+template<> struct simplify_type< ::clang::QualType>
+ : public simplify_type<const ::clang::QualType> {};
+}
namespace clang {
@@ -305,7 +312,7 @@ public:
/// PointerType - C99 6.7.5.1 - Pointer Declarators.
///
-class PointerType : public Type, public FoldingSetNode {
+class PointerType : public Type, public llvm::FoldingSetNode {
QualType PointeeType;
PointerType(QualType Pointee, QualType CanonicalPtr) :
Type(Pointer, CanonicalPtr), PointeeType(Pointee) {
@@ -318,10 +325,10 @@ public:
virtual void getAsStringInternal(std::string &InnerString) const;
- void Profile(FoldingSetNodeID &ID) {
+ void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getPointeeType());
}
- static void Profile(FoldingSetNodeID &ID, QualType Pointee) {
+ static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee) {
ID.AddPointer(Pointee.getAsOpaquePtr());
}
@@ -331,7 +338,7 @@ public:
/// ReferenceType - C++ 8.3.2 - Reference Declarators.
///
-class ReferenceType : public Type, public FoldingSetNode {
+class ReferenceType : public Type, public llvm::FoldingSetNode {
QualType ReferenceeType;
ReferenceType(QualType Referencee, QualType CanonicalRef) :
Type(Reference, CanonicalRef), ReferenceeType(Referencee) {
@@ -342,10 +349,10 @@ public:
QualType getReferenceeType() const { return ReferenceeType; }
- void Profile(FoldingSetNodeID &ID) {
+ void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getReferenceeType());
}
- static void Profile(FoldingSetNodeID &ID, QualType Referencee) {
+ static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee) {
ID.AddPointer(Referencee.getAsOpaquePtr());
}
@@ -355,7 +362,7 @@ public:
/// ArrayType - C99 6.7.5.2 - Array Declarators.
///
-class ArrayType : public Type, public FoldingSetNode {
+class ArrayType : public Type, public llvm::FoldingSetNode {
public:
/// ArraySizeModifier - Capture whether this is a normal array (e.g. int X[4])
/// an array with a static size (e.g. int X[static 4]), or with a star size
@@ -392,11 +399,12 @@ public:
virtual void getAsStringInternal(std::string &InnerString) const;
- void Profile(FoldingSetNodeID &ID) {
+ void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getSizeModifier(), getIndexTypeQualifier(), getElementType(),
getSize());
}
- static void Profile(FoldingSetNodeID &ID, ArraySizeModifier SizeModifier,
+ static void Profile(llvm::FoldingSetNodeID &ID,
+ ArraySizeModifier SizeModifier,
unsigned IndexTypeQuals, QualType ElementType,
Expr *SizeExpr) {
ID.AddInteger(SizeModifier);
@@ -437,7 +445,7 @@ public:
/// FunctionTypeNoProto - Represents a K&R-style 'int foo()' function, which has
/// no information available about its arguments.
-class FunctionTypeNoProto : public FunctionType, public FoldingSetNode {
+class FunctionTypeNoProto : public FunctionType, public llvm::FoldingSetNode {
FunctionTypeNoProto(QualType Result, QualType Canonical)
: FunctionType(FunctionNoProto, Result, false, Canonical) {}
friend class ASTContext; // ASTContext creates these.
@@ -446,10 +454,10 @@ public:
virtual void getAsStringInternal(std::string &InnerString) const;
- void Profile(FoldingSetNodeID &ID) {
+ void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getResultType());
}
- static void Profile(FoldingSetNodeID &ID, QualType ResultType) {
+ static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType) {
ID.AddPointer(ResultType.getAsOpaquePtr());
}
@@ -462,7 +470,7 @@ public:
/// FunctionTypeProto - Represents a prototype with argument type info, e.g.
/// 'int foo(int)' or 'int foo(void)'. 'void' is represented as having no
/// arguments, not as having a single void argument.
-class FunctionTypeProto : public FunctionType, public FoldingSetNode {
+class FunctionTypeProto : public FunctionType, public llvm::FoldingSetNode {
FunctionTypeProto(QualType Result, QualType *ArgArray, unsigned numArgs,
bool isVariadic, QualType Canonical)
: FunctionType(FunctionProto, Result, isVariadic, Canonical),
@@ -495,9 +503,9 @@ public:
}
static bool classof(const FunctionTypeProto *) { return true; }
- void Profile(FoldingSetNodeID &ID);
- static void Profile(FoldingSetNodeID &ID, QualType Result, QualType* ArgTys,
- unsigned NumArgs, bool isVariadic);
+ void Profile(llvm::FoldingSetNodeID &ID);
+ static void Profile(llvm::FoldingSetNodeID &ID, QualType Result,
+ QualType* ArgTys, unsigned NumArgs, bool isVariadic);
};
@@ -568,6 +576,5 @@ inline QualType QualType::getCanonicalType() const {
}
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h
index 007633f170c..eda7fed81ba 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -16,7 +16,6 @@
#include <string>
-namespace llvm {
namespace clang {
class DiagnosticClient;
class SourceLocation;
@@ -154,6 +153,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h
index b80db162482..ad955d72807 100644
--- a/clang/include/clang/Basic/FileManager.h
+++ b/clang/include/clang/Basic/FileManager.h
@@ -20,7 +20,6 @@
// FIXME: Enhance libsystem to support inode and other fields in stat.
#include <sys/types.h>
-namespace llvm {
namespace clang {
class FileManager;
@@ -71,8 +70,8 @@ class FileManager {
/// DirEntries/FileEntries - This is a cache of directory/file entries we have
/// looked up. The actual Entry is owned by UniqueFiles/UniqueDirs above.
///
- StringMap<DirectoryEntry*> DirEntries;
- StringMap<FileEntry*> FileEntries;
+ llvm::StringMap<DirectoryEntry*> DirEntries;
+ llvm::StringMap<FileEntry*> FileEntries;
/// NextFileUID - Each FileEntry we create is assigned a unique ID #.
///
@@ -108,6 +107,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index c0fea3cb0be..37a5e73614f 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_LANGOPTIONS_H
#define LLVM_CLANG_LANGOPTIONS_H
-namespace llvm {
namespace clang {
/// LangOptions - This class keeps track of the various options that can be
@@ -41,6 +40,5 @@ struct LangOptions {
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h
index 7cb2e7b005f..1a90da9b096 100644
--- a/clang/include/clang/Basic/SourceLocation.h
+++ b/clang/include/clang/Basic/SourceLocation.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_SOURCELOCATION_H
#define LLVM_CLANG_SOURCELOCATION_H
-namespace llvm {
namespace clang {
/// SourceLocation - This is a carefully crafted 32-bit identifier that encodes
@@ -105,6 +104,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index ba39d214b55..ef0ac0ba981 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -21,6 +21,7 @@
namespace llvm {
class MemoryBuffer;
+}
namespace clang {
@@ -36,7 +37,7 @@ namespace SrcMgr {
struct FileInfo {
/// Buffer - The actual buffer containing the characters from the input
/// file.
- const MemoryBuffer *Buffer;
+ const llvm::MemoryBuffer *Buffer;
/// SourceLineCache - A new[]'d array of offsets for each source line. This
/// is lazily computed.
@@ -188,7 +189,7 @@ public:
/// createFileIDForMemBuffer - Create a new FileID that represents the
/// specified memory buffer. This does no caching of the buffer and takes
/// ownership of the MemoryBuffer, so only pass a MemoryBuffer to this once.
- unsigned createFileIDForMemBuffer(const MemoryBuffer *Buffer) {
+ unsigned createFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer) {
return createFileID(createMemBufferInfoRec(Buffer), SourceLocation());
}
@@ -200,7 +201,7 @@ public:
/// getBuffer - Return the buffer for the specified FileID.
///
- const MemoryBuffer *getBuffer(unsigned FileID) const {
+ const llvm::MemoryBuffer *getBuffer(unsigned FileID) const {
return getFileInfo(FileID)->Buffer;
}
@@ -298,7 +299,7 @@ private:
/// createMemBufferInfoRec - Create a new info record for the specified memory
/// buffer. This does no caching.
- const SrcMgr::InfoRec *createMemBufferInfoRec(const MemoryBuffer *Buffer);
+ const SrcMgr::InfoRec *createMemBufferInfoRec(const llvm::MemoryBuffer *Buf);
const SrcMgr::FileIDInfo *getFIDInfo(unsigned FileID) const {
assert(FileID-1 < FileIDs.size() && "Invalid FileID!");
@@ -336,6 +337,5 @@ private:
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index e1394b4f611..17fa86bdc83 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -18,7 +18,6 @@
#include <vector>
#include <string>
-namespace llvm {
namespace clang {
class TargetInfoImpl;
@@ -205,6 +204,5 @@ private:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h
index a004e343654..e51f0c7f8a0 100644
--- a/clang/include/clang/Basic/TokenKinds.h
+++ b/clang/include/clang/Basic/TokenKinds.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_TOKENKINDS_H
#define LLVM_CLANG_TOKENKINDS_H
-namespace llvm {
namespace clang {
namespace tok {
@@ -48,6 +47,5 @@ const char *getTokenName(enum TokenKind Kind);
} // end namespace tok
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/CodeGen/ModuleBuilder.h b/clang/include/clang/CodeGen/ModuleBuilder.h
index d364e1b619c..e9cb2b5bd41 100644
--- a/clang/include/clang/CodeGen/ModuleBuilder.h
+++ b/clang/include/clang/CodeGen/ModuleBuilder.h
@@ -16,6 +16,8 @@
namespace llvm {
class Module;
+}
+
namespace clang {
class ASTContext;
class FunctionDecl;
@@ -26,7 +28,7 @@ namespace CodeGen {
typedef void BuilderTy;
/// Init - Create an ModuleBuilder with the specified ASTContext.
- BuilderTy *Init(ASTContext &Context, Module &M);
+ BuilderTy *Init(ASTContext &Context, llvm::Module &M);
/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
///
@@ -41,6 +43,5 @@ namespace CodeGen {
void Terminate(BuilderTy *Builder);
} // end namespace CodeGen
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/DirectoryLookup.h b/clang/include/clang/Lex/DirectoryLookup.h
index 580e7dfa866..a1cfb0a340d 100644
--- a/clang/include/clang/Lex/DirectoryLookup.h
+++ b/clang/include/clang/Lex/DirectoryLookup.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
#define LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
-namespace llvm {
namespace clang {
class DirectoryEntry;
@@ -66,7 +65,6 @@ public:
bool isFramework() const { return Framework; }
};
-} // end namespace llvm
} // end namespace clang
#endif
diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index 72d8758df9a..79b3366ecd5 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -18,7 +18,6 @@
#include "llvm/ADT/StringMap.h"
#include <vector>
-namespace llvm {
namespace clang {
class FileEntry;
class FileManager;
@@ -71,7 +70,7 @@ class HeaderSearch {
/// FrameworkMap - This is a collection mapping a framework or subframework
/// name like "Carbon" to the Carbon.framework directory.
- StringMap<const DirectoryEntry *> FrameworkMap;
+ llvm::StringMap<const DirectoryEntry *> FrameworkMap;
// Various statistics we track for performance analysis.
unsigned NumIncluded;
@@ -162,7 +161,6 @@ private:
PerFileInfo &getFileInfo(const FileEntry *FE);
};
-} // end namespace llvm
} // end namespace clang
#endif
diff --git a/clang/include/clang/Lex/IdentifierTable.h b/clang/include/clang/Lex/IdentifierTable.h
index 1e25d901581..4edba600948 100644
--- a/clang/include/clang/Lex/IdentifierTable.h
+++ b/clang/include/clang/Lex/IdentifierTable.h
@@ -18,7 +18,6 @@
#include "llvm/ADT/StringMap.h"
#include <string>
-namespace llvm {
namespace clang {
class MacroInfo;
class LangOptions;
@@ -132,7 +131,7 @@ public:
class IdentifierTable {
// Shark shows that using MallocAllocator is *much* slower than using this
// BumpPtrAllocator!
- typedef StringMap<IdentifierInfo, BumpPtrAllocator> HashTableTy;
+ typedef llvm::StringMap<IdentifierInfo, llvm::BumpPtrAllocator> HashTableTy;
HashTableTy HashTable;
public:
/// IdentifierTable ctor - Create the identifier table, populating it with
@@ -167,7 +166,6 @@ private:
void AddKeywords(const LangOptions &LangOpts);
};
-} // end namespace llvm
} // end namespace clang
#endif
diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h
index 0d77372410f..db0c7183d21 100644
--- a/clang/include/clang/Lex/Lexer.h
+++ b/clang/include/clang/Lex/Lexer.h
@@ -21,7 +21,8 @@
#include <vector>
namespace llvm {
-class MemoryBuffer;
+ class MemoryBuffer;
+}
namespace clang {
class Diagnostic;
@@ -35,7 +36,7 @@ class Lexer {
//===--------------------------------------------------------------------===//
// Constant configuration values for this lexer.
const char * const BufferEnd; // End of the buffer.
- const MemoryBuffer *InputFile; // The file we are reading from.
+ const llvm::MemoryBuffer *InputFile; // The file we are reading from.
unsigned CurFileID; // FileID for the current input file.
Preprocessor &PP; // Preprocessor object controlling lexing.
LangOptions Features; // Features enabled by this language (cache).
@@ -98,8 +99,8 @@ public:
/// with the specified preprocessor managing the lexing process. This lexer
/// assumes that the specified MemoryBuffer and Preprocessor objects will
/// outlive it, but doesn't take ownership of either pointer.
- Lexer(const MemoryBuffer *InBuffer, unsigned CurFileID, Preprocessor &PP,
- const char *BufStart = 0, const char *BufEnd = 0);
+ Lexer(const llvm::MemoryBuffer *InBuffer, unsigned CurFileID,
+ Preprocessor &PP, const char *BufStart = 0, const char *BufEnd = 0);
/// getFeatures - Return the language features currently enabled. NOTE: this
/// lexer modifies features as a file is parsed!
@@ -348,6 +349,5 @@ private:
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/LexerToken.h b/clang/include/clang/Lex/LexerToken.h
index 193476be8f5..119a1d92add 100644
--- a/clang/include/clang/Lex/LexerToken.h
+++ b/clang/include/clang/Lex/LexerToken.h
@@ -17,7 +17,6 @@
#include "clang/Basic/TokenKinds.h"
#include "clang/Basic/SourceLocation.h"
-namespace llvm {
namespace clang {
class IdentifierInfo;
@@ -134,6 +133,5 @@ struct PPConditionalInfo {
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/LiteralSupport.h b/clang/include/clang/Lex/LiteralSupport.h
index cf8c3156f32..7e6e7f2abca 100644
--- a/clang/include/clang/Lex/LiteralSupport.h
+++ b/clang/include/clang/Lex/LiteralSupport.h
@@ -12,14 +12,16 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_LITERALSUPPORT_H
-#define LLVM_CLANG_LITERALSUPPORT_H
+#ifndef CLANG_LITERALSUPPORT_H
+#define CLANG_LITERALSUPPORT_H
#include <string>
#include "llvm/ADT/SmallString.h"
namespace llvm {
class APInt;
+}
+
namespace clang {
class Diagnostic;
@@ -68,7 +70,7 @@ public:
/// matches Val's input width. If there is an overflow (i.e., if the unsigned
/// value read is larger than the APInt's bits will hold), set Val to the low
/// bits of the result and return true. Otherwise, return false.
- bool GetIntegerValue(APInt &Val);
+ bool GetIntegerValue(llvm::APInt &Val);
private:
void Diag(SourceLocation Loc, unsigned DiagID,
@@ -133,7 +135,7 @@ class StringLiteralParser {
unsigned MaxTokenLength;
unsigned SizeBound;
unsigned wchar_tByteWidth;
- SmallString<512> ResultBuf;
+ llvm::SmallString<512> ResultBuf;
char *ResultPtr; // cursor
public:
StringLiteralParser(const LexerToken *StringToks, unsigned NumStringToks,
@@ -146,6 +148,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif \ No newline at end of file
diff --git a/clang/include/clang/Lex/MacroExpander.h b/clang/include/clang/Lex/MacroExpander.h
index 46fee578818..8bb4ebfd5d0 100644
--- a/clang/include/clang/Lex/MacroExpander.h
+++ b/clang/include/clang/Lex/MacroExpander.h
@@ -17,7 +17,6 @@
#include "clang/Basic/SourceLocation.h"
#include <vector>
-namespace llvm {
namespace clang {
class MacroInfo;
class Preprocessor;
@@ -175,7 +174,6 @@ private:
void ExpandFunctionArguments();
};
-} // end namespace llvm
} // end namespace clang
#endif
diff --git a/clang/include/clang/Lex/MacroInfo.h b/clang/include/clang/Lex/MacroInfo.h
index 1bbdd7f3b7b..ad489de7443 100644
--- a/clang/include/clang/Lex/MacroInfo.h
+++ b/clang/include/clang/Lex/MacroInfo.h
@@ -17,7 +17,6 @@
#include "clang/Lex/LexerToken.h"
#include <vector>
-namespace llvm {
namespace clang {
class Preprocessor;
@@ -182,7 +181,6 @@ public:
}
};
-} // end namespace llvm
} // end namespace clang
#endif
diff --git a/clang/include/clang/Lex/MultipleIncludeOpt.h b/clang/include/clang/Lex/MultipleIncludeOpt.h
index 724abc96eb0..e4ec5b8c35b 100644
--- a/clang/include/clang/Lex/MultipleIncludeOpt.h
+++ b/clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_MULTIPLEINCLUDEOPT_H
#define LLVM_CLANG_MULTIPLEINCLUDEOPT_H
-namespace llvm {
namespace clang {
class IdentifierInfo;
@@ -104,6 +103,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
index 7267bdcf262..def8072dacd 100644
--- a/clang/include/clang/Lex/PPCallbacks.h
+++ b/clang/include/clang/Lex/PPCallbacks.h
@@ -18,7 +18,6 @@
#include "clang/Basic/SourceLocation.h"
#include <string>
-namespace llvm {
namespace clang {
class SourceLocation;
@@ -50,6 +49,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/Pragma.h b/clang/include/clang/Lex/Pragma.h
index f99453a9ae6..5e35ae02de0 100644
--- a/clang/include/clang/Lex/Pragma.h
+++ b/clang/include/clang/Lex/Pragma.h
@@ -17,7 +17,6 @@
#include <cassert>
#include <vector>
-namespace llvm {
namespace clang {
class Preprocessor;
class LexerToken;
@@ -79,6 +78,5 @@ public:
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index c551ad11241..e3aff760120 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -19,7 +19,6 @@
#include "clang/Lex/MacroExpander.h"
#include "clang/Basic/SourceLocation.h"
-namespace llvm {
namespace clang {
class SourceManager;
@@ -451,6 +450,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Lex/ScratchBuffer.h b/clang/include/clang/Lex/ScratchBuffer.h
index a78487957b8..e2d62d19c7e 100644
--- a/clang/include/clang/Lex/ScratchBuffer.h
+++ b/clang/include/clang/Lex/ScratchBuffer.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_SCRATCHBUFFER_H
#define LLVM_CLANG_SCRATCHBUFFER_H
-namespace llvm {
namespace clang {
class SourceManager;
class SourceLocation;
@@ -47,6 +46,5 @@ private:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h
index 48644f9ea09..1b7e633011e 100644
--- a/clang/include/clang/Parse/Action.h
+++ b/clang/include/clang/Parse/Action.h
@@ -17,7 +17,6 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TokenKinds.h"
-namespace llvm {
namespace clang {
// Semantic.
class DeclSpec;
@@ -397,6 +396,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Parse/AttributeList.h b/clang/include/clang/Parse/AttributeList.h
index 08c832d2583..8bde7d08fd0 100644
--- a/clang/include/clang/Parse/AttributeList.h
+++ b/clang/include/clang/Parse/AttributeList.h
@@ -17,7 +17,6 @@
#include "clang/Parse/Action.h"
#include <cassert>
-namespace llvm {
namespace clang {
/// AttributeList - Represents GCC's __attribute__ declaration. There are
@@ -83,6 +82,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Parse/DeclSpec.h b/clang/include/clang/Parse/DeclSpec.h
index b429506afe6..95be9938310 100644
--- a/clang/include/clang/Parse/DeclSpec.h
+++ b/clang/include/clang/Parse/DeclSpec.h
@@ -19,7 +19,6 @@
#include "clang/Parse/AttributeList.h"
#include "llvm/ADT/SmallVector.h"
-namespace llvm {
namespace clang {
class LangOptions;
class IdentifierInfo;
@@ -441,7 +440,7 @@ private:
/// parsed. This is pushed from the identifier out, which means that element
/// #0 will be the most closely bound to the identifier, and
/// DeclTypeInfo.back() will be the least closely bound.
- SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
+ llvm::SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
// attributes.
AttributeList *AttrList;
@@ -549,6 +548,5 @@ public:
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 98202a4f21e..19bee276a4c 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -17,7 +17,6 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/Action.h"
-namespace llvm {
namespace clang {
class DeclSpec;
class Declarator;
@@ -368,6 +367,5 @@ private:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Parse/Scope.h b/clang/include/clang/Parse/Scope.h
index 28c2d801c66..367bbf25231 100644
--- a/clang/include/clang/Parse/Scope.h
+++ b/clang/include/clang/Parse/Scope.h
@@ -16,9 +16,7 @@
#include "clang/Parse/Action.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/SmallSet.h"
-namespace llvm {
namespace clang {
/// Scope - A scope is a transient data structure that is used while parsing the
@@ -78,7 +76,7 @@ private:
/// popped, these declarations are removed from the IdentifierTable's notion
/// of current declaration. It is up to the current Action implementation to
/// implement these semantics.
- typedef SmallPtrSet<Action::DeclTy*, 32> DeclSetTy;
+ typedef llvm::SmallPtrSet<Action::DeclTy*, 32> DeclSetTy;
DeclSetTy DeclsInScope;
public:
Scope(Scope *Parent, unsigned ScopeFlags) {
@@ -144,6 +142,5 @@ public:
};
} // end namespace clang
-} // end namespace llvm
#endif
diff --git a/clang/include/clang/Sema/ASTStreamer.h b/clang/include/clang/Sema/ASTStreamer.h
index b57593c91b5..f55f8710cee 100644
--- a/clang/include/clang/Sema/ASTStreamer.h
+++ b/clang/include/clang/Sema/ASTStreamer.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_AST_ASTSTREAMER_H
#define LLVM_CLANG_AST_ASTSTREAMER_H
-namespace llvm {
namespace clang {
class Preprocessor;
class ASTContext;
@@ -42,6 +41,5 @@ namespace clang {
void ASTStreamer_Terminate(ASTStreamerTy *Streamer);
} // end namespace clang
-} // end namespace llvm
#endif
OpenPOWER on IntegriCloud