aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Driver/clang.cpp1
-rw-r--r--include/clang/Basic/LangOptions.h6
-rw-r--r--lib/Lex/Preprocessor.cpp3
3 files changed, 7 insertions, 3 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 34fd62fd9d..5c89ed0776 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -353,6 +353,7 @@ static bool InitializeLangOptions(LangOptions &Options, LangKind LK){
PCH = true;
break;
case langkind_asm_cpp:
+ Options.AsmPreprocessor = 1;
// FALLTHROUGH
case langkind_c_cpp:
NoPreprocess = true;
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index b1bdebabc4..5cf9fc1b4b 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -25,6 +25,7 @@ struct LangOptions {
unsigned Trigraphs : 1; // Trigraphs in source files.
unsigned BCPLComment : 1; // BCPL-style '//' comments.
unsigned DollarIdents : 1; // '$' allowed in identifiers.
+ unsigned AsmPreprocessor : 1; // Preprocessor in asm mode.
unsigned ImplicitInt : 1; // C89 implicit 'int'.
unsigned Digraphs : 1; // C94, C99 and C++
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
@@ -47,7 +48,7 @@ struct LangOptions {
unsigned NeXTRuntime : 1; // Use NeXT runtime.
unsigned ThreadsafeStatics : 1; // Whether static initializers are protected
- // by lockis.
+ // by locks.
unsigned Blocks : 1; // block extension to C
private:
unsigned GC : 2; // Objective-C Garbage Collection modes. We declare
@@ -58,7 +59,8 @@ public:
enum GCMode { NonGC, GCOnly, HybridGC };
LangOptions() {
- Trigraphs = BCPLComment = DollarIdents = ImplicitInt = Digraphs = 0;
+ Trigraphs = BCPLComment = DollarIdents = AsmPreprocessor = 0;
+ ImplicitInt = Digraphs = 0;
HexFloats = 0;
GC = ObjC1 = ObjC2 = 0;
C99 = Microsoft = CPlusPlus = CPlusPlus0x = NoExtensions = 0;
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index e9894fea4d..00d3d56e2e 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -431,7 +431,8 @@ static void InitializePredefinedMacros(Preprocessor &PP,
// These should all be defined in the preprocessor according to the
// current language configuration.
DefineBuiltinMacro(Buf, "__STDC__=1");
- //DefineBuiltinMacro(Buf, "__ASSEMBLER__=1");
+ if (PP.getLangOptions().AsmPreprocessor)
+ DefineBuiltinMacro(Buf, "__ASSEMBLER__=1");
if (PP.getLangOptions().C99 && !PP.getLangOptions().CPlusPlus)
DefineBuiltinMacro(Buf, "__STDC_VERSION__=199901L");
else if (0) // STDC94 ?