[cfe-commits] r106715 - in /cfe/trunk/lib: Basic/Targets.cpp Frontend/InitPreprocessor.cpp Lex/PPMacroExpansion.cpp
Eric Christopher
echristo at apple.com
Wed Jun 23 19:02:00 PDT 2010
Author: echristo
Date: Wed Jun 23 21:02:00 2010
New Revision: 106715
URL: http://llvm.org/viewvc/llvm-project?rev=106715&view=rev
Log:
More clang support for darwin tls. Add a __has_feature macro and
target specific preprocessor define as well.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=106715&r1=106714&r2=106715&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Jun 23 21:02:00 2010
@@ -150,7 +150,7 @@
public:
DarwinTargetInfo(const std::string& triple) :
OSTargetInfo<Target>(triple) {
- this->TLSSupported = false;
+ this->TLSSupported = llvm::Triple(triple).getDarwinMajorNumber() > 6;
}
virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const {
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=106715&r1=106714&r2=106715&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Jun 23 21:02:00 2010
@@ -460,6 +460,10 @@
if (FEOpts.ProgramAction == frontend::RunAnalysis)
Builder.defineMacro("__clang_analyzer__");
+ // Define __HAS_TLS__ if the target supports it.
+ if (TI.isTLSSupported())
+ Builder.defineMacro("__HAS_TLS__");
+
// Get other target #defines.
TI.getTargetDefines(LangOpts, Builder);
}
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=106715&r1=106714&r2=106715&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed Jun 23 21:02:00 2010
@@ -17,6 +17,7 @@
#include "clang/Lex/MacroInfo.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/LexDiagnostic.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/raw_ostream.h"
@@ -510,6 +511,7 @@
//.Case("cxx_nullptr", false)
//.Case("cxx_rvalue_references", false)
//.Case("cxx_variadic_templates", false)
+ .Case("tls", PP.getTargetInfo().isTLSSupported())
.Default(false);
}
More information about the cfe-commits
mailing list