summaryrefslogtreecommitdiffstats
path: root/clang/Lex/PPExpressions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-14 19:03:49 +0000
committerChris Lattner <sabre@nondot.org>2006-10-14 19:03:49 +0000
commit81278c6356695e99f91189f044725e753a6babe8 (patch)
treeb2e9387976c1407c16f8457a2888e2116d2bb9e8 /clang/Lex/PPExpressions.cpp
parent2194ddc83d6f6eaceaeb6b20ac3ddf5e77b7d9d5 (diff)
downloadbcm5719-llvm-81278c6356695e99f91189f044725e753a6babe8.tar.gz
bcm5719-llvm-81278c6356695e99f91189f044725e753a6babe8.zip
Implement the #define_target preprocessor directive.
llvm-svn: 38980
Diffstat (limited to 'clang/Lex/PPExpressions.cpp')
-rw-r--r--clang/Lex/PPExpressions.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/Lex/PPExpressions.cpp b/clang/Lex/PPExpressions.cpp
index cc09dbeb03f..3217df9fc9e 100644
--- a/clang/Lex/PPExpressions.cpp
+++ b/clang/Lex/PPExpressions.cpp
@@ -21,6 +21,7 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/MacroInfo.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Basic/Diagnostic.h"
using namespace llvm;
@@ -95,7 +96,17 @@ static bool EvaluateValue(int &Result, LexerToken &PeekTok, DefinedTracker &DT,
Result = II->getMacroInfo() != 0;
// If there is a macro, mark it used.
- if (Result) II->getMacroInfo()->setIsUsed(true);
+ if (Result) {
+ II->getMacroInfo()->setIsUsed(true);
+
+ // If this is the first use of a target-specific macro, warn about it.
+ if (II->getMacroInfo()->isTargetSpecific()) {
+ // Don't warn on second use.
+ II->getMacroInfo()->setIsTargetSpecific(false);
+ PP.getTargetInfo().DiagnoseNonPortability(PeekTok.getLocation(),
+ diag::port_target_macro_use);
+ }
+ }
// Consume identifier.
PP.Lex(PeekTok);
OpenPOWER on IntegriCloud