aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-20 06:37:11 +0000
committerChris Lattner <sabre@nondot.org>2011-07-20 06:37:11 +0000
commit9594675cc1eb52a054de13c4a21e466643847480 (patch)
treecfa8b0d8b038b25c9e2feba4e650afdea578c78a /include/clang
parentb13eab95e1a5bb1e78706179f15f8416e9fbcfbf (diff)
introduce a centralized place to introduce and inject llvm types into the
clang namespace. There are a number of LLVM types that are used pervasively and it doesn't make sense to keep qualifying them. Start with casting operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/Attr.h17
-rw-r--r--include/clang/AST/Stmt.h7
-rw-r--r--include/clang/AST/Type.h7
-rw-r--r--include/clang/Basic/LLVM.h30
-rw-r--r--include/clang/Driver/Action.h8
-rw-r--r--include/clang/Driver/Job.h8
-rw-r--r--include/clang/Driver/Option.h7
7 files changed, 45 insertions, 39 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index 719023926b..f634cf538c 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -14,18 +14,17 @@
#ifndef LLVM_CLANG_AST_ATTR_H
#define LLVM_CLANG_AST_ATTR_H
-#include "llvm/Support/Casting.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSwitch.h"
+#include "clang/Basic/LLVM.h"
#include "clang/Basic/AttrKinds.h"
#include "clang/AST/Type.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/VersionTuple.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
#include <cassert>
#include <cstring>
#include <algorithm>
-using llvm::dyn_cast;
namespace clang {
class ASTContext;
@@ -159,12 +158,12 @@ class specific_attr_iterator {
mutable AttrVec::const_iterator Current;
void AdvanceToNext() const {
- while (!llvm::isa<SpecificAttr>(*Current))
+ while (!isa<SpecificAttr>(*Current))
++Current;
}
void AdvanceToNext(AttrVec::const_iterator I) const {
- while (Current != I && !llvm::isa<SpecificAttr>(*Current))
+ while (Current != I && !isa<SpecificAttr>(*Current))
++Current;
}
@@ -180,11 +179,11 @@ public:
reference operator*() const {
AdvanceToNext();
- return llvm::cast<SpecificAttr>(*Current);
+ return cast<SpecificAttr>(*Current);
}
pointer operator->() const {
AdvanceToNext();
- return llvm::cast<SpecificAttr>(*Current);
+ return cast<SpecificAttr>(*Current);
}
specific_attr_iterator& operator++() {
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index bf5f383be5..4fb13f3125 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -14,16 +14,15 @@
#ifndef LLVM_CLANG_AST_STMT_H
#define LLVM_CLANG_AST_STMT_H
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/raw_ostream.h"
+#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/StmtIterator.h"
#include "clang/AST/DeclGroup.h"
-#include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/SmallVector.h"
#include <string>
-using llvm::dyn_cast_or_null;
namespace llvm {
class FoldingSetNodeID;
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index ef0dbdae03..0383ec8e9c 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -22,19 +22,14 @@
#include "clang/Basic/Visibility.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateName.h"
-#include "llvm/Support/Casting.h"
#include "llvm/Support/type_traits.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
+#include "clang/Basic/LLVM.h"
-using llvm::isa;
-using llvm::cast;
-using llvm::cast_or_null;
-using llvm::dyn_cast;
-using llvm::dyn_cast_or_null;
namespace clang {
enum {
TypeAlignmentInBits = 4,
diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h
new file mode 100644
index 0000000000..597fba3921
--- /dev/null
+++ b/include/clang/Basic/LLVM.h
@@ -0,0 +1,30 @@
+//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file forward declares and imports various common LLVM datatypes that
+// clang wants to use unqualified.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_BASIC_LLVM_H
+#define CLANG_BASIC_LLVM_H
+
+// This should be the only #include.
+#include "llvm/Support/Casting.h"
+
+namespace clang {
+ // Casting operators.
+ using llvm::isa;
+ using llvm::cast;
+ using llvm::dyn_cast;
+ using llvm::dyn_cast_or_null;
+ using llvm::cast_or_null;
+} // end namespace clang.
+
+#endif
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h
index 4b45c98313..abf58c9127 100644
--- a/include/clang/Driver/Action.h
+++ b/include/clang/Driver/Action.h
@@ -14,13 +14,7 @@
#include "clang/Driver/Types.h"
#include "clang/Driver/Util.h"
-
-#include "llvm/Support/Casting.h"
-using llvm::isa;
-using llvm::cast;
-using llvm::cast_or_null;
-using llvm::dyn_cast;
-using llvm::dyn_cast_or_null;
+#include "clang/Basic/LLVM.h"
namespace clang {
namespace driver {
diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h
index d2767d1b87..d7a23c754b 100644
--- a/include/clang/Driver/Job.h
+++ b/include/clang/Driver/Job.h
@@ -12,13 +12,7 @@
#include "clang/Driver/Util.h"
#include "llvm/ADT/SmallVector.h"
-
-#include "llvm/Support/Casting.h"
-using llvm::isa;
-using llvm::cast;
-using llvm::cast_or_null;
-using llvm::dyn_cast;
-using llvm::dyn_cast_or_null;
+#include "clang/Basic/LLVM.h"
namespace clang {
namespace driver {
diff --git a/include/clang/Driver/Option.h b/include/clang/Driver/Option.h
index 9dfa461400..1d50246521 100644
--- a/include/clang/Driver/Option.h
+++ b/include/clang/Driver/Option.h
@@ -12,12 +12,7 @@
#include "clang/Driver/OptSpecifier.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Casting.h"
-using llvm::isa;
-using llvm::cast;
-using llvm::cast_or_null;
-using llvm::dyn_cast;
-using llvm::dyn_cast_or_null;
+#include "clang/Basic/LLVM.h"
namespace clang {
namespace driver {