[cfe-commits] r138870 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/TokenKinds.def include/clang/Lex/Preprocessor.h include/clang/Sema/Sema.h lib/Lex/Preprocessor.cpp lib/Parse/Parser.cpp test/Modules/Inputs/diamond_bottom.h test/Modules/Inputs/diamond_left.h test/Modules/Inputs/diamond_right.h test/Modules/diamond.c test/Modules/load_failure.c test/Modules/lookup.cpp test/Modules/lookup.m
Douglas Gregor
dgregor at apple.com
Wed Aug 31 11:19:09 PDT 2011
Author: dgregor
Date: Wed Aug 31 13:19:09 2011
New Revision: 138870
URL: http://llvm.org/viewvc/llvm-project?rev=138870&view=rev
Log:
Switch __import__ over to __import_module__, so we don't conflict with
existing practice with Python extension modules. Not that Python
extension modules should be using a double-underscored identifier
anyway, but...
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/test/Modules/Inputs/diamond_bottom.h
cfe/trunk/test/Modules/Inputs/diamond_left.h
cfe/trunk/test/Modules/Inputs/diamond_right.h
cfe/trunk/test/Modules/diamond.c
cfe/trunk/test/Modules/load_failure.c
cfe/trunk/test/Modules/lookup.cpp
cfe/trunk/test/Modules/lookup.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Aug 31 13:19:09 2011
@@ -571,7 +571,7 @@
// Modules
def err_module_expected_ident : Error<
- "expected a module name after '__import__'">;
+ "expected a module name after '__import_module__'">;
def err_module_expected_semi : Error<
"expected a semicolon name after module name">;
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Wed Aug 31 13:19:09 2011
@@ -397,7 +397,7 @@
// Apple Extension.
KEYWORD(__private_extern__ , KEYALL)
-KEYWORD(__import__ , KEYALL)
+KEYWORD(__import_module__ , KEYALL)
// Microsoft Extension.
KEYWORD(__declspec , KEYALL)
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Aug 31 13:19:09 2011
@@ -554,8 +554,8 @@
CachingLex(Result);
--LexDepth;
- // If we have the __import__ keyword, handle the module import now.
- if (Result.getKind() == tok::kw___import__ && LexDepth == 0)
+ // If we have the __import_module__ keyword, handle the module import now.
+ if (Result.getKind() == tok::kw___import_module__ && LexDepth == 0)
HandleModuleImport(Result);
}
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Aug 31 13:19:09 2011
@@ -1078,7 +1078,7 @@
/// \brief The parser has processed a module import declaration.
///
- /// \param ImportLoc The location of the '__import__' keyword.
+ /// \param ImportLoc The location of the '__import_module__' keyword.
///
/// \param ModuleName The name of the module.
///
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Aug 31 13:19:09 2011
@@ -513,7 +513,7 @@
void Preprocessor::HandleModuleImport(Token &Import) {
// The token sequence
//
- // __import__ identifier
+ // __import_module__ identifier
//
// indicates a module import directive. We load the module and then
// leave the token sequence for the parser.
@@ -525,10 +525,10 @@
*ModuleNameTok.getIdentifierInfo(),
ModuleNameTok.getLocation());
- // FIXME: Transmogrify __import__ into some kind of AST-only __import__ that
- // is not recognized by the preprocessor but is recognized by the parser.
- // It would also be useful to stash the ModuleKey somewhere, so we don't try
- // to load the module twice.
+ // FIXME: Transmogrify __import_module__ into some kind of AST-only
+ // __import_module__ that is not recognized by the preprocessor but is
+ // recognized by the parser. It would also be useful to stash the ModuleKey
+ // somewhere, so we don't try to load the module twice.
}
void Preprocessor::AddCommentHandler(CommentHandler *Handler) {
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Wed Aug 31 13:19:09 2011
@@ -676,7 +676,7 @@
ParseMicrosoftIfExistsExternalDeclaration();
return DeclGroupPtrTy();
- case tok::kw___import__:
+ case tok::kw___import_module__:
return ParseModuleImport();
default:
@@ -1543,7 +1543,8 @@
}
Parser::DeclGroupPtrTy Parser::ParseModuleImport() {
- assert(Tok.is(tok::kw___import__) && "Improper start to module import");
+ assert(Tok.is(tok::kw___import_module__) &&
+ "Improper start to module import");
SourceLocation ImportLoc = ConsumeToken();
// Parse the module name.
Modified: cfe/trunk/test/Modules/Inputs/diamond_bottom.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_bottom.h?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/diamond_bottom.h (original)
+++ cfe/trunk/test/Modules/Inputs/diamond_bottom.h Wed Aug 31 13:19:09 2011
@@ -1,4 +1,4 @@
-__import__ diamond_left;
-__import__ diamond_right;
+__import_module__ diamond_left;
+__import_module__ diamond_right;
char bottom(char *x);
Modified: cfe/trunk/test/Modules/Inputs/diamond_left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_left.h?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/diamond_left.h (original)
+++ cfe/trunk/test/Modules/Inputs/diamond_left.h Wed Aug 31 13:19:09 2011
@@ -1,4 +1,4 @@
-__import__ diamond_top;
+__import_module__ diamond_top;
float left(float *);
Modified: cfe/trunk/test/Modules/Inputs/diamond_right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_right.h?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/diamond_right.h (original)
+++ cfe/trunk/test/Modules/Inputs/diamond_right.h Wed Aug 31 13:19:09 2011
@@ -1,4 +1,4 @@
-__import__ diamond_top;
+__import_module__ diamond_top;
double right(double *);
Modified: cfe/trunk/test/Modules/diamond.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/diamond.c?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/diamond.c (original)
+++ cfe/trunk/test/Modules/diamond.c Wed Aug 31 13:19:09 2011
@@ -3,7 +3,7 @@
// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
-__import__ diamond_bottom;
+__import_module__ diamond_bottom;
void test_diamond(int i, float f, double d, char c) {
top(&i);
Modified: cfe/trunk/test/Modules/load_failure.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/load_failure.c?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/load_failure.c (original)
+++ cfe/trunk/test/Modules/load_failure.c Wed Aug 31 13:19:09 2011
@@ -1,14 +1,14 @@
#ifdef NONEXISTENT
-__import__ load_nonexistent;
+__import_module__ load_nonexistent;
#endif
#ifdef FAILURE
-__import__ load_failure;
+__import_module__ load_failure;
#endif
// RUN: %clang_cc1 -x c++ -emit-module -o %T/load_failure.pcm %S/Inputs/load_failure.h
// RUN: %clang_cc1 -I %T %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
-// CHECK-NONEXISTENT: load_failure.c:2:12: fatal error: module 'load_nonexistent' not found
+// CHECK-NONEXISTENT: load_failure.c:2:19: fatal error: module 'load_nonexistent' not found
// RUN: %clang_cc1 -I %T %s -DFAILURE 2>&1 | FileCheck -check-prefix=CHECK-FAILURE %s
// FIXME: Clean up diagnostic text below and give it a location
Modified: cfe/trunk/test/Modules/lookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/lookup.cpp?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/lookup.cpp (original)
+++ cfe/trunk/test/Modules/lookup.cpp Wed Aug 31 13:19:09 2011
@@ -1,7 +1,7 @@
-#define import __import__
+#define import __import_module__
import lookup_left_cxx;
-#define IMPORT(X) __import__ X
+#define IMPORT(X) __import_module__ X
IMPORT(lookup_right_cxx);
void test(int i, float f) {
Modified: cfe/trunk/test/Modules/lookup.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/lookup.m?rev=138870&r1=138869&r2=138870&view=diff
==============================================================================
--- cfe/trunk/test/Modules/lookup.m (original)
+++ cfe/trunk/test/Modules/lookup.m Wed Aug 31 13:19:09 2011
@@ -1,8 +1,8 @@
// lookup_left.h: expected-note{{using}}
// lookup_right.h: expected-note{{also found}}
-__import__ lookup_left_objc;
-__import__ lookup_right_objc;
+__import_module__ lookup_left_objc;
+__import_module__ lookup_right_objc;
void test(id x) {
[x method]; // expected-warning{{multiple methods named 'method' found}}
More information about the cfe-commits
mailing list