[cfe-commits] r68189 - in /cfe/trunk: test/Driver/preprocessor.c test/Preprocessor/include-pth.c test/Sema/carbon.c test/SemaObjC/cocoa.m test/SemaObjCXX/cocoa.mm tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 31 22:09:09 PDT 2009
Author: ddunbar
Date: Wed Apr 1 00:09:09 2009
New Revision: 68189
URL: http://llvm.org/viewvc/llvm-project?rev=68189&view=rev
Log:
Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
generation
- Simpler, and fixes PR3915.
Cleanup test cases for PTH:
- Update to use -emit-pth
- Removed PTH test of carbon.c and cocoa.mm; these didn't actually
verify anything, and since PTH is token based the extra coverage
(over cocoa.m) isn't particularly helpful.
- Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
available parallelism when running tests.
Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)
Added:
cfe/trunk/test/Driver/preprocessor.c
Modified:
cfe/trunk/test/Preprocessor/include-pth.c
cfe/trunk/test/Sema/carbon.c
cfe/trunk/test/SemaObjC/cocoa.m
cfe/trunk/test/SemaObjCXX/cocoa.mm
cfe/trunk/tools/clang-cc/clang-cc.cpp
Added: cfe/trunk/test/Driver/preprocessor.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/preprocessor.c?rev=68189&view=auto
==============================================================================
--- cfe/trunk/test/Driver/preprocessor.c (added)
+++ cfe/trunk/test/Driver/preprocessor.c Wed Apr 1 00:09:09 2009
@@ -0,0 +1,6 @@
+// RUN: clang -E -x c-header %s > %t &&
+// RUN: grep 'B B' %t
+
+#define A B
+A A
+
Modified: cfe/trunk/test/Preprocessor/include-pth.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/include-pth.c?rev=68189&r1=68188&r2=68189&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/include-pth.c (original)
+++ cfe/trunk/test/Preprocessor/include-pth.c Wed Apr 1 00:09:09 2009
@@ -1,3 +1,3 @@
-// RUN: clang-cc -x c-header %s -o %t &&
+// RUN: clang-cc -emit-pth %s -o %t &&
// RUN: clang-cc -include-pth %t %s -E | grep 'file_to_include' | count 2
#include "file_to_include.h"
Modified: cfe/trunk/test/Sema/carbon.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/carbon.c?rev=68189&r1=68188&r2=68189&view=diff
==============================================================================
--- cfe/trunk/test/Sema/carbon.c (original)
+++ cfe/trunk/test/Sema/carbon.c Wed Apr 1 00:09:09 2009
@@ -1,5 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -print-stats &&
-// RUN: clang-cc -x c-header -o %t %s && clang-cc -token-cache %t %s
+// RUN: clang-cc %s -fsyntax-only -print-stats
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
Modified: cfe/trunk/test/SemaObjC/cocoa.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/cocoa.m?rev=68189&r1=68188&r2=68189&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/cocoa.m (original)
+++ cfe/trunk/test/SemaObjC/cocoa.m Wed Apr 1 00:09:09 2009
@@ -1,9 +1,5 @@
// RUN: clang-cc %s -print-stats &&
-// RUN: clang-cc %s -disable-free &&
-// RUN: clang-cc -x objective-c-header -o %t %s &&
-// RUN: clang-cc -token-cache %t %s &&
-// RUN: clang-cc -x objective-c-header -o %t %s &&
-// RUN: clang-cc -token-cache %t %s -E %s -o /dev/null
+// RUN: clang-cc %s -disable-free
#ifdef __APPLE__
#include <Cocoa/Cocoa.h>
#endif
Modified: cfe/trunk/test/SemaObjCXX/cocoa.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/cocoa.mm?rev=68189&r1=68188&r2=68189&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/cocoa.mm (original)
+++ cfe/trunk/test/SemaObjCXX/cocoa.mm Wed Apr 1 00:09:09 2009
@@ -1,6 +1,4 @@
-// RUN: clang-cc %s -print-stats &&
-// RUN: clang-cc -x objective-c++-header -o %t %s &&
-// RUN: clang-cc -token-cache %t %s
+// RUN: clang-cc %s -print-stats
#ifdef __APPLE__
#include <Cocoa/Cocoa.h>
#endif
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=68189&r1=68188&r2=68189&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Apr 1 00:09:09 2009
@@ -253,16 +253,12 @@
langkind_c,
langkind_c_cpp,
langkind_asm_cpp,
- langkind_c_pch,
langkind_cxx,
langkind_cxx_cpp,
- langkind_cxx_pch,
langkind_objc,
langkind_objc_cpp,
- langkind_objc_pch,
langkind_objcxx,
- langkind_objcxx_cpp,
- langkind_objcxx_pch
+ langkind_objcxx_cpp
};
static llvm::cl::opt<LangKind>
@@ -282,14 +278,14 @@
"Preprocessed Objective C"),
clEnumValN(langkind_objcxx_cpp, "objective-c++-cpp-output",
"Preprocessed Objective C++"),
- clEnumValN(langkind_c_pch, "c-header",
- "Precompiled C header"),
- clEnumValN(langkind_objc_pch, "objective-c-header",
- "Precompiled Objective-C header"),
- clEnumValN(langkind_cxx_pch, "c++-header",
- "Precompiled C++ header"),
- clEnumValN(langkind_objcxx_pch, "objective-c++-header",
- "Precompiled Objective-C++ header"),
+ clEnumValN(langkind_c, "c-header",
+ "C header"),
+ clEnumValN(langkind_objc, "objective-c-header",
+ "Objective-C header"),
+ clEnumValN(langkind_cxx, "c++-header",
+ "C++ header"),
+ clEnumValN(langkind_objcxx, "objective-c++-header",
+ "Objective-C++ header"),
clEnumValEnd));
static llvm::cl::opt<bool>
@@ -358,32 +354,9 @@
}
-static bool InitializeLangOptions(LangOptions &Options, LangKind LK){
+static void InitializeLangOptions(LangOptions &Options, LangKind LK){
// FIXME: implement -fpreprocessed mode.
bool NoPreprocess = false;
- bool PCH = false;
-
- // Test for 'PCH'.
- switch (LK) {
- default:
- break;
- case langkind_c_pch:
- LK = langkind_c;
- PCH = true;
- break;
- case langkind_objc_pch:
- LK = langkind_objc;
- PCH = true;
- break;
- case langkind_cxx_pch:
- LK = langkind_cxx;
- PCH = true;
- break;
- case langkind_objcxx_pch:
- LK = langkind_objcxx;
- PCH = true;
- break;
- }
switch (LK) {
default: assert(0 && "Unknown language kind!");
@@ -416,8 +389,6 @@
Options.CPlusPlus = 1;
break;
}
-
- return PCH;
}
/// LangStds - Language standards we support.
@@ -581,18 +552,14 @@
case langkind_c:
case langkind_asm_cpp:
case langkind_c_cpp:
- case langkind_c_pch:
case langkind_objc:
case langkind_objc_cpp:
- case langkind_objc_pch:
LangStd = lang_gnu99;
break;
case langkind_cxx:
case langkind_cxx_cpp:
- case langkind_cxx_pch:
case langkind_objcxx:
case langkind_objcxx_cpp:
- case langkind_objcxx_pch:
LangStd = lang_gnucxx98;
break;
}
@@ -1657,7 +1624,7 @@
LangOptions LangInfo;
InitializeBaseLanguage();
LangKind LK = GetLanguage(InFile);
- bool PCH = InitializeLangOptions(LangInfo, LK);
+ InitializeLangOptions(LangInfo, LK);
InitializeGCMode(LangInfo);
InitializeLanguageStandard(LangInfo, LK, Target.get());
@@ -1688,7 +1655,7 @@
Diags.setClient(TextDiagClient);
// Process the source file.
- ProcessInputFile(*PP, PPFactory, InFile, PCH ? GeneratePCH : ProgAction);
+ ProcessInputFile(*PP, PPFactory, InFile, ProgAction);
HeaderInfo.ClearFileInfo();
}
More information about the cfe-commits
mailing list